Linux Perf
futex-hash.c File Reference
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <sys/time.h>
#include "../util/stat.h"
#include <subcmd/parse-options.h>
#include "bench.h"
#include "futex.h"
#include "cpumap.h"
#include <err.h>
Include dependency graph for futex-hash.c:

Go to the source code of this file.

Classes

struct  worker
 

Functions

static void * workerfn (void *arg)
 
static void toggle_done (int sig __maybe_unused, siginfo_t *info __maybe_unused, void *uc __maybe_unused)
 
static void print_summary (void)
 
int bench_futex_hash (int argc, const char **argv)
 

Variables

static unsigned int nthreads = 0
 
static unsigned int nsecs = 10
 
static unsigned int nfutexes = 1024
 
static bool fshared = false
 
static bool done = false
 
static bool silent = false
 
static int futex_flag = 0
 
struct timeval start end runtime
 
static pthread_mutex_t thread_lock
 
static unsigned int threads_starting
 
static struct stats throughput_stats
 
static pthread_cond_t thread_parent
 
static pthread_cond_t thread_worker
 
static const struct option options []
 
static const char *const bench_futex_hash_usage []
 

Function Documentation

◆ bench_futex_hash()

int bench_futex_hash ( int  argc,
const char **  argv 
)

Definition at line 118 of file futex-hash.c.

Here is the call graph for this function:

◆ print_summary()

static void print_summary ( void  )
static

Definition at line 108 of file futex-hash.c.

Here is the call graph for this function:

◆ toggle_done()

static void toggle_done ( int sig  __maybe_unused,
siginfo_t *info  __maybe_unused,
void *uc  __maybe_unused 
)
static

Definition at line 98 of file futex-hash.c.

◆ workerfn()

static void* workerfn ( void *  arg)
static

Definition at line 65 of file futex-hash.c.

Here is the call graph for this function:

Variable Documentation

◆ bench_futex_hash_usage

const char* const bench_futex_hash_usage[]
static
Initial value:
= {
"perf bench futex hash <options>",
NULL
}

Definition at line 60 of file futex-hash.c.

◆ done

bool done = false
static

Definition at line 35 of file futex-hash.c.

◆ fshared

bool fshared = false
static

Definition at line 35 of file futex-hash.c.

◆ futex_flag

int futex_flag = 0
static

Definition at line 36 of file futex-hash.c.

◆ nfutexes

unsigned int nfutexes = 1024
static

Definition at line 34 of file futex-hash.c.

◆ nsecs

unsigned int nsecs = 10
static

Definition at line 32 of file futex-hash.c.

◆ nthreads

unsigned int nthreads = 0
static

Definition at line 31 of file futex-hash.c.

◆ options

const struct option options[]
static
Initial value:
= {
OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"),
OPT_UINTEGER('r', "runtime", &nsecs, "Specify runtime (in seconds)"),
OPT_UINTEGER('f', "futexes", &nfutexes, "Specify amount of futexes per threads"),
OPT_BOOLEAN( 's', "silent", &silent, "Silent mode: do not display data/details"),
OPT_BOOLEAN( 'S', "shared", &fshared, "Use shared futexes instead of private ones"),
}
static bool silent
Definition: futex-hash.c:35
static unsigned int nfutexes
Definition: futex-hash.c:34
static unsigned int nthreads
Definition: futex-hash.c:31
static bool fshared
Definition: futex-hash.c:35
static unsigned int nsecs
Definition: futex-hash.c:32

Definition at line 51 of file futex-hash.c.

◆ runtime

struct timeval start end runtime

Definition at line 38 of file futex-hash.c.

◆ silent

bool silent = false
static

Definition at line 35 of file futex-hash.c.

◆ thread_lock

pthread_mutex_t thread_lock
static

Definition at line 39 of file futex-hash.c.

◆ thread_parent

pthread_cond_t thread_parent
static

Definition at line 42 of file futex-hash.c.

◆ thread_worker

pthread_cond_t thread_worker
static

Definition at line 42 of file futex-hash.c.

◆ threads_starting

unsigned int threads_starting
static

Definition at line 40 of file futex-hash.c.

◆ throughput_stats

struct stats throughput_stats
static

Definition at line 41 of file futex-hash.c.