UNIX does usually fully support getrusage -- you may have to enable XOPEN support. What version of unix do you have?
will show you.
If the system is from the last 15 years there will be macro defined that "turns on" XOPEN support. It looks like one of these
#define _XOPEN_SOURCE causes restrictions on Darwin - OSX (Apple) rather than extensions.
You have to read your system/compiler documentation (man pages) - specifcally the one for getrusage.
If valgrid reports memory leaks, fix them regardless of what one of your buddies says. Otherwise you are programming by coincidence, not design.
Hi All,
I have a pair of sun ultra 5_10 with SunOS 5.5.1.
Both are almost equally patched and set up with simillar applications.
host# uname -a
SunOS host 5.5.1 Generic_103640-24 sun4u sparc SUNW,Ultra-5_10
Even though both have
same amount of RAM ( 512 Mb ) ,
... (1 Reply)
Hi,
I am new to Unix and shell programming.
I am trying to write a shell program to read 4 variables from command line.
For example,
Please enter your name: somebody
Please enter your address: address
plase enter your phone: phone
I'd like to save all threee variables in my program for... (3 Replies)
What is amount of free RAM i have now?
total used free shared buffers cached
Mem: 1010 963 46 0 215 256
-/+ buffers/cache: 491 518
Swap: 1983 0 1983
Above is the output of... (1 Reply)
I am trying to write a small (and rather simple) script to gather some info about the system and piping it to dzen2
first, i want to explain some things.
I know i could have used conky, but my intention was to expand my knowledge of bash, pipes and redirections inside a script, and to have fun... (14 Replies)
Hi
I'm running a program many times with differents input.
I mean that i run my_prog with some parameters and i wait till the end, then i start again another simulations with some others differents parameters.
Is possible to make it automatic with a script bash.
Maybe i need some... (2 Replies)
Hi Gurus,
I'm using HPUX B.11.23 U ia64 with sh shell.
Is it possible to insert a word "Warning" in the end of this line if there is high percentage? For example: if the percentage is higher than 80%?
Sample data:
/dev/vgsap/TEST1 /oracle/TST/TEST1 9.89 GB 8.37 GB ... (11 Replies)
Hi all,
Can you please tell me the command, with which one can know the amount of space a specific directory has used.
df -k . ---> Displays, the amount of space allocated, and used for a directory.
du -k <dir name> - gives me the memory used of all the files inside <dir>
But i... (2 Replies)
Hi,
I have a fortran program with serial and MPI version. I want to compare the time taken by these programs to run. I use ifort/gfortran compiler.
How to compare the time taken by each program to run? Is there any sample code for comparison?
Thanks,
rpd (1 Reply)
We have a program source C and is required to indicate how many times each function is called from the C program. also print the line number where there is a call.
I've tried something like this:
#!/bin/sh
for i in $*;do
if !
then
echo $i is not a C file.
else echo $i... (0 Replies)
Hi,
I'm looking into doing a few performance tweaks by adjusting my max memory on a few lpars.
I would to create a time stamp script so i could review it for a week and determine how much space i can lower my max memory to so i could reclaim and allocate that memory to where it is needed the... (2 Replies)
Discussion started by: vpundit
2 Replies
LEARN ABOUT LINUX
wait3
WAIT4(2) Linux Programmer's Manual WAIT4(2)NAME
wait3, wait4 - wait for process to change state, BSD style
SYNOPSIS
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
pid_t wait3(int *status, int options,
struct rusage *rusage);
pid_t wait4(pid_t pid, int *status, int options,
struct rusage *rusage);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
wait3():
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
wait4():
_BSD_SOURCE
DESCRIPTION
The wait3() and wait4() system calls are similar to waitpid(2), but additionally return resource usage information about the child in the
structure pointed to by rusage.
Other than the use of the rusage argument, the following wait3() call:
wait3(status, options, rusage);
is equivalent to:
waitpid(-1, status, options);
Similarly, the following wait4() call:
wait4(pid, status, options, rusage);
is equivalent to:
waitpid(pid, status, options);
In other words, wait3() waits of any child, while wait4() can be used to select a specific child, or children, on which to wait. See
wait(2) for further details.
If rusage is not NULL, the struct rusage to which it points will be filled with accounting information about the child. See getrusage(2)
for details.
RETURN VALUE
As for waitpid(2).
ERRORS
As for waitpid(2).
CONFORMING TO
4.3BSD.
NOTES
Including <sys/time.h> is not required these days, but increases portability. (Indeed, <sys/resource.h> defines the rusage structure with
fields of type struct timeval defined in <sys/time.h>.)
On Linux, wait3() is a library function implemented on top of the wait4() system call.
SEE ALSO fork(2), getrusage(2), sigaction(2), signal(2), wait(2), signal(7)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-20 WAIT4(2)