Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index 638477ecf6fc8720af438cf07dde48b162fcb19f..b7858983f8ff6cf95bcc367059e6e5d07eb3d757 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()) { |