Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162975
b: refs/heads/master
c: 6ca6cca
h: refs/heads/master
i:
  162973: 54123e5
  162971: f4e4cb2
  162967: 144f477
  162959: 7dd56ee
  162943: 60cebe3
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Sep 15, 2009
1 parent 4a620c5 commit 4ca5754
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 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: 555f386c98cc93890f48fdea098936755270304b
refs/heads/master: 6ca6cca31ddc7cc8b1dc38b12d7593d2667defe8
24 changes: 14 additions & 10 deletions trunk/kernel/trace/trace_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ u64 notrace trace_clock(void)
* Used by plugins that need globally coherent timestamps.
*/

static u64 prev_trace_clock_time;

static raw_spinlock_t trace_clock_lock ____cacheline_aligned_in_smp =
(raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
/* keep prev_time and lock in the same cacheline. */
static struct {
u64 prev_time;
raw_spinlock_t lock;
} trace_clock_struct ____cacheline_aligned_in_smp =
{
.lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED,
};

u64 notrace trace_clock_global(void)
{
Expand All @@ -88,19 +92,19 @@ u64 notrace trace_clock_global(void)
if (unlikely(in_nmi()))
goto out;

__raw_spin_lock(&trace_clock_lock);
__raw_spin_lock(&trace_clock_struct.lock);

/*
* TODO: if this happens often then maybe we should reset
* my_scd->clock to prev_trace_clock_time+1, to make sure
* my_scd->clock to prev_time+1, to make sure
* we start ticking with the local clock from now on?
*/
if ((s64)(now - prev_trace_clock_time) < 0)
now = prev_trace_clock_time + 1;
if ((s64)(now - trace_clock_struct.prev_time) < 0)
now = trace_clock_struct.prev_time + 1;

prev_trace_clock_time = now;
trace_clock_struct.prev_time = now;

__raw_spin_unlock(&trace_clock_lock);
__raw_spin_unlock(&trace_clock_struct.lock);

out:
raw_local_irq_restore(flags);
Expand Down

0 comments on commit 4ca5754

Please sign in to comment.