#include "base/task/thread_pool.h"
#include <stddef.h>
#include <atomic>
#include <memory>
#include <optional>
#include <vector>
#include "base/barrier_closure.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/simple_thread.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
namespace base {
namespace internal {
namespace {
constexpr char kMetricPrefixThreadPool[] = …;
constexpr char kMetricPostTaskThroughput[] = …;
constexpr char kMetricRunTaskThroughput[] = …;
constexpr char kMetricNumTasksPosted[] = …;
constexpr char kStoryBindPostThenRunNoOp[] = …;
constexpr char kStoryPostThenRunNoOp[] = …;
constexpr char kStoryPostThenRunNoOpManyThreads[] = …;
constexpr char kStoryPostThenRunNoOpMoreThanRunningThreads[] = …;
constexpr char kStoryPostRunNoOp[] = …;
constexpr char kStoryPostRunNoOpManyThreads[] = …;
constexpr char kStoryPostRunBusyManyThreads[] = …;
perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) { … }
enum class ExecutionMode { … };
class PostingThread : public SimpleThread { … };
class ThreadPoolPerfTest : public testing::Test { … };
}
TEST_F(ThreadPoolPerfTest, BindPostThenRunNoOpTasks) { … }
TEST_F(ThreadPoolPerfTest, PostThenRunNoOpTasks) { … }
TEST_F(ThreadPoolPerfTest, PostThenRunNoOpTasksManyThreads) { … }
TEST_F(ThreadPoolPerfTest, PostThenRunNoOpTasksMorePostingThanRunningThreads) { … }
TEST_F(ThreadPoolPerfTest, PostRunNoOpTasks) { … }
TEST_F(ThreadPoolPerfTest, PostRunNoOpTasksManyThreads) { … }
TEST_F(ThreadPoolPerfTest, PostRunBusyTasksManyThreads) { … }
}
}