Ejemplo n.º 1
0
        private void GenerateReport(object state)
        {
            string       timeStamp = GetTimeStamp();
            double       total     = _infoRecords.Sum(host => host.Value);
            ReportObject obj       = ReportObject.Create(timeStamp, _infoRecords.Count, total);

            AppendToReport(obj);
            _infoRecords = new BlockingCollection <SocketInfoHost>(60); //reset concurrent collection
        }
Ejemplo n.º 2
0
        private void AppendToReport(ReportObject obj)
        {
            var fileName = ConfigurationManager.AppSettings["resultFile"];

            using (StreamWriter writer = File.AppendText(fileName))
            {
                var content = string.Format("{0},{1},{2:######.000000}", obj.TimeStamp, obj.Sessions, obj.SumAggregation);
                writer.WriteLineAsync(content);
                Console.WriteLine(content);
            }
        }