Add top-level trace markers for each benchmark
Also add new paragraph about using systrace correctly
Docs-Preview: https://skia.org/?cl=41502
Change-Id: I114c14cc2e87a8b72aec46d8c354d3ea877a41ab
Reviewed-on: https://skia-review.googlesource.com/41502
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index bd23c3e..d69db82 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -46,6 +46,7 @@
#include "SkSurface.h"
#include "SkTaskGroup.h"
#include "SkThreadUtils.h"
+#include "SkTraceEvent.h"
#include "Stats.h"
#include "ThermalManager.h"
#include "ios_utils.h"
@@ -1272,6 +1273,8 @@
}
}
+ TRACE_EVENT1("skia", bench->getUniqueName(), "config", config);
+
target->setup();
bench->perCanvasPreDraw(canvas);
diff --git a/site/dev/tools/tracing.md b/site/dev/tools/tracing.md
index f20f76e..60595bc 100644
--- a/site/dev/tools/tracing.md
+++ b/site/dev/tools/tracing.md
@@ -19,6 +19,11 @@
tracing information to [atrace](https://source.android.com/devices/tech/debug/ftrace). On other
platforms, this has no effect.
+If you run `systrace` from the host command line, you will need to supply `-a <app_name>`,
+and the `<app_name>` argument will need to exactly match the command line used on the target
+device. For example, if you use `adb shell "cd /data/local/tmp; ./nanobench --trace atrace ..."`
+you must pass `-a ./nanobench` or systrace will ignore events from the application.
+
Console Logging
---------------
@@ -30,25 +35,25 @@
out/Release/dm --config gl --match ^gamma$ --trace debugf
~~~
-[ 0] <skia.gpu> GrDrawingManager::internalFlush id=1 #0 {
-[ 0] } GrDrawingManager::internalFlush
-[ 0] <skia.gpu> GrGpu::createTexture id=1 #1 {
-[ 0] } GrGpu::createTexture
-[ 0] <skia.gpu> GrRenderTargetContext::discard id=1 #2 {
-[ 0] } GrRenderTargetContext::discard
-[ 0] <skia.gpu> SkGpuDevice::clearAll id=1 #3 {
-[ 1] <skia.gpu> GrRenderTargetContext::clear id=1 #4 {
-[ 1] } GrRenderTargetContext::clear
-[ 0] } SkGpuDevice::clearAll
-[ 0] <skia> SkCanvas::drawRect() #5 {
-[ 1] <skia.gpu> SkGpuDevice::drawRect id=1 #6 {
-[ 2] <skia.gpu> GrRenderTargetContext::drawRect id=1 #7 {
-[ 3] <skia.gpu> GrRenderTargetContext::addDrawOp id=1 #8 {
-[ 3] } GrRenderTargetContext::addDrawOp
-[ 2] } GrRenderTargetContext::drawRect
-[ 1] } SkGpuDevice::drawRect
-[ 0] } SkCanvas::drawRect()
-...
+[ 0] <skia.gpu> GrDrawingManager::internalFlush id=1 #0 {
+[ 0] } GrDrawingManager::internalFlush
+[ 0] <skia.gpu> GrGpu::createTexture id=1 #1 {
+[ 0] } GrGpu::createTexture
+[ 0] <skia.gpu> GrRenderTargetContext::discard id=1 #2 {
+[ 0] } GrRenderTargetContext::discard
+[ 0] <skia.gpu> SkGpuDevice::clearAll id=1 #3 {
+[ 1] <skia.gpu> GrRenderTargetContext::clear id=1 #4 {
+[ 1] } GrRenderTargetContext::clear
+[ 0] } SkGpuDevice::clearAll
+[ 0] <skia> SkCanvas::drawRect() #5 {
+[ 1] <skia.gpu> SkGpuDevice::drawRect id=1 #6 {
+[ 2] <skia.gpu> GrRenderTargetContext::drawRect id=1 #7 {
+[ 3] <skia.gpu> GrRenderTargetContext::addDrawOp id=1 #8 {
+[ 3] } GrRenderTargetContext::addDrawOp
+[ 2] } GrRenderTargetContext::drawRect
+[ 1] } SkGpuDevice::drawRect
+[ 0] } SkCanvas::drawRect()
+...
~~~
Chrome Tracing