Sponsored Content
Top Forums Shell Programming and Scripting Performance degradation with KSH93 Post 302303304 by i.f.schulz on Thursday 2nd of April 2009 10:27:06 AM
Old 04-02-2009
I have two output files. First I get some values from the first file, then I calculate values from the second file that are based on the first one. If you're wondering why I have semicolons at the end of each line, it's because the code is being joined in one string and executed by the "eval" command.

This code takes a couple of seconds for the first calculation and after the 50th it takes more than 1 minute, even though the output files are similar to each other in length.

# Timestamp
u_start=`perl -e 'print time()'`;

# Read values from EnvOPT.dat:? file
if [[ -a EnvOPT.dat:$OFP ]]; then
for x in `grep -e "^Contrail_Length " -e "^Contrail_Climate_Impact " -e "^Contrail_ETS_Cost " -e "^CO2_Emissions " -e "^CO2_Climate_Impact " -e "^CO2_ETS_Cost " EnvOPT.dat:$OFP`; do
param=`echo $x | awk '{print $1}'`;
value=`echo $x | awk '{print $3}'`;

case $param in
Contrail_Length) contrail_length="$value"; ;;
Contrail_Climate_Impact) contrail_climate_impact="$value"; ;;
Contrail_ETS_Cost) contrail_ets_cost="$value"; ;;
CO2_Emissions) co2_emissions="$value"; ;;
CO2_Climate_Impact) co2_climate_impact="$value"; ;;
CO2_ETS_Cost) co2_ets_cost="$value"; ;;
esac;
done;

# Edit both files, keep only important lines
sed '/#OFP_DEP_DEST#/,/ROUTING_TEXT/!d' ProfOPT.dat:$OFP | sed -e '1,12d' -e '$d' > ProfOPT.dat:tmp;
sed '/#Section MetPhenomIndices#/,$!d' EnvOPT.dat:$OFP | sed '1,3d' > EnvOPT.dat:tmp;

# Save edited files in array
set -A u_prof $(< ProfOPT.dat:tmp);
set -A u_env $(< EnvOPT.dat:tmp);

v=0;
# Number of lines (equal in both files)
u=${#u_prof[@]};
fuel_night=0;
while (( $v < $((u-1)) )); do
# Get values from first file (column 3)
val1=`echo ${u_env[$v]} | awk '{print $3}'`;
val2=`echo ${u_env[$((v+1))]} | awk '{print $3}'`;
# If values at line "i" and "i+1" equals "0" then...
if (( $val1 == 0 && $val2 == 0 )); then
# Get values from second file
(column 13)
val1=`echo ${u_prof[$v]} | awk '{print $13}'`;
val2=`echo ${u_prof[$((v+1))]} | awk '{print $13}'`;
# Calculate delta fuel and add to total fuel
fuel_night=$((fuel_night+val2-val1));
fi;
((v+=1));
done;
fi;

u_end=`perl -e 'print time()'`;
echo " Elapsed time: $((u_end-u_start)) seconds";

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh93 deprecation...

Any means of running ksh93 in a ksh88-mode? Might sound odd, but I want/need to restrict U/Win-developed scripts to correspond to the ksh88 version on my Solaris environment(s). Thanks. (2 Replies)
Discussion started by: curleb
2 Replies

2. Shell Programming and Scripting

ksh88 or ksh93

Hi all! Does anybody know how can I check if any UNIX installation has implemented ksh88 or ksh93? Thanks in advance. Néstor. (3 Replies)
Discussion started by: Nestor
3 Replies

3. UNIX for Advanced & Expert Users

Install ksh93 for cygwin

Hi, Does anyone know where can I get ksh93 for installation on CYGWIN. Thanks? (1 Reply)
Discussion started by: devtakh
1 Replies

4. UNIX for Advanced & Expert Users

Gurus needed to diagnose severe performance degradation

Hi everyone, newbie forum poster here. I'm an Oracle DBA and I require some guidance from the Unix gurus here about how to pinpoint where a problem is within a Solaris 9 system running on an 8 CPU Fujitsu server that acts as our Oracle database server. Our sysadmins are trying their best to... (13 Replies)
Discussion started by: DBA_guy
13 Replies

5. UNIX for Advanced & Expert Users

Writing Custom Builtins for KSH93

I am looking to create some ksh93 extensions using the custom builtin feature. I can successfully create a builtin function, load it using the builtin -f command and get an output. However, I want to get/set values of KSH variables from within my built-in. For example, lets say I am creating... (2 Replies)
Discussion started by: a_programmer
2 Replies

6. Shell Programming and Scripting

ksh93 different results using -x option

This problem seems to be specific to ksh93. If you run with set -x some scripts don't work properly. For example: $ cat ksh.test2 ] && print FUBAR! || print OK! $ $ /bin/ksh93 ksh.test2 OK! $ /bin/ksh93 -x ksh.test2 + ] + print FUBAR! FUBAR! $ Trying to find out why this is... (8 Replies)
Discussion started by: lthorson
8 Replies

7. UNIX for Advanced & Expert Users

Embed tcl in ksh93 script

Hello everyone, I am trying to embed some tcl code inside a ksh93 script but I am not having any success. I even tried the simplest of code, something like this: . . jk=$(echo $(tcl << | write_file junkme "test"' | )) just to see if a file gets written. When I run there are no errors, but ... (3 Replies)
Discussion started by: gio001
3 Replies

8. Shell Programming and Scripting

Solaris 11 ksh93 if condition issue

Solaris 11 ksh93 if condition issue Has anyone run into issues with Solaris 11 with ksh93 if condition where it intermittently return wrong return code? We did not see this issue in Solaris 10 with ksh88 Any thoughts? Thanks! Solaris version: SunOS t52-ccc-28 5.11 11.2... (4 Replies)
Discussion started by: nugent
4 Replies

9. UNIX for Advanced & Expert Users

Ksh93 on Linux compatible with ksh93 on AIX

Hi Experts, I have several shell scripts that have been developed on a Linux box for korn ksh93. If we want to run this software on an AIX 6.1 box that runs ksh88 by default can we just change the she-bang line to reference /bin/ksh93 which ships with AIX as its "enhanced shell" to ensure... (6 Replies)
Discussion started by: Keith Turley
6 Replies

10. AIX

Ksh93/AIX compatibility

Hi everyone ! Im trying to know from wich version of AIX KSH93 is available ? Internet tell me 6.x and 7.x AIX are available, bue what about 5.x ? Is KSH93 available on AIX 5.x ? Is it the same way to manipulate variables as KSH93 on 7.x ? Thanks for your support and have a nice day ! (2 Replies)
Discussion started by: majinfrede
2 Replies
ACTDIAG(1)						      General Commands Manual							ACTDIAG(1)

NAME
actdiag - generate activity-diagram image file from spec-text file. SYNOPSIS
actdiag [options] files DESCRIPTION
This manual page documents briefly the actdiag commands. actdiag is a program that generate activity-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. -h, --help show this help message and exit -a, --antialias Pass diagram image to anti-alias filter -c FILE, --config=FILE read configurations from FILE -o FILE write diagram to FILE -f FONT, --font=FONT use FONT to draw diagram -s, ----separate Separate diagram images for each group (SVG only) -T TYPE Output diagram as TYPE format SEE ALSO
The programs are documented fully by http://tk0miya.bitbucket.org/actdiag/build/html/index.html AUTHOR
actdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). June 5, 2011 ACTDIAG(1)
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy