From 68a4bb27d1a747b240ea68cd320a51dbd261ed14 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 15 Apr 2014 17:43:03 -0700 Subject: Rename parser_perftest to depfile_parser_perftest. --- configure.py | 4 +-- src/depfile_parser_perftest.cc | 77 ++++++++++++++++++++++++++++++++++++++++++ src/parser_perftest.cc | 77 ------------------------------------------ 3 files changed, 79 insertions(+), 79 deletions(-) create mode 100644 src/depfile_parser_perftest.cc delete mode 100644 src/parser_perftest.cc diff --git a/configure.py b/configure.py index da2f6ef..50a4176 100755 --- a/configure.py +++ b/configure.py @@ -377,8 +377,8 @@ all_targets += ninja_test n.comment('Ancillary executables.') -objs = cxx('parser_perftest') -all_targets += n.build(binary('parser_perftest'), 'link', objs, +objs = cxx('depfile_parser_perftest') +all_targets += n.build(binary('depfile_parser_perftest'), 'link', objs, implicit=ninja_lib, variables=[('libs', libs)]) objs = cxx('build_log_perftest') all_targets += n.build(binary('build_log_perftest'), 'link', objs, diff --git a/src/depfile_parser_perftest.cc b/src/depfile_parser_perftest.cc new file mode 100644 index 0000000..b215221 --- /dev/null +++ b/src/depfile_parser_perftest.cc @@ -0,0 +1,77 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "depfile_parser.h" +#include "util.h" +#include "metrics.h" + +int main(int argc, char* argv[]) { + if (argc < 2) { + printf("usage: %s \n", argv[0]); + return 1; + } + + vector times; + for (int i = 1; i < argc; ++i) { + const char* filename = argv[i]; + + for (int limit = 1 << 10; limit < (1<<20); limit *= 2) { + int64_t start = GetTimeMillis(); + for (int rep = 0; rep < limit; ++rep) { + string buf; + string err; + if (ReadFile(filename, &buf, &err) < 0) { + printf("%s: %s\n", filename, err.c_str()); + return 1; + } + + DepfileParser parser; + if (!parser.Parse(&buf, &err)) { + printf("%s: %s\n", filename, err.c_str()); + return 1; + } + } + int64_t end = GetTimeMillis(); + + if (end - start > 100) { + int delta = (int)(end - start); + float time = delta*1000 / (float)limit; + printf("%s: %.1fus\n", filename, time); + times.push_back(time); + break; + } + } + } + + if (!times.empty()) { + float min = times[0]; + float max = times[0]; + float total = 0; + for (size_t i = 0; i < times.size(); ++i) { + total += times[i]; + if (times[i] < min) + min = times[i]; + else if (times[i] > max) + max = times[i]; + } + + printf("min %.1fus max %.1fus avg %.1fus\n", + min, max, total / times.size()); + } + + return 0; +} diff --git a/src/parser_perftest.cc b/src/parser_perftest.cc deleted file mode 100644 index b215221..0000000 --- a/src/parser_perftest.cc +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2011 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "depfile_parser.h" -#include "util.h" -#include "metrics.h" - -int main(int argc, char* argv[]) { - if (argc < 2) { - printf("usage: %s \n", argv[0]); - return 1; - } - - vector times; - for (int i = 1; i < argc; ++i) { - const char* filename = argv[i]; - - for (int limit = 1 << 10; limit < (1<<20); limit *= 2) { - int64_t start = GetTimeMillis(); - for (int rep = 0; rep < limit; ++rep) { - string buf; - string err; - if (ReadFile(filename, &buf, &err) < 0) { - printf("%s: %s\n", filename, err.c_str()); - return 1; - } - - DepfileParser parser; - if (!parser.Parse(&buf, &err)) { - printf("%s: %s\n", filename, err.c_str()); - return 1; - } - } - int64_t end = GetTimeMillis(); - - if (end - start > 100) { - int delta = (int)(end - start); - float time = delta*1000 / (float)limit; - printf("%s: %.1fus\n", filename, time); - times.push_back(time); - break; - } - } - } - - if (!times.empty()) { - float min = times[0]; - float max = times[0]; - float total = 0; - for (size_t i = 0; i < times.size(); ++i) { - total += times[i]; - if (times[i] < min) - min = times[i]; - else if (times[i] > max) - max = times[i]; - } - - printf("min %.1fus max %.1fus avg %.1fus\n", - min, max, total / times.size()); - } - - return 0; -} -- cgit v0.12