LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-15-2008, 09:56 PM   #1
nonis
Member
 
Registered: Jan 2007
Posts: 95

Rep: Reputation: 15
Check for high resolution timer


Is there some program that will tell me if I am currently using a high resolution timer kernel? I recompiled my kernel for high resolution timers, because I heard it fixes a music timing problem in the SDL port of the game Cave Story (check it out if you haven't!). I'm not sure if it worked and didn't solve the problem, or didn't work, because the problem still came up a couple of times. So, is there a way I can tell if the kernel I am running has high resolution timers?
 
Old 06-17-2008, 06:59 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
1. you can see if the startup messages contain something like "Switched to high resolution mode on CPU 0"
Code:
dmesg | grep -i "high resolution"
2. you can examine /proc/timer_list. Here is an example from a system of mine:
Code:
$ cat /proc/timer_list
Timer List Version: v0.3
HRTIMER_MAX_CLOCK_BASES: 2
now at 8126099139257 nsecs

cpu: 0
 clock 0:
  .index:      0
  .resolution: 1 nsecs
  .get_time:   ktime_get_real
  .offset:     1213695287591567949 nsecs
active timers:
 clock 1:
  .index:      1
  .resolution: 1 nsecs
  .get_time:   ktime_get
  .offset:     0 nsecs
active timers:
 #0: <d5149ea8>, tick_sched_timer, S:01, tick_nohz_restart_sched_tick, swapper/0
 # expires at 8126100000000 nsecs [in 860743 nsecs]
 #1: <d5149ea8>, hrtick, S:01, hrtick_set, bash/6852
 # expires at 8126108046966 nsecs [in 8907709 nsecs]
 #2: <d5149ea8>, hrtimer_wakeup, S:01, futex_wait, firefox/4993
 # expires at 8126303835084 nsecs [in 204695827 nsecs]
 #3: <d5149ea8>, hrtimer_wakeup, S:01, futex_wait, thunderbird-bin/2952
 # expires at 8126834713057 nsecs [in 735573800 nsecs]
 #4: <d5149ea8>, it_real_fn, S:01, do_setitimer, lm_TMW.ld/2250
 # expires at 8141081124879 nsecs [in 14981985622 nsecs]
 #5: <d5149ea8>, hrtimer_wakeup, S:01, futex_wait, firefox/6809
 # expires at 8149722588347 nsecs [in 23623449090 nsecs]
 #6: <d5149ea8>, hrtimer_wakeup, S:01, futex_wait, firefox/6768
 # expires at 8157305776161 nsecs [in 31206636904 nsecs]
 #7: <d5149ea8>, hrtimer_wakeup, S:01, do_nanosleep, crond/2092
 # expires at 8173925829711 nsecs [in 47826690454 nsecs]
 #8: <d5149ea8>, it_real_fn, S:01, do_setitimer, sendmail/2072
 # expires at 10839968827086 nsecs [in 2713869687829 nsecs]
 #9: <d5149ea8>, it_real_fn, S:01, do_setitimer, sendmail/2081
 # expires at 10840266232140 nsecs [in 2714167092883 nsecs]
 #10: <d5149ea8>, hrtimer_wakeup, S:01, do_nanosleep, atd/2269
 # expires at 10844500356794 nsecs [in 2718401217537 nsecs]
  .expires_next   : 8126100000000 nsecs
  .hres_active    : 1
  .nr_events      : 1634095
  .nohz_mode      : 2
  .idle_tick      : 8126090000000 nsecs
  .tick_stopped   : 0
  .idle_jiffies   : 7826089
  .idle_calls     : 1223744
  .idle_sleeps    : 1112495
  .idle_entrytime : 8126089044561 nsecs
  .idle_waketime  : 8126096221672 nsecs
  .idle_exittime  : 8126096244128 nsecs
  .idle_sleeptime : 6897217943073 nsecs
  .last_jiffies   : 7826089
  .next_jiffies   : 7826116
  .idle_expires   : 8126116000000 nsecs
jiffies: 7826099


Tick Device: mode:     1
Clock Event Device: pit
 max_delta_ns:   27461866
 min_delta_ns:   12571
 mult:           5124677
 shift:          32
 mode:           3
 next_event:     9223372036854775807 nsecs
 set_next_event: pit_next_event
 set_mode:       init_pit_timer
 event_handler:  tick_handle_oneshot_broadcast
tick_broadcast_mask: 00000000
tick_broadcast_oneshot_mask: 00000000


Tick Device: mode:     1
Clock Event Device: lapic
 max_delta_ns:   994239172
 min_delta_ns:   1777
 mult:           36237551
 shift:          32
 mode:           3
 next_event:     8126100000000 nsecs
 set_next_event: lapic_next_event
 set_mode:       lapic_timer_setup
 event_handler:  hrtimer_interrupt
I put in red the relevant things:
a. the resolution of the clock has a value of 1 nsecs
b. the attribute .hres_active has a value of 1
c. the event_handler for the tick device is hrtimer_interrupt

Hope this helps.
 
Old 06-18-2008, 03:14 PM   #3
nonis
Member
 
Registered: Jan 2007
Posts: 95

Original Poster
Rep: Reputation: 15
Thanks, that helped a lot.
 
Old 05-04-2009, 07:24 AM   #4
sixerjman
Member
 
Registered: Sep 2004
Distribution: Debian Testing / Unstable
Posts: 180
Blog Entries: 1

Rep: Reputation: 32
Yes, thank you. This is an outstanding answer. Pulseaudio broke my sound system
and this is exactly the piece of the puzzle that will help me figure out what is going on. Thanks again for the concise answer to the question (and for the good question).
 
  


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
timer resolution in linux platform for channel switching in wirelless medium arun thakur Programming 0 02-13-2008 07:10 AM
High Resolution Timer over 1000hz antidelldude Linux - General 0 01-29-2008 07:10 AM
High resolution clock addy86 Programming 4 09-03-2005 11:26 PM
high resolution webcam ahz10 Linux - Hardware 6 05-24-2005 04:55 PM
High Resolution Timers snoopy42 Linux - General 2 12-10-2002 05:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:24 PM.

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