Sponsored Content
Top Forums Shell Programming and Scripting How to get the time cost of functions? Post 302251880 by otheus on Tuesday 28th of October 2008 09:46:32 AM
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

 

5 More Discussions You Might Find Interesting

1. 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

2. 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

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. 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

5. 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
times(1)							   User Commands							  times(1)

NAME
times - shell built-in function to report time usages of the current shell SYNOPSIS
sh times ksh times DESCRIPTION
sh Print the accumulated user and system times for processes run from the shell. ksh Print the accumulated user and system times for the shell and for processes run from the shell. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), sh(1), time(1), attributes(5) SunOS 5.10 15 Apr 1994 times(1)
All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy