2009-09-24 16:02:18 +00:00
|
|
|
#ifndef __PERF_COLOR_H
|
|
|
|
#define __PERF_COLOR_H
|
2009-06-04 13:19:47 +00:00
|
|
|
|
2017-04-19 23:57:47 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2009-06-04 13:19:47 +00:00
|
|
|
/* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
|
|
|
|
#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"
|
|
|
|
|
2009-07-02 18:14:34 +00:00
|
|
|
#define MIN_GREEN 0.5
|
|
|
|
#define MIN_RED 5.0
|
|
|
|
|
2009-06-04 13:19:47 +00:00
|
|
|
/*
|
|
|
|
* This variable stores the value of color.ui
|
|
|
|
*/
|
|
|
|
extern int perf_use_color_default;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use this instead of perf_default_config if you need the value of color.ui.
|
|
|
|
*/
|
|
|
|
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);
|
2010-03-31 14:33:40 +00:00
|
|
|
int color_vsnprintf(char *bf, size_t size, const char *color,
|
|
|
|
const char *fmt, va_list args);
|
2009-08-16 20:05:48 +00:00
|
|
|
int color_vfprintf(FILE *fp, const char *color, const char *fmt, va_list args);
|
2009-06-04 13:19:47 +00:00
|
|
|
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
|
2010-03-31 14:33:40 +00:00
|
|
|
int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
|
2009-06-04 13:19:47 +00:00
|
|
|
int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
|
2013-12-30 07:34:20 +00:00
|
|
|
int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
|
2013-10-31 23:47:45 +00:00
|
|
|
int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
|
2014-07-31 05:47:36 +00:00
|
|
|
int percent_color_len_snprintf(char *bf, size_t size, const char *fmt, ...);
|
2009-07-02 18:14:34 +00:00
|
|
|
int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
|
2009-08-15 10:26:57 +00:00
|
|
|
const char *get_percent_color(double percent);
|
2009-06-04 13:19:47 +00:00
|
|
|
|
2009-09-24 16:02:18 +00:00
|
|
|
#endif /* __PERF_COLOR_H */
|