This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to increase kernel timer frequency



I wanted to measure the time taken between some statements in my driver code(Linux version 3.4). I am using jiffies to record the start and end of the counter and then converting to milliseconds.

By default the HZ value is defined as 128 which gives the precision of only 7ms(ie for each increment in the counter by 1 ,the corresponding time will be incremented by 7ms)

If I increase the value of HZ to 1000,I can get a precision of 1ms.

I should modify some statements in kernel code.

So far I have tried these things but in vain In arch/arm/include/asm/param.h #define HZ CONFIG_HZ was replaced with #define HZ 256.

Are there any other statements to be modified?

  • Hi,

    What platform are you using Pandaboard, Blaze, Blaze Tablet? Also what OS are you running: Android or Linux?

    For example in TI Android releases you can try modifying the include/asm-generic/param.h as well (it should have similar define for HZ):  #define HZ         CONFIG_HZ       /* Internal kernel timer frequency */

    Also try changing the #define USER_HZ    100  in same files (arc/arm/include/asm/param.h & include/asm-generic/param.h)

    In addition to that you may need to modify your defconfig file. You can reference some of the other platforms supported in kernel. That is, try adding CONFIG_HZ_100=y in your defconfig.

    Best Regards,
    Yordan

  • Hi,

    I am using Pandaboard loaded with Linux Operating System with Kernel version 3.4.

    Did you mean to change at .config:CONFIG_HZ = y; since I did not find defconfig?

    Also after modifying what command am i supposed to give?

    like make modules / make uImage to reflect those changes?

    Also at present I have included

    #include <linux/sched.h>
    #include <linux/param.h>
    

    in my driver file.Any other header files to be included?There are some warning related to redefinition when I include asm-generic/param.h

    Thanks & Regards

    DDPD

  • Hi,

    The .config file is one of the options to enable CONFIG_HZ=y. After you modify the .config file you should execute make uImage - to build the kernel

    If necessary (if you want to install all modules on the pandaboard), after the compilation of uImage is complete, you can execute make modules.

    The other option is to add the CONFIG_HZ=y in arch/arm/configs/omap4plus_defconfig After that you should execute the following set of commands:
    make omap4plus_defconfig    //this will build the .config file

    make uImage

    make modules                            //if necessary to build additional modules for your kernel.

    Best Regards,
    Yordan

  • Hi,


    How about the header file?

    Which one to be included? linux/param.h or asm-generic/param.h ?


    Update:I gave CONFIG_HZ=y in arch/arm/configs/omap4plus_defconfig. I got a warning.

    Then I gave CONFIG_HZ=256 in arch/arm/configs/omap4plus_defconfig. and was compiled without warning

    Then code was compiled as per the commands given by you.

    Finally uImage is copied to SD card

    Still the HZ value when printed shows 128

    Regards

    DDPD