FFmpeg
Loading...
Searching...
No Matches
internal.h File Reference
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "checkasm/attributes.h"
#include "checkasm/test.h"
#include "longjmp.h"
#include "stats.h"
#include <stdnoreturn.h>

Go to the source code of this file.

Data Structures

struct  CheckasmJson
 

Macros

#define COLD   __attribute__((cold))
 
#define __has_attribute(x)
 
#define NOINLINE   __attribute__((noinline))
 
#define NORETURN   noreturn
 
#define ALWAYS_INLINE   inline __attribute__((always_inline))
 
#define THREAD_LOCAL   __thread
 
#define ARRAY_SIZE(a)
 
#define PACKED(...)
 
#define FALLTHROUGH   do {} while (0)
 
#define COLOR_DEFAULT   -1
 
#define COLOR_RED   31
 
#define COLOR_GREEN   32
 
#define COLOR_YELLOW   33
 
#define COLOR_BLUE   34
 
#define COLOR_MAGENTA   35
 
#define COLOR_CYAN   36
 
#define COLOR_WHITE   37
 
#define LOG_COLOR(...)
 
#define LOG(...)
 

Functions

void checkasm_srand (unsigned seed)
 
NORETURN void checkasm_fail_abort (const char *msg,...) CHECKASM_PRINTF(1
 
void checkasm_setup_fprintf (void)
 
int checkasm_vfprintf (FILE *const f, int color, const char *fmt, va_list arg) CHECKASM_PRINTF(3
 
int static int checkasm_fprintf (FILE *const f, int color, const char *fmt,...)
 
void checkasm_statusline (const char *status)
 
void checkasm_json (CheckasmJson *json, const char *key, const char *fmt,...) CHECKASM_PRINTF(3
 
void void checkasm_json_str (CheckasmJson *json, const char *key, const char *str)
 
void checkasm_json_push (CheckasmJson *json, const char *const key, char type)
 
void checkasm_json_pop (CheckasmJson *json, char type)
 
void checkasm_set_signal_handlers (void)
 
const char * checkasm_get_last_signal_desc (void)
 
int checkasm_perf_init (void)
 
int checkasm_perf_init_linux (CheckasmPerf *perf)
 
int checkasm_perf_init_macos (CheckasmPerf *perf)
 
int checkasm_perf_init_arm (CheckasmPerf *perf)
 
int checkasm_perf_validate_start (const CheckasmPerf *perf)
 
int checkasm_perf_validate_start_stop (const CheckasmPerf *perf)
 
int checkasm_run_on_all_cores (void(*func)(void))
 
uint64_t checkasm_gettime_nsec (void)
 
uint64_t checkasm_gettime_nsec_diff (uint64_t t)
 
unsigned checkasm_seed (void)
 
void checkasm_noop (void *)
 
void checkasm_measure_nop_cycles (CheckasmMeasurement *meas, uint64_t target_cycles)
 
void checkasm_measure_perf_scale (CheckasmMeasurement *meas)
 
static int imax (const int a, const int b)
 
static int imin (const int a, const int b)
 
static void * checkasm_handle_oom (void *ptr)
 
static void * checkasm_mallocz (const size_t size)
 
static char * checkasm_strdup (const char *str)
 
char * checkasm_vasprintf (const char *fmt, va_list arg)
 

Variables

volatile sig_atomic_t checkasm_interrupted
 
checkasm_jmp_buf checkasm_context
 
CheckasmPerf checkasm_perf
 

Macro Definition Documentation

◆ COLD

◆ __has_attribute

#define __has_attribute ( x)
Value:
0

Definition at line 51 of file internal.h.

◆ NOINLINE

#define NOINLINE   __attribute__((noinline))

Definition at line 59 of file internal.h.

Referenced by checkasm_noop().

◆ NORETURN

#define NORETURN   noreturn

Definition at line 66 of file internal.h.

Referenced by checkasm_fail_abort().

◆ ALWAYS_INLINE

#define ALWAYS_INLINE   inline __attribute__((always_inline))

Definition at line 72 of file internal.h.

Referenced by gettime_nsec(), rotl(), and xoshiro128pp().

◆ THREAD_LOCAL

#define THREAD_LOCAL   __thread

Definition at line 76 of file internal.h.

◆ ARRAY_SIZE

#define ARRAY_SIZE ( a)
Value:
(sizeof(a) / sizeof((a)[0]))
int a

Definition at line 81 of file internal.h.

Referenced by checkasm_get_jedec_vendor_name(), checkasm_measure_nop_cycles(), and checkasm_measure_perf_scale().

◆ PACKED

#define PACKED ( ...)
Value:
__VA_ARGS__ __attribute__((__packed__))

Definition at line 86 of file internal.h.

◆ FALLTHROUGH

#define FALLTHROUGH   do {} while (0)

Definition at line 92 of file internal.h.

Referenced by print_bench_header().

◆ COLOR_DEFAULT

#define COLOR_DEFAULT   -1

Definition at line 101 of file internal.h.

Referenced by print_bench_iter().

◆ COLOR_RED

#define COLOR_RED   31

◆ COLOR_GREEN

#define COLOR_GREEN   32

◆ COLOR_YELLOW

#define COLOR_YELLOW   33

◆ COLOR_BLUE

#define COLOR_BLUE   34

Definition at line 105 of file internal.h.

Referenced by print_summary().

◆ COLOR_MAGENTA

#define COLOR_MAGENTA   35

Definition at line 106 of file internal.h.

◆ COLOR_CYAN

#define COLOR_CYAN   36

Definition at line 107 of file internal.h.

◆ COLOR_WHITE

#define COLOR_WHITE   37

Definition at line 108 of file internal.h.

◆ LOG_COLOR

#define LOG_COLOR ( ...)
Value:
checkasm_fprintf(stderr, __VA_ARGS__)
int static int checkasm_fprintf(FILE *const f, int color, const char *fmt,...)
Definition internal.h:116

Definition at line 125 of file internal.h.

Referenced by checkasm_report(), fail_internal(), print_cpu_name(), print_info(), and print_summary().

◆ LOG

Function Documentation

◆ checkasm_srand()

void checkasm_srand ( unsigned seed)

Definition at line 229 of file utils.c.

Referenced by check_cpu_flag(), checkasm_check_key(), and run_all_tests().

◆ checkasm_fail_abort()

NORETURN void checkasm_fail_abort ( const char * msg,
... )

◆ checkasm_setup_fprintf()

void checkasm_setup_fprintf ( void )

Definition at line 544 of file utils.c.

Referenced by checkasm_list_cpu_flags(), and checkasm_run().

◆ checkasm_vfprintf()

int checkasm_vfprintf ( FILE *const f,
int color,
const char * fmt,
va_list arg )

◆ checkasm_fprintf()

int static int checkasm_fprintf ( FILE *const f,
int color,
const char * fmt,
... )
inlinestatic

◆ checkasm_statusline()

void checkasm_statusline ( const char * status)

Definition at line 501 of file utils.c.

Referenced by print_summary(), and update_statusline().

◆ checkasm_json()

void checkasm_json ( CheckasmJson * json,
const char * key,
const char * fmt,
... )

◆ checkasm_json_str()

void void checkasm_json_str ( CheckasmJson * json,
const char * key,
const char * str )

◆ checkasm_json_push()

void checkasm_json_push ( CheckasmJson * json,
const char *const key,
char type )

◆ checkasm_json_pop()

void checkasm_json_pop ( CheckasmJson * json,
char type )

◆ checkasm_set_signal_handlers()

void checkasm_set_signal_handlers ( void )

Definition at line 132 of file signal.c.

Referenced by checkasm_json(), and checkasm_run().

◆ checkasm_get_last_signal_desc()

const char * checkasm_get_last_signal_desc ( void )

Definition at line 167 of file signal.c.

Referenced by check_cpu_flag(), and checkasm_json().

◆ checkasm_perf_init()

int checkasm_perf_init ( void )

Definition at line 59 of file perf.c.

Referenced by checkasm_json(), and checkasm_run().

◆ checkasm_perf_init_linux()

int checkasm_perf_init_linux ( CheckasmPerf * perf)

◆ checkasm_perf_init_macos()

int checkasm_perf_init_macos ( CheckasmPerf * perf)

◆ checkasm_perf_init_arm()

int checkasm_perf_init_arm ( CheckasmPerf * perf)

Definition at line 148 of file arm.c.

Referenced by checkasm_perf_init(), and checkasm_perf_init_macos().

◆ checkasm_perf_validate_start()

int checkasm_perf_validate_start ( const CheckasmPerf * perf)

Definition at line 128 of file perf.c.

Referenced by checkasm_perf_init(), and checkasm_perf_init_macos().

◆ checkasm_perf_validate_start_stop()

int checkasm_perf_validate_start_stop ( const CheckasmPerf * perf)

Definition at line 150 of file perf.c.

Referenced by checkasm_perf_init_macos().

◆ checkasm_run_on_all_cores()

int checkasm_run_on_all_cores ( void(* func )(void))

Definition at line 625 of file checkasm.c.

Referenced by checkasm_perf_init(), and checkasm_perf_init_macos().

◆ checkasm_gettime_nsec()

◆ checkasm_gettime_nsec_diff()

uint64_t checkasm_gettime_nsec_diff ( uint64_t t)

◆ checkasm_seed()

unsigned checkasm_seed ( void )

Definition at line 117 of file utils.c.

Referenced by checkasm_perf_init_macos(), and checkasm_run().

◆ checkasm_noop()

void checkasm_noop ( void * ptr)

◆ checkasm_measure_nop_cycles()

void checkasm_measure_nop_cycles ( CheckasmMeasurement * meas,
uint64_t target_cycles )

Definition at line 176 of file perf.c.

Referenced by check_cpu_flag(), checkasm_perf_init_macos(), and checkasm_run().

◆ checkasm_measure_perf_scale()

void checkasm_measure_perf_scale ( CheckasmMeasurement * meas)

Definition at line 209 of file perf.c.

Referenced by check_cpu_flag(), checkasm_perf_init_macos(), and checkasm_run().

◆ imax()

◆ imin()

static int imin ( const int a,
const int b )
inlinestatic

Definition at line 182 of file internal.h.

Referenced by filter_frame().

◆ checkasm_handle_oom()

static void * checkasm_handle_oom ( void * ptr)
inlinestatic

Definition at line 187 of file internal.h.

Referenced by checkasm_mallocz(), and checkasm_strdup().

◆ checkasm_mallocz()

static void * checkasm_mallocz ( const size_t size)
inlinestatic

Definition at line 197 of file internal.h.

Referenced by checkasm_check_key(), checkasm_vasprintf(), and func_get().

◆ checkasm_strdup()

static char * checkasm_strdup ( const char * str)
inlinestatic

Definition at line 202 of file internal.h.

Referenced by checkasm_report().

◆ checkasm_vasprintf()

char * checkasm_vasprintf ( const char * fmt,
va_list arg )

Definition at line 853 of file utils.c.

Referenced by checkasm_set_func_variant().

Variable Documentation

◆ checkasm_interrupted

volatile sig_atomic_t checkasm_interrupted
extern

◆ checkasm_context

◆ checkasm_perf