linux/tools/perf/util/string2.h
Fabian Hemmer cef7af25c9 perf tools: Add OCaml demangling
Detect symbols generated by the OCaml compiler based on their prefix.

Demangle OCaml symbols, returning a newly allocated string (like the
existing Java demangling functionality).

Move a helper function (hex) from tests/code-reading.c to util/string.c

To test:

  echo 'Printf.printf "%d\n" (Random.int 42)' > test.ml
  perf record ocamlopt.opt test.ml
  perf report -d ocamlopt.opt

Signed-off-by: Fabian Hemmer <copy@copy.sh>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LPU-Reference: 20210203211537.b25ytjb6dq5jfbwx@nyu
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-02-17 15:15:06 -03:00

44 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef PERF_STRING_H
#define PERF_STRING_H
#include <linux/string.h>
#include <linux/types.h>
#include <sys/types.h> // pid_t
#include <stddef.h>
#include <string.h>
extern const char *graph_dotted_line;
extern const char *dots;
s64 perf_atoll(const char *str);
bool strglobmatch(const char *str, const char *pat);
bool strglobmatch_nocase(const char *str, const char *pat);
bool strlazymatch(const char *str, const char *pat);
static inline bool strisglob(const char *str)
{
return strpbrk(str, "*?[") != NULL;
}
int strtailcmp(const char *s1, const char *s2);
char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
static inline char *asprintf_expr_in_ints(const char *var, size_t nints, int *ints)
{
return asprintf_expr_inout_ints(var, true, nints, ints);
}
static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int *ints)
{
return asprintf_expr_inout_ints(var, false, nints, ints);
}
char *asprintf__tp_filter_pids(size_t npids, pid_t *pids);
char *strpbrk_esc(char *str, const char *stopset);
char *strdup_esc(const char *str);
unsigned int hex(char c);
#endif /* PERF_STRING_H */