Add skeleton of perfetto cmdline tool.

Test:
  - ninja -C out/android_x64 perfetto
  - adb shell "stop traced_probes; stop traced; start traced; start traced_probes;"
  - adb push out/android_x64/perfetto /data/local/tmp/ &&  \
      adb push out/android_x64/libtraced_shared.so /data/local/tmp && \
      adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/perfetto -c :test -o /data/local/tmp/trace"

Change-Id: I44d53c5b043df426bcb9e5577fdeaaa387a4eb70
diff --git a/BUILD.gn b/BUILD.gn
index 441d438..512934e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -17,7 +17,10 @@
 group("all") {
   testonly = true  # allow to build also test targets
   deps = [
+    ":perfetto",
     ":perfetto_tests",
+    ":traced",
+    ":traced_probes",
     "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)",
     "src/protozero/protoc_plugin($host_toolchain)",
     "src/tracing:consumer_cmd",
@@ -59,11 +62,15 @@
   shared_library("libtraced_shared") {
     deps = [
       "gn:default_deps",
+      "src/traced/perfetto_cmd",
       "src/traced/probes",
       "src/traced/service",
     ]
   }
 
+  # The unprivileged trace daemon that listens for Producer and Consumer
+  # connections, handles the coordination of the tracing sessions and owns the
+  # log buffers.
   executable("traced") {
     deps = [
       ":libtraced_shared",
@@ -74,6 +81,8 @@
     ]
   }
 
+  # The unprivileged daemon that is allowed to access tracefs (for ftrace).
+  # Registers as a Producer on the traced daemon.
   executable("traced_probes") {
     deps = [
       ":libtraced_shared",
@@ -83,4 +92,16 @@
       "src/traced/probes/main.cc",
     ]
   }
+
+  # The command line client for Perfetto. Allows to configure / start / stop
+  # tracing, acting as a Consumer.
+  executable("perfetto") {
+    deps = [
+      ":libtraced_shared",
+      "gn:default_deps",
+    ]
+    sources = [
+      "src/traced/perfetto_cmd/main.cc",
+    ]
+  }
 }