lkml.org 
[lkml]   [2012]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: how to look for source code in kernel
On Fri, Dec 28, 2012 at 11:03:40PM +0100, Geert Uytterhoeven wrote:
> That's the first run. Now everything is in the buffer cache (assumed
> you have enough RAM), and try again...

Right, until you do something else on the box requiring just the right
amount of memory to overflow the buffer cache working set and start
kicking out pages. Btw, the thing has 4G of RAM.

* first run:

$ time git ls-files | xargs grep -E 'struct mce\W*{'
arch/x86/include/uapi/asm/mce.h:struct mce {
arch/x86/kernel/cpu/mcheck/mce.c: if (!final || memcmp(m, final, sizeof(struct mce))) {

real 2m48.415s
user 0m2.388s
sys 0m15.668s

* second run coming from the buffer cache, search for something else:

$ time git ls-files | xargs grep -E 'struct task_struct\W*{'
include/linux/sched.h:struct task_struct {

real 0m1.651s
user 0m0.672s
sys 0m1.048s

* do something else (kernel build, git gc, some (very leaky) userspace
memory hog, whatever :)) which kicks some buffer cache pages out:

$ time git ls-files | xargs grep -E 'struct mce\W*{'
arch/x86/include/uapi/asm/mce.h:struct mce {
arch/x86/kernel/cpu/mcheck/mce.c: if (!final || memcmp(m, final, sizeof(struct mce))) {

real 0m37.360s
user 0m1.152s
sys 0m4.176s

so on a machine with a lot of memory and an SSD, you can probably safely
rely on the buffer cache but not on a laptop, in my experience.

Btw, cscope can also grep for regex patterns so you don't need the git
grep thing anymore, especially since it looks at tracked files only.

Thanks.

--
Regards/Gruss,
Boris.


\
 
 \ /
  Last update: 2012-12-29 12:41    [W:0.111 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site