#include <android-base/test_utils.h>
#include "command.h"
+#include "event_selection_set.h"
#include "get_test_data.h"
#include "read_apk.h"
#include "test_util.h"
hit_set.end());
}
-#if defined(__ANDROID__) || defined(__linux__)
+#if defined(__linux__)
static std::unique_ptr<Command> RecordCmd() {
return CreateCommandInstance("record");
}
TEST_F(ReportCommandTest, dwarf_callgraph) {
- TemporaryFile tmp_file;
- ASSERT_TRUE(RecordCmd()->Run({"-g", "-o", tmp_file.path, "sleep", SLEEP_SEC}));
- ReportRaw(tmp_file.path, {"-g"});
- ASSERT_TRUE(success);
+ if (IsDwarfCallChainSamplingSupported()) {
+ TemporaryFile tmp_file;
+ ASSERT_TRUE(RecordCmd()->Run({"-g", "-o", tmp_file.path, "sleep", SLEEP_SEC}));
+ ReportRaw(tmp_file.path, {"-g"});
+ ASSERT_TRUE(success);
+ } else {
+ GTEST_LOG_(INFO)
+ << "This test does nothing as dwarf callchain sampling is not supported on this device.";
+ }
}
#endif
#ifndef SIMPLE_PERF_EVENT_FD_H_
#define SIMPLE_PERF_EVENT_FD_H_
-#include <poll.h>
#include <sys/types.h>
#include <memory>
uint64_t id; // The id of the perf_event_file.
};
+struct pollfd;
+
// EventFd represents an opened perf_event_file.
class EventFd {
public:
#ifndef SIMPLE_PERF_EVENT_SELECTION_SET_H_
#define SIMPLE_PERF_EVENT_SELECTION_SET_H_
-#include <poll.h>
#include <functional>
#include <map>
#include <vector>
std::vector<CounterInfo> counters;
};
+struct pollfd;
+
// EventSelectionSet helps to monitor events.
// Firstly, the user creates an EventSelectionSet, and adds the specific event types to monitor.
// Secondly, the user defines how to monitor the events (by setting enable_on_exec flag,