compute compilation time using script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting compute compilation time using script
# 1  
Old 10-01-2008
compute compilation time using script

Hi,

I use this script to compute compilation time several time to get system performance and compare different system:

#!/bin/sh
# measure the different between time before and
# after the compilation of benchmark

# Start at iteration 1
num=1
while [ $num -le 10 ]
do
# Add one to the iteration number
num=`expr $num + 1`
sec1=`date | cut -c18-19`

gcc benchmark.c

sec2=`date | cut -c18-19`
result=`expr $sec2 - $sec1`

if [ $result -le 0 ]
then
echo The compilation time = 0
else
echo The compilation time = $result
fi

done

the output is compilation time in sec ( which is large):
The compilation time = 1
The compilation time = 0
The compilation time = 1
The compilation time = 0
The compilation time = 1
The compilation time = 1
The compilation time = 0
The compilation time = 1
The compilation time = 0
The compilation time = 1

how to get time in micro or milli second?

appreciate your help...
# 2  
Old 10-01-2008
zainab,

Instead of using like this. why cant you use time function.

For eg :
Code:
time gcc benchmark.c

This will return the time taken to execute the program.
# 3  
Old 10-01-2008
you can use
Code:
timex programname

to get the time details
# 4  
Old 10-02-2008
thank you soooooooo muchSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compilation error character is missing-UNIX shell script

Dear Friends, Regarding Compilation error character is missing-unix shell script I am new to unix shell script. My requirement is --I need to find out 3 files in my UBM unix directory,if any one(CMUSER) file is available means,then i need to exit from my unix script, Below is my unix... (2 Replies)
Discussion started by: Joseph2017
2 Replies

2. Shell Programming and Scripting

Shell or awk script to compute average of all the points within a circle

HI Help, I have a file which looks like below --- Input file ---> 1970113.00000 3460.00000 1.09516 1970116.00000 3791.00000 1.06350 1970120.00000 4120.00000 1.07588 1970115.00000 4450.00000 1.09591 1970116.00000 4780.00000 1.09965 1970120.00000 5109.00000 1.06733 ... (7 Replies)
Discussion started by: Indra2011
7 Replies

3. Programming

How to calculate compilation time using c?

is there function with library "time.h" to calculate the processing time of the code? (3 Replies)
Discussion started by: fwrlfo
3 Replies

4. Shell Programming and Scripting

Unix Script Help - to grep an output and compute

Hi guys, I'm not a frequent visitor of this site so please forgive if this has been asked before. I'm trying to monitor the swap memory usage on my Solaris 10 Unix server. The command I'm wanting to run is: swap -s The output is: total: 33332016k bytes allocated + 40373832k... (2 Replies)
Discussion started by: d-train
2 Replies

5. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

6. Web Development

How to compute previous and next buttons?

I have a project to migrate my club's membership database from Access to web based using MySQL/PHP, but I have a problem I can't get my head around and would appreciate some help... Background... I want to be able to display each member's data on screen and add a Previous and Next button to move... (2 Replies)
Discussion started by: JerryHone
2 Replies

7. Shell Programming and Scripting

Extract info from log file and compute using time date stamp

Looking for a shell script or a simple perl script . I am new to scripting and not very good at it . I have 2 directories . One of them holds a text file with list of files in it and the second one is a daily log which shows the file completion time. I need to co-relate both and make a report. ... (0 Replies)
Discussion started by: breez_drew
0 Replies

8. Shell Programming and Scripting

Compilation errors in running configure script

Hi all, I tried to cross compile Ghostscript-8.54 source. I am getting some errors during cross compilation. I have pasted the errors below. CC=arm-unknown-linux-gnu-gcc LD=arm-unknown-linux-gnu-ld ./configure --host=i686-pc-linux-gnu --target=arm-unknown-linux-gnu --without-x && make ... (2 Replies)
Discussion started by: siva4ever
2 Replies

9. Shell Programming and Scripting

Script to check good compilation of packets

Hi, I'm making a script to compile some packets and I need for each one to check if the compilation is good... I need to check if "./configure" and "make" runs correctly. Are any scripting commands to make this? For example, the solution can be a command that get the program's exit code... (1 Reply)
Discussion started by: paolom
1 Replies

10. Shell Programming and Scripting

to compute diskspace

Guys, have any idea for the script like this? also to compute w/ decimal. thanks a=10 b=20 c=30 d=40 if a < b then ( a -b)*1024 = free space b + (c -d) = total space if a > b then (b / d)*1024 = cpu (3 Replies)
Discussion started by: kenshinhimura
3 Replies
Login or Register to Ask a Question