aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/trace
Commit message (Collapse)AuthorAge
* Optimize the size of our JSONGravatar Brian Osman2017-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | Catapult (Chrome tracing) has a hard upper limit of 256 MB of JSON data. This is independent of the number of events, because V8 can't store a single string longer than that. Before these changes, longer traces (eg all GL GMs, which was my test case) would be much larger (306 MB). This CL includes four changes that help to reduce the text size: 1) Offset timestamps (saved 7.3 MB) 2) Limit timestamps and durations to 3 digits (saved 10.7 MB) 3) Shorten thread IDs (saved 7.2 MB) 4) Omit categories from JSON (saved 25.7 MB) Note that category filtering still works, this just prevents us from writing the categories to the JSON, which was of limited value. At this point, my 306 MB file is now 255.3 MB, and loads. Bug: skia: Change-Id: Iaafc84025ddd52904f1ce9c1c2e9cbca65113079 Reviewed-on: https://skia-review.googlesource.com/35523 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* Record all trace event data inline, with variable sized entriesGravatar Brian Osman2017-08-16
| | | | | | | | | | | | Removes the need for strdup with copied strings, paves the way for more (and richer) payload, and shrinks the average event way down. Bug: skia: Change-Id: I9604fe713c34cfc877dce84563af89c579abd65b Reviewed-on: https://skia-review.googlesource.com/35166 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Added SkJSONWriterGravatar Brian Osman2017-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a stand-alone helper class for writing properly structured JSON to an SkWStream. It currently solves two problems (although this CL only uses it in one context): 1) Performance. Writing out JSON this way is about 10x faster than using JSONCPP. For the large amounts of data generated by the tracing system, that's a big win. 2) Makes it easy to emit structured JSON from code that's not fully centralized. We'd like to spit out JSON that describes a GrContext, GrGpu, GrCaps, etc... Doing that with simple string manipulation is complex, and spreads this logic over all those functions. Using JSONCPP adds yet another (large) third party library dependency (that we only build into our own tools right now). This went through several revisions. I originally planned it as a stateful SkString wrapper, so the user could just build their JSON as a string. That's O(N^2), though, because SkString grows by a (small) constant amount. Even using a better growth strategy still means needing RAM for all the resulting text, which is usually pointless. This version has a constant memory cost, so writing huge amounts of JSON to disk (tracing a long DM run can emit 100's of MBs) doesn't stress resources. Bug: skia: Change-Id: Ia716524b246db0f97d332da60d2ce9903069e748 Reviewed-on: https://skia-review.googlesource.com/31204 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Add support for object creation/snapshot/deletion eventsGravatar Brian Osman2017-08-03
| | | | | | | | | | | | | - Bring back some previously deleted macros and helper types. - Automatically inject base_type information into snapshot events, to allow simpler tracking of polymorphic object types. - Fix JSON formatting of pointer values (they were serializing as bool). Bug: skia: Change-Id: Iac7803f72ce5396ffd2fbcb5a36d76745c5e3f3e Reviewed-on: https://skia-review.googlesource.com/28220 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* Add --traceMatch argument to filter tracing categoriesGravatar Brian Osman2017-07-26
| | | | | | | | | Bug: skia: Change-Id: I1449f0f4d7d9ab6225d98c601eafa7461a2a7dde Reviewed-on: https://skia-review.googlesource.com/27120 Commit-Queue: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* Automatically prepend "disabled-by-default-" to TRACE categoriesGravatar Brian Osman2017-07-26
| | | | | | | | | | | Ensures that all Skia events are disabled by default in Chrome, and eliminates redundant typing. Bug: skia: Change-Id: I289c5e5a01084fcf4cccf512da65a4727f4aeca2 Reviewed-on: https://skia-review.googlesource.com/26880 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* ok, basic tracing supportGravatar Mike Klein2017-07-24
| | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't do anything in the default process-per-task mode, because those child tasks exit using _exit(), which doesn't trigger the event tracer destructor to flush. I don't remember exactly why I exit with _exit(), so I'm going to have to follow up on that. But written this way as I think I'm at least initializing the tracing in the right place for each process for the future. In threaded (-j -1) and serial (-j 0) modes, everything seems to work great. I'm also thinking I might add a tracer like the SkDebugf tracer but using ok_log(), which handles interlaced logging from concurrent tasks better than vanilla SkDebugf. Example: ninja -C out ok; and out/ok gm 8888 filter:search=fontmgr_bounds trace -j -1 Change-Id: Ia3cdad930ce65e6fd12fa74f3fb00894e35138d3 Reviewed-on: https://skia-review.googlesource.com/26350 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Faster, thread-safe implementationGravatar Brian Osman2017-07-24
| | | | | | | | | Bug: skia: Change-Id: I401c5a9885c348aa424ab07b094acecddb209490 Reviewed-on: https://skia-review.googlesource.com/25860 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Tracing cleanup and bugfixesGravatar Brian Osman2017-07-21
| | | | | | | | | | | | | | | | TraceID was unused, remove it. Simplify casting logic by using the same union helper as the macros. This fixes a bug that was present in the bool handling - we were treating the union value as a pointer, so we were dereferencing random stack memory. Luckily it never crashes, we did get the wrong values for bools. Bug: skia: Change-Id: I15d44756214f34c1f6479980d9a487ac7f3d8f6c Reviewed-on: https://skia-review.googlesource.com/25801 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Add category support to JSON and SkDebugf tracingGravatar Brian Osman2017-07-21
| | | | | | | | Bug: skia: Change-Id: I4d0bdb9d954e49b79ace0552d7b74b36a512c00d Reviewed-on: https://skia-review.googlesource.com/25642 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* First stab at JSON event tracerGravatar Brian Osman2017-07-20
| | | | | | | | | | | | | | | | | | | | 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 <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Add SkDebugf trace event handler.Gravatar Brian Salomon2017-07-19
Also adds more trace events to GPU backend. Change-Id: Ifa5f0cd4b1fd582f0cc30d37d9e6414dc498c75d Reviewed-on: https://skia-review.googlesource.com/24622 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>