#include "base/task/sequence_manager/sequence_manager.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/message_loop/message_pump_default.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/sequence_checker.h"
#include "base/synchronization/condition_variable.h"
#include "base/task/sequence_manager/task_queue.h"
#include "base/task/sequence_manager/test/mock_time_domain.h"
#include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "base/task/sequence_manager/test/test_task_time_observer.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_impl.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread.h"
#include "base/time/default_tick_clock.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
namespace base {
namespace sequence_manager {
namespace {
const int kNumTasks = …;
constexpr char kMetricPrefixSequenceManager[] = …;
constexpr char kMetricPostTimePerTask[] = …;
perf_test::PerfResultReporter SetUpReporter(const std::string& story_name) { … }
}
class PerfTestTimeDomain : public MockTimeDomain { … };
enum class PerfTestType { … };
class PerfTestDelegate { … };
class BaseSequenceManagerPerfTestDelegate : public PerfTestDelegate { … };
class SequenceManagerWithMessagePumpPerfTestDelegate
: public BaseSequenceManagerPerfTestDelegate { … };
class SingleThreadInThreadPoolPerfTestDelegate : public PerfTestDelegate { … };
class TestCase { … };
class TaskSource { … };
class SameThreadTaskSource : public TaskSource { … };
class CrossThreadTaskSource : public TaskSource { … };
class SingleThreadImmediateTestCase : public TestCase { … };
class SingleThreadDelayedTestCase : public TestCase { … };
class TwoThreadTestCase : public TestCase { … };
class SequenceManagerPerfTest : public testing::TestWithParam<PerfTestType> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(SequenceManagerPerfTest, PostDelayedTasks_OneQueue) { … }
TEST_P(SequenceManagerPerfTest, PostDelayedTasks_FourQueues) { … }
TEST_P(SequenceManagerPerfTest, PostDelayedTasks_EightQueues) { … }
TEST_P(SequenceManagerPerfTest, PostDelayedTasks_ThirtyTwoQueues) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasks_OneQueue) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasks_FourQueues) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasks_EightQueues) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasks_ThirtyTwoQueues) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasksFromTwoThreads_OneQueue) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasksFromTwoThreads_FourQueues) { … }
TEST_P(SequenceManagerPerfTest, PostImmediateTasksFromTwoThreads_EightQueues) { … }
TEST_P(SequenceManagerPerfTest,
PostImmediateTasksFromTwoThreads_ThirtyTwoQueues) { … }
}
}