LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   A kernel module needs to monitor certain system activities on app launch. (https://www.linuxquestions.org/questions/linux-kernel-70/a-kernel-module-needs-to-monitor-certain-system-activities-on-app-launch-748040/)

cyclops.xmen 08-17-2009 12:28 AM

A kernel module needs to monitor certain system activities on app launch.
 
I have an application and a linux kernel module.

When I launch the application, I want the kernel module to monitor certain system activities.

The system activities to be monitored can be very varied, the simplest being measuring the wall clock time for the application run duration.

The monitoring should stop when the application run is over.

What should be a good architectural design for this problem?

Any ideas will be greatly appreciated.

Thanks!

--Cyclops

neonsignal 08-17-2009 01:31 AM

First I would question why the monitor part needs to be a kernel module (unless it does something that is kernel specific, although even then you might find the ptrace facilities provide what you need).

If it is going to be a kernel module, you'd probably want to insert it at the start and remove it at the end. So perhaps you would have a main component, one that inserts the system module, starts the application, waits on the application process to terminate, queries the system module and reports the results (or they could be logged), and then unloads the system module.

cyclops.xmen 08-17-2009 08:21 PM

The module should collect different kernel related statistics, that is why I made it a kernel module.
The way Neonsignal has told, has worked for me!! Thanks a lot for that!
Now my next question is, I want to count the cache misses in the kernel driver for the duration the app is executing. Any pointers on how to calculate cache misses from within the kernel module will be highly appreciated.


All times are GMT -5. The time now is 11:10 PM.