mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm-exegesis][NFC] Remove dead code.
This commit is contained in:
parent
c945e58715
commit
1cb40bb793
@ -82,24 +82,6 @@ private:
|
||||
#endif
|
||||
};
|
||||
|
||||
// Helper to measure a list of PerfEvent for a particular function.
|
||||
// callback is called for each successful measure (PerfEvent needs to be valid).
|
||||
template <typename Function>
|
||||
void Measure(
|
||||
ArrayRef<PerfEvent> Events,
|
||||
const std::function<void(const PerfEvent &Event, int64_t Value)> &Callback,
|
||||
Function Fn) {
|
||||
for (const auto &Event : Events) {
|
||||
if (!Event.valid())
|
||||
continue;
|
||||
Counter Cnt(Event);
|
||||
Cnt.start();
|
||||
Fn();
|
||||
Cnt.stop();
|
||||
Callback(Event, Cnt.read());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pfm
|
||||
} // namespace exegesis
|
||||
} // namespace llvm
|
||||
|
@ -22,21 +22,14 @@ using ::testing::Not;
|
||||
TEST(PerfHelperTest, FunctionalTest) {
|
||||
#ifdef HAVE_LIBPFM
|
||||
ASSERT_FALSE(pfmInitialize());
|
||||
const PerfEvent SingleEvent("CYCLES:u");
|
||||
const auto &EmptyFn = []() {};
|
||||
std::string CallbackEventName;
|
||||
std::string CallbackEventNameFullyQualifed;
|
||||
int64_t CallbackEventCycles;
|
||||
Measure(
|
||||
makeArrayRef(SingleEvent),
|
||||
[&](const PerfEvent &Event, int64_t Value) {
|
||||
CallbackEventName = std::string(Event.name());
|
||||
CallbackEventNameFullyQualifed = std::string(Event.getPfmEventString());
|
||||
CallbackEventCycles = Value;
|
||||
},
|
||||
EmptyFn);
|
||||
EXPECT_EQ(CallbackEventName, "CYCLES:u");
|
||||
EXPECT_THAT(CallbackEventNameFullyQualifed, Not(IsEmpty()));
|
||||
const PerfEvent Event("CYCLES:u");
|
||||
ASSERT_TRUE(Event.valid());
|
||||
EXPECT_EQ(Event.name(), "CYCLES:u");
|
||||
EXPECT_THAT(Event.getPfmEventString(), Not(IsEmpty()));
|
||||
Counter Cnt(Event);
|
||||
Cnt.start();
|
||||
Cnt.stop();
|
||||
Cnt.read();
|
||||
pfmTerminate();
|
||||
#else
|
||||
ASSERT_TRUE(pfmInitialize());
|
||||
|
Loading…
Reference in New Issue
Block a user