# Help modifying Linux Kernel

## fernandoc1

I wish to create a tool that counts how many context changes happens on linux kernel and use add a filter that counts how many times a given process has been chose to execute.

Can some help me?

----------

## John R. Graham

What do you need help with?  If it's just general knowledge on the structure of the Kernel, I've found Understanding the Linux Kernel to be an interesting read.

- John

----------

## fernandoc1

I found in kernel/sched.c where the kernel swap context. I'm want to add a variable that count the total number of context changes that it made in a given period, and  I wish to create a statistic of how many times the kernel chose a given process.

I'm a little confused on how can I pass a parameter to the kernel while it is running.

----------

## widremann

'man 5 acct' might be a good start

----------

## John R. Graham

 *fernandoc1 wrote:*   

> I'm a little confused on how can I pass a parameter to the kernel while it is running.

 The standard way to do this is through a device driver.  You can write--or modify an existing (e.g., proc, sys)--device driver that accepts parameters for your test functions through data that you write to the device or through ioctl functions.  You can then also get statistics by reading the device.

- John

----------

