Here i made one function which calculates CRC16 of any file . i made this function and program in C .
Now i want to find out CPU usage and Memory usage of my this CRC16 calculation function.
I know about top command. here i have no more time to see this thing on other tab and its not user friendly to use this.
i found one link but i cant get more idea about this.
Is there any function which do these things and give me result?
Please Any body help me to find out this thing.
Type in
man 2 getrusagefor more info.I expect that
ru_idrssis what you need for memory usage. It should be filled in in more recent versions of the Linux kernel. Or you could use procps and get info from the /proc directory. The difference inru_utimebefore and after the calculation will give you the CPU timeThere is more info in this question: How to get memory usage at run time in c++?