This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Problem Opening a FILE


I am not printing any information on screen, The purpose of introducing
the FILE is because I am getting overflow of buffer.

I am using aggregate var to store the information of around 50K packets
, which makes the stack full and information is lost, so I thought may
be I can save my packet information in some data structure and can then
calculation on my own. 

For that I wanted to open the file, so that the moment system tap, taps
the kernel function and I extract the information, I put it in the file.

> I guess we'd need to know more about why stap -o FILE doesn't work for
> you.  Have you considered using
> 	stap .... > FILE
> or
> 	stap ... | myprog > FILE
> where myprog is some program that reads and filters stap output?

------------
Using -o FILE won't help me, as I am not printing anything on screen
during runtime. Infact when I use -FILE I am not able to run for 1
second also.

-----Original Message-----
From: Jim Keniston [mailto:jkenisto@us.ibm.com] 
Sent: Monday, July 07, 2008 1:37 PM
To: Goel, Khushboo
Cc: systemtap@sources.redhat.com
Subject: Re: Problem Opening a FILE

On Mon, 2008-07-07 at 10:57 -0700, Goel, Khushboo wrote:
> I am a intern at Intel Corporation, looking for some help in system
Tap,
> new with technology. 
> I am using System Tap for probing kernel function so that I can know
> more about packet that are send over network. For this I need to open
a
> File so that I can save all raw data as I probe in the kernel (that's
> why can't use -O FILE option). I want to save this data when I am
> probing in the function, continuously.

I guess we'd need to know more about why stap -o FILE doesn't work for
you.  Have you considered using
	stap .... > FILE
or
	stap ... | myprog > FILE
where myprog is some program that reads and filters stap output?

stap stdout really is the intended channel for data from printf() and
similar functions in stap scripts.  As far as I know, stap doesn't
provide anything like fprintf() to write to an alternate channel.

Note that unlike libc printf(), stap's printf() can write binary data
(using %b) if that's your desire.  Also, stap's mechanism for
transferring data from kernel to user mode has a very high bandwidth, in
case that's a concern.

>  
> 
> 
> So I am using embedded c code to open a file, but some how its not
> allowing me. Can anyone tell how to open a file in System tap, and
which
> files tot include.

Embedded C in stap scripts is pulled as-is into the kernel module that
stap creates and inserts.  So unless you're trying to write kernel code
to simulate libc opens and writes (which seems to me an ambitious and
dangerous undertaking), embedded C is probably not your answer.
> 
>  
> 
> I using FILE *fp = NULL, to make file pointer, but its not allowing to
> me do it.

FILE is a libc (user-mode-side) construct, not available to stap
scripts.

> 
> Or any other alternative way to save all the data.
> 
>  
> 
> Please, I am new to System tap.

I hope this helps.

> 
> 
> Regards
> Khushboo Goel

Jim Keniston


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]