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

Go to the source code of this file.

Classes

struct  worker
 

Functions

static void print_summary (void)
 
static void toggle_done (int sig __maybe_unused, siginfo_t *info __maybe_unused, void *uc __maybe_unused)
 
static void * workerfn (void *arg)
 
static void create_threads (struct worker *w, pthread_attr_t thread_attr, struct cpu_map *cpu)
 
int bench_futex_lock_pi (int argc, const char **argv)
 

Variables

static u_int32_t global_futex = 0
 
static struct workerworker
 
static unsigned int nsecs = 10
 
static bool silent = false
 
static bool multi = false
 
static bool done = false
 
static bool fshared = false
 
static unsigned int nthreads = 0
 
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_lock_pi_usage []
 

Function Documentation

◆ bench_futex_lock_pi()

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

Definition at line 146 of file futex-lock-pi.c.

Here is the call graph for this function:

◆ create_threads()

static void create_threads ( struct worker w,
pthread_attr_t  thread_attr,
struct cpu_map cpu 
)
static

Definition at line 117 of file futex-lock-pi.c.

Here is the call graph for this function:

◆ print_summary()

static void print_summary ( void  )
static

Definition at line 58 of file futex-lock-pi.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 68 of file futex-lock-pi.c.

◆ workerfn()

static void* workerfn ( void *  arg)
static

Definition at line 78 of file futex-lock-pi.c.

Here is the call graph for this function:

Variable Documentation

◆ bench_futex_lock_pi_usage

const char* const bench_futex_lock_pi_usage[]
static
Initial value:
= {
"perf bench futex lock-pi <options>",
NULL
}

Definition at line 53 of file futex-lock-pi.c.

◆ done

bool done = false
static

Definition at line 35 of file futex-lock-pi.c.

◆ fshared

bool fshared = false
static

Definition at line 35 of file futex-lock-pi.c.

◆ futex_flag

int futex_flag = 0
static

Definition at line 37 of file futex-lock-pi.c.

◆ global_futex

u_int32_t global_futex = 0
static

Definition at line 31 of file futex-lock-pi.c.

◆ multi

bool multi = false
static

Definition at line 34 of file futex-lock-pi.c.

◆ nsecs

unsigned int nsecs = 10
static

Definition at line 33 of file futex-lock-pi.c.

◆ nthreads

unsigned int nthreads = 0
static

Definition at line 36 of file futex-lock-pi.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_BOOLEAN( 'M', "multi", &multi, "Use multiple futexes"),
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 fshared
Definition: futex-lock-pi.c:35
static bool silent
Definition: futex-lock-pi.c:34
static bool multi
Definition: futex-lock-pi.c:34
static unsigned int nthreads
Definition: futex-lock-pi.c:36
static unsigned int nsecs
Definition: futex-lock-pi.c:33

Definition at line 44 of file futex-lock-pi.c.

◆ runtime

struct timeval start end runtime

Definition at line 38 of file futex-lock-pi.c.

◆ silent

bool silent = false
static

Definition at line 34 of file futex-lock-pi.c.

◆ thread_lock

pthread_mutex_t thread_lock
static

Definition at line 39 of file futex-lock-pi.c.

◆ thread_parent

pthread_cond_t thread_parent
static

Definition at line 42 of file futex-lock-pi.c.

◆ thread_worker

pthread_cond_t thread_worker
static

Definition at line 42 of file futex-lock-pi.c.

◆ threads_starting

unsigned int threads_starting
static

Definition at line 40 of file futex-lock-pi.c.

◆ throughput_stats

struct stats throughput_stats
static

Definition at line 41 of file futex-lock-pi.c.

◆ worker

struct worker* worker
static

Definition at line 32 of file futex-lock-pi.c.