Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am studying how Linux kernel works and getting interested in the timescale of anything that happens in the kernel.

Of course I know it depends on the HW, but would like to get an example. For instance,

  • Interrupt Service routine : ~1ms?
  • System calls : ~10ms?
  • Printf(output 1 character) : 20ms?(not sure at all)

It would be appreciated if anyone could leave any comment or recommend a website which includes info like the above.

share|improve this question
    
printf isn't a syscall, it's a library call. And anything related to write if that's what you meant is impossible to estimate, depends much too much on what is being written to. –  Mat Feb 21 '12 at 8:45
    
OK thanks. I meant I wanted to know any timescale info or example from the lowest HW level(ex. access time from CPU to memory) to application level. For the later, performance analysis results like Oprofile would be helpful. –  Nobu Feb 22 '12 at 1:33
    
Doesn't this depend entirely on the particular machine the results are obtained from? A Linux-based IP camera and a massive server will yield drastically different results. Even between two machines of the same ‘class’, the results would differ a lot. In fact, I'll bet you if you change libc, C compiler, kernel version, recompile your own, or even make a couple of BIOS config changes, you'll get different results on the same computer too. It might help to know what motivates your question at a high level. –  Alexios Mar 12 '12 at 10:11
    
If by "timescale" of access to the hardware by userspace applications you mean the latency, I think you will find it is 10ms for a normal linux kernel (and it will NOT differ on a faster machine, I believe this has to do with hardcoded values such as the 1000 Hz userland tick). I.e., you cannot accurately try to schedule anything with a finer granularity than 10ms. –  TAFKA 'goldilocks' Aug 23 '13 at 14:17
add comment

1 Answer

Probably you are looking for top.

TIME+ column show you time of cpu usage by processes.

top - 13:33:24 up 2 days, 21:28, 7 users,  load average: 0.27, 0.95, 0.92
Tasks: 733 total,  19 running, 691 sleeping,   0 stopped,  23 zombie
%Cpu(s): 18.4 us, 24.5 sy, 57.1 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  16287248 total, 15047664 used,  1239584 free,   144600 buffers
KiB Swap: 37457960 total,  6876096 used, 30581864 free,  5184516 cached

  PID USER      PR  NI S  %CPU %MEM    TIME+  COMMAND
    1 root      20   0 S   0.0  0.0   1037:17 init
    2 root      20   0 S   0.0  0.0   0:00.03 kthreadd
    3 root      20   0 S   0.0  0.0  45:34.38 ksoftirqd/0
    5 root       0 -20 S   0.0  0.0   0:00.00 kworker/0:0H
    7 root       0 -20 S   0.0  0.0   0:00.00 kworker/u:0H
    8 root      rt   0 S   0.0  0.0   0:17.35 migration/0
    9 root      20   0 S   0.0  0.0   6:52.03 rcu_preempt
   10 root      20   0 S   0.0  0.0   0:00.00 rcu_bh
   11 root      20   0 S   0.0  0.0   0:00.00 rcu_sched
   12 root      rt   0 S   0.0  0.0   0:00.46 watchdog/0
   13 root      rt   0 S   0.0  0.0   0:00.47 watchdog/1
   14 root      20   0 S   8.4  0.0  22:22.00 ksoftirqd/1
   15 root      rt   0 S   0.0  0.0   0:19.23 migration/1
   18 root      rt   0 S   0.0  0.0   0:00.48 watchdog/2
   19 root      20   0 S   0.0  0.0  21:09.37 ksoftirqd/2
   20 root      rt   0 S   0.0  0.0   0:19.26 migration/2
   22 root       0 -20 S   0.0  0.0   0:00.00 kworker/2:0H
   23 root      rt   0 S   0.0  0.0   0:00.50 watchdog/3
   24 root      20   0 R   0.0  0.0  23:53.19 ksoftirqd/3
   25 root      rt   0 S   0.0  0.0   0:20.26 migration/3
   27 root       0 -20 S   0.0  0.0   0:00.00 kworker/3:0H
   28 root       0 -20 S   0.0  0.0   0:00.00 cpuset
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.