aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkJSONWriter.h
Commit message (Collapse)AuthorAge
* Move SkNoncopyable to include/private.Gravatar Ben Wagner2018-07-17
| | | | | | | Change-Id: I62f60ea52faeebddecacf03d9429ac3f7c516b8e Reviewed-on: https://skia-review.googlesource.com/141823 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* 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>
* Revert "Revert "Support single line objects and arrays""Gravatar Brian Osman2017-08-10
| | | | | | | | | | This reverts commit a5a69cfb480b99747ddc272149d35c6302abf1bf. Bug: skia: Change-Id: I08475d96255b9df13e5c86e1ef9c7f4739e51459 Reviewed-on: https://skia-review.googlesource.com/33202 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Revert "Revert "GrContext::dump that produces JSON formatted output""Gravatar Brian Osman2017-08-10
| | | | | | | | | | This reverts commit 0f450acd76fd58a2f7464f99869ed6afbfac303c. Bug: skia: Change-Id: I97428fbbc6d82bf8b186ec5fdbf1a939c00e4126 Reviewed-on: https://skia-review.googlesource.com/32726 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Revert "Support single line objects and arrays"Gravatar Brian Osman2017-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6a7d56fa0f7009be9df36774774f3c337d7c7760. Reason for revert: Earlier commit needs to be reverted for Chrome roll. Original change's description: > Support single line objects and arrays > > This is just a formatting nicety. The new caps dump has several large > arrays of structs, and keeping each object on one line makes them much > more readable. (It also limits the total length of the output, which > helps when scanning through). > > Example of the output, before and after this change: > https://gist.github.com/brianosman/872f33be9af49031023b791e7db0b1fb > > Bug: skia: > Change-Id: I0fe0c2241b0c7f451b0837500e554d0491126d5e > Reviewed-on: https://skia-review.googlesource.com/32820 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,brianosman@google.com Change-Id: I2b05cf79ca4804e5944f2eb3e17fe4be4d5af290 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/32860 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
* Support single line objects and arraysGravatar Brian Osman2017-08-09
| | | | | | | | | | | | | | | | This is just a formatting nicety. The new caps dump has several large arrays of structs, and keeping each object on one line makes them much more readable. (It also limits the total length of the output, which helps when scanning through). Example of the output, before and after this change: https://gist.github.com/brianosman/872f33be9af49031023b791e7db0b1fb Bug: skia: Change-Id: I0fe0c2241b0c7f451b0837500e554d0491126d5e Reviewed-on: https://skia-review.googlesource.com/32820 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>