private static void WriteCounters(PerfItem perfItem, int i) { // Open the file for writing using (var streamWriter = File.AppendText(ConfigurationManager.AppSettings["CsvPath"])) { if (i == 0) { // Write the header streamWriter.WriteLine("Interval,% Processor Time,Disk Reads/sec,Disk Writes/sec,Log Bytes Flushed/sec"); } streamWriter.WriteLine(string.Format( s_csvCultureInfo, "{0},{1},{2},{3},{4}", new object[] { perfItem.CollectedDate, perfItem.Cpu, perfItem.DiskRead, perfItem.DiskWrite, perfItem.LogBytes } ) ); } }
private static void DisplayCounters(PerfItem perfItem, int i) { const int offset = 22; if (i == 0) { Console.WriteLine($"|{"Interval",offset}|{"Cpu",offset}|{"Disk Read",offset}|{"Disk Write",offset}|{"Log Bytes",offset}|"); } Console.WriteLine($"|{perfItem.CollectedDate,offset}|{perfItem.Cpu,offset}|{perfItem.DiskRead,offset}|{perfItem.DiskWrite,offset}|{perfItem.LogBytes,offset}|"); }
private static void WriteCounters(PerfItem perfItem, int i, string filePath) { // Open the file for writing using (var streamWriter = File.AppendText(filePath)) { if (i == 0) { streamWriter.WriteLine("Interval|% Processor Time|Disk Reads/sec|Disk Writes/sec|Log Bytes Flushed/sec"); } streamWriter.WriteLine( string.Format(_cultureInfo, "{0}|{1}|{2}|{3}|{4}", perfItem.CollectedDate, perfItem.Cpu, perfItem.DiskRead, perfItem.DiskWrite, perfItem.LogBytes)); } }
private static void WriteCounters(PerfItem perfItem, int i, string filePath) { // Open the file for writing using (var streamWriter = File.AppendText(filePath)) { if (i == 0) { // Write the header streamWriter.WriteLine("Interval,% Processor Time,Disk Reads/sec,Disk Writes/sec,Log Bytes Flushed/sec"); } streamWriter.WriteLine( $"{perfItem.CollectedDate},{perfItem.Cpu},{perfItem.DiskRead},{perfItem.DiskWrite},{perfItem.LogBytes}"); } }