1 # Util.py - Python extension for perf trace, miscellaneous utility code
3 # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
5 # This software may be distributed under the terms of the GNU General
6 # Public License ("GPL") version 2 as published by the Free Software
9 NSECS_PER_SEC = 1000000000
14 def nsecs(secs, nsecs):
15 return secs * NSECS_PER_SEC + nsecs
17 def nsecs_secs(nsecs):
18 return nsecs / NSECS_PER_SEC
20 def nsecs_nsecs(nsecs):
21 return nsecs % NSECS_PER_SEC
24 str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),