static void ProcessorActivity(/*string file*/) { string file = @"../../Processor Activity.txt"; StreamWriter writer = new StreamWriter(new FileStream(file, FileMode.Create)); writer.WriteLine(PCStatus.CPULoad()); writer.Write("---------------------"); writer.Close(); Console.WriteLine($"ProcessorActivity() done at {Math.Round(sec, 1)} sec"); }
static void SerializedProcessorActivity(/*string file*/) { string file = @"../../Processor Activity.txt"; FileStream s1 = new FileStream(file, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); using (s1) { formatter.Serialize(s1, PCStatus.CPULoad()); } Console.WriteLine($"SerializedProcessorActivity() done at {Math.Round(sec, 1)} sec"); }