libcopp  2.2.0
Macros | Typedefs | Functions | Variables
sample_benchmark_coroutine_stack_pool.cpp File Reference
#include <inttypes.h>
#include <stdint.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <libcopp/coroutine/coroutine_context_container.h>
#include <libcopp/stack/stack_pool.h>
Include dependency graph for sample_benchmark_coroutine_stack_pool.cpp:

Go to the source code of this file.

Macros

#define CALC_CLOCK_T   clock_t
 
#define CALC_CLOCK_NOW()   clock()
 
#define CALC_MS_CLOCK(x)   static_cast<int>((x) / (CLOCKS_PER_SEC / 1000))
 
#define CALC_NS_AVG_CLOCK(x, y)   (1000000LL * static_cast<long long>((x) / (CLOCKS_PER_SEC / 1000)) / (y ? y : 1))
 

Typedefs

typedef copp::stack_pool< copp::allocator::default_statck_allocator > stack_pool_t
 
typedef copp::coroutine_context_container< copp::allocator::stack_allocator_pool< stack_pool_t > > my_cotoutine_t
 

Functions

static int my_runner (void *)
 
static void benchmark_round (int index)
 
int main (int argc, char *argv[])
 

Variables

stack_pool_t::ptr_t global_stack_pool
 
int switch_count = 100
 
int MAX_COROUTINE_NUMBER = 100000
 

Macro Definition Documentation

◆ CALC_CLOCK_NOW

#define CALC_CLOCK_NOW ( )    clock()

Definition at line 30 of file sample_benchmark_coroutine_stack_pool.cpp.

◆ CALC_CLOCK_T

#define CALC_CLOCK_T   clock_t

Definition at line 29 of file sample_benchmark_coroutine_stack_pool.cpp.

◆ CALC_MS_CLOCK

#define CALC_MS_CLOCK (   x)    static_cast<int>((x) / (CLOCKS_PER_SEC / 1000))

Definition at line 31 of file sample_benchmark_coroutine_stack_pool.cpp.

◆ CALC_NS_AVG_CLOCK

#define CALC_NS_AVG_CLOCK (   x,
 
)    (1000000LL * static_cast<long long>((x) / (CLOCKS_PER_SEC / 1000)) / (y ? y : 1))

Definition at line 32 of file sample_benchmark_coroutine_stack_pool.cpp.

Typedef Documentation

◆ my_cotoutine_t

typedef copp::coroutine_context_container<copp::allocator::stack_allocator_pool<stack_pool_t> > my_cotoutine_t

Definition at line 40 of file sample_benchmark_coroutine_stack_pool.cpp.

◆ stack_pool_t

typedef copp::stack_pool<copp::allocator::default_statck_allocator> stack_pool_t

Definition at line 36 of file sample_benchmark_coroutine_stack_pool.cpp.

Function Documentation

◆ benchmark_round()

static void benchmark_round ( int  index)
static

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ my_runner()

static int my_runner ( void *  )
static

Variable Documentation

◆ global_stack_pool

stack_pool_t::ptr_t global_stack_pool

Definition at line 37 of file sample_benchmark_coroutine_stack_pool.cpp.

Referenced by benchmark_round(), and main().

◆ MAX_COROUTINE_NUMBER

int MAX_COROUTINE_NUMBER = 100000

Definition at line 54 of file sample_benchmark_coroutine_stack_pool.cpp.

Referenced by benchmark_round(), and main().

◆ switch_count

int switch_count = 100

Definition at line 38 of file sample_benchmark_coroutine_stack_pool.cpp.

Referenced by main(), and my_runner().