How to get the time cost of functions?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get the time cost of functions?
# 1  
Old 10-28-2008
How to get the time cost of functions?

hi,
There is a shell including many functions, when I run ksh -x/-v to see the call sequence, but how do I know which function cost more?
Of course, use time CMD to get the scripts runnning time, while it can not tell me which cost more.
Thanks very much.
a2156z
# 2  
Old 10-28-2008
Well, you could do something like this:
Code:
if [ $TIME ]; then 
  PREFIX=time
else
  PREFIX=""
fi

$PREFIX myfunc arg1 arg2 arg3

$PREFIX myfunc2 arg1 arg2 arg3 | $PREFIX myfunc3 arg1

Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

2. UNIX for Advanced & Expert Users

why sshd cost different memory in the same system

It is a little bit weird to me when i found this on a solaris 9 system with openssh package. Below is the result copied from "top" output: PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND 13491 root 1 59 0 27M 18M sleep 0:06 0.00% sshd -i 20198 root ... (1 Reply)
Discussion started by: sleepy_11
1 Replies

3. UNIX for Dummies Questions & Answers

How to get UNIX tutorials(Free of Cost)

I wanted to learn UNIX & Shell Programming.Now i want material at free of cost.Where can i get ...tell me the SItes to get the tutorials (3 Replies)
Discussion started by: hairamu
3 Replies

4. Programming

time functions help?

Hello to anyone who can help me! I am in need of some help in procuring a more exact timing scheme in C for use with gcc. I manage to get a timing in seconds just fine using difftime(). However, I need more accurate.. milliseconds... no clue. Please help? Brian (2 Replies)
Discussion started by: bcowan
2 Replies

5. UNIX for Dummies Questions & Answers

The Cost Of UNIX

Can Anyone Tell Me The Cost Of UNIX As I'm Considering Finally Getting Rid Of This Rubbish Windows Based OS. I Would Also Like To Know Anyones Opinions On The Best Free Version, Thanks. (1 Reply)
Discussion started by: OSNovice
1 Replies
Login or Register to Ask a Question