private static void ExecutePostWorker(string postDataWithUrl) { PostWorker target = new PostWorker(postDataWithUrl); target.DoWork(); _responseData = target.GetResponseData(); }
public bool Start(HostControl hostControl) { PerfluxConfigurationSection config = ConfigurationManager.GetSection("perflux") as PerfluxConfigurationSection; if (config == null) { log.Error("Could not load configuration."); throw new ConfigurationErrorsException("Configuration section \"perflux\" is missing."); } ConnectionUri = config.Connection.GetConnectionUri(); log.Info("InfluxDb host:{0} Port:{1} Database:{2}", config.Connection.HostName, config.Connection.Port, config.Connection.DatabaseName); var configCounters = config.GetCounters(); foreach (var series in configCounters.Keys) { log.Info("Adding counter {0}.", series); Counters.Add(series, new Counter(configCounters[series])); } countWorker = new CountWorker(this, config.MonitorIntervalSeconds, config.RateLimit); postWorker = new PostWorker(this, config.PostIntervalSeconds); cleanupWorker = new CleanupWorker(this, config.CounterCleanupIntervalSeconds); countWorker.Start(); postWorker.Start(); cleanupWorker.Start(); return(true); }
public Worker(Generator g, PostWorker pw, Object consoleLocker) { this.generator = g; this.r = new Random (); this.pw = pw; this.consoleLocker = consoleLocker; }
public MultiGenerator() { Generator g = new Generator (200); PostWorker pw = new PostWorker (50, consoleLocker); ts = new Thread[Environment.ProcessorCount * 2]; for (int i = 0; i < ts.Length; ++i) { ts[i] = new Thread(new Worker (g, pw, consoleLocker).run); ts[i].Name = "Worker : " + i; } }