diff options
author | Mike Klein <mtklein@chromium.org> | 2017-07-24 15:21:31 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-24 20:02:07 +0000 |
commit | b323a5ed1f26a5b8e4e9f8f78225bdf95dc5a177 (patch) | |
tree | 6015edd7fae15488eaaa05a570499adf4d3e3bb3 | |
parent | 019ff27ac0167026f9f8f4aaec8fb6461d8ba21e (diff) |
sprinkle more tracing in GM, tests, and ok, and add TRACE_FUNC
Change-Id: I562d438bd65e9fd900cfc6831f971b4af25c8ae6
Reviewed-on: https://skia-review.googlesource.com/26361
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | dm/DM.cpp | 2 | ||||
-rw-r--r-- | gm/gm.cpp | 4 | ||||
-rw-r--r-- | src/core/SkTraceEvent.h | 7 | ||||
-rw-r--r-- | tests/Test.h | 10 | ||||
-rw-r--r-- | tools/ok_test.cpp | 3 | ||||
-rw-r--r-- | tools/ok_vias.cpp | 3 |
6 files changed, 24 insertions, 5 deletions
@@ -1256,7 +1256,7 @@ static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions) if (!FLAGS_dryRun && !is_blacklisted("_", "tests", "_", test.name)) { start("unit", "test", "", test.name); GrContextFactory factory(grCtxOptions); - test.proc(&reporter, &factory); + test.run(&reporter, &factory); } done("unit", "test", "", test.name); } @@ -8,6 +8,7 @@ #include "gm.h" #include "sk_tool_utils.h" #include "SkShader.h" +#include "SkTraceEvent.h" using namespace skiagm; GM::GM() { @@ -21,11 +22,13 @@ GM::GM() { GM::~GM() {} void GM::draw(SkCanvas* canvas) { + TRACE_EVENT1("GM", TRACE_FUNC, "name", TRACE_STR_COPY(this->getName())); this->drawBackground(canvas); this->drawContent(canvas); } void GM::drawContent(SkCanvas* canvas) { + TRACE_EVENT0("GM", TRACE_FUNC); if (!fHaveCalledOnceBeforeDraw) { fHaveCalledOnceBeforeDraw = true; this->onOnceBeforeDraw(); @@ -34,6 +37,7 @@ void GM::drawContent(SkCanvas* canvas) { } void GM::drawBackground(SkCanvas* canvas) { + TRACE_EVENT0("GM", TRACE_FUNC); if (!fHaveCalledOnceBeforeDraw) { fHaveCalledOnceBeforeDraw = true; this->onOnceBeforeDraw(); diff --git a/src/core/SkTraceEvent.h b/src/core/SkTraceEvent.h index 8b9a15cff4..116330dcb5 100644 --- a/src/core/SkTraceEvent.h +++ b/src/core/SkTraceEvent.h @@ -17,6 +17,13 @@ //////////////////////////////////////////////////////////////////////////////// // Implementation specific tracing API definitions. +// Makes it easier to add traces with a simple TRACE_EVENT0("skia", TRACE_FUNC). +#if defined(_MSC_VER) + #define TRACE_FUNC __FUNCSIG__ +#else + #define TRACE_FUNC __PRETTY_FUNCTION__ +#endif + // By default, const char* argument values are assumed to have long-lived scope // and will not be copied. Use this macro to force a const char* to be copied. #define TRACE_STR_COPY(str) \ diff --git a/tests/Test.h b/tests/Test.h index db2552b614..c9a381eb12 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -7,10 +7,11 @@ #ifndef skiatest_Test_DEFINED #define skiatest_Test_DEFINED -#include "SkString.h" #include "../tools/Registry.h" -#include "SkTypes.h" #include "SkClipOpPriv.h" +#include "SkString.h" +#include "SkTraceEvent.h" +#include "SkTypes.h" #if SK_SUPPORT_GPU #include "GrContextFactory.h" @@ -94,6 +95,11 @@ struct Test { const char* name; bool needsGpu; TestProc proc; + + void run(skiatest::Reporter* r, sk_gpu_test::GrContextFactory* factory) const { + TRACE_EVENT1("test", TRACE_FUNC, "name", this->name/*these are static*/); + this->proc(r, factory); + } }; typedef sk_tools::Registry<Test> TestRegistry; diff --git a/tools/ok_test.cpp b/tools/ok_test.cpp index f5c4f22489..7c020d88e1 100644 --- a/tools/ok_test.cpp +++ b/tools/ok_test.cpp @@ -32,7 +32,6 @@ struct TestStream : Stream { SkISize size() override { return {0,0}; } Status draw(SkCanvas*) override { - struct : public skiatest::Reporter { Status status = Status::OK; bool extended, verbose_; @@ -54,7 +53,7 @@ struct TestStream : Stream { factory = &a_real_factory; #endif - test.proc(&reporter, factory); + test.run(&reporter, factory); return reporter.status; } }; diff --git a/tools/ok_vias.cpp b/tools/ok_vias.cpp index 35e6f1fcab..c3c0bad2d8 100644 --- a/tools/ok_vias.cpp +++ b/tools/ok_vias.cpp @@ -10,6 +10,7 @@ #include "SkOSFile.h" #include "SkPictureRecorder.h" #include "SkPngEncoder.h" +#include "SkTraceEvent.h" #include "ProcStats.h" #include "Timer.h" #include "ok.h" @@ -42,6 +43,7 @@ struct ViaPic : Dst { } Status draw(Src* src) override { + TRACE_EVENT0("ok", TRACE_FUNC); SkRTreeFactory factory; SkPictureRecorder rec; rec.beginRecording(SkRect::MakeSize(SkSize::Make(src->size())), @@ -76,6 +78,7 @@ struct Png : Dst { } Status draw(Src* src) override { + TRACE_EVENT0("ok", TRACE_FUNC); for (auto status = target->draw(src); status != Status::OK; ) { return status; } |