Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288694
b: refs/heads/master
c: 83b8450
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Feb 27, 2012
1 parent 4d8a1ef commit 80bd079
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5500fa51199aee770ce53718853732600543619e
refs/heads/master: 83b8450317a1441aef5d110cbc4102d53df9ec02
9 changes: 6 additions & 3 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
#include <trace/events/task.h>
#include "internal.h"

#include <trace/events/sched.h>

int core_uses_pid;
char core_pattern[CORENAME_MAX_SIZE] = "core";
unsigned int core_pipe_limit;
Expand Down Expand Up @@ -1401,9 +1403,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
*/
bprm->recursion_depth = depth;
if (retval >= 0) {
if (depth == 0)
ptrace_event(PTRACE_EVENT_EXEC,
old_pid);
if (depth == 0) {
trace_sched_process_exec(current, old_pid, bprm);
ptrace_event(PTRACE_EVENT_EXEC, old_pid);
}
put_binfmt(fmt);
allow_write_access(bprm->file);
if (bprm->file)
Expand Down
27 changes: 27 additions & 0 deletions trunk/include/trace/events/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <linux/sched.h>
#include <linux/tracepoint.h>
#include <linux/binfmts.h>

/*
* Tracepoint for calling kthread_stop, performed to end a kthread:
Expand Down Expand Up @@ -275,6 +276,32 @@ TRACE_EVENT(sched_process_fork,
__entry->child_comm, __entry->child_pid)
);

/*
* Tracepoint for exec:
*/
TRACE_EVENT(sched_process_exec,

TP_PROTO(struct task_struct *p, pid_t old_pid,
struct linux_binprm *bprm),

TP_ARGS(p, old_pid, bprm),

TP_STRUCT__entry(
__string( filename, bprm->filename )
__field( pid_t, pid )
__field( pid_t, old_pid )
),

TP_fast_assign(
__assign_str(filename, bprm->filename);
__entry->pid = p->pid;
__entry->old_pid = p->pid;
),

TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
__entry->pid, __entry->old_pid)
);

/*
* XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
Expand Down
1 change: 0 additions & 1 deletion trunk/tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "util.h"
#include "event.h"
#include "string.h"
#include "strlist.h"
#include "debug.h"
#include "cache.h"
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/thread_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
if (!tid_str) {
threads = malloc(sizeof(*threads) + sizeof(pid_t));
if (threads != NULL) {
threads->map[1] = -1;
threads->map[0] = -1;
threads->nr = 1;
}
return threads;
Expand Down
12 changes: 12 additions & 0 deletions trunk/tools/perf/util/trace-event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,11 @@ static long long arg_num_eval(struct print_arg *arg)
die("unknown op '%s'", arg->op.op);
}
break;
case '+':
left = arg_num_eval(arg->op.left);
right = arg_num_eval(arg->op.right);
val = left + right;
break;
default:
die("unknown op '%s'", arg->op.op);
}
Expand Down Expand Up @@ -1483,6 +1488,13 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok)

free_token(token);
type = process_arg(event, arg, &token);

if (type == EVENT_OP)
type = process_op(event, arg, &token);

if (type == EVENT_ERROR)
goto out_free;

if (test_type_token(type, token, EVENT_DELIM, ","))
goto out_free;

Expand Down

0 comments on commit 80bd079

Please sign in to comment.