static void Main(string[] args) { //b.GenerateOutputFile(@"C:\test\xlogtest", @"c:\test\central_test.log"); //b.GenerateOutputFile(@"c:\test\logs", @"c:\test\central_test.log"); //EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(@"c:\test\logs", @"C:\test\endless"); //EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless" }, @"C:\temp\var\log\pods"); EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless" }, @"c:\test\logs"); // ReSharper disable once RedundantJumpStatement return; /* * EndlessFileStream.EndlessFileStream e = new EndlessFileStream.EndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless", MaxLogFileSizeInMByte = 1024 }); * var stream = e.Reader.ReadEntries(FileStreamDirection.Forward, int.MaxValue); * string search = "gonzo"; * Stopwatch w = Stopwatch.StartNew(); * int count = 0; * foreach (var line in stream) * { * //Console.WriteLine(line); * if (line.content.Contains(search, StringComparison.OrdinalIgnoreCase)) * { ++count; * Console.WriteLine($"[{count}] found"); * } * } * * Console.WriteLine($"Needed {w.ElapsedMilliseconds} ms"); * * count = 0; w = Stopwatch.StartNew(); * Parallel.ForEach(stream, (line) => * { * { * //Console.WriteLine(line); * if (line.content.Contains(search, StringComparison.OrdinalIgnoreCase)) * { ++count; * Console.WriteLine($"[{count}] found"); * } * } * }); * * Console.WriteLine($"Needed {w.ElapsedMilliseconds} ms"); * return; * * //TestWritingAndPerformance(); * ReadWhileWrite(); */ }
static void Main(string[] args) { //b.GenerateOutputFile(@"C:\test\xlogtest", @"c:\test\central_test.log"); //b.GenerateOutputFile(@"c:\test\logs", @"c:\test\central_test.log"); //EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(@"c:\test\logs", @"C:\test\endless"); //EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless" }, @"C:\temp\var\log\pods"); EndlessFileStreamBuilder b = new EndlessFileStreamBuilder(); b.GenerateEndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless" }, @"c:\test\logs"); return; EndlessFileStream e = new EndlessFileStream(new EndlessFileStreamSettings { BaseDirectory = @"C:\test\endless", MaxLogFileSizeInMByte = 1024 }); var stream = e.Reader.ReadEntries(FileStreamDirection.Forward, int.MaxValue); string search = "gonzo"; Stopwatch w = Stopwatch.StartNew(); int count = 0; foreach (var line in stream) { //Console.WriteLine(line); if (line.content.Contains(search, StringComparison.OrdinalIgnoreCase)) { ++count; Console.WriteLine($"[{count}] found"); } } Console.WriteLine($"Needed {w.ElapsedMilliseconds} ms"); count = 0; w = Stopwatch.StartNew(); Parallel.ForEach(stream, (line) => { { //Console.WriteLine(line); if (line.content.Contains(search, StringComparison.OrdinalIgnoreCase)) { ++count; Console.WriteLine($"[{count}] found"); } } }); Console.WriteLine($"Needed {w.ElapsedMilliseconds} ms"); return; //TestWritingAndPerformance(); ReadWhileWrite(); }