Linux Perf
sched-messaging.c File Reference
#include "../perf.h"
#include "../util/util.h"
#include <subcmd/parse-options.h>
#include "../builtin.h"
#include "bench.h"
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <poll.h>
#include <limits.h>
#include <err.h>
#include <linux/time64.h>
Include dependency graph for sched-messaging.c:

Go to the source code of this file.

Classes

struct  sender_context
 
struct  receiver_context
 

Macros

#define DATASIZE   100
 

Functions

static void fdpair (int fds[2])
 
static void ready (int ready_out, int wakefd)
 
static void * sender (struct sender_context *ctx)
 
static void * receiver (struct receiver_context *ctx)
 
static pthread_t create_worker (void *ctx, void *(*func)(void *))
 
static void reap_worker (pthread_t id)
 
static unsigned int group (pthread_t *pth, unsigned int num_fds, int ready_out, int wakefd)
 
int bench_sched_messaging (int argc, const char **argv)
 

Variables

static bool use_pipes = false
 
static unsigned int nr_loops = 100
 
static bool thread_mode = false
 
static unsigned int num_groups = 10
 
static const struct option options []
 
static const char *const bench_sched_message_usage []
 

Macro Definition Documentation

◆ DATASIZE

#define DATASIZE   100

Definition at line 35 of file sched-messaging.c.

Function Documentation

◆ bench_sched_messaging()

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

Definition at line 264 of file sched-messaging.c.

Here is the call graph for this function:

◆ create_worker()

static pthread_t create_worker ( void *  ctx,
void *(*)(void *)  func 
)
static

Definition at line 140 of file sched-messaging.c.

◆ fdpair()

static void fdpair ( int  fds[2])
static

Definition at line 56 of file sched-messaging.c.

◆ group()

static unsigned int group ( pthread_t *  pth,
unsigned int  num_fds,
int  ready_out,
int  wakefd 
)
static

Definition at line 195 of file sched-messaging.c.

Here is the call graph for this function:

◆ ready()

static void ready ( int  ready_out,
int  wakefd 
)
static

Definition at line 70 of file sched-messaging.c.

◆ reap_worker()

static void reap_worker ( pthread_t  id)
static

Definition at line 179 of file sched-messaging.c.

◆ receiver()

static void* receiver ( struct receiver_context ctx)
static

Definition at line 113 of file sched-messaging.c.

Here is the call graph for this function:

◆ sender()

static void* sender ( struct sender_context ctx)
static

Definition at line 85 of file sched-messaging.c.

Here is the call graph for this function:

Variable Documentation

◆ bench_sched_message_usage

const char* const bench_sched_message_usage[]
static
Initial value:
= {
"perf bench sched messaging <options>",
NULL
}

Definition at line 259 of file sched-messaging.c.

◆ nr_loops

unsigned int nr_loops = 100
static

Definition at line 38 of file sched-messaging.c.

◆ num_groups

unsigned int num_groups = 10
static

Definition at line 40 of file sched-messaging.c.

◆ options

const struct option options[]
static
Initial value:
= {
OPT_BOOLEAN('p', "pipe", &use_pipes,
"Use pipe() instead of socketpair()"),
OPT_BOOLEAN('t', "thread", &thread_mode,
"Be multi thread instead of multi process"),
OPT_UINTEGER('g', "group", &num_groups, "Specify number of groups"),
OPT_UINTEGER('l', "nr_loops", &nr_loops, "Specify the number of loops to run (default: 100)"),
}
static bool thread_mode
static bool use_pipes
static unsigned int num_groups
static unsigned int nr_loops

Definition at line 249 of file sched-messaging.c.

◆ thread_mode

bool thread_mode = false
static

Definition at line 39 of file sched-messaging.c.

◆ use_pipes

bool use_pipes = false
static

Definition at line 37 of file sched-messaging.c.