LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-13-2012, 02:50 PM   #1
chandan123
LQ Newbie
 
Registered: Sep 2012
Posts: 1

Rep: Reputation: Disabled
Retrieving the Kernel Current Time


please share with me the procedure or source code with which the current time of the kernel can be retreived and time elapses can be figured out.

Waiting for a REeply

Regards
Chandan
 
Old 09-13-2012, 05:33 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
For a simple solution, look at man time. (I'm not sure what the qualifier "of the kernel" means, since readig the clock is a kernel function.)

Here's an example:
Code:
$ pstree -p 10332
bash(10332)───pstree(11415)
$ time pstree -p 10332
bash(10332)───pstree(11450)

real    0m0.027s
user    0m0.005s
sys     0m0.021s
If you want the "nity-grity," look at /proc/timer_list where you'll see something like this:
Code:
$ cat /proc/timer_list
Timer List Version: v0.6
HRTIMER_MAX_CLOCK_BASES: 3
now at 6253894235805 nsecs

cpu: 0
 clock 0:
  .base:       ffff88031fc0e680
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get
  .offset:     0 nsecs
active timers:
 #0: <ffff88031fc0e880>, tick_sched_timer, S:01, hrtimer_start_range_ns, swapper/0/0
 # expires at 6253895000000-6253895000000 nsecs [in 764195 to 764195 nsecs]
 #1: <ffff8802d6b55a28>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, alsa-sink/1777
 # expires at 6253895261904-6253895261904 nsecs [in 1026099 to 1026099 nsecs]
 #2: root_task_group, sched_rt_period_timer, S:01, start_bandwidth_timer, swapper/0/1
 # expires at 6254000000000-6254000000000 nsecs [in 105764195 to 105764195 nsecs]
 #3: <ffff88030d781a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, iscsid/785
 # expires at 6254047070373-6254047320372 nsecs [in 152834568 to 153084567 nsecs]
 #4: <ffff880309557eb8>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, iscsid/784
 # expires at 6254153117112-6254153167112 nsecs [in 258881307 to 258931307 nsecs]
 #5: <ffff88030a42feb8>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, gpm/803
 # expires at 6255559436136-6255559486136 nsecs [in 1665200331 to 1665250331 nsecs]
 #6: <ffff88031fc0ea00>, watchdog_timer_fn, S:01, hrtimer_start, watchdog/0/7
 # expires at 6256028998107-6256028998107 nsecs [in 2134762302 to 2134762302 nsecs]
 #7: <ffff8802e5dfdd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, MutexDeadlockMo/1974
 # expires at 6256657313060-6256657363060 nsecs [in 2763077255 to 2763127255 nsecs]
 #8: <ffff8802d3fb9a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, gconfd-2/1858
 # expires at 6269276081106-6269306070104 nsecs [in 15381845301 to 15411834299 nsecs]
 #9: <ffff88030806feb8>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, crond/814
 # expires at 6272356632920-6272356682920 nsecs [in 18462397115 to 18462447115 nsecs]
 #10: <ffff8802d3c1f918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1909
 # expires at 6274117690826-6274175834731 nsecs [in 20223455021 to 20281598926 nsecs]
 #11: <ffff8802d1ad3918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1911
 # expires at 6274537505689-6274597505687 nsecs [in 20643269884 to 20703269882 nsecs]
 #12: <ffff88030d7b1918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chronyd/821
 # expires at 6305871967004-6305936113294 nsecs [in 51977731199 to 52041877489 nsecs]
 #13: <ffff8802dbe63a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, kded4/1701
 # expires at 6565007701816-6565107701816 nsecs [in 311113466011 to 311213466011 nsecs]
 #14: <ffff88030d7f1918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, mdadm/791
 # expires at 7020671213935-7020771213935 nsecs [in 766776978130 to 766876978130 nsecs]
 clock 1:
  .base:       ffff88031fc0e6c0
  .index:      1
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1347567928712906090 nsecs
active timers:
 #0: <ffff8801efdb7d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9993
 # expires at 1347574182612953000-1347574182613003000 nsecs [in 1347567928718717195 to 1347567928718767195 nsecs]
 #1: <ffff880284c21d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4954
 # expires at 1347574182760106000-1347574182760156000 nsecs [in 1347567928865870195 to 1347567928865920195 nsecs]
 #2: <ffff88025583fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/10105
 # expires at 1347574182980828000-1347574182980878000 nsecs [in 1347567929086592195 to 1347567929086642195 nsecs]
 #3: <ffff880284cfbd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4922
 # expires at 1347574183039871000-1347574183039921000 nsecs [in 1347567929145635195 to 1347567929145685195 nsecs]
 #4: <ffff88021462bd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9994
 # expires at 1347574183046792000-1347574183046842000 nsecs [in 1347567929152556195 to 1347567929152606195 nsecs]
 #5: <ffff8801efc9fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9824
 # expires at 1347574183280026000-1347574183280076000 nsecs [in 1347567929385790195 to 1347567929385840195 nsecs]
 #6: <ffff8802770a1d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/5099
 # expires at 1347574183451308000-1347574183451358000 nsecs [in 1347567929557072195 to 1347567929557122195 nsecs]
 #7: <ffff8802bcc23d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4953
 # expires at 1347574183471630000-1347574183471680000 nsecs [in 1347567929577394195 to 1347567929577444195 nsecs]
 #8: <ffff88030a5e5d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, mysqld/1627
 # expires at 1347574183513440000-1347574183513490000 nsecs [in 1347567929619204195 to 1347567929619254195 nsecs]
 #9: <ffff880284f1dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9991
 # expires at 1347574183561534000-1347574183561584000 nsecs [in 1347567929667298195 to 1347567929667348195 nsecs]
 #10: <ffff8802dd7b7d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3998
 # expires at 1347574185262715000-1347574185262765000 nsecs [in 1347567931368479195 to 1347567931368529195 nsecs]
 #11: <ffff8802b5795d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4756
 # expires at 1347574186446276000-1347574186446326000 nsecs [in 1347567932552040195 to 1347567932552090195 nsecs]
 #12: <ffff88030a29dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1016/10167
 # expires at 1347574782013064000-1347574782013114000 nsecs [in 1347568528118828195 to 1347568528118878195 nsecs]
 clock 2:
  .base:       ffff88031fc0e700
  .index:      2
  .resolution: 1 nsecs
  .get_time:   ktime_get_boottime
  .offset:     0 nsecs
active timers:
  .expires_next   : 6253895000000 nsecs
  .hres_active    : 1
  .nr_events      : 1507796
  .nr_retries     : 1171
  .nr_hangs       : 0
  .max_hang_time  : 0 nsecs
  .nohz_mode      : 2
  .idle_tick      : 6253889000000 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 4300921184
  .idle_calls     : 2621097
  .idle_sleeps    : 2028809
  .idle_entrytime : 6253889508875 nsecs
  .idle_waketime  : 6253884028001 nsecs
  .idle_exittime  : 6253889508875 nsecs
  .idle_sleeptime : 5464575379438 nsecs
  .iowait_sleeptime: 47436526327 nsecs
  .last_jiffies   : 4300921184
  .next_jiffies   : 4300921298
  .idle_expires   : 6254002000000 nsecs
jiffies: 4300921190

cpu: 1
 clock 0:
  .base:       ffff88031fc4e680
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get
  .offset:     0 nsecs
active timers:
 #0: <ffff880238801a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, konsole/10329
 # expires at 6253898661010-6253898711010 nsecs [in 4425205 to 4475205 nsecs]
 #1: <ffff8802b6289e08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_IOThread/3801
 # expires at 6253989977790-6253990077789 nsecs [in 95741985 to 95841984 nsecs]
 #2: <ffff88031fc4e880>, tick_sched_timer, S:01, hrtimer_start, swapper/1/0
 # expires at 6254048000000-6254048000000 nsecs [in 153764195 to 153764195 nsecs]
 #3: <ffff8802e5cf5a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, akonadi_control/1601
 # expires at 6255376208870-6255386198868 nsecs [in 1481973065 to 1491963063 nsecs]
 #4: <ffff88030d1b7a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, NetworkManager/734
 # expires at 6256000875495-6256006875493 nsecs [in 2106639690 to 2112639688 nsecs]
 #5: <ffff88031fc4ea00>, watchdog_timer_fn, S:01, hrtimer_start, watchdog/1/11
 # expires at 6256040997027-6256040997027 nsecs [in 2146761222 to 2146761222 nsecs]
 #6: <ffff8802eaba1a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, plasma-desktop/1595
 # expires at 6257152605027-6257155869026 nsecs [in 3258369222 to 3261633221 nsecs]
 #7: <ffff8802d68ad918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1913
 # expires at 6274096886483-6274156886481 nsecs [in 20202650678 to 20262650676 nsecs]
 #8: <ffff8802dd62b918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1914
 # expires at 6274431190899-6274491190897 nsecs [in 20536955094 to 20596955092 nsecs]
 #9: <ffff8802d8829918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1910
 # expires at 6274484135951-6274544135949 nsecs [in 20589900146 to 20649900144 nsecs]
 #10: <ffff8802b61efe08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_CacheThr/3800
 # expires at 6276475368681-6276498359680 nsecs [in 22581132876 to 22604123875 nsecs]
 #11: <ffff8802d47bba68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, CommLayerManage/1982
 # expires at 6350244644332-6350344644331 nsecs [in 96350408527 to 96450408526 nsecs]
 #12: <ffff8802d3fdfa68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, udisksd/1865
 # expires at 6690000887436-6690100887436 nsecs [in 436106651631 to 436206651631 nsecs]
 #13: <ffff8802d890de08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, cupsd/1954
 # expires at 26246119741560-26246219741560 nsecs [in 19992225505755 to 19992325505755 nsecs]
 #14: <ffff8802e5f3cf00>, timerfd_tmrproc, S:01, hrtimer_start, systemd/1
 # expires at 87300022678261-87300022678261 nsecs [in 81046128442456 to 81046128442456 nsecs]
 clock 1:
  .base:       ffff88031fc4e6c0
  .index:      1
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1347567928712906090 nsecs
active timers:
 #0: <ffff880284c1dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4956
 # expires at 1347574183148360000-1347574183148410000 nsecs [in 1347567929254124195 to 1347567929254174195 nsecs]
 #1: <ffff8802bbd2fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4851
 # expires at 1347574183414039000-1347574183414089000 nsecs [in 1347567929519803195 to 1347567929519853195 nsecs]
 #2: <ffff88030a5b7d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, mysqld/1628
 # expires at 1347574183523997000-1347574183524047000 nsecs [in 1347567929629761195 to 1347567929629811195 nsecs]
 #3: <ffff8802ae583d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_SyncThre/3885
 # expires at 1347574184868841000-1347574184868891000 nsecs [in 1347567930974605195 to 1347567930974655195 nsecs]
 #4: <ffff88030a5d7d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, mysqld/1629
 # expires at 1347574185377069000-1347574185377119000 nsecs [in 1347567931482833195 to 1347567931482883195 nsecs]
 #5: <ffff8802e8567d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3911
 # expires at 1347574185503573000-1347574185503623000 nsecs [in 1347567931609337195 to 1347567931609387195 nsecs]
 #6: <ffff8802d6a4bd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3930
 # expires at 1347574187723321000-1347574187723371000 nsecs [in 1347567933829085195 to 1347567933829135195 nsecs]
 #7: <ffff8802b600fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_HistoryT/3866
 # expires at 1347574194948074000-1347574194948124000 nsecs [in 1347567941053838195 to 1347567941053888195 nsecs]
 #8: <ffff8802ae791d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4778
 # expires at 1347574199083960000-1347574199084010000 nsecs [in 1347567945189724195 to 1347567945189774195 nsecs]
 #9: <ffff8802ae783d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/7494
 # expires at 1347574200215540000-1347574200215590000 nsecs [in 1347567946321304195 to 1347567946321354195 nsecs]
 #10: <ffff8802bbea1d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_DBThread/3795
 # expires at 1347574207721460000-1347574207721510000 nsecs [in 1347567953827224195 to 1347567953827274195 nsecs]
 #11: <ffff880255b3dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1008/10089
 # expires at 1347574768207214000-1347574768207264000 nsecs [in 1347568514312978195 to 1347568514313028195 nsecs]
 #12: <ffff8801ef98fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1016/10165
 # expires at 1347574777722335000-1347574777722385000 nsecs [in 1347568523828099195 to 1347568523828149195 nsecs]
 clock 2:
  .base:       ffff88031fc4e700
  .index:      2
  .resolution: 1 nsecs
  .get_time:   ktime_get_boottime
  .offset:     0 nsecs
active timers:
  .expires_next   : 6253898711010 nsecs
  .hres_active    : 1
  .nr_events      : 1471397
  .nr_retries     : 1340
  .nr_hangs       : 0
  .max_hang_time  : 0 nsecs
  .nohz_mode      : 2
  .idle_tick      : 6253890000000 nsecs
  .tick_stopped   : 1
  .idle_jiffies   : 4300921185
  .idle_calls     : 2333150
  .idle_sleeps    : 1792507
  .idle_entrytime : 6253893046988 nsecs
  .idle_waketime  : 6253893018371 nsecs
  .idle_exittime  : 6253889822922 nsecs
  .idle_sleeptime : 5471235924664 nsecs
  .iowait_sleeptime: 77703875492 nsecs
  .last_jiffies   : 4300921189
  .next_jiffies   : 4300921344
  .idle_expires   : 6254048000000 nsecs
jiffies: 4300921190

cpu: 2
 clock 0:
  .base:       ffff88031fc8e680
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get
  .offset:     0 nsecs
active timers:
 #0: <ffff88031fc8e880>, tick_sched_timer, S:01, hrtimer_start_range_ns, swapper/2/0
 # expires at 6253895000000-6253895000000 nsecs [in 764195 to 764195 nsecs]
 #1: <ffff8802bbf55e08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Gamepad polling/4711
 # expires at 6253895727102-6253895777102 nsecs [in 1491297 to 1541297 nsecs]
 #2: <ffff8802d6bc3a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3777
 # expires at 6253899191889-6253899241889 nsecs [in 4956084 to 5006084 nsecs]
 #3: <ffff8802d3d3ba68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, knemo/1853
 # expires at 6254302910259-6254303906258 nsecs [in 408674454 to 409670453 nsecs]
 #4: <ffff8802d6a3ba68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, tracker-miner-f/1776
 # expires at 6254335193067-6254337718065 nsecs [in 440957262 to 443482260 nsecs]
 #5: <ffff8802e26d1a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, gkrellm/1676
 # expires at 6254494612208-6254495559207 nsecs [in 600376403 to 601323402 nsecs]
 #6: <ffff88030bcbd918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, sendmail/981
 # expires at 6254621818762-6254626818760 nsecs [in 727582957 to 732582955 nsecs]
 #7: <ffff8802b54c3a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, threaded-ml/4016
 # expires at 6254764100051-6254765007049 nsecs [in 869864246 to 870771244 nsecs]
 #8: <ffff8802e5f65918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, mysqld/1630
 # expires at 6254883775915-6254884775908 nsecs [in 989540110 to 990540103 nsecs]
 #9: <ffff88031fc8ea00>, watchdog_timer_fn, S:01, hrtimer_start, watchdog/2/15
 # expires at 6256053995562-6256053995562 nsecs [in 2159759757 to 2159759757 nsecs]
 #10: <ffff8802d88bda68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, rtkit-daemon/1691
 # expires at 6258385722325-6260885722325 nsecs [in 4491486520 to 6991486520 nsecs]
 #11: <ffff8802d88bda68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, rtkit-daemon/1691
 # expires at 6258385722325-6260885722325 nsecs [in 4491486520 to 6991486520 nsecs]
 #12: <ffff880307989a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, rpcbind/887
 # expires at 6271193499636-6271223499634 nsecs [in 17299263831 to 17329263829 nsecs]
 #13: <ffff8803066dba68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, audispd/718
 # expires at 6273785206994-6273805206992 nsecs [in 19890971189 to 19910971187 nsecs]
 #14: <ffff8802d89e7918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1912
 # expires at 6274791309692-6274851309689 nsecs [in 20897073887 to 20957073884 nsecs]
 #15: <ffff8802d683fa68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1773
 # expires at 6279117695012-6279177694011 nsecs [in 25223459207 to 25283458206 nsecs]
 #16: <ffff8802d6821a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, zeitgeist-daemo/1758
 # expires at 6387276681175-6387376681175 nsecs [in 133382445370 to 133482445370 nsecs]
 #17: <ffff8802d6811d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Stats2Thread/1986
 # expires at 6402787670026-6402787720026 nsecs [in 148893434221 to 148893484221 nsecs]
 #18: <ffff8803089f6ab8>, it_real_fn, S:01, hrtimer_start, sendmail/1058
 # expires at 7228037569599-7228037569599 nsecs [in 974143333794 to 974143333794 nsecs]
 #19: <ffff8802ec17ba68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, udisks-daemon/1572
 # expires at 7260000295751-7260100295751 nsecs [in 1006106059946 to 1006206059946 nsecs]
 #20: <ffff880307fb1a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, avahi-daemon/796
 # expires at 7758110271553-7758210271553 nsecs [in 1504216035748 to 1504316035748 nsecs]
 clock 1:
  .base:       ffff88031fc8e6c0
  .index:      1
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1347567928712906090 nsecs
active timers:
 #0: <ffff8802b557dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4686
 # expires at 1347574182669616000-1347574182669666000 nsecs [in 1347567928775380195 to 1347567928775430195 nsecs]
 #1: <ffff8802bbc2bd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3984
 # expires at 1347574182724348000-1347574182724398000 nsecs [in 1347567928830112195 to 1347567928830162195 nsecs]
 #2: <ffff88023884fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9992
 # expires at 1347574182724668000-1347574182724718000 nsecs [in 1347567928830432195 to 1347567928830482195 nsecs]
 #3: <ffff88030ad51d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3831
 # expires at 1347574182738283000-1347574182738333000 nsecs [in 1347567928844047195 to 1347567928844097195 nsecs]
 #4: <ffff880284ce3d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4991
 # expires at 1347574183241115000-1347574183241165000 nsecs [in 1347567929346879195 to 1347567929346929195 nsecs]
 #5: <ffff880284d8fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4951
 # expires at 1347574183423714000-1347574183423764000 nsecs [in 1347567929529478195 to 1347567929529528195 nsecs]
 #6: <ffff88029c65fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4899
 # expires at 1347574184938505000-1347574184938555000 nsecs [in 1347567931044269195 to 1347567931044319195 nsecs]
 #7: <ffff8802d188dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3872
 # expires at 1347574185002678000-1347574185002728000 nsecs [in 1347567931108442195 to 1347567931108492195 nsecs]
 #8: <ffff88029c6d3d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4575
 # expires at 1347574185240164000-1347574185240214000 nsecs [in 1347567931345928195 to 1347567931345978195 nsecs]
 #9: <ffff8801ef7bfd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1016/10164
 # expires at 1347574768209469000-1347574768209519000 nsecs [in 1347568514315233195 to 1347568514315283195 nsecs]
 #10: <ffff8801edef5d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1016/10168
 # expires at 1347574777725050000-1347574777725100000 nsecs [in 1347568523830814195 to 1347568523830864195 nsecs]
 clock 2:
  .base:       ffff88031fc8e700
  .index:      2
  .resolution: 1 nsecs
  .get_time:   ktime_get_boottime
  .offset:     0 nsecs
active timers:
  .expires_next   : 6253895777102 nsecs
  .hres_active    : 1
  .nr_events      : 1450897
  .nr_retries     : 1290
  .nr_hangs       : 0
  .max_hang_time  : 0 nsecs
  .nohz_mode      : 2
  .idle_tick      : 6253888000000 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 4300921183
  .idle_calls     : 2134787
  .idle_sleeps    : 1544030
  .idle_entrytime : 6253895043501 nsecs
  .idle_waketime  : 6253882799062 nsecs
  .idle_exittime  : 6253888231850 nsecs
  .idle_sleeptime : 5425125451675 nsecs
  .iowait_sleeptime: 136257858692 nsecs
  .last_jiffies   : 4300921191
  .next_jiffies   : 4300921192
  .idle_expires   : 6254032000000 nsecs
jiffies: 4300921191

cpu: 3
 clock 0:
  .base:       ffff88031fcce680
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get
  .offset:     0 nsecs
active timers:
 #0: <ffff88031fcce880>, tick_sched_timer, S:01, hrtimer_start_range_ns, swapper/3/0
 # expires at 6253896000000-6253896000000 nsecs [in 1764195 to 1764195 nsecs]
 #1: <ffff8802dd619a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, skype/1686
 # expires at 6253918138181-6253918188181 nsecs [in 23902376 to 23952376 nsecs]
 #2: <ffff8802d1b5fd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/2109
 # expires at 6254044176894-6254044226894 nsecs [in 149941089 to 149991089 nsecs]
 #3: <ffff8802d3d35d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Backbone/1980
 # expires at 6254056381764-6254056431764 nsecs [in 162145959 to 162195959 nsecs]
 #4: <ffff8802ec277918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, kwin/1577
 # expires at 6254091449173-6254091651855 nsecs [in 197213368 to 197416050 nsecs]
 #5: <ffff8802d8a57918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, python/1702
 # expires at 6254264482719-6254266482718 nsecs [in 370246914 to 372246913 nsecs]
 #6: <ffff8802ae42be08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, Chrome_FileThre/3797
 # expires at 6254341337800-6254341837799 nsecs [in 447101995 to 447601994 nsecs]
 #7: <ffff88030a547918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, X/1113
 # expires at 6254547681941-6254548340939 nsecs [in 653446136 to 654105134 nsecs]
 #8: <ffff88030840beb8>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, irqbalance/740
 # expires at 6255287096458-6255287146458 nsecs [in 1392860653 to 1392910653 nsecs]
 #9: <ffff880308b19a68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, kded4/1514
 # expires at 6255936231276-6255941225275 nsecs [in 2041995471 to 2046989470 nsecs]
 #10: <ffff88031fccea00>, watchdog_timer_fn, S:01, hrtimer_start, watchdog/3/19
 # expires at 6256065994138-6256065994138 nsecs [in 2171758333 to 2171758333 nsecs]
 #11: <ffff88030aded918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, ssh-agent/1454
 # expires at 6257002211575-6257012211573 nsecs [in 3107975770 to 3117975768 nsecs]
 #12: <ffff8802e5d2da68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, akonadiserver/1603
 # expires at 6258101111364-6258105328363 nsecs [in 4206875559 to 4211092558 nsecs]
 #13: <ffff88023884beb8>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, sleep/10401
 # expires at 6260844112695-6260844162695 nsecs [in 6949876890 to 6949926890 nsecs]
 #14: <ffff8802d88bfa68>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, rtkit-daemon/1692
 # expires at 6263385769152-6263385769152 nsecs [in 9491533347 to 9491533347 nsecs]
 #15: <ffff88030d1ade08>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, auditd/687
 # expires at 6271466466792-6271526209791 nsecs [in 17572230987 to 17631973986 nsecs]
 #16: <ffff880307fbccf8>, it_real_fn, S:01, hrtimer_start, sendmail/981
 # expires at 7227224341986-7227224341986 nsecs [in 973330106181 to 973330106181 nsecs]
 #17: <ffff880308e1f918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, dhclient/859
 # expires at 34171231437910-34171331437910 nsecs [in 27917337202105 to 27917437202105 nsecs]
 #18: <ffff880308025918>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, rsyslogd/804
 # expires at 86417826144924-86417926144924 nsecs [in 80163931909119 to 80164031909119 nsecs]
 clock 1:
  .base:       ffff88031fcce6c0
  .index:      1
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1347567928712906090 nsecs
active timers:
 #0: <ffff8802b57d3d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, AudioThread/3793
 # expires at 1347574182625376000-1347574182625426000 nsecs [in 1347567928731140195 to 1347567928731190195 nsecs]
 #1: <ffff8802bbe6dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/10104
 # expires at 1347574182842081000-1347574182842131000 nsecs [in 1347567928947845195 to 1347567928947895195 nsecs]
 #2: <ffff8802559bfd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/9559
 # expires at 1347574182900802000-1347574182900852000 nsecs [in 1347567929006566195 to 1347567929006616195 nsecs]
 #3: <ffff8802ae4b9d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4957
 # expires at 1347574183037849000-1347574183037899000 nsecs [in 1347567929143613195 to 1347567929143663195 nsecs]
 #4: <ffff880284c15d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4952
 # expires at 1347574183043819000-1347574183043869000 nsecs [in 1347567929149583195 to 1347567929149633195 nsecs]
 #5: <ffff88029c411d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4828
 # expires at 1347574183058502000-1347574183058552000 nsecs [in 1347567929164266195 to 1347567929164316195 nsecs]
 #6: <ffff8802d6a73d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3959
 # expires at 1347574184864585000-1347574184864635000 nsecs [in 1347567930970349195 to 1347567930970399195 nsecs]
 #7: <ffff8802b6179d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3920
 # expires at 1347574185509854000-1347574185509904000 nsecs [in 1347567931615618195 to 1347567931615668195 nsecs]
 #8: <ffff88030bffbd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/4323
 # expires at 1347574186833595000-1347574186833645000 nsecs [in 1347567932939359195 to 1347567932939409195 nsecs]
 #9: <ffff8802bce4dd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3976
 # expires at 1347574187724086000-1347574187724136000 nsecs [in 1347567933829850195 to 1347567933829900195 nsecs]
 #10: <ffff8802ea8b5d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/3969
 # expires at 1347574189461229000-1347574189461279000 nsecs [in 1347567935566993195 to 1347567935567043195 nsecs]
 #11: <ffff880284d2bd58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, chrome/5050
 # expires at 1347574192210548000-1347574192210598000 nsecs [in 1347567938316312195 to 1347567938316362195 nsecs]
 #12: <ffff8801efc47d58>, hrtimer_wakeup, S:01, hrtimer_start_range_ns, WorkerPool/1016/10169
 # expires at 1347574758695488000-1347574758695538000 nsecs [in 1347568504801252195 to 1347568504801302195 nsecs]
 #13: <ffff88030d6789e8>, posix_timer_fn, S:01, hrtimer_start_range_ns, atd/812
 # expires at 1347575146000000000-1347575146000000000 nsecs [in 1347568892105764195 to 1347568892105764195 nsecs]
 clock 2:
  .base:       ffff88031fcce700
  .index:      2
  .resolution: 1 nsecs
  .get_time:   ktime_get_boottime
  .offset:     0 nsecs
active timers:
  .expires_next   : 6253896000000 nsecs
  .hres_active    : 1
  .nr_events      : 1429669
  .nr_retries     : 1147
  .nr_hangs       : 0
  .max_hang_time  : 0 nsecs
  .nohz_mode      : 2
  .idle_tick      : 6253890000000 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 4300921185
  .idle_calls     : 1995654
  .idle_sleeps    : 1453760
  .idle_entrytime : 6253895043354 nsecs
  .idle_waketime  : 6253875383831 nsecs
  .idle_exittime  : 6253889356465 nsecs
  .idle_sleeptime : 5480091339968 nsecs
  .iowait_sleeptime: 94430252273 nsecs
  .last_jiffies   : 4300921191
  .next_jiffies   : 4300921192
  .idle_expires   : 6254048000000 nsecs
jiffies: 4300921191


Tick Device: mode:     1
Broadcast device
Clock Event Device: hpet
 max_delta_ns:   149983003520
 min_delta_ns:   13409
 mult:           61496115
 shift:          32
 mode:           1
 next_event:     9223372036854775807 nsecs
 set_next_event: hpet_legacy_next_event
 set_mode:       hpet_legacy_set_mode
 event_handler:  tick_handle_oneshot_broadcast
 retries:        0
tick_broadcast_mask: 00000000
tick_broadcast_oneshot_mask: 00000000


Tick Device: mode:     1
Per CPU device: 0
Clock Event Device: lapic
 max_delta_ns:   171774641367
 min_delta_ns:   1199
 mult:           53694608
 shift:          32
 mode:           3
 next_event:     6253896000000 nsecs
 set_next_event: lapic_next_event
 set_mode:       lapic_timer_setup
 event_handler:  hrtimer_interrupt
 retries:        1

Tick Device: mode:     1
Per CPU device: 1
Clock Event Device: lapic
 max_delta_ns:   171774641367
 min_delta_ns:   1199
 mult:           53694608
 shift:          32
 mode:           3
 next_event:     6253898711010 nsecs
 set_next_event: lapic_next_event
 set_mode:       lapic_timer_setup
 event_handler:  hrtimer_interrupt
 retries:        2

Tick Device: mode:     1
Per CPU device: 2
Clock Event Device: lapic
 max_delta_ns:   171774641367
 min_delta_ns:   1199
 mult:           53694608
 shift:          32
 mode:           3
 next_event:     6253895777102 nsecs
 set_next_event: lapic_next_event
 set_mode:       lapic_timer_setup
 event_handler:  hrtimer_interrupt
 retries:        1

Tick Device: mode:     1
Per CPU device: 3
Clock Event Device: lapic
 max_delta_ns:   171774641367
 min_delta_ns:   1199
 mult:           53694608
 shift:          32
 mode:           3
 next_event:     6253896000000 nsecs
 set_next_event: lapic_next_event
 set_mode:       lapic_timer_setup
 event_handler:  hrtimer_interrupt
 retries:        1
From the start of that output you can see that each processor my system has 14 active timers, so "the kernel time" (without noting the timer) is somewhat hard to understand.

At the end of that output you can see that each system processor has its own timers.

Of course, any specific process may switch between processors and may create independent threads, so, if you want more then the simple time command delivers, you may need to white your own kernel function (module).

Last edited by PTrenholme; 09-13-2012 at 05:34 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Should glibc be updated in current every time there is a kernel update? samac Slackware 51 02-13-2010 10:19 AM
Help retrieving current internet passcode... ladyigrainia Linux - Wireless Networking 5 08-27-2009 11:50 AM
pwd: error retrieving current directory: getcwd: cannot access parent directories: Pe bootkernel Linux - General 1 05-05-2008 05:45 AM
How to get current time without kernel transition Lothar Schwab Linux - General 3 08-02-2007 12:46 AM
retrieving execution time for process dipenchaudhary Programming 3 02-24-2006 10:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration