blob: 107e601879da5b508bd5b6e4edeedafd3ff2e229 [file] [log] [blame]
Ahmad Sharifae1714d2013-01-17 11:29:37 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PERF_TOOL_H
6#define PERF_TOOL_H
7
8#include <string>
9
10#include <base/basictypes.h>
11#include <dbus-c++/dbus.h>
12
Ahmad Shariff5597f62013-04-25 12:25:41 -070013#include "random_selector.h"
14
Ahmad Sharifae1714d2013-01-17 11:29:37 -080015namespace debugd {
16
17class PerfTool {
18 public:
19 PerfTool();
20 ~PerfTool();
21
Ahmad Shariff5597f62013-04-25 12:25:41 -070022 // Randomly runs the perf tool in various modes and collects various events
23 // for |duration_secs| seconds and returns a protobuf containing the collected
24 // data.
25 std::vector<uint8> GetRichPerfData(const uint32_t& duration_secs,
26 DBus::Error& error); // NOLINT
Ahmad Sharifae1714d2013-01-17 11:29:37 -080027 private:
Ahmad Shariff5597f62013-04-25 12:25:41 -070028 // Helper function that runs perf for a given |duration_secs| returning the
29 // collected data in |data_string|.
30 void GetPerfDataHelper(const uint32_t& duration_secs,
31 const std::string& perf_command_line,
Ahmad Sharifae1714d2013-01-17 11:29:37 -080032 DBus::Error& error,
33 std::string* data_string); // NOLINT
Ahmad Shariff5597f62013-04-25 12:25:41 -070034
35 RandomSelector random_selector_;
36
Ahmad Sharifae1714d2013-01-17 11:29:37 -080037 DISALLOW_COPY_AND_ASSIGN(PerfTool);
38};
39
40}; // namespace debugd
41
42#endif // !PERF_TOOL_H
43