Merge "profiling: Allow to set sampling rate on command line."
diff --git a/src/profiling/memory/README.md b/src/profiling/memory/README.md
new file mode 100644
index 0000000..a0ecaa8
--- /dev/null
+++ b/src/profiling/memory/README.md
@@ -0,0 +1,34 @@
+# heapprofd - Android Heap Profiler
+
+_These are temporary instructions while heapprofd is under development. They are
+subject to frequent change and will be obsoleted once heapprofd is integrated
+into Perfetto._
+
+Currently heapprofd only works with SELinux disabled and when run as root.
+
+To start profiling the process `${PID}`, run the following sequence of commands.
+
+```
+adb root
+adb shell setenforce 0
+
+adb shell rm /dev/socket/heapprofd
+adb shell 'heapprofd -r 128000 /dev/socket/heapprofd' &
+adb shell kill -36 ${PID}
+```
+
+To obtain heap dumps for all profiled processes, send `SIGUSR1` to heapprofd
+which produces heap dumps in /data/local/tmp.
+
+```
+adb shell killall -USR1 heapprofd
+adb pull /data/local/tmp/heap_dump.${PID}
+```
+
+This file can then be converted to a flamegraph using Brendan Gregg's
+[`flamegraph.pl`](
+  https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl).
+
+```
+flamegraph.pl heap_dump.${PID} > heap_dump.${PID}.svg
+```
diff --git a/src/trace_processor/table.cc b/src/trace_processor/table.cc
index 41d382b..228551d 100644
--- a/src/trace_processor/table.cc
+++ b/src/trace_processor/table.cc
@@ -269,7 +269,7 @@
 }
 
 Table::Schema::Schema() = default;
-Table::Schema::Schema(const Schema&) noexcept = default;
+Table::Schema::Schema(const Schema&) = default;
 Table::Schema& Table::Schema::operator=(const Schema&) = default;
 
 std::string Table::Schema::ToCreateTableStmt() {
diff --git a/src/trace_processor/table.h b/src/trace_processor/table.h
index 6e3f8d4..db1af75 100644
--- a/src/trace_processor/table.h
+++ b/src/trace_processor/table.h
@@ -120,7 +120,7 @@
     Schema(std::vector<Column>, std::vector<size_t> primary_keys);
 
     // This class is explicitly copiable.
-    Schema(const Schema&) noexcept;
+    Schema(const Schema&);
     Schema& operator=(const Schema& t);
 
     std::string ToCreateTableStmt();
diff --git a/src/trace_processor/trace_processor_shell.cc b/src/trace_processor/trace_processor_shell.cc
index 05540e1..c86a82a 100644
--- a/src/trace_processor/trace_processor_shell.cc
+++ b/src/trace_processor/trace_processor_shell.cc
@@ -46,8 +46,8 @@
 #include <signal.h>
 #endif
 
-using namespace perfetto;
-using namespace perfetto::trace_processor;
+namespace perfetto {
+namespace trace_processor {
 
 namespace {
 TraceProcessor* g_tp;
@@ -182,9 +182,7 @@
   printf("\nQuery executed in %.3f ms\n\n", (t_end - t_start).count() / 1E6);
 }
 
-}  // namespace
-
-int main(int argc, char** argv) {
+int TraceProcessorMain(int argc, char** argv) {
   if (argc < 2) {
     PERFETTO_ELOG("Usage: %s [-d] trace_file.proto", argv[0]);
     return 1;
@@ -275,3 +273,12 @@
 
   return 0;
 }
+
+}  // namespace
+
+}  // namespace trace_processor
+}  // namespace perfetto
+
+int main(int argc, char** argv) {
+  return perfetto::trace_processor::TraceProcessorMain(argc, argv);
+}