Commit 8ebfdf2b authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'perf/urgent' of...

Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
parents 12b5da34 65f3e56e
...@@ -61,8 +61,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ ...@@ -61,8 +61,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar AR = $(CROSS_COMPILE)ar
FLEX = $(CROSS_COMPILE)flex
BISON= $(CROSS_COMPILE)bison
# Additional ARCH settings for x86 # Additional ARCH settings for x86
ifeq ($(ARCH),i386) ifeq ($(ARCH),i386)
...@@ -184,7 +182,7 @@ endif ...@@ -184,7 +182,7 @@ endif
### --- END CONFIGURATION SECTION --- ### --- END CONFIGURATION SECTION ---
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
BASIC_LDFLAGS = BASIC_LDFLAGS =
# Guard against environment variables # Guard against environment variables
...@@ -236,6 +234,25 @@ endif ...@@ -236,6 +234,25 @@ endif
export PERL_PATH export PERL_PATH
FLEX = $(CROSS_COMPILE)flex
BISON= $(CROSS_COMPILE)bison
event-parser:
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
$(OUTPUT)util/parse-events-flex.c: event-parser
$(OUTPUT)util/parse-events-bison.c: event-parser
pmu-parser:
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
$(OUTPUT)util/pmu-flex.c: pmu-parser
$(OUTPUT)util/pmu-bison.c: pmu-parser
$(OUTPUT)util/parse-events.o: event-parser pmu-parser
LIB_FILE=$(OUTPUT)libperf.a LIB_FILE=$(OUTPUT)libperf.a
LIB_H += ../../include/linux/perf_event.h LIB_H += ../../include/linux/perf_event.h
...@@ -754,6 +771,15 @@ $(OUTPUT)perf.o perf.spec \ ...@@ -754,6 +771,15 @@ $(OUTPUT)perf.o perf.spec \
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .o .c .S .s .SUFFIXES: .o .c .S .s
# These two need to be here so that when O= is not used they take precedence
# over the general rule for .o
$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
...@@ -790,12 +816,6 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS ...@@ -790,12 +816,6 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
$(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
$(OUTPUT)util/pmu-flex.o: util/pmu-flex.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
...@@ -883,14 +903,6 @@ cscope: ...@@ -883,14 +903,6 @@ cscope:
$(RM) cscope* $(RM) cscope*
$(FIND) . -name '*.[hcS]' -print | xargs cscope -b $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
event-parser:
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c
pmu-parser:
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o util/pmu-bison.c
$(QUIET_FLEX)$(FLEX) --header-file=util/pmu-flex.h -t util/pmu.l > util/pmu-flex.c
### Detect prefix changes ### Detect prefix changes
TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
$(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
...@@ -978,6 +990,7 @@ clean: ...@@ -978,6 +990,7 @@ clean:
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
$(MAKE) -C Documentation/ clean $(MAKE) -C Documentation/ clean
$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
$(RM) $(OUTPUT)util/*-{bison,flex}*
$(python-clean) $(python-clean)
.PHONY: all install clean strip .PHONY: all install clean strip
......
...@@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym) ...@@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym)
int symbol__alloc_hist(struct symbol *sym) int symbol__alloc_hist(struct symbol *sym)
{ {
struct annotation *notes = symbol__annotation(sym); struct annotation *notes = symbol__annotation(sym);
size_t sizeof_sym_hist = (sizeof(struct sym_hist) + const size_t size = sym->end - sym->start + 1;
(sym->end - sym->start) * sizeof(u64)); size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64));
notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist); notes->src = zalloc(sizeof(*notes->src) + symbol_conf.nr_events * sizeof_sym_hist);
if (notes->src == NULL) if (notes->src == NULL)
...@@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, ...@@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
if (addr >= sym->end) if (addr > sym->end)
return 0; return 0;
offset = addr - sym->start; offset = addr - sym->start;
...@@ -408,7 +408,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, ...@@ -408,7 +408,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
if (!notes->src->lines) if (!notes->src->lines)
return -1; return -1;
start = map->unmap_ip(map, sym->start); start = map__rip_2objdump(map, sym->start);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
char *path = NULL; char *path = NULL;
......
...@@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, ...@@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
return -EFAULT; return -EFAULT;
data->raw_data = (void *) pdata; data->raw_data = (void *) pdata;
array = (void *)array + data->raw_size + sizeof(u32);
} }
if (type & PERF_SAMPLE_BRANCH_STACK) { if (type & PERF_SAMPLE_BRANCH_STACK) {
......
...@@ -607,7 +607,7 @@ static void init_rem_hits(void) ...@@ -607,7 +607,7 @@ static void init_rem_hits(void)
rem_hits.ms.sym = rem_sq_bracket; rem_hits.ms.sym = rem_sq_bracket;
} }
static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
u64 total_samples, int depth, u64 total_samples, int depth,
int depth_mask, int left_margin) int depth_mask, int left_margin)
{ {
...@@ -615,21 +615,16 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, ...@@ -615,21 +615,16 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
struct callchain_node *child; struct callchain_node *child;
struct callchain_list *chain; struct callchain_list *chain;
int new_depth_mask = depth_mask; int new_depth_mask = depth_mask;
u64 new_total;
u64 remaining; u64 remaining;
size_t ret = 0; size_t ret = 0;
int i; int i;
uint entries_printed = 0; uint entries_printed = 0;
if (callchain_param.mode == CHAIN_GRAPH_REL) remaining = total_samples;
new_total = self->children_hit;
else
new_total = total_samples;
remaining = new_total;
node = rb_first(&self->rb_root); node = rb_first(root);
while (node) { while (node) {
u64 new_total;
u64 cumul; u64 cumul;
child = rb_entry(node, struct callchain_node, rb_node); child = rb_entry(node, struct callchain_node, rb_node);
...@@ -657,11 +652,17 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, ...@@ -657,11 +652,17 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
list_for_each_entry(chain, &child->val, list) { list_for_each_entry(chain, &child->val, list) {
ret += ipchain__fprintf_graph(fp, chain, depth, ret += ipchain__fprintf_graph(fp, chain, depth,
new_depth_mask, i++, new_depth_mask, i++,
new_total, total_samples,
cumul, cumul,
left_margin); left_margin);
} }
ret += __callchain__fprintf_graph(fp, child, new_total,
if (callchain_param.mode == CHAIN_GRAPH_REL)
new_total = child->children_hit;
else
new_total = total_samples;
ret += __callchain__fprintf_graph(fp, &child->rb_root, new_total,
depth + 1, depth + 1,
new_depth_mask | (1 << depth), new_depth_mask | (1 << depth),
left_margin); left_margin);
...@@ -671,40 +672,52 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self, ...@@ -671,40 +672,52 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
} }
if (callchain_param.mode == CHAIN_GRAPH_REL && if (callchain_param.mode == CHAIN_GRAPH_REL &&
remaining && remaining != new_total) { remaining && remaining != total_samples) {
if (!rem_sq_bracket) if (!rem_sq_bracket)
return ret; return ret;
new_depth_mask &= ~(1 << (depth - 1)); new_depth_mask &= ~(1 << (depth - 1));
ret += ipchain__fprintf_graph(fp, &rem_hits, depth, ret += ipchain__fprintf_graph(fp, &rem_hits, depth,
new_depth_mask, 0, new_total, new_depth_mask, 0, total_samples,
remaining, left_margin); remaining, left_margin);
} }
return ret; return ret;
} }
static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self, static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
u64 total_samples, int left_margin) u64 total_samples, int left_margin)
{ {
struct callchain_node *cnode;
struct callchain_list *chain; struct callchain_list *chain;
u32 entries_printed = 0;
bool printed = false; bool printed = false;
struct rb_node *node;
int i = 0; int i = 0;
int ret = 0; int ret;
u32 entries_printed = 0;
list_for_each_entry(chain, &self->val, list) { /*
* If have one single callchain root, don't bother printing
* its percentage (100 % in fractal mode and the same percentage
* than the hist in graph mode). This also avoid one level of column.
*/
node = rb_first(root);
if (node && !rb_next(node)) {
cnode = rb_entry(node, struct callchain_node, rb_node);
list_for_each_entry(chain, &cnode->val, list) {
/*
* If we sort by symbol, the first entry is the same than
* the symbol. No need to print it otherwise it appears as
* displayed twice.
*/
if (!i++ && sort__first_dimension == SORT_SYM) if (!i++ && sort__first_dimension == SORT_SYM)
continue; continue;
if (!printed) { if (!printed) {
ret += callchain__fprintf_left_margin(fp, left_margin); ret += callchain__fprintf_left_margin(fp, left_margin);
ret += fprintf(fp, "|\n"); ret += fprintf(fp, "|\n");
ret += callchain__fprintf_left_margin(fp, left_margin); ret += callchain__fprintf_left_margin(fp, left_margin);
ret += fprintf(fp, "---"); ret += fprintf(fp, "---");
left_margin += 3; left_margin += 3;
printed = true; printed = true;
} else } else
...@@ -718,13 +731,15 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self, ...@@ -718,13 +731,15 @@ static size_t callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
if (++entries_printed == callchain_param.print_limit) if (++entries_printed == callchain_param.print_limit)
break; break;
} }
root = &cnode->rb_root;
}
ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1, left_margin); return __callchain__fprintf_graph(fp, root, total_samples,
1, 1, left_margin);
return ret;
} }
static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, static size_t __callchain__fprintf_flat(FILE *fp,
struct callchain_node *self,
u64 total_samples) u64 total_samples)
{ {
struct callchain_list *chain; struct callchain_list *chain;
...@@ -733,7 +748,7 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, ...@@ -733,7 +748,7 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self,
if (!self) if (!self)
return 0; return 0;
ret += callchain__fprintf_flat(fp, self->parent, total_samples); ret += __callchain__fprintf_flat(fp, self->parent, total_samples);
list_for_each_entry(chain, &self->val, list) { list_for_each_entry(chain, &self->val, list) {
...@@ -749,44 +764,58 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self, ...@@ -749,44 +764,58 @@ static size_t callchain__fprintf_flat(FILE *fp, struct callchain_node *self,
return ret; return ret;
} }
static size_t hist_entry_callchain__fprintf(struct hist_entry *he, static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *self,
u64 total_samples, int left_margin, u64 total_samples)
FILE *fp)
{ {
struct rb_node *rb_node;
struct callchain_node *chain;
size_t ret = 0; size_t ret = 0;
u32 entries_printed = 0; u32 entries_printed = 0;
struct rb_node *rb_node;
struct callchain_node *chain;
rb_node = rb_first(&he->sorted_chain); rb_node = rb_first(self);
while (rb_node) { while (rb_node) {
double percent; double percent;
chain = rb_entry(rb_node, struct callchain_node, rb_node); chain = rb_entry(rb_node, struct callchain_node, rb_node);
percent = chain->hit * 100.0 / total_samples; percent = chain->hit * 100.0 / total_samples;
switch (callchain_param.mode) {
case CHAIN_FLAT: ret = percent_color_fprintf(fp, " %6.2f%%\n", percent);
ret += percent_color_fprintf(fp, " %6.2f%%\n", ret += __callchain__fprintf_flat(fp, chain, total_samples);
percent);
ret += callchain__fprintf_flat(fp, chain, total_samples);
break;
case CHAIN_GRAPH_ABS: /* Falldown */
case CHAIN_GRAPH_REL:
ret += callchain__fprintf_graph(fp, chain, total_samples,
left_margin);
case CHAIN_NONE:
default:
break;
}
ret += fprintf(fp, "\n"); ret += fprintf(fp, "\n");
if (++entries_printed == callchain_param.print_limit) if (++entries_printed == callchain_param.print_limit)
break; break;
rb_node = rb_next(rb_node); rb_node = rb_next(rb_node);
} }
return ret; return ret;
} }
static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
u64 total_samples, int left_margin,
FILE *fp)
{
switch (callchain_param.mode) {
case CHAIN_GRAPH_REL:
return callchain__fprintf_graph(fp, &he->sorted_chain, he->period,
left_margin);
break;
case CHAIN_GRAPH_ABS:
return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
left_margin);
break;
case CHAIN_FLAT:
return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples);
break;
case CHAIN_NONE:
break;
default:
pr_err("Bad callchain mode\n");
}
return 0;
}
void hists__output_recalc_col_len(struct hists *hists, int max_rows) void hists__output_recalc_col_len(struct hists *hists, int max_rows)
{ {
struct rb_node *next = rb_first(&hists->entries); struct rb_node *next = rb_first(&hists->entries);
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
PE_VALUE = 258,
PE_VALUE_SYM = 259,
PE_RAW = 260,
PE_TERM = 261,
PE_NAME = 262,
PE_MODIFIER_EVENT = 263,
PE_MODIFIER_BP = 264,
PE_NAME_CACHE_TYPE = 265,
PE_NAME_CACHE_OP_RESULT = 266,
PE_PREFIX_MEM = 267,
PE_PREFIX_RAW = 268,
PE_ERROR = 269
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 46 "util/parse-events.y"
char *str;
unsigned long num;
struct list_head *head;
struct parse_events__term *term;
/* Line 2068 of yacc.c */
#line 73 "util/parse-events-bison.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE parse_events_lval;
This diff is collapsed.
#ifndef parse_events_HEADER_H
#define parse_events_HEADER_H 1
#define parse_events_IN_HEADER 1
#line 6 "util/parse-events-flex.h"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
/* end standard C headers. */
/* flex integer type definitions */
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
extern int parse_events_leng;
extern FILE *parse_events_in, *parse_events_out;
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
void parse_events_restart (FILE *input_file );
void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer );
YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size );
void parse_events__delete_buffer (YY_BUFFER_STATE b );
void parse_events__flush_buffer (YY_BUFFER_STATE b );
void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer );
void parse_events_pop_buffer_state (void );
YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str );
YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len );
void *parse_events_alloc (yy_size_t );
void *parse_events_realloc (void *,yy_size_t );
void parse_events_free (void * );
/* Begin user sect3 */
extern int parse_events_lineno;
extern char *parse_events_text;
#define yytext_ptr parse_events_text
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
#define INITIAL 0
#endif
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
#include <unistd.h>
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int parse_events_lex_destroy (void );
int parse_events_get_debug (void );
void parse_events_set_debug (int debug_flag );
YY_EXTRA_TYPE parse_events_get_extra (void );
void parse_events_set_extra (YY_EXTRA_TYPE user_defined );
FILE *parse_events_get_in (void );
void parse_events_set_in (FILE * in_str );
FILE *parse_events_get_out (void );
void parse_events_set_out (FILE * out_str );
int parse_events_get_leng (void );
char *parse_events_get_text (void );
int parse_events_get_lineno (void );
void parse_events_set_lineno (int line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int parse_events_wrap (void );
#else
extern int parse_events_wrap (void );
#endif
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
extern int parse_events_lex (void);
#define YY_DECL int parse_events_lex (void)
#endif /* !YY_DECL */
/* yy_get_previous_state - get the state just before the EOB char was reached */
#undef YY_NEW_FILE
#undef YY_FLUSH_BUFFER
#undef yy_set_bol
#undef yy_new_buffer
#undef yy_set_interactive
#undef YY_DO_BEFORE_ACTION
#ifdef YY_DECL_IS_OURS
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
#line 121 "util/parse-events.l"
#line 315 "util/parse-events-flex.h"
#undef parse_events_IN_HEADER
#endif /* parse_events_HEADER_H */
...@@ -67,6 +67,7 @@ cache-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); } ...@@ -67,6 +67,7 @@ cache-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); } branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); } branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); } bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); }
ref-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES); }
cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); } cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); }
task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); } task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); }
page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); } page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -972,10 +972,12 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) ...@@ -972,10 +972,12 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
struct dwarf_callback_param *param = data; struct dwarf_callback_param *param = data;
struct probe_finder *pf = param->data; struct probe_finder *pf = param->data;
struct perf_probe_point *pp = &pf->pev->point; struct perf_probe_point *pp = &pf->pev->point;
Dwarf_Attribute attr;
/* Check tag and diename */ /* Check tag and diename */
if (dwarf_tag(sp_die) != DW_TAG_subprogram || if (dwarf_tag(sp_die) != DW_TAG_subprogram ||
!die_compare_name(sp_die, pp->function)) !die_compare_name(sp_die, pp->function) ||
dwarf_attr(sp_die, DW_AT_declaration, &attr))
return DWARF_CB_OK; return DWARF_CB_OK;
/* Check declared file */ /* Check declared file */
......
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <libgen.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -51,6 +50,8 @@ struct symbol_conf symbol_conf = { ...@@ -51,6 +50,8 @@ struct symbol_conf symbol_conf = {
int dso__name_len(const struct dso *dso) int dso__name_len(const struct dso *dso)
{ {
if (!dso)
return strlen("[unknown]");
if (verbose) if (verbose)
return dso->long_name_len; return dso->long_name_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment