root/tools/perf/lib/core.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. __base_pr
  2. __printf
  3. libperf_init

   1 // SPDX-License-Identifier: GPL-2.0-only
   2 
   3 #define __printf(a, b)  __attribute__((format(printf, a, b)))
   4 
   5 #include <stdio.h>
   6 #include <stdarg.h>
   7 #include <unistd.h>
   8 #include <perf/core.h>
   9 #include <internal/lib.h>
  10 #include "internal.h"
  11 
  12 static int __base_pr(enum libperf_print_level level, const char *format,
  13                      va_list args)
  14 {
  15         return vfprintf(stderr, format, args);
  16 }
  17 
  18 static libperf_print_fn_t __libperf_pr = __base_pr;
  19 
  20 __printf(2, 3)
  21 void libperf_print(enum libperf_print_level level, const char *format, ...)
  22 {
  23         va_list args;
  24 
  25         if (!__libperf_pr)
  26                 return;
  27 
  28         va_start(args, format);
  29         __libperf_pr(level, format, args);
  30         va_end(args);
  31 }
  32 
  33 void libperf_init(libperf_print_fn_t fn)
  34 {
  35         page_size = sysconf(_SC_PAGE_SIZE);
  36         __libperf_pr = fn;
  37 }

/* [<][>][^][v][top][bottom][index][help] */