# LatencyTop Kernelpatch [Solved]

## donmartio

Hey there,

i recently found this latencytop tool and would like to test it.

It's in portage so everything is fine so far. But it needs a patched kernel.

Now my question is, is there a 'good way' to patch the gentoo-souces?

Or should i wait 'til it is included?

Or has anybody got latencytop working?

Any help appreciated.

----------

## frenkel

You can patch it yourself. Just download it from: http://www.latencytop.org/download.php

Cd to your /usr/src/linux/ dir and run a command like this:

```
patch -p0 < /dir/to/the/patch/latencytop.patch
```

If that doesn't work, you might try -p1 instead.

----------

## donmartio

Well... thanks for the answer.

I looked inside the patch and it seems that it is for the 2.6.24 Kernel and the gentoo sources are 2.6.23.

The Patch is not vary big so i may try to patch it by hand.

But this is the kernel... may someone get this working a more 'smoother' way.

Greetings

DonMartio

----------

## frenkel

 *donmartio wrote:*   

> Well... thanks for the answer.
> 
> I looked inside the patch and it seems that it is for the 2.6.24 Kernel and the gentoo sources are 2.6.23.
> 
> The Patch is not vary big so i may try to patch it by hand.
> ...

 

Currently you can't get it working without patching the kernel. Read their website.

----------

## dark_knight

donmartio, did you successfully manage to patch the kernel and run the userspace app?

I'm asking because I've patched the 24-rc8 (waiting for stabilization  :Wink: ), activated CONFIG_LATENCYTOP and some other stuff, rebooted, ran the userspace application, but I can't get any result.

Thanks

----------

## donmartio

Ho dark_knight,

no, i try it as soon as i find some time.

I presume you are using the vanilla-sources.

You can't get any result includes that you can't get any response.

Which means no errors too?

Well a i said, the patch is not very big, but this is the kernel and i have to do some safety precautions.

I post here if i'm done.

----------

## dark_knight

 *donmartio wrote:*   

> I presume you are using the vanilla-sources.

 

Yeah, I'm using vanilla ATM, because I wanted to try some new features. But I think that I will revert back to gentoo-sources, if I get no results, as soon as my mirror will catch their update to .24  :Wink: 

 *donmartio wrote:*   

> You can't get any result includes that you can't get any response.
> 
> Which means no errors too?

 

Yeah, even no errors. Through inspection of the userspace code I've spotted that the data are read from /proc/latency_stats, which, in my case, is laconically empty:

```
dark@darkplace ~ $ cat /proc/latency_stats 

Latency Top version : v0.1

dark@darkplace ~ $
```

----------

## donmartio

So finally i did it.

First thing is i got the same result. Latencytop shows an empty table if i start it.

But i think that is either i don't know ho to use it now or there are some kernel options missing.

But here is the patch i have build by using the other patch for gentoo-sources-2-6-23-r6

I made a copy of it which i called gentoo-sources-2-6-23-r9.

So here it is:

http://www.larkos.de/latencytop.patch

Now the only problem ist to get it working.

----------

## hoacker

Latencytop patch is included in master-devel branch of zen-sources (patch set based on linus' git tree, 2.6.24) and it just works for me...

```
# cat /proc/latency_stats

Latency Top version : v0.1

1610 19050407 206081 page fault ()

457 920155 82536 Unknown reason (kthread_create+0xb5/0x1)

...

```

Ebuilds for zen-sources are available in layman but I don't know which git branches they pull, I don't use them atm. 

See:

http://www.zen-sources.org/

https://forums.gentoo.org/viewtopic-t-641834-highlight-.html

Maybe give it a try...

----------

## dark_knight

 *donmartio wrote:*   

> So finally i did it.
> 
> First thing is i got the same result. Latencytop shows an empty table if i start it.

 

It's already a step forward... I've just tried, and the patch available on the website applies flawlessly on the gentoo-sources-2.6.24. Compiles fine.

I've not rebooted yet, though. Will do over the week-end (maybe).

 *hoacker wrote:*   

> Latencytop patch is included in master-devel branch of zen-sources (patch set based on linus' git tree, 2.6.24) and it just works for me...

 

Thanks for the info, but ATM I do not want to try another patchset. I still think that the reason might be a misconfiguration problem on my side. Could you please paste your .config please? So I can check differences from my kernel configuration. Thanks anyway!

----------

## hoacker

 *dark_knight wrote:*   

> Could you please paste your .config please? So I can check differences from my kernel configuration. Thanks anyway!

 

My .config: http://pastebin.com/m6c20c5cb

----------

## donmartio

And finally i found it

The latencytop kernel support is not enabled by default.

So if you do

```
sysctl -w kernel.latencytop=1
```

The feature is enabled and then latencytop show a lot of things.

Hope that helps

----------

## dark_knight

donmartio, I owe you a beer. Now it works  :Wink: 

----------

## dark_knight

Ok, it works, but I have another question now  :Razz:  about the actual output of the program

This is an example of the output of the program, while on heavy compilation:

```
sync_buffer __wait_on_buffer sync_dirty_buffer jou1087.7 msec        681.4 msec

sync_buffer __wait_on_buffer __ext3_get_inode_loc 430.1 msec         37.6 msec

do_lookup __link_path_walk link_path_walk path_wal429.9 msec        230.5 msec

sync_page __lock_page do_generic_mapping_read gene404.2 msec          7.1 msec

get_request_wait __make_request generic_make_reque265.1 msec        149.8 msec

ide_do_drive_cmd cdrom_queue_packet_command cdrom_ 42.2 msec         42.2 msec

ide_do_drive_cmd cdrom_queue_packet_command cdrom_ 42.2 msec         42.2 msec

ide_do_drive_cmd cdrom_queue_packet_command cdrom_ 42.2 msec         32.6 msec

ide_do_drive_cmd cdrom_queue_packet_command cdrom_ 42.2 msec         37.2 msec
```

As you can see, the program outputs the "bare" name (I guess) of the function on which the system lags most, messing the layout.

On the screenshots posted on the website http://www.latencytop.org/ , instead, I see that the program "resolves" the low-level name into a more understandable human-readable name. Has anyone else encountered this problem?

--nevermind: upgrading to the latest version solved the problem

----------

