The reason I use uptime instead of /proc/loadavg because I wish to use same coding for Solaris, I see the Solaris uptime same as mine SUSE.
So any idea why the calculation showing error?
Does your Solaris system use the same version of ksh?
ksh93 supports floating point. You do not need the external bc program
Something like
Also, remove the quotes
Those are strings and not numbers.
is it not possible to simply di aritmetic without using bc or awk
i have tried folllowing operatrions but they support only integer types plz suggest me code for floating using values stored in the variables.the ans i get is integer and if i input floating values i get error numeric constant... (6 Replies)
I am begining to learn bourne shell and as a practice I have written a script which when given the purchase price and percentage of discount calculates the savings.
I somehow cannot figure out why my script fails to do arthimatic calculation on real numbers.
Could anyone look at the script... (5 Replies)
hi,
i have a bash script that i want to receive a a string from another bash file. But because the string has a dot in the middle it gives me an error. The error is in this line:
let valor=$1
and the value passed is rules.txt
the error is:
let: valor=rules.txt: syntax error: invalid... (2 Replies)
i'm trying to make a script to simply add numbers together
for example i have a file script file called add
add 1 2 3 4 5
15
however i want the user to put at least 3 numbers so i did this
if
then
echo "please enter more than two numbers"
exit 1
fi
but it's telling me i have... (3 Replies)
hi there again,
i need to do a simple division with my data with a number of rows. i think i wanted to have a simple output like this one:
col1 col2 col3
val1 val2 val1/val2
valn valm valn/valm
any suggestion is very much appreciated. thanks much. (2 Replies)
I am writing a script in zsh shell, it fetchs a number from a file using the awk command, store it as a variable, which in my case is a small number 0.62000. I want to change this number by multiplying it by 1000 to become 620.0 using the command in the script
var2=$((var1*1000))
trouble is... (2 Replies)
Hi,
I am trying to do an addition to a value stored in a variable...
var1=`grep -n "match" sample.txt|cut -d : -f1`
var2=`echo $var1|cut -d " " -f1` (Here i want add +1 to the output value) (4 Replies)
Hi experts,
I'm facing trouble with the below bash script, any help is appreciated
#!/usr/bin/bash
..
if (( "${date1}" > "${l_date1}" ))
then
echo "success"
else
echo "nothing"
fi
the variable date1 contains 08/06/2013 and l_date1 contains 10/08/2013
this small script to... (6 Replies)
Hello.
LEAP_VERSION="4.2"
export ARRAY_MAIN_REPO_LEAP=('zypper_local' 'openSUSE-Leap-'"$LEAP_VERSION"'-Non-Oss' 'openSUSE-Leap-'"$LEAP_VERSION"'-Oss' 'openSUSE-Leap-'"$LEAP_VERSION"'-Update' 'openSUSE-Leap-'"$LEAP_VERSION"'-Update-Non-Oss')Seems that the - is interpreted as a numeric... (2 Replies)
Hi guys...
I am working on limited basic set of maths routines for ksh93 that can be sourced as . ./ksh_math.sh and I am gobsmacked by its capabilities.
Although some big guns may already know this, I didn't, and ksh93 is easily able to do floating point numbers to floating point powers and... (16 Replies)
Discussion started by: wisecracker
16 Replies
LEARN ABOUT NETBSD
i386_pmc_read
I386_PMC_INFO(2) BSD/i386 System Calls Manual I386_PMC_INFO(2)NAME
i386_pmc_info, i386_pmc_startstop, i386_pmc_read -- interface to CPU performance counters
LIBRARY
i386 Architecture Library (libi386, -li386)
SYNOPSIS
#include <sys/types.h>
#include <machine/sysarch.h>
#include <machine/specialreg.h>
int
i386_pmc_info(struct i386_pmc_info_args *ia);
int
i386_pmc_startstop(struct i386_pmc_startstop_args *ssa);
int
i386_pmc_read(struct i386_pmc_read_args *ra);
DESCRIPTION
These functions provide an interface to the CPU performance counters on the 586-class and 686-class processors.
i386_pmc_info() will return information about the available CPU counters. The information is returned in ia having the following structure:
struct i386_pmc_info_args {
int type;
int flags;
};
The type member describes the class of performance counters available. Valid values are:
PMC_TYPE_NONE No PMC support
PMC_TYPE_I586 586-class CPUs
PMC_TYPE_I686 686-class Intel CPUs
PMC_TYPE_K7 686-class AMD CPUs
The flags member describes additional capabilities of the processor. Valid values are:
PMC_INFO_HASTSC CPU has time-stamp counter
i386_pmc_startstop() is used to start and stop the measurement of the CPU performance counters. The argument ssa has the following struc-
ture:
struct i386_pmc_startstop_args {
int counter;
uint64_t val;
uint8_t event;
uint8_t unit;
uint8_t compare;
uint8_t flags;
};
The counter specified by the member counter is started if the member flags has PMC_SETUP_KERNEL or PMC_SETUP_USER set, otherwise the counter
is stopped. The initial value of the counter is set to val. Additional values for the flags member are PMC_SETUP_EDGE and PMC_SETUP_INV.
The event member specifies some event written to the control register. The unit member specifies the measurement units. The compare member
is a mask for the counter.
i386_pmc_read() will return information about a specific CPU counter measured during the last measurement period determined by the calling of
i386_pmc_startstop(). The information is returned in ra having the following structure:
struct i386_pmc_read_args {
int counter;
uint64_t val;
uint64_t time;
};
The counter to read should be specified by the counter member. Counters are numbered from 0 to PMC_NCOUNTERS. The value of the counter is
returned in the val member. The time since epoch, measured in CPU clock cycles, is returned in the time member.
RETURN VALUES
Upon successful completion zero is returned, otherwise -1 is returned on failure.
BSD November 10, 2001 BSD