From 53136aa93f0d0e72facabb70a7d40ed265e4be0e Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Thu, 20 Jul 2017 15:43:35 -0400 Subject: First stab at JSON event tracer Not yet thread safe (so it forces threading off). Builds JSON on the fly, so overhead is certainly bad. Plan to fix all of that, but this at least "works". There is now one tracing flag: 'trace'. - 'debugf' installs the SkDebugf tracer. - 'atrace' installs the Android ATrace tracer. - Any other value is interpreted as a filename, and produces a JSON file for chrome://tracing. All three modes work in DM, nanobench, and Viewer. Bug: skia: Change-Id: I3fbc22382b99418a508c670be2770195c0a1c364 Reviewed-on: https://skia-review.googlesource.com/24781 Commit-Queue: Brian Osman Reviewed-by: Brian Salomon --- dm/DM.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index 06ad765f3d..6310ed77f4 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -11,6 +11,7 @@ #include "Resources.h" #include "SkBBHFactory.h" #include "SkChecksum.h" +#include "SkChromeTracingTracer.h" #include "SkCodec.h" #include "SkColorPriv.h" #include "SkColorSpace.h" @@ -20,7 +21,7 @@ #include "SkCommonFlagsPathRenderer.h" #include "SkData.h" #include "SkDebugfTracer.h" -#include "SkEventTracer.h" +#include "SkEventTracingPriv.h" #include "SkFontMgr.h" #include "SkGraphics.h" #include "SkHalf.h" @@ -1272,10 +1273,10 @@ extern sk_sp (*gCreateTypefaceDelegate)(const char [], SkFontStyle ) int main(int argc, char** argv) { SkCommandLineFlags::Parse(argc, argv); - if (FLAGS_trace) { - SkAssertResult(SkEventTracer::SetInstance(new SkDebugfTracer())); - } - #if defined(SK_BUILD_FOR_IOS) + + initializeEventTracingForTools(&FLAGS_threads); + +#if defined(SK_BUILD_FOR_IOS) cd_Documents(); #endif setbuf(stdout, nullptr); @@ -1386,6 +1387,7 @@ int main(int argc, char** argv) { SkGraphics::PurgeAllCaches(); info("Finished!\n"); + return 0; } -- cgit v1.2.3