mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	RT <linux-rt-users@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	john stultz <johnstul@us.ibm.com>
Subject: [PATCH RT 1/3]  time keeping add cycle_raw for actual incrementation
Date: Fri, 24 Aug 2007 13:57:09 -0400	[thread overview]
Message-ID: <1187978229.2941.17.camel@localhost.localdomain> (raw)

The get_monotonic_cycles needs to produce a monotonic counter as output.
Currently it uses cycles_last as the base to add the delta too.
cycles_last only is the counter that was last measured and is cyclic in
nature (not monotonic).

This patch adds a cycle_raw to produce an accumulative counter.
Unfortunately there is already an cycle_accumulate variable, but that is
used to avoid clock source overflow and can also be decremented
(probably that name should be changed and we should use that for this
patch).


From: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>



Index: linux-2.6-rt/include/linux/clocksource.h
===================================================================
--- linux-2.6-rt.orig/include/linux/clocksource.h	2007-08-24 11:35:27.000000000 -0400
+++ linux-2.6-rt/include/linux/clocksource.h	2007-08-24 11:35:36.000000000 -0400
@@ -77,7 +77,7 @@ struct clocksource {
 	void (*resume)(void);
 
 	/* timekeeping specific data, ignore */
-	cycle_t cycle_accumulated, cycle_interval;
+	cycle_t cycle_accumulated, cycle_interval, cycle_raw;
 	u64	xtime_interval;
 	/*
 	 * Second part is written at each timer interrupt
@@ -198,6 +198,7 @@ static inline void clocksource_accumulat
 	cycle_t offset = (now - cs->cycle_last) & cs->mask;
 	cs->cycle_last = now;
 	cs->cycle_accumulated += offset;
+	cs->cycle_raw += offset;
 }
 
 /**
Index: linux-2.6-rt/kernel/time/timekeeping.c
===================================================================
--- linux-2.6-rt.orig/kernel/time/timekeeping.c	2007-08-24 11:35:27.000000000 -0400
+++ linux-2.6-rt/kernel/time/timekeeping.c	2007-08-24 11:35:47.000000000 -0400
@@ -75,7 +75,7 @@ cycle_t notrace get_monotonic_cycles(voi
 	/* calculate the delta since the last update_wall_time: */
 	cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
 
-	return clock->cycle_last + cycle_delta;
+	return clock->cycle_raw + cycle_delta;
 }
 
 unsigned long notrace cycles_to_usecs(cycle_t cycles)




                 reply	other threads:[~2007-08-24 17:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1187978229.2941.17.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®