diff options
author | Evan Martin <martine@danga.com> | 2012-09-05 16:19:26 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-09-05 16:19:26 (GMT) |
commit | 14863bbc3337a64099f8509daf407f8ec1570c38 (patch) | |
tree | f1caf82f34af283db955cf3987bd227e2c046684 /src/ninja.cc | |
parent | c84ee51b5a8f4587db2141f04e5da45f2f0ada9b (diff) | |
download | Ninja-14863bbc3337a64099f8509daf407f8ec1570c38.zip Ninja-14863bbc3337a64099f8509daf407f8ec1570c38.tar.gz Ninja-14863bbc3337a64099f8509daf407f8ec1570c38.tar.bz2 |
factor out metrics dump from ninja main
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index c55ba38..582f38e 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -609,6 +609,22 @@ bool OpenLog(BuildLog* build_log, Globals* globals, return true; } +/// Dump the output requested by '-d stats'. +void DumpMetrics(Globals* globals) { + g_metrics->Report(); + + printf("\n"); + int count = (int)globals->state->paths_.size(); + int buckets = +#ifdef _MSC_VER + (int)globals->state->paths_.comp.bucket_size; +#else + (int)globals->state->paths_.bucket_count(); +#endif + printf("path->node hash load %.2f (%d entries / %d buckets)\n", + count / (double) buckets, count, buckets); +} + int RunBuild(Builder* builder, int argc, char** argv) { string err; vector<Node*> targets; @@ -811,20 +827,8 @@ reload: Builder builder(globals.state, config, &build_log, &disk_interface); int result = RunBuild(&builder, argc, argv); - if (g_metrics) { - g_metrics->Report(); - - printf("\n"); - int count = (int)globals.state->paths_.size(); - int buckets = -#ifdef _MSC_VER - (int)globals.state->paths_.comp.bucket_size; -#else - (int)globals.state->paths_.bucket_count(); -#endif - printf("path->node hash load %.2f (%d entries / %d buckets)\n", - count / (double) buckets, count, buckets); - } + if (g_metrics) + DumpMetrics(&globals); return result; } |