FFmpeg
Data Structures | Macros | Functions | Variables
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)   0
 
#define NOINLINE   __attribute__((noinline))
 
#define NORETURN   noreturn
 
#define ALWAYS_INLINE   inline __attribute__((always_inline))
 
#define THREAD_LOCAL   __thread
 
#define ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 
#define PACKED(...)   __VA_ARGS__ __attribute__((__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
 

Functions

void checkasm_srand (unsigned seed)
 
NORETURN void checkasm_fail_abort (const char *msg,...) CHECKASM_PRINTF(1
 
void checkasm_setup_fprintf (void)
 
void checkasm_fprintf (FILE *const f, const int color, const char *const fmt,...) CHECKASM_PRINTF(3
 
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

#define COLD   __attribute__((cold))

Definition at line 45 of file internal.h.

◆ __has_attribute

#define __has_attribute (   x)    0

Definition at line 51 of file internal.h.

◆ NOINLINE

#define NOINLINE   __attribute__((noinline))

Definition at line 59 of file internal.h.

◆ NORETURN

#define NORETURN   noreturn

Definition at line 66 of file internal.h.

◆ ALWAYS_INLINE

#define ALWAYS_INLINE   inline __attribute__((always_inline))

Definition at line 72 of file internal.h.

◆ THREAD_LOCAL

#define THREAD_LOCAL   __thread

Definition at line 76 of file internal.h.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a) / sizeof((a)[0]))

Definition at line 81 of file internal.h.

◆ PACKED

#define PACKED (   ...)    __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.

◆ COLOR_DEFAULT

#define COLOR_DEFAULT   -1

Definition at line 101 of file internal.h.

◆ COLOR_RED

#define COLOR_RED   31

Definition at line 102 of file internal.h.

◆ COLOR_GREEN

#define COLOR_GREEN   32

Definition at line 103 of file internal.h.

◆ COLOR_YELLOW

#define COLOR_YELLOW   33

Definition at line 104 of file internal.h.

◆ COLOR_BLUE

#define COLOR_BLUE   34

Definition at line 105 of file internal.h.

◆ 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.

Function Documentation

◆ checkasm_srand()

void checkasm_srand ( unsigned  seed)

Definition at line 127 of file utils.c.

Referenced by check_cpu_flag(), and checkasm_check_key().

◆ checkasm_fail_abort()

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

◆ checkasm_setup_fprintf()

void checkasm_setup_fprintf ( void  )

Definition at line 404 of file utils.c.

Referenced by checkasm_list_cpu_flags(), and checkasm_run().

◆ checkasm_fprintf()

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

◆ 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 
)

Definition at line 444 of file utils.c.

Referenced by cpu_info_json(), json_var(), print_bench_header(), and print_bench_iter().

◆ checkasm_json_push()

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

Definition at line 469 of file utils.c.

Referenced by json_measurement(), json_var(), print_bench_header(), and print_bench_iter().

◆ 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_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().

◆ checkasm_perf_init()

int checkasm_perf_init ( void  )

Definition at line 59 of file perf.c.

Referenced by checkasm_run().

◆ checkasm_perf_init_linux()

int checkasm_perf_init_linux ( CheckasmPerf perf)

Referenced by checkasm_perf_init().

◆ checkasm_perf_init_macos()

int checkasm_perf_init_macos ( CheckasmPerf perf)

Referenced by checkasm_perf_init().

◆ checkasm_perf_init_arm()

int checkasm_perf_init_arm ( CheckasmPerf perf)

Definition at line 148 of file arm.c.

Referenced by checkasm_perf_init().

◆ 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().

◆ checkasm_perf_validate_start_stop()

int checkasm_perf_validate_start_stop ( const CheckasmPerf perf)

Definition at line 150 of file perf.c.

◆ checkasm_run_on_all_cores()

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

Definition at line 601 of file checkasm.c.

Referenced by checkasm_perf_init().

◆ checkasm_gettime_nsec()

uint64_t checkasm_gettime_nsec ( void  )

◆ 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_run().

◆ checkasm_noop()

void checkasm_noop ( void *  )

◆ 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(), 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(), and checkasm_run().

◆ imax()

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

◆ imin()

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

Definition at line 165 of file internal.h.

Referenced by filter_frame().

◆ checkasm_handle_oom()

static void* checkasm_handle_oom ( void *  ptr)
inlinestatic

Definition at line 170 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 180 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 185 of file internal.h.

Referenced by checkasm_report().

◆ checkasm_vasprintf()

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

Definition at line 711 of file utils.c.

Referenced by checkasm_set_func_variant().

Variable Documentation

◆ checkasm_interrupted

volatile sig_atomic_t checkasm_interrupted

◆ checkasm_context

checkasm_jmp_buf checkasm_context

◆ checkasm_perf

CheckasmPerf checkasm_perf