kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
Macros | Functions | Variables
test_threadpool_stress.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <err.h>
#include <poll.h>
#include <sys/time.h>
#include "threadpool.h"

Go to the source code of this file.

Macros

#define ATOMIC_BOOL_COMPARE_AND_SWAP(PTR, OLD, NEW)   (__sync_bool_compare_and_swap(PTR, OLD, NEW))
 
#define SPIN_ADJ(F, ADJ)
 

Functions

static void dump_stats (const char *prefix, struct threadpool_info *stats, size_t ticks)
 
static size_t fibs (size_t arg)
 
static void task_cb (void *udata)
 
int main (int argc, char **argv)
 

Variables

static size_t task_count = 0
 
static size_t last_count = 0
 

Macro Definition Documentation

#define ATOMIC_BOOL_COMPARE_AND_SWAP (   PTR,
  OLD,
  NEW 
)    (__sync_bool_compare_and_swap(PTR, OLD, NEW))

Definition at line 44 of file test_threadpool_stress.c.

#define SPIN_ADJ (   F,
  ADJ 
)
Value:
do { \
for (;;) { \
size_t v = F; \
if (ATOMIC_BOOL_COMPARE_AND_SWAP(&F, v, v + ADJ)) { \
break; \
} \
} \
} while (0)
#define ATOMIC_BOOL_COMPARE_AND_SWAP(PTR, OLD, NEW)

Definition at line 48 of file test_threadpool_stress.c.

Function Documentation

static void dump_stats ( const char *  prefix,
struct threadpool_info stats,
size_t  ticks 
)
static
static size_t fibs ( size_t  arg)
static

Definition at line 58 of file test_threadpool_stress.c.

static void task_cb ( void *  udata)
static

Definition at line 63 of file test_threadpool_stress.c.

References fibs(), SPIN_ADJ, and task_count.

int main ( int  argc,
char **  argv 
)

Variable Documentation

size_t task_count = 0
static

Definition at line 32 of file test_threadpool_stress.c.

size_t last_count = 0
static

Definition at line 33 of file test_threadpool_stress.c.