Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add node microbenchmark tests for gettid() & pthread_self() #70

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions perf-regression/node-microbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <assert.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <pthread.h>
#include <stdatomic.h>
Expand All @@ -23,6 +24,7 @@
#ifdef HAVE_ABT_H
#include <abt.h>
#endif
#include <pthread.h>

#include <mpi.h>

Expand Down Expand Up @@ -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[] = {
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}
Loading