/// <summary> /// Start AMDuProfCLI.exe to log events. /// </summary> /// <param name="logFilesPath">Path to store logfiles.</param> /// <param name="duration">Duration for monitoring in seconds.</param> /// <returns>True if completed with status 0.</returns> public async Task <bool> Start(string logFilesPath, int duration) { if (!Enabled) { Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}: AMDuProfCLI is disabled"); return(false); } if (!IsInstalled()) { Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}: AMDuProfCLI is not installed"); return(false); } System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(logFilesPath)); bool isSuccess = false; string commandLine = $"collect --verbose 3 --system-wide --config power --duration {duration} --output {logFilesPath}"; await Task.Delay(1); isSuccess = RunBinary.Run(BinaryPath, commandLine, true); await Task.Delay(1); return(isSuccess); }
/// <summary> /// Start ippet\ipppet.exe to log events in TSV format. /// </summary> /// <param name="logFilePrefix">Log file prefix in TSV format will be saved as prefix_processes.xls.</param> /// <param name="duration">Duration for monitoring in seconds.</param> /// <returns>True if completed with status 0.</returns> public async Task <bool> Start(string logFilePrefix, int duration) { if (!Enabled) { return(false); } bool isSuccess = false; string commandLine = $"-o y -enable_web n -zip n -time_end {duration} -log_file {logFilePrefix}"; await Task.Delay(1); isSuccess = RunBinary.Run(BinaryPath, commandLine); await Task.Delay(1); return(isSuccess); }
/// <summary> /// Start socwatch\socwatch.exe to log events. /// </summary> /// <param name="logFilesPath">Path to store logfiles.</param> /// <param name="duration">Duration for monitoring in seconds.</param> /// <returns>True if completed with status 0.</returns> public async Task <bool> Start(string logFilesPath, int duration) { if (!Enabled) { Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}: SocWatch is disabled"); return(false); } bool isSuccess = false; string commandLine = $"--polling --interval 1 --max-detail -f sys --time {duration} -o {logFilesPath}"; await Task.Delay(1); isSuccess = RunBinary.Run(BinaryPath, commandLine); await Task.Delay(1); return(isSuccess); }