Thread: CPU frequency

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    29

    CPU frequency

    Hello
    I have a kernel process compiled to an kernel_process.ko (kernel object)
    The size of the kernel object file is 15K. when i load the this kernel object file
    into the memory it's strats runing on my cpu.
    How can i know how much frequency my kernel process is taking from the CPU core ?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You don't want to use system programs: Task manager in Windows, System monitor in Linux (or Top in a terminal)?

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    I am using linux OS. How can i use the terminal for that matter ?
    Can you tell me what command should i write ?

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    man ps
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    How is 'ps' going to show you kernel threads?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    try "ps auxwf" this should show some of the common kenrel houskeeping threads.

    ssharish
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

  7. #7
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Quote Originally Posted by brewbuck View Post
    How is 'ps' going to show you kernel threads?
    The ps fax command shows kernel threads; look for [kthread] and its tree in the output of ps fax.

  8. #8
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    I worry that someone using a (presumbly self-written but at least self-compiled) kernel process cannot work out how to use ps to monitor CPU usage. Is it just me?

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C frequency help needed
    By blammo04 in forum C Programming
    Replies: 2
    Last Post: 03-07-2010, 02:57 PM
  2. Frequency Array
    By kiai_viper in forum C Programming
    Replies: 6
    Last Post: 07-21-2007, 01:05 AM
  3. letter frequency
    By knoxville in forum C Programming
    Replies: 15
    Last Post: 08-01-2006, 02:31 AM
  4. frequency?
    By tu_user in forum C++ Programming
    Replies: 2
    Last Post: 01-18-2004, 10:43 AM
  5. STL Question (frequency)
    By Eibro in forum C++ Programming
    Replies: 3
    Last Post: 04-23-2003, 09:12 AM