#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include <string>
#include "base/threading/simple_thread.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
namespace base {
namespace {
constexpr char kMetricPrefixWaitableEvent[] = …;
constexpr char kMetricWaitTime[] = …;
constexpr char kMetricSignalTime[] = …;
constexpr char kMetricElapsedCycles[] = …;
constexpr char kStorySingleThread[] = …;
constexpr char kStoryMultiThreadWaiter[] = …;
constexpr char kStoryMultiThreadSignaler[] = …;
constexpr char kStoryTimedThroughput[] = …;
perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) { … }
class TraceWaitableEvent { … };
class SignalerThread : public SimpleThread { … };
void PrintPerfWaitableEvent(const TraceWaitableEvent* event,
const std::string& story_name,
size_t* elapsed_cycles = nullptr) { … }
}
TEST(WaitableEventPerfTest, SingleThread) { … }
TEST(WaitableEventPerfTest, MultipleThreads) { … }
TEST(WaitableEventPerfTest, Throughput) { … }
}