summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/ctype.c17
-rw-r--r--tools/perf/util/parse-events.c14
-rw-r--r--tools/perf/util/string.c2
-rw-r--r--tools/perf/util/string.h4
-rw-r--r--tools/perf/util/symbol.c20
-rw-r--r--tools/perf/util/symbol.h16
-rw-r--r--tools/perf/util/util.h18
7 files changed, 48 insertions, 43 deletions
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c
index b90ec004f29..0b791bd346b 100644
--- a/tools/perf/util/ctype.c
+++ b/tools/perf/util/ctype.c
@@ -11,16 +11,21 @@ enum {
D = GIT_DIGIT,
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | * */
+ P = GIT_PRINT_EXTRA, /* printable - alpha - digit - glob - regex */
+
+ PS = GIT_SPACE | GIT_PRINT_EXTRA,
};
unsigned char sane_ctype[256] = {
+/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
+
0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
- S, 0, 0, 0, R, 0, 0, 0, R, R, G, R, 0, 0, R, 0, /* 32.. 47 */
- D, D, D, D, D, D, D, D, D, D, 0, 0, 0, 0, 0, G, /* 48.. 63 */
- 0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
- A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, 0, /* 80.. 95 */
- 0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
- A, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0, /* 112..127 */
+ PS,P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
+ D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
+ P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
+ A, A, A, A, A, A, A, A, A, A, A, G, G, P, R, P, /* 80.. 95 */
+ P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
+ A, A, A, A, A, A, A, A, A, A, A, R, R, P, P, 0, /* 112..127 */
/* Nothing in the 128.. range */
};
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5a72586e1df..35d04da38d6 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -13,8 +13,8 @@ int nr_counters;
struct perf_counter_attr attrs[MAX_COUNTERS];
struct event_symbol {
- __u8 type;
- __u64 config;
+ u8 type;
+ u64 config;
char *symbol;
};
@@ -63,8 +63,8 @@ static char *hw_event_names[] = {
};
static char *sw_event_names[] = {
- "cpu-clock-ticks",
- "task-clock-ticks",
+ "cpu-clock-msecs",
+ "task-clock-msecs",
"page-faults",
"context-switches",
"CPU-migrations",
@@ -96,7 +96,7 @@ static char *hw_cache_result [][MAX_ALIASES] = {
char *event_name(int counter)
{
- __u64 config = attrs[counter].config;
+ u64 config = attrs[counter].config;
int type = attrs[counter].type;
static char buf[32];
@@ -112,7 +112,7 @@ char *event_name(int counter)
return "unknown-hardware";
case PERF_TYPE_HW_CACHE: {
- __u8 cache_type, cache_op, cache_result;
+ u8 cache_type, cache_op, cache_result;
static char name[100];
cache_type = (config >> 0) & 0xff;
@@ -202,7 +202,7 @@ static int parse_generic_hw_symbols(const char *str, struct perf_counter_attr *a
*/
static int parse_event_symbols(const char *str, struct perf_counter_attr *attr)
{
- __u64 config, id;
+ u64 config, id;
int type;
unsigned int i;
const char *sep, *pstr;
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index ec33c0c7f4e..c93eca9a7be 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -15,7 +15,7 @@ static int hex(char ch)
* While we find nice hex chars, build a long_val.
* Return number of chars processed.
*/
-int hex2u64(const char *ptr, __u64 *long_val)
+int hex2u64(const char *ptr, u64 *long_val)
{
const char *p = ptr;
*long_val = 0;
diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h
index 72812c1c9a7..37b03255b42 100644
--- a/tools/perf/util/string.h
+++ b/tools/perf/util/string.h
@@ -1,8 +1,8 @@
#ifndef _PERF_STRING_H_
#define _PERF_STRING_H_
-#include <linux/types.h>
+#include "../types.h"
-int hex2u64(const char *ptr, __u64 *val);
+int hex2u64(const char *ptr, u64 *val);
#endif
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 49a55f81371..86e14375e74 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -9,9 +9,9 @@
const char *sym_hist_filter;
-static struct symbol *symbol__new(__u64 start, __u64 len,
+static struct symbol *symbol__new(u64 start, u64 len,
const char *name, unsigned int priv_size,
- __u64 obj_start, int verbose)
+ u64 obj_start, int verbose)
{
size_t namelen = strlen(name) + 1;
struct symbol *self = calloc(1, priv_size + sizeof(*self) + namelen);
@@ -21,14 +21,14 @@ static struct symbol *symbol__new(__u64 start, __u64 len,
if (verbose >= 2)
printf("new symbol: %016Lx [%08lx]: %s, hist: %p, obj_start: %p\n",
- (__u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
+ (u64)start, (unsigned long)len, name, self->hist, (void *)(unsigned long)obj_start);
self->obj_start= obj_start;
self->hist = NULL;
self->hist_sum = 0;
if (sym_hist_filter && !strcmp(name, sym_hist_filter))
- self->hist = calloc(sizeof(__u64), len);
+ self->hist = calloc(sizeof(u64), len);
if (priv_size) {
memset(self, 0, priv_size);
@@ -89,7 +89,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)
{
struct rb_node **p = &self->syms.rb_node;
struct rb_node *parent = NULL;
- const __u64 ip = sym->start;
+ const u64 ip = sym->start;
struct symbol *s;
while (*p != NULL) {
@@ -104,7 +104,7 @@ static void dso__insert_symbol(struct dso *self, struct symbol *sym)
rb_insert_color(&sym->rb_node, &self->syms);
}
-struct symbol *dso__find_symbol(struct dso *self, __u64 ip)
+struct symbol *dso__find_symbol(struct dso *self, u64 ip)
{
struct rb_node *n;
@@ -151,7 +151,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb
goto out_failure;
while (!feof(file)) {
- __u64 start;
+ u64 start;
struct symbol *sym;
int line_len, len;
char symbol_type;
@@ -232,7 +232,7 @@ static int dso__load_perf_map(struct dso *self, symbol_filter_t filter, int verb
goto out_failure;
while (!feof(file)) {
- __u64 start, size;
+ u64 start, size;
struct symbol *sym;
int line_len, len;
@@ -353,7 +353,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf,
{
uint32_t nr_rel_entries, idx;
GElf_Sym sym;
- __u64 plt_offset;
+ u64 plt_offset;
GElf_Shdr shdr_plt;
struct symbol *f;
GElf_Shdr shdr_rel_plt;
@@ -523,7 +523,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
elf_symtab__for_each_symbol(syms, nr_syms, index, sym) {
struct symbol *f;
- __u64 obj_start;
+ u64 obj_start;
if (!elf_sym__is_function(&sym))
continue;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0d1292bd827..ea332e56e45 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -2,16 +2,18 @@
#define _PERF_SYMBOL_ 1
#include <linux/types.h>
+#include "../types.h"
#include "list.h"
#include "rbtree.h"
struct symbol {
struct rb_node rb_node;
- __u64 start;
- __u64 end;
- __u64 obj_start;
- __u64 hist_sum;
- __u64 *hist;
+ u64 start;
+ u64 end;
+ u64 obj_start;
+ u64 hist_sum;
+ u64 *hist;
+ void *priv;
char name[0];
};
@@ -19,7 +21,7 @@ struct dso {
struct list_head node;
struct rb_root syms;
unsigned int sym_priv_size;
- struct symbol *(*find_symbol)(struct dso *, __u64 ip);
+ struct symbol *(*find_symbol)(struct dso *, u64 ip);
char name[0];
};
@@ -35,7 +37,7 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym)
return ((void *)sym) - self->sym_priv_size;
}
-struct symbol *dso__find_symbol(struct dso *self, __u64 ip);
+struct symbol *dso__find_symbol(struct dso *self, u64 ip);
int dso__load_kernel(struct dso *self, const char *vmlinux,
symbol_filter_t filter, int verbose);
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 76590a16c27..b8cfed776d8 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -100,11 +100,6 @@
#include <iconv.h>
#endif
-#ifndef NO_OPENSSL
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#endif
-
/* On most systems <limits.h> would have given us this, but
* not on some systems (e.g. GNU/Hurd).
*/
@@ -332,17 +327,20 @@ static inline int has_extension(const char *filename, const char *ext)
#undef tolower
#undef toupper
extern unsigned char sane_ctype[256];
-#define GIT_SPACE 0x01
-#define GIT_DIGIT 0x02
-#define GIT_ALPHA 0x04
-#define GIT_GLOB_SPECIAL 0x08
-#define GIT_REGEX_SPECIAL 0x10
+#define GIT_SPACE 0x01
+#define GIT_DIGIT 0x02
+#define GIT_ALPHA 0x04
+#define GIT_GLOB_SPECIAL 0x08
+#define GIT_REGEX_SPECIAL 0x10
+#define GIT_PRINT_EXTRA 0x20
+#define GIT_PRINT 0x3E
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
#define isascii(x) (((x) & ~0x7f) == 0)
#define isspace(x) sane_istest(x,GIT_SPACE)
#define isdigit(x) sane_istest(x,GIT_DIGIT)
#define isalpha(x) sane_istest(x,GIT_ALPHA)
#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
+#define isprint(x) sane_istest(x,GIT_PRINT)
#define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
#define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
#define tolower(x) sane_case((unsigned char)(x), 0x20)