0
votes

Hello every one I am writing a kernel module and want to find the clock cycles of a particular function. I have included the library #include </linux/time.h> then declared

clock_t c0;

c0 = clock();

but I am getting the error

implicit declaration of a function clock

Can any one help me solve this problem?

I am using gcc on Linux.

1
Can you provide us with some more of your code? - Julien May
sure but the code is about 1000 lines :( - mainajaved
can't you use, before and after, gettimeofday defined in sys/time.h? it will be inaccurate at the end of the day though. - vulkanino
actually i want to find cpu cluck cycles - mainajaved

1 Answers

7
votes

The function clock is in libc. By definition, when you're developing for the kernel you don't have access to libc functions (look up "freestanding environment").