LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2011, 11:43 PM   #1
neyshule
LQ Newbie
 
Registered: Apr 2011
Posts: 11

Rep: Reputation: 0
How to calculate how many times a function runs?????


Hi all:
I have a function in a kernel module and I want to see how many times it is called and runs per second. I add a counter in the function so once it runs, counter+=1; is there any timer or something which can check this counter every second???Thanks very much.

Last edited by neyshule; 09-25-2011 at 01:04 AM. Reason: not precise
 
Old 09-25-2011, 01:03 AM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
The answer depends on what programming language it is, with which you are writing the code.
Did I perhaps miss in your question, someplace where you gave us that information?
 
Old 09-25-2011, 10:10 AM   #3
neyshule
LQ Newbie
 
Registered: Apr 2011
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kakaka View Post
The answer depends on what programming language it is, with which you are writing the code.
Did I perhaps miss in your question, someplace where you gave us that information?
I'm writing a kernel function so I use c++/c.
 
Old 09-25-2011, 01:02 PM   #4
ambrop7
Member
 
Registered: May 2011
Distribution: Gentoo
Posts: 98

Rep: Reputation: 16
Use timers provided by the Linux kernel. First Google hit for "linux kernel timer" gives http://makelinux.com/ldd3/chp-7-sect-4 .
 
  


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
Posting piece of code on the internet vinians Linux - Newbie 2 10-03-2009 07:53 PM
piece of code Volcano Programming 8 08-04-2009 09:28 AM
is there a piece of c code that can set the terminal window tinieprotonjam Programming 2 01-27-2007 07:20 AM
Unusual piece of bash script code raypen Slackware 2 03-18-2006 10:49 PM
nice piece of code ....HOW DOES IT WORK? deadhead Programming 7 12-07-2003 12:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:17 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