systemtap returntimeofday_s and some questions


 
Thread Tools Search this Thread
Top Forums Programming systemtap returntimeofday_s and some questions
# 1  
Old 03-26-2011
systemtap returntimeofday_s and some questions

Hi gurus,
could you please explain few questions about systemtap.

1st
===
seems gettimeofday_s() always returns 0
Code:
stap -ve 'probe timer.s(4){ printf("%d ", gettimeofday_s()) }'

returns 0 0 0 ... also gettimeofday_ms gettimeofday_ns

When I am trying to investigate what is going on issuing second commnat paraller to first one
Code:
stap -ve 'probe kernel.function("*gettimeofday*") { printf("%d\t%s\n",pid(),execname()); }'

it returns various PID and execs but neither belongs to stap
3rd command also issued paraller to 1st
Code:
stap -ve 'probe kprobe.function("*gettimeofday*") { printf("%d\t%s\n",pid(),execname()); }''

seems it goes throught 5 phases (compiles and loaded into kernel) - but prints nothing just: WARNING: probe registration error (symbol not found)


the date command runs normally
Code:
[root@fedora ~]# date
Sat Mar 26 10:30:10 CET 2011

What is wrong with gettimeofday ???


2nd
===
I am trying to trace system calls per process with following code
Code:
stap -ve 'probe syscall.open {if (execname()=="ping") { printf("execname(): %s, pid(): %d, argstr: %s, filename: %s, name: %s\n", execname(), pid(), argstr, filename, name) } }'

can be process tracd according to execname() + PATH containing binary - the equivalent of /proc/$PID/exe



3rd
===
according man stap the -L option should be the used to get possible variables.
Code:
[root@fedora ~]# stap -L 'syscall.open'
syscall.open name:string filename:string flags:long mode:long argstr:string $filename:char const* $flags:int $mode:int $ret:long int

works as expected

Now, how to know which variables can be used in all library calls ?
Code:
stap -vL 'kernel.function("*")' > kernel.functions

did not returns anything why

Also can somebody explain those variables with $ (target variables) They are those which can be used in source code of app ?


4nd
===
where are described functions that can be used with stap ? Those in man stapfuncs ?
and tapsets are those in tapset refference ?



Many thanks all

Last edited by wakatana; 03-26-2011 at 10:03 AM..
# 2  
Old 04-04-2011
gettimeofday

See the syntax in the link provided above : a pointer to a timeval structure should be specified as first argument to store the result

Last edited by ctsgnb; 04-04-2011 at 02:10 PM..
# 3  
Old 07-13-2011
Quote:
Originally Posted by wakatana
Hi gurus,
could you please explain few questions about systemtap.

1st
===
seems gettimeofday_s() always returns 0
Code:
stap -ve 'probe timer.s(4){ printf("%d ", gettimeofday_s()) }'

returns 0 0 0 ... also gettimeofday_ms gettimeofday_ns

The script you referred runs well on my pc.

When I am trying to investigate what is going on issuing second commnat paraller to first one
Code:
stap -ve 'probe kernel.function("*gettimeofday*") { printf("%d\t%s\n",pid(),execname()); }'

it returns various PID and execs but neither belongs to stap
3rd command also issued paraller to 1st

Runs well also.

Code:
stap -ve 'probe kprobe.function("*gettimeofday*") { printf("%d\t%s\n",pid(),execname()); }''

seems it goes throught 5 phases (compiles and loaded into kernel) - but prints nothing just: WARNING: probe registration error (symbol not found)

*gettimeofday* equals *gettimeofday

the date command runs normally
Code:
[root@fedora ~]# date
Sat Mar 26 10:30:10 CET 2011

What is wrong with gettimeofday ???


2nd
===
I am trying to trace system calls per process with following code
Code:
stap -ve 'probe syscall.open {if (execname()=="ping") { printf("execname(): %s, pid(): %d, argstr: %s, filename: %s, name: %s\n", execname(), pid(), argstr, filename, name) } }'

can be process tracd according to execname() + PATH containing binary - the equivalent of /proc/$PID/exe



3rd
===
according man stap the -L option should be the used to get possible variables.
Code:
[root@fedora ~]# stap -L 'syscall.open'
syscall.open name:string filename:string flags:long mode:long argstr:string $filename:char const* $flags:int $mode:int $ret:long int

works as expected

Now, how to know which variables can be used in all library calls ?
Code:
stap -vL 'kernel.function("*")' > kernel.functions

did not returns anything why

Also can somebody explain those variables with $ (target variables) They are those which can be used in source code of app ?

This code will run a long time .

4nd
===
where are described functions that can be used with stap ? Those in man stapfuncs ?
and tapsets are those in tapset refference ?

Yes, you are right.

Many thanks all
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Programming

Systemtap

Hi, I am a newbie to the systemtap. I was wondering is there a way I can write the data to file instead of printing on the screen. This way, I can process the systemtap output periodically using other programs. Thanks in advance!! Fidelity (2 Replies)
Discussion started by: fidelity
2 Replies

2. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

3. Shell Programming and Scripting

More ps questions.

Hey all, Thanks for all the help you have given me. Two more things I am trying to figure out. I need to issue a command..example ps -ef | grep <process> This would return about 10-15 running processes. I need to verify that there are x amount of processes running. What is... (7 Replies)
Discussion started by: jeffs42885
7 Replies

4. UNIX for Dummies Questions & Answers

A few questions...

I'm new to this UNIX world ! :D I login to a remote server (UNIX ) from an XP machine.. Let's say I need to download a window manager, I've decided upon wmaker .. But how do I go about it? How do I connect to the internet from my remote Unix X-Term terminal? And how do i install it? ... (2 Replies)
Discussion started by: halluc1nati0n
2 Replies

5. UNIX for Dummies Questions & Answers

3 questions in 1

Hi folks, 1. How can i know which version/type of unix i am running? any special commands?. I connect to a remote machine through SSH but have no clue what kind of unix that is (don't laugh :-)) 2. Why does the machine i connect to have $ sign as its shell prompt sign while solaris has #... (2 Replies)
Discussion started by: alikun
2 Replies

6. UNIX for Dummies Questions & Answers

Just a few questions.

Hi everyone im new to this forums, i just wanted to get started by asking a few question(Im a Unix newbie) 1. How do i sort a file called "dirr" in a ascending order on the 3rd column 2. what does alias on=who do Thanks in advance!!! (1 Reply)
Discussion started by: Da Paper
1 Replies

7. UNIX for Dummies Questions & Answers

questions

Dear Guys , I have some Questions , i need to have answeres for . 1. now if i took a back up for /etc/passwd and /etc/shadow , like simple copy .. and Install a new system , and paste those two files to the new system ... are the passwords and user info. going to work ?? is it posibble ? ... (1 Reply)
Discussion started by: tamemi
1 Replies
Login or Register to Ask a Question