Skip to content

Commit

Permalink
Adds some basic program stats to AP.exe
Browse files Browse the repository at this point in the history
Not tested yet.
  • Loading branch information
atruskie committed Nov 2, 2017
1 parent 4c29188 commit 6c8abf2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AudioAnalysis/AnalysisPrograms/MainEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public static int Main(string[] args)
// note: Exception handling can be found in CurrentDomainOnUnhandledException
Execute(Arguments);

LogProgramStats();

HangBeforeExit();

// finally return error level
Expand Down
14 changes: 14 additions & 0 deletions AudioAnalysis/AnalysisPrograms/Production/MainEntryUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,5 +548,19 @@ private static void ModifyVerbosity(MainEntryArguments arguments)
// LoggedConsole.WriteErrorLine("Clean wrapper ERROR");
// LoggedConsole.WriteFatalLine("Clean wrapper FATAL", new Exception("I'm a fake"));
}

private static void LogProgramStats()
{
var thisProcess = Process.GetCurrentProcess();
var stats = new
{
Runtime = (DateTime.Now - thisProcess.StartTime).TotalSeconds,
PeakWorkingSet = thisProcess.PeakWorkingSet64,
};

var statsString = "Programs stats:\n" + Json.SerialiseToString(stats, prettyPrint: true);

NoConsole.Log.Debug(statsString);
}
}
}

0 comments on commit 6c8abf2

Please sign in to comment.