1- // Copyright (c) 2020-2022 , NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+ // Copyright (c) 2020-2023 , NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ static void ThreadPoolArgs(benchmark::internal::Benchmark *b) {
2727 b->Args ({batch_size, work_size_min, work_size_max, nthreads});
2828}
2929
30- BENCHMARK_DEFINE_F (ThreadPoolBench, AddWork )(benchmark::State& st) {
30+ BENCHMARK_DEFINE_F (ThreadPoolBench, AddTask )(benchmark::State& st) {
3131 int batch_size = st.range (0 );
3232 int work_size_min = st.range (1 );
3333 int work_size_max = st.range (2 );
@@ -40,7 +40,7 @@ BENCHMARK_DEFINE_F(ThreadPoolBench, AddWork)(benchmark::State& st) {
4040 while (st.KeepRunning ()) {
4141 for (int i = 0 ; i < batch_size; i++) {
4242 auto size = this ->RandInt (work_size_min, work_size_max);
43- thread_pool.AddWork (
43+ thread_pool.AddTask (
4444 [&data, size, &total_count](int thread_id){
4545 std::vector<uint8_t > other_data;
4646 for (int i = 0 ; i < size; i++) {
@@ -59,13 +59,13 @@ BENCHMARK_DEFINE_F(ThreadPoolBench, AddWork)(benchmark::State& st) {
5959 std::cout << total_count << std::endl;
6060}
6161
62- BENCHMARK_REGISTER_F (ThreadPoolBench, AddWork )->Iterations (1000 )
62+ BENCHMARK_REGISTER_F (ThreadPoolBench, AddTask )->Iterations (1000 )
6363->Unit(benchmark::kMicrosecond )
6464->UseRealTime()
6565->Apply(ThreadPoolArgs);
6666
6767
68- BENCHMARK_DEFINE_F (ThreadPoolBench, AddWorkDeferred )(benchmark::State& st) {
68+ BENCHMARK_DEFINE_F (ThreadPoolBench, AddTaskDeferred )(benchmark::State& st) {
6969 int batch_size = st.range (0 );
7070 int work_size_min = st.range (1 );
7171 int work_size_max = st.range (2 );
@@ -78,7 +78,7 @@ BENCHMARK_DEFINE_F(ThreadPoolBench, AddWorkDeferred)(benchmark::State& st) {
7878 while (st.KeepRunning ()) {
7979 for (int i = 0 ; i < batch_size; i++) {
8080 auto size = this ->RandInt (work_size_min, work_size_max);
81- thread_pool.AddWork (
81+ thread_pool.AddTask (
8282 [&data, size, &total_count](int thread_id){
8383 std::vector<uint8_t > other_data;
8484 for (int i = 0 ; i < size; i++) {
@@ -98,7 +98,7 @@ BENCHMARK_DEFINE_F(ThreadPoolBench, AddWorkDeferred)(benchmark::State& st) {
9898}
9999
100100
101- BENCHMARK_REGISTER_F (ThreadPoolBench, AddWorkDeferred )->Iterations (1000 )
101+ BENCHMARK_REGISTER_F (ThreadPoolBench, AddTaskDeferred )->Iterations (1000 )
102102->Unit(benchmark::kMicrosecond )
103103->UseRealTime()
104104->Apply(ThreadPoolArgs);
0 commit comments