diff options
author | msarett <msarett@google.com> | 2016-01-04 11:35:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-04 11:35:43 -0800 |
commit | c149f0e36e0ca0ff35ec6e2f79419b58d529db40 (patch) | |
tree | f647726a8d28daec63a3bd61812bddd016924021 | |
parent | 4abb0c11da669a40d126c6b7698e37732e052d84 (diff) |
On Valgrind bots, print a message every 20 minutes
I believe that the timeout failure on the Valgrind bot occurs
because we skip many tests consecutively without printing any
output. Skipping these tests requires non-trivial work.
Printing a message every 20 minutes will avoid timeouts.
BUG=skia:4740
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1554193002
Review URL: https://codereview.chromium.org/1554193002
-rw-r--r-- | bench/nanobench.cpp | 26 | ||||
-rw-r--r-- | tools/nanobench_flags.json | 2 | ||||
-rwxr-xr-x | tools/nanobench_flags.py | 2 | ||||
-rw-r--r-- | tools/valgrind.supp | 12 |
4 files changed, 42 insertions, 0 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 638477ecf6..b7858983f8 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -38,6 +38,7 @@ #include "SkString.h" #include "SkSurface.h" #include "SkTaskGroup.h" +#include "SkThreadUtils.h" #include <stdlib.h> @@ -106,6 +107,7 @@ DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test."); DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?"); DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json"); +DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out"); static double now_ms() { return SkTime::GetNSecs() * 1e-6; } @@ -972,6 +974,26 @@ private: int fCurrentAnimSKP; }; +// Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung. +// This prints something every once in a while so that it knows we're still working. +static void start_keepalive() { + struct Loop { + static void forever(void*) { + for (;;) { + static const int kSec = 1200; + #if defined(SK_BUILD_FOR_WIN) + Sleep(kSec * 1000); + #else + sleep(kSec); + #endif + SkDebugf("\nBenchmarks still running...\n"); + } + } + }; + static SkThread* intentionallyLeaked = new SkThread(Loop::forever); + intentionallyLeaked->start(); +} + int nanobench_main(); int nanobench_main() { SetupCrashHandler(); @@ -1042,6 +1064,10 @@ int nanobench_main() { SkTDArray<Config> configs; create_configs(&configs); + if (FLAGS_keepAlive) { + start_keepalive(); + } + int runs = 0; BenchmarkStream benchStream; while (Benchmark* b = benchStream.next()) { diff --git a/tools/nanobench_flags.json b/tools/nanobench_flags.json index 2bebb14b66..1b44316deb 100644 --- a/tools/nanobench_flags.json +++ b/tools/nanobench_flags.json @@ -137,6 +137,8 @@ "1", "--samples", "1", + "--keepAlive", + "true", "--match", "~interlaced1.png", "~interlaced2.png", diff --git a/tools/nanobench_flags.py b/tools/nanobench_flags.py index d461b20289..906137247b 100755 --- a/tools/nanobench_flags.py +++ b/tools/nanobench_flags.py @@ -56,6 +56,8 @@ def get_args(bot): # Don't care about Valgrind performance. args.extend(['--loops', '1']) args.extend(['--samples', '1']) + # Ensure that the bot framework does not think we have timed out. + args.extend(['--keepAlive', 'true']) if 'HD2000' in bot: args.extend(['--GPUbenchTileW', '256']) diff --git a/tools/valgrind.supp b/tools/valgrind.supp index 5aee804dd8..4e2dd35f92 100644 --- a/tools/valgrind.supp +++ b/tools/valgrind.supp @@ -12,6 +12,18 @@ fun:main } +# Intentional thread / memory leak in nanobench. +{ + nanobench_keepalive_thread_leak + Memcheck:Leak + match-leak-kinds: possible + ... + fun:_ZN8SkThreadC1EPFvPvES0_ + fun:_ZL15start_keepalivev + fun:_Z14nanobench_mainv + fun:main +} + # Third party lib, driver issues. { ati_driver_bug_1 |