libcopp  2.2.0
Macros | Functions | Variables
sample_benchmark_coroutine.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 dependency graph for sample_benchmark_coroutine.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))
 

Functions

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

Variables

int switch_count = 100
 
int max_coroutine_number = 100000
 
copp::coroutine_context_default::ptr_t * co_arr = nullptr
 

Macro Definition Documentation

◆ CALC_CLOCK_NOW

#define CALC_CLOCK_NOW ( )    clock()

Definition at line 29 of file sample_benchmark_coroutine.cpp.

◆ CALC_CLOCK_T

#define CALC_CLOCK_T   clock_t

Definition at line 28 of file sample_benchmark_coroutine.cpp.

◆ CALC_MS_CLOCK

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

Definition at line 30 of file sample_benchmark_coroutine.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 31 of file sample_benchmark_coroutine.cpp.

Function Documentation

◆ main()

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

◆ my_runner()

static int my_runner ( void *  )
static

Definition at line 37 of file sample_benchmark_coroutine.cpp.

References this_coroutine::get_coroutine(), and switch_count.

Variable Documentation

◆ co_arr

copp::coroutine_context_default::ptr_t* co_arr = nullptr

Definition at line 49 of file sample_benchmark_coroutine.cpp.

Referenced by benchmark_round(), CASE_TEST(), and main().

◆ max_coroutine_number

int max_coroutine_number = 100000

Definition at line 48 of file sample_benchmark_coroutine.cpp.

Referenced by main().

◆ switch_count

int switch_count = 100

Definition at line 34 of file sample_benchmark_coroutine.cpp.

Referenced by main(), and my_runner().