netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: netdev@vger.kernel.org
Cc: Patrick McHardy <kaber@trash.net>, shemminger@linux-foundation.org
Subject: [RFC IPROUTE 08/08]: Increase internal clock resolution to nsec
Date: Sun,  4 Mar 2007 20:15:04 +0100 (MET)	[thread overview]
Message-ID: <20070304191413.22838.98460.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070304191402.22838.91224.sendpatchset@localhost.localdomain>

[IPROUTE]: Increase internal clock resolution to nsec

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 8a76c51f61dd3881bba35f8c73aaa92eabaf50da
tree d4b252b801a14ee19ed77d4a06daaacd8c17b495
parent 0e0db5d408bdac33eadd9d947c0e6904df26ab8f
author Patrick McHardy <kaber@trash.net> Sat, 03 Mar 2007 20:30:50 +0100
committer Patrick McHardy <kaber@trash.net> Sat, 03 Mar 2007 20:30:50 +0100

 tc/tc_core.h |    2 +-
 tc/tc_util.c |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tc/tc_core.h b/tc/tc_core.h
index a139da6..28bf97a 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -4,7 +4,7 @@ #define _TC_CORE_H_ 1
 #include <asm/types.h>
 #include <linux/pkt_sched.h>
 
-#define TIME_UNITS_PER_SEC	1000000
+#define TIME_UNITS_PER_SEC	1000000000
 
 int  tc_core_time2big(long time);
 long tc_core_time2tick(long time);
diff --git a/tc/tc_util.c b/tc/tc_util.c
index a7e4257..a07c6aa 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -228,6 +228,9 @@ int get_time(unsigned *time, const char 
 		else if (strcasecmp(p, "us") == 0 || strcasecmp(p, "usec")==0 ||
 			 strcasecmp(p, "usecs") == 0)
 			t *= TIME_UNITS_PER_SEC/1000000;
+		else if (strcasecmp(p, "ns") == 0 || strcasecmp(p, "nsec")==0 ||
+			 strcasecmp(p, "nsecs") == 0)
+			t *= TIME_UNITS_PER_SEC/1000000000;
 		else
 			return -1;
 	}
@@ -245,8 +248,10 @@ void print_time(char *buf, int len, __u3
 		snprintf(buf, len, "%.1fs", tmp/TIME_UNITS_PER_SEC);
 	else if (tmp >= TIME_UNITS_PER_SEC/1000)
 		snprintf(buf, len, "%.1fms", tmp/(TIME_UNITS_PER_SEC/1000));
+	else if (tmp >= TIME_UNITS_PER_SEC/1000000)
+		snprintf(buf, len, "%.1fus", tmp/(TIME_UNITS_PER_SEC/1000000));
 	else
-		snprintf(buf, len, "%uus", time);
+		snprintf(buf, len, "%uns", time);
 }
 
 char * sprint_time(__u32 time, char *buf)

  parent reply	other threads:[~2007-03-04 19:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04 19:14 [RFC IPROUTE 00/08]: Time cleanups + nano-second clock resolution support Patrick McHardy
2007-03-04 19:14 ` [RFC IPROUTE 01/08]: tbf: fix latency printing Patrick McHardy
2007-03-04 19:14 ` [RFC IPROUTE 02/08]: Use tc_calc_xmittime() where appropriate Patrick McHardy
2007-03-04 19:14 ` [RFC IPROUTE 03/08]: Introduce tc_calc_xmitsize and use " Patrick McHardy
2007-03-04 19:14 ` [RFC IPROUTE 04/08]: Introduce TIME_UNITS_PER_SEC to represent internal clock resolution Patrick McHardy
2007-03-04 19:15 ` [RFC IPROUTE 05/08]: Replace "usec" by "time" in function names Patrick McHardy
2007-03-04 19:15 ` [RFC IPROUTE 06/08]: Add sprint_ticks() function and use in CBQ Patrick McHardy
2007-03-04 19:15 ` [RFC IPROUTE 07/08]: Handle different kernel clock resolutions Patrick McHardy
2007-03-04 19:15 ` Patrick McHardy [this message]
2007-03-13 21:42 ` [RFC IPROUTE 00/08]: Time cleanups + nano-second clock resolution support Stephen Hemminger
2007-03-14  8:54   ` Patrick McHardy

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=20070304191413.22838.98460.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).