Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: tracing: Add alignment to syscall metadata declarations perf: Sync callchains with period based hits perf: Resurrect flat callchains perf: Version String fix, for fallback if not from git perf: Version String fix, using kernel version
This commit is contained in:
commit
f469461df6
|
@ -124,7 +124,8 @@ extern struct trace_event_functions enter_syscall_print_funcs;
|
||||||
extern struct trace_event_functions exit_syscall_print_funcs;
|
extern struct trace_event_functions exit_syscall_print_funcs;
|
||||||
|
|
||||||
#define SYSCALL_TRACE_ENTER_EVENT(sname) \
|
#define SYSCALL_TRACE_ENTER_EVENT(sname) \
|
||||||
static struct syscall_metadata __syscall_meta_##sname; \
|
static struct syscall_metadata \
|
||||||
|
__attribute__((__aligned__(4))) __syscall_meta_##sname; \
|
||||||
static struct ftrace_event_call \
|
static struct ftrace_event_call \
|
||||||
__attribute__((__aligned__(4))) event_enter_##sname; \
|
__attribute__((__aligned__(4))) event_enter_##sname; \
|
||||||
static struct ftrace_event_call __used \
|
static struct ftrace_event_call __used \
|
||||||
|
@ -138,7 +139,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SYSCALL_TRACE_EXIT_EVENT(sname) \
|
#define SYSCALL_TRACE_EXIT_EVENT(sname) \
|
||||||
static struct syscall_metadata __syscall_meta_##sname; \
|
static struct syscall_metadata \
|
||||||
|
__attribute__((__aligned__(4))) __syscall_meta_##sname; \
|
||||||
static struct ftrace_event_call \
|
static struct ftrace_event_call \
|
||||||
__attribute__((__aligned__(4))) event_exit_##sname; \
|
__attribute__((__aligned__(4))) event_exit_##sname; \
|
||||||
static struct ftrace_event_call __used \
|
static struct ftrace_event_call __used \
|
||||||
|
|
|
@ -107,7 +107,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
|
||||||
goto out_free_syms;
|
goto out_free_syms;
|
||||||
err = 0;
|
err = 0;
|
||||||
if (symbol_conf.use_callchain) {
|
if (symbol_conf.use_callchain) {
|
||||||
err = append_chain(he->callchain, data->callchain, syms);
|
err = append_chain(he->callchain, data->callchain, syms, data->period);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free_syms;
|
goto out_free_syms;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,13 @@ if [ $# -eq 1 ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GVF=${OUTPUT}PERF-VERSION-FILE
|
GVF=${OUTPUT}PERF-VERSION-FILE
|
||||||
DEF_VER=v0.0.2.PERF
|
|
||||||
|
|
||||||
LF='
|
LF='
|
||||||
'
|
'
|
||||||
|
|
||||||
# First see if there is a version file (included in release tarballs),
|
# First check if there is a .git to get the version from git describe
|
||||||
# then try git-describe, then default.
|
# otherwise try to get the version from the kernel makefile
|
||||||
if test -f version
|
if test -d ../../.git -o -f ../../.git &&
|
||||||
then
|
|
||||||
VN=$(cat version) || VN="$DEF_VER"
|
|
||||||
elif test -d .git -o -f .git &&
|
|
||||||
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
||||||
case "$VN" in
|
case "$VN" in
|
||||||
*$LF*) (exit 1) ;;
|
*$LF*) (exit 1) ;;
|
||||||
|
@ -27,7 +23,12 @@ elif test -d .git -o -f .git &&
|
||||||
then
|
then
|
||||||
VN=$(echo "$VN" | sed -e 's/-/./g');
|
VN=$(echo "$VN" | sed -e 's/-/./g');
|
||||||
else
|
else
|
||||||
VN="$DEF_VER"
|
eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
|
||||||
|
eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
|
||||||
|
eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
|
||||||
|
eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
|
||||||
|
|
||||||
|
VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VN=$(expr "$VN" : v*'\(.*\)')
|
VN=$(expr "$VN" : v*'\(.*\)')
|
||||||
|
|
|
@ -230,7 +230,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
||||||
int start)
|
int start, u64 period)
|
||||||
{
|
{
|
||||||
struct callchain_node *new;
|
struct callchain_node *new;
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
||||||
fill_node(new, chain, start);
|
fill_node(new, chain, start);
|
||||||
|
|
||||||
new->children_hit = 0;
|
new->children_hit = 0;
|
||||||
new->hit = 1;
|
new->hit = period;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -248,7 +248,8 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
||||||
struct callchain_list *to_split, int idx_parents, int idx_local)
|
struct callchain_list *to_split, int idx_parents, int idx_local,
|
||||||
|
u64 period)
|
||||||
{
|
{
|
||||||
struct callchain_node *new;
|
struct callchain_node *new;
|
||||||
struct list_head *old_tail;
|
struct list_head *old_tail;
|
||||||
|
@ -275,41 +276,41 @@ split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
|
||||||
/* create a new child for the new branch if any */
|
/* create a new child for the new branch if any */
|
||||||
if (idx_total < chain->nr) {
|
if (idx_total < chain->nr) {
|
||||||
parent->hit = 0;
|
parent->hit = 0;
|
||||||
add_child(parent, chain, idx_total);
|
add_child(parent, chain, idx_total, period);
|
||||||
parent->children_hit++;
|
parent->children_hit += period;
|
||||||
} else {
|
} else {
|
||||||
parent->hit = 1;
|
parent->hit = period;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__append_chain(struct callchain_node *root, struct resolved_chain *chain,
|
__append_chain(struct callchain_node *root, struct resolved_chain *chain,
|
||||||
unsigned int start);
|
unsigned int start, u64 period);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__append_chain_children(struct callchain_node *root,
|
__append_chain_children(struct callchain_node *root,
|
||||||
struct resolved_chain *chain,
|
struct resolved_chain *chain,
|
||||||
unsigned int start)
|
unsigned int start, u64 period)
|
||||||
{
|
{
|
||||||
struct callchain_node *rnode;
|
struct callchain_node *rnode;
|
||||||
|
|
||||||
/* lookup in childrens */
|
/* lookup in childrens */
|
||||||
chain_for_each_child(rnode, root) {
|
chain_for_each_child(rnode, root) {
|
||||||
unsigned int ret = __append_chain(rnode, chain, start);
|
unsigned int ret = __append_chain(rnode, chain, start, period);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
goto inc_children_hit;
|
goto inc_children_hit;
|
||||||
}
|
}
|
||||||
/* nothing in children, add to the current node */
|
/* nothing in children, add to the current node */
|
||||||
add_child(root, chain, start);
|
add_child(root, chain, start, period);
|
||||||
|
|
||||||
inc_children_hit:
|
inc_children_hit:
|
||||||
root->children_hit++;
|
root->children_hit += period;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__append_chain(struct callchain_node *root, struct resolved_chain *chain,
|
__append_chain(struct callchain_node *root, struct resolved_chain *chain,
|
||||||
unsigned int start)
|
unsigned int start, u64 period)
|
||||||
{
|
{
|
||||||
struct callchain_list *cnode;
|
struct callchain_list *cnode;
|
||||||
unsigned int i = start;
|
unsigned int i = start;
|
||||||
|
@ -345,18 +346,18 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain,
|
||||||
|
|
||||||
/* we match only a part of the node. Split it and add the new chain */
|
/* we match only a part of the node. Split it and add the new chain */
|
||||||
if (i - start < root->val_nr) {
|
if (i - start < root->val_nr) {
|
||||||
split_add_child(root, chain, cnode, start, i - start);
|
split_add_child(root, chain, cnode, start, i - start, period);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we match 100% of the path, increment the hit */
|
/* we match 100% of the path, increment the hit */
|
||||||
if (i - start == root->val_nr && i == chain->nr) {
|
if (i - start == root->val_nr && i == chain->nr) {
|
||||||
root->hit++;
|
root->hit += period;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We match the node and still have a part remaining */
|
/* We match the node and still have a part remaining */
|
||||||
__append_chain_children(root, chain, i);
|
__append_chain_children(root, chain, i, period);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +381,7 @@ static void filter_context(struct ip_callchain *old, struct resolved_chain *new,
|
||||||
|
|
||||||
|
|
||||||
int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
||||||
struct map_symbol *syms)
|
struct map_symbol *syms, u64 period)
|
||||||
{
|
{
|
||||||
struct resolved_chain *filtered;
|
struct resolved_chain *filtered;
|
||||||
|
|
||||||
|
@ -397,7 +398,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
||||||
if (!filtered->nr)
|
if (!filtered->nr)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
__append_chain_children(root, filtered, 0);
|
__append_chain_children(root, filtered, 0, period);
|
||||||
end:
|
end:
|
||||||
free(filtered);
|
free(filtered);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,9 @@ static inline void callchain_init(struct callchain_node *node)
|
||||||
INIT_LIST_HEAD(&node->brothers);
|
INIT_LIST_HEAD(&node->brothers);
|
||||||
INIT_LIST_HEAD(&node->children);
|
INIT_LIST_HEAD(&node->children);
|
||||||
INIT_LIST_HEAD(&node->val);
|
INIT_LIST_HEAD(&node->val);
|
||||||
|
|
||||||
|
node->parent = NULL;
|
||||||
|
node->hit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u64 cumul_hits(struct callchain_node *node)
|
static inline u64 cumul_hits(struct callchain_node *node)
|
||||||
|
@ -58,7 +61,7 @@ static inline u64 cumul_hits(struct callchain_node *node)
|
||||||
|
|
||||||
int register_callchain_param(struct callchain_param *param);
|
int register_callchain_param(struct callchain_param *param);
|
||||||
int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
int append_chain(struct callchain_node *root, struct ip_callchain *chain,
|
||||||
struct map_symbol *syms);
|
struct map_symbol *syms, u64 period);
|
||||||
|
|
||||||
bool ip_callchain__valid(struct ip_callchain *chain, event_t *event);
|
bool ip_callchain__valid(struct ip_callchain *chain, event_t *event);
|
||||||
#endif /* __PERF_CALLCHAIN_H */
|
#endif /* __PERF_CALLCHAIN_H */
|
||||||
|
|
Loading…
Reference in New Issue