0001
0002 #ifndef __PERF_COLOR_H
0003 #define __PERF_COLOR_H
0004
0005 #include <stdio.h>
0006 #include <stdarg.h>
0007
0008
0009 #define COLOR_MAXLEN 24
0010
0011 #define PERF_COLOR_NORMAL ""
0012 #define PERF_COLOR_RESET "\033[m"
0013 #define PERF_COLOR_BOLD "\033[1m"
0014 #define PERF_COLOR_RED "\033[31m"
0015 #define PERF_COLOR_GREEN "\033[32m"
0016 #define PERF_COLOR_YELLOW "\033[33m"
0017 #define PERF_COLOR_BLUE "\033[34m"
0018 #define PERF_COLOR_MAGENTA "\033[35m"
0019 #define PERF_COLOR_CYAN "\033[36m"
0020 #define PERF_COLOR_BG_RED "\033[41m"
0021
0022 #define MIN_GREEN 0.5
0023 #define MIN_RED 5.0
0024
0025
0026
0027
0028 extern int perf_use_color_default;
0029
0030
0031
0032
0033
0034 int perf_color_default_config(const char *var, const char *value, void *cb);
0035
0036 int perf_config_colorbool(const char *var, const char *value, int stdout_is_tty);
0037 int color_vsnprintf(char *bf, size_t size, const char *color,
0038 const char *fmt, va_list args);
0039 int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args);
0040 int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
0041 int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
0042 int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
0043 int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
0044 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
0045 int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);
0046 int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
0047 const char *get_percent_color(double percent);
0048
0049 #endif