Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165329
b: refs/heads/master
c: 3f0a525
h: refs/heads/master
i:
  165327: 199b99f
v: v3
  • Loading branch information
Xiao Guangrong authored and Thomas Gleixner committed Aug 29, 2009
1 parent b2d46bc commit 9d78bbd
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 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: c6a2a1770245f654f35f60e1458d4356680f9519
refs/heads/master: 3f0a525ebf4b8ef041a332bbe4a73aee94bb064b
66 changes: 66 additions & 0 deletions trunk/include/trace/events/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,72 @@ TRACE_EVENT(hrtimer_cancel,
TP_printk("hrtimer %p", __entry->timer)
);

/**
* itimer_state - called when itimer is started or canceled
* @which: name of the interval timer
* @value: the itimers value, itimer is canceled if value->it_value is
* zero, otherwise it is started
* @expires: the itimers expiry time
*/
TRACE_EVENT(itimer_state,

TP_PROTO(int which, const struct itimerval *const value,
cputime_t expires),

TP_ARGS(which, value, expires),

TP_STRUCT__entry(
__field( int, which )
__field( cputime_t, expires )
__field( long, value_sec )
__field( long, value_usec )
__field( long, interval_sec )
__field( long, interval_usec )
),

TP_fast_assign(
__entry->which = which;
__entry->expires = expires;
__entry->value_sec = value->it_value.tv_sec;
__entry->value_usec = value->it_value.tv_usec;
__entry->interval_sec = value->it_interval.tv_sec;
__entry->interval_usec = value->it_interval.tv_usec;
),

TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu",
__entry->which, __entry->expires,
__entry->value_sec, __entry->value_usec,
__entry->interval_sec, __entry->interval_usec)
);

/**
* itimer_expire - called when itimer expires
* @which: type of the interval timer
* @pid: pid of the process which owns the timer
* @now: current time, used to calculate the latency of itimer
*/
TRACE_EVENT(itimer_expire,

TP_PROTO(int which, struct pid *pid, cputime_t now),

TP_ARGS(which, pid, now),

TP_STRUCT__entry(
__field( int , which )
__field( pid_t, pid )
__field( cputime_t, now )
),

TP_fast_assign(
__entry->which = which;
__entry->now = now;
__entry->pid = pid_nr(pid);
),

TP_printk("which %d, pid %d, now %lu", __entry->which,
(int) __entry->pid, __entry->now)
);

#endif /* _TRACE_TIMER_H */

/* This part must be outside protection */
Expand Down
5 changes: 5 additions & 0 deletions trunk/kernel/itimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/time.h>
#include <linux/posix-timers.h>
#include <linux/hrtimer.h>
#include <trace/events/timer.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -122,6 +123,7 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer)
struct signal_struct *sig =
container_of(timer, struct signal_struct, real_timer);

trace_itimer_expire(ITIMER_REAL, sig->leader_pid, 0);
kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid);

return HRTIMER_NORESTART;
Expand Down Expand Up @@ -166,6 +168,8 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
}
it->expires = nval;
it->incr = ninterval;
trace_itimer_state(clock_id == CPUCLOCK_VIRT ?
ITIMER_VIRTUAL : ITIMER_PROF, value, nval);

spin_unlock_irq(&tsk->sighand->siglock);

Expand Down Expand Up @@ -217,6 +221,7 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
} else
tsk->signal->it_real_incr.tv64 = 0;

trace_itimer_state(ITIMER_REAL, value, 0);
spin_unlock_irq(&tsk->sighand->siglock);
break;
case ITIMER_VIRTUAL:
Expand Down
7 changes: 6 additions & 1 deletion trunk/kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/math64.h>
#include <asm/uaccess.h>
#include <linux/kernel_stat.h>
#include <trace/events/timer.h>

/*
* Called after updating RLIMIT_CPU to set timer expiration if necessary.
Expand Down Expand Up @@ -1090,9 +1091,13 @@ static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it,
cputime_one_jiffy);
it->error -= onecputick;
}
} else
} else {
it->expires = cputime_zero;
}

trace_itimer_expire(signo == SIGPROF ?
ITIMER_PROF : ITIMER_VIRTUAL,
tsk->signal->leader_pid, cur_time);
__group_send_sig_info(signo, SEND_SIG_PRIV, tsk);
}

Expand Down

0 comments on commit 9d78bbd

Please sign in to comment.