linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to know list of files accessed
@ 2012-02-13 11:30 ranjith kumar
  2012-02-13 12:32 ` Michael Opdenacker
  0 siblings, 1 reply; 4+ messages in thread
From: ranjith kumar @ 2012-02-13 11:30 UTC (permalink / raw)
  To: linux-kernel

Hi,
Suppose I downloaded linux kernel.
When I run "make", many of the .c files will be compiled.
I want to know which .c files are compiles and which .c files are not compiled.
Is there any way to know in linux?

Access time of the files which are compiled is not getting modified
when I run "make" . why?

Thanks in advance.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to know list of files accessed
  2012-02-13 11:30 how to know list of files accessed ranjith kumar
@ 2012-02-13 12:32 ` Michael Opdenacker
  2012-02-14  4:44   ` Valdis.Kletnieks
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Opdenacker @ 2012-02-13 12:32 UTC (permalink / raw)
  To: ranjith kumar; +Cc: linux-kernel

Hi Ranjith,

On 02/13/2012 12:30 PM, ranjith kumar wrote:
> Hi,
> Suppose I downloaded linux kernel.
> When I run "make", many of the .c files will be compiled.
> I want to know which .c files are compiles and which .c files are not compiled.
> Is there any way to know in linux?
An easy way is to run your command with 'strace' to trap all the calls
to 'open':

strace make 2>&1 | grep open
>
> Access time of the files which are compiled is not getting modified
> when I run "make" . why?
That's correct. As long as you don't read these files, there's no reason
to update their latest access time. Comparing access time with modified
time is a useful way to know which files haven't been read after being
modified.

Cheers

Michael.
-- 
Michael Opdenacker, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
+33 484 253 396


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to know list of files accessed
  2012-02-13 12:32 ` Michael Opdenacker
@ 2012-02-14  4:44   ` Valdis.Kletnieks
  2012-02-14  8:26     ` Matthias Schniedermeyer
  0 siblings, 1 reply; 4+ messages in thread
From: Valdis.Kletnieks @ 2012-02-14  4:44 UTC (permalink / raw)
  To: Michael Opdenacker; +Cc: ranjith kumar, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

On Mon, 13 Feb 2012 13:32:56 +0100, Michael Opdenacker said:

> An easy way is to run your command with 'strace' to trap all the calls
> to 'open':
>
> strace make 2>&1 | grep open

You really want 'strace -f make' - the -f flag makes it follow forks, which you
want to do because it's gcc that's doing most of the actual file I/O, not make.

Oh.  and you want to redirect that grep into a temporary file and be
prepared to post-process it with perl or something, there's going to be
*zillions* of open() syscalls.

[-- Attachment #2: Type: application/pgp-signature, Size: 865 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to know list of files accessed
  2012-02-14  4:44   ` Valdis.Kletnieks
@ 2012-02-14  8:26     ` Matthias Schniedermeyer
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Schniedermeyer @ 2012-02-14  8:26 UTC (permalink / raw)
  To: Valdis.Kletnieks; +Cc: Michael Opdenacker, ranjith kumar, linux-kernel

On 13.02.2012 23:44, Valdis.Kletnieks@vt.edu wrote:
> On Mon, 13 Feb 2012 13:32:56 +0100, Michael Opdenacker said:
> 
> > An easy way is to run your command with 'strace' to trap all the calls
> > to 'open':
> >
> > strace make 2>&1 | grep open
> 
> You really want 'strace -f make' - the -f flag makes it follow forks, which you
> want to do because it's gcc that's doing most of the actual file I/O, not make.
> 
> Oh.  and you want to redirect that grep into a temporary file and be
> prepared to post-process it with perl or something, there's going to be
> *zillions* of open() syscalls.

Inotify is certainly easier.

When inotifywait from inotify-tools is available:
inotifywait -m -r -e open <dir> > files.opened

This monitors recusivly for the "open" event and writes it into 
files.opened.

In my case that is:
wc -l files.opened
1115553 files.opened

And this number of unique files with directories
sort < files.opened | uniq | wc -l
5454

And this number af unique fiels without dirs.
cat files.opened | grep -v ISDIR | sort | uniq | wc -l
3837

I use "O=../compile_dir" to get the output into another dir, if you 
don't do that all newly created files are also counted, as you also 
"open" them.




Bis denn

-- 
Real Programmers consider "what you see is what you get" to be just as 
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated, 
cryptic, powerful, unforgiving, dangerous.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-14  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13 11:30 how to know list of files accessed ranjith kumar
2012-02-13 12:32 ` Michael Opdenacker
2012-02-14  4:44   ` Valdis.Kletnieks
2012-02-14  8:26     ` Matthias Schniedermeyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).