Linux Perf
color.h File Reference
#include <stdio.h>
Include dependency graph for color.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define COLOR_MAXLEN   24
 
#define PERF_COLOR_NORMAL   ""
 
#define PERF_COLOR_RESET   "\033[m"
 
#define PERF_COLOR_BOLD   "\033[1m"
 
#define PERF_COLOR_RED   "\033[31m"
 
#define PERF_COLOR_GREEN   "\033[32m"
 
#define PERF_COLOR_YELLOW   "\033[33m"
 
#define PERF_COLOR_BLUE   "\033[34m"
 
#define PERF_COLOR_MAGENTA   "\033[35m"
 
#define PERF_COLOR_CYAN   "\033[36m"
 
#define PERF_COLOR_BG_RED   "\033[41m"
 
#define MIN_GREEN   0.5
 
#define MIN_RED   5.0
 

Functions

int perf_color_default_config (const char *var, const char *value, void *cb)
 
int perf_config_colorbool (const char *var, const char *value, int stdout_is_tty)
 
int color_vsnprintf (char *bf, size_t size, const char *color, const char *fmt, va_list args)
 
int color_vfprintf (FILE *fp, const char *color, const char *fmt, va_list args)
 
int color_fprintf (FILE *fp, const char *color, const char *fmt,...)
 
int color_snprintf (char *bf, size_t size, const char *color, const char *fmt,...)
 
int color_fwrite_lines (FILE *fp, const char *color, size_t count, const char *buf)
 
int value_color_snprintf (char *bf, size_t size, const char *fmt, double value)
 
int percent_color_snprintf (char *bf, size_t size, const char *fmt,...)
 
int percent_color_len_snprintf (char *bf, size_t size, const char *fmt,...)
 
int percent_color_fprintf (FILE *fp, const char *fmt, double percent)
 
const char * get_percent_color (double percent)
 

Variables

int perf_use_color_default
 

Macro Definition Documentation

◆ COLOR_MAXLEN

#define COLOR_MAXLEN   24

Definition at line 8 of file color.h.

◆ MIN_GREEN

#define MIN_GREEN   0.5

Definition at line 21 of file color.h.

◆ MIN_RED

#define MIN_RED   5.0

Definition at line 22 of file color.h.

◆ PERF_COLOR_BG_RED

#define PERF_COLOR_BG_RED   "\033[41m"

Definition at line 19 of file color.h.

◆ PERF_COLOR_BLUE

#define PERF_COLOR_BLUE   "\033[34m"

Definition at line 16 of file color.h.

◆ PERF_COLOR_BOLD

#define PERF_COLOR_BOLD   "\033[1m"

Definition at line 12 of file color.h.

◆ PERF_COLOR_CYAN

#define PERF_COLOR_CYAN   "\033[36m"

Definition at line 18 of file color.h.

◆ PERF_COLOR_GREEN

#define PERF_COLOR_GREEN   "\033[32m"

Definition at line 14 of file color.h.

◆ PERF_COLOR_MAGENTA

#define PERF_COLOR_MAGENTA   "\033[35m"

Definition at line 17 of file color.h.

◆ PERF_COLOR_NORMAL

#define PERF_COLOR_NORMAL   ""

Definition at line 10 of file color.h.

◆ PERF_COLOR_RED

#define PERF_COLOR_RED   "\033[31m"

Definition at line 13 of file color.h.

◆ PERF_COLOR_RESET

#define PERF_COLOR_RESET   "\033[m"

Definition at line 11 of file color.h.

◆ PERF_COLOR_YELLOW

#define PERF_COLOR_YELLOW   "\033[33m"

Definition at line 15 of file color.h.

Function Documentation

◆ color_fprintf()

int color_fprintf ( FILE *  fp,
const char *  color,
const char *  fmt,
  ... 
)

Definition at line 123 of file color.c.

Here is the call graph for this function:

◆ color_fwrite_lines()

int color_fwrite_lines ( FILE *  fp,
const char *  color,
size_t  count,
const char *  buf 
)

Definition at line 139 of file color.c.

◆ color_snprintf()

int color_snprintf ( char *  bf,
size_t  size,
const char *  color,
const char *  fmt,
  ... 
)

Definition at line 111 of file color.c.

Here is the call graph for this function:

◆ color_vfprintf()

int color_vfprintf ( FILE *  fp,
const char *  color,
const char *  fmt,
va_list  args 
)

Definition at line 106 of file color.c.

Here is the call graph for this function:

◆ color_vsnprintf()

int color_vsnprintf ( char *  bf,
size_t  size,
const char *  color,
const char *  fmt,
va_list  args 
)

Definition at line 100 of file color.c.

Here is the call graph for this function:

◆ get_percent_color()

const char* get_percent_color ( double  percent)

Definition at line 162 of file color.c.

◆ percent_color_fprintf()

int percent_color_fprintf ( FILE *  fp,
const char *  fmt,
double  percent 
)

Definition at line 180 of file color.c.

Here is the call graph for this function:

◆ percent_color_len_snprintf()

int percent_color_len_snprintf ( char *  bf,
size_t  size,
const char *  fmt,
  ... 
)

Definition at line 208 of file color.c.

Here is the call graph for this function:

◆ percent_color_snprintf()

int percent_color_snprintf ( char *  bf,
size_t  size,
const char *  fmt,
  ... 
)

Definition at line 197 of file color.c.

Here is the call graph for this function:

◆ perf_color_default_config()

int perf_color_default_config ( const char *  var,
const char *  value,
void *  cb 
)

◆ perf_config_colorbool()

int perf_config_colorbool ( const char *  var,
const char *  value,
int  stdout_is_tty 
)

Definition at line 13 of file color.c.

Here is the call graph for this function:

◆ value_color_snprintf()

int value_color_snprintf ( char *  bf,
size_t  size,
const char *  fmt,
double  value 
)

Definition at line 191 of file color.c.

Here is the call graph for this function:

Variable Documentation

◆ perf_use_color_default

int perf_use_color_default

Definition at line 11 of file color.c.