User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

How many timer events could Pi generate per second?

Thu Nov 20, 2014 6:16 am

Greetings,

I'm using Pi for traffic control. The HTB queue discipline require a "burst" parameter, which could be calculated by:
[Timer events per second] x [burst parameter] = bandwidth

On the "man htb" page, the NOTES part told me that Intel system generate 100 timer events per second, could anyone tell me how is this value on Pi's ARM processor?

Thanks~!

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: How many timer events could Pi generate per second?

Thu Nov 20, 2014 8:11 am

That value is likely to be the same since it is a Unix thing, not a cpu architecture or clock speed issue.
>)))'><'(((<

User avatar
joan
Posts: 14935
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How many timer events could Pi generate per second?

Thu Nov 20, 2014 8:26 am

I'm not sure what you are trying to find out.

I routinely use a C program which is woken up a thousand times a second.

I'm not aware that the system imposes any particular granularity on how many times per second you can be woken. Perhaps 5000 per second from C would be usable without undue overhead.

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How many timer events could Pi generate per second?

Thu Nov 20, 2014 8:38 am

allfox wrote: On the "man htb" page, the NOTES part told me that Intel system generate 100 timer events per second, could anyone tell me how is this value on Pi's ARM processor?
The processor (not overclocked) runs at 700MHz. That's 700,000,000 instruction ticks per second (some instructions take more than one timer cycle). So as long as the code path for your timer event has a path length of less than 700,000 instructions you won't be running out of CPU any time soon. [Note: I'm studiously ignoring the stuff that the operating system has to do to run your timer event.]

The practical way to see what's happening is to run this thing and monitor it with top.

I suspect your Raspberry Pi with it's slow network (everything goes through the SMSC9514) and puny processor is not the right machine to do any form of packet inspection and traffic shaping. It will rapidly become a bottleneck on a busy network.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: How many timer events could Pi generate per second?

Thu Nov 20, 2014 3:33 pm

Thank you for reply!

When I was dealing with Windows, M$ also told me that the system clock has a limit so the timer can only be triggered at a quite slow speed.
According to http://msdn.microsoft.com/en-us/library ... 10%29.aspx :

Code: Select all

When run on a Windows 7 system whose system clock has a resolution of approximately 15 milliseconds
So Windows won't able to generate more than 67 timer events if I use the System.Timers.Timer class.

I quite agree that maybe this is only an OS thing and has nothing to do with CPU. I'm asking this because the "man htc" page said "On Intel" explicitly.

I think I'll try the value 100 timer events per second, and monitor it to see what's going on.

And I'm only using Pi to shape the traffic in my dorm, I think Pi is fast enough, as there are only 3 people sharing a 4MB internet connection. Anyway, I think even if I find out that it's too slow, I learnt something. So I'll try it to see how it's going. Thanks for noting me.

Again, thank you!

Return to “General discussion”