Chrome: Enable ChromeOS-Wide-Profiling

We want to gather perf data collected by running "perf record -a" from opt-in
ChromeOS users. This CL enables that.

We use debugd in ChromeOS to run quipper, a program that runs "perf record -a"
and returns that data in a protobuf. We do this every 12 hours for 2 seconds.
The overhead is minimal (5% slowdown for 2 seconds on "lumpy" machines).

BUG=157508
TEST=Manual:
Change the perf record interval from 12 hours to 1 minute and set a
breakpoint on ParseProtoIfValid(). It gets hit and the protobuf is parsed
properly.


Review URL: https://chromiumcodereview.appspot.com/11185038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180484 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 9b90486..375d6fcd 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -63,6 +63,7 @@
 
 using content::GpuDataManager;
 using metrics::OmniboxEventProto;
+using metrics::PerfDataProto;
 using metrics::ProfilerEventProto;
 using metrics::SystemProfileProto;
 using tracked_objects::ProcessDataSnapshot;
@@ -929,6 +930,12 @@
   std::vector<ActiveGroupId> field_trial_ids;
   GetFieldTrialIds(&field_trial_ids);
   WriteFieldTrials(field_trial_ids, system_profile);
+
+#if defined(OS_CHROMEOS)
+  PerfDataProto perf_data_proto;
+  if (perf_provider_.GetPerfData(&perf_data_proto))
+    uma_proto()->add_perf_data()->Swap(&perf_data_proto);
+#endif
 }
 
 void MetricsLog::RecordProfilerData(