diff --git a/perf-regression/node-microbench.c b/perf-regression/node-microbench.c index 548d82f..da96de3 100644 --- a/perf-regression/node-microbench.c +++ b/perf-regression/node-microbench.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ #ifdef HAVE_ABT_H #include #endif +#include #include @@ -63,6 +65,8 @@ static void test_abt_eventual_dynamic_allocation(long unsigned iters); static void test_abt_eventual_static_allocation(long unsigned iters); #endif #endif +static void test_pthread_self(long unsigned iters); +static void test_gettid(long unsigned iters); static struct options g_opts; static struct test_case g_test_cases[] = { @@ -88,6 +92,8 @@ static struct test_case g_test_cases[] = { {"ABT_eventual static per fn", test_abt_eventual_static_allocation}, #endif #endif + {"pthread_self", test_pthread_self}, + {"gettid", test_gettid}, {NULL, NULL}}; int main(int argc, char** argv) @@ -426,3 +432,23 @@ static void test_abt_eventual_static_allocation(long unsigned iters) #endif /* ABT_EVENTUAL_INITIALIZER */ #endif /* HAVE_ABT_H */ + +/* how expensive is pthread_self()? */ +static void test_pthread_self(long unsigned iters) +{ + long unsigned i; + + for (i = 0; i < iters; i++) { pthread_self(); } + + return; +} + +/* how expensive is gettid()? */ +static void test_gettid(long unsigned iters) +{ + long unsigned i; + + for (i = 0; i < iters; i++) { gettid(); } + + return; +}