10-31-2011
you are using wrong format for printing out the tms structure members, which are clock_t and you use %f
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i need to output an ls command to a file but also capture any errors from that command and output them to a log file and the screen.
if it's only possible to output them to a log file and not the screen then that's fine.
this is what i've tried so far, but it won't populate log.txt. i've... (16 Replies)
Discussion started by: mjays
16 Replies
2. AIX
Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies
3. Shell Programming and Scripting
Okay, not sure if it can be done, I would think it could be done and I'm just having a hard time with it.
fun_close_wait(){
ipVar="${1} ${2}"
portVar=`cat "${5}" | cut -d' ' -f 1`
for ip in $ipVar
do
for port in $portVar
do
netstatVar=`netstat -n | grep... (4 Replies)
Discussion started by: cbo0485
4 Replies
4. UNIX for Advanced & Expert Users
iam trying to built a firewall.so i have used netfilter for it.
in function main_hook sock_buff is returning null and in my log file continuously "sock buff null" is printed plse help to solve this problem..
(using print_string iam printing strings on current terminal (terminal we ping))
... (1 Reply)
Discussion started by: pavan6754
1 Replies
5. UNIX for Dummies Questions & Answers
Hi
I am new to the forum and would like to ask:
i have a file in form with thousands of column
id.1 A01 A01 A68 A68
id.2 A5 A5 A3 A3
1001 0 0 0.136 0.136
1002 0 0 0.262 0.183
1003 0 0 0.662 0.662
1004 0 0 ... (9 Replies)
Discussion started by: newbeeuk
9 Replies
6. UNIX for Dummies Questions & Answers
Ok, so i monitor disk space on remote machines using snmp. Works great for me. But whenever a particular partition happens to have Terabytes of data, snmp starts reporting negative values.
Can someone please tell me how to get around this problem?
The AllocationUnit is 512 bytes. Weird... (0 Replies)
Discussion started by: SkySmart
0 Replies
7. Programming
I have this code where I have declared a struct with some functions. Trying to write the function implementation outside the struct declaration and do not know how to proceed.
#ifndef ParseEl_hh
#define ParseEl_hh
#include <iostream>
#include <fstream>
#include "DynBaseObj.hh"... (7 Replies)
Discussion started by: kristinu
7 Replies
8. UNIX for Dummies Questions & Answers
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)
Discussion started by: oana06
0 Replies
9. Shell Programming and Scripting
Hi
I am pretty confused in returning and capturing multiple values
i have defined a function which should return values "total, difference"
i have used as
#!/usr/bin/ksh
calc()
{
total=$1+$2
echo "$total"
diff=$2-$1
echo "$diff"
}
I have invoked this function as
calc 5 8
Now i... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
10. Shell Programming and Scripting
Hi,
I have a small part of a project which is done as a bash script. bash was selected as an portability issue that works out of the box. In this script I have an exec shell-function, a wrapper around arbitrary commands. I want to have STDOUT, as an addon STDERR and the EXIT-CODE of a specified... (5 Replies)
Discussion started by: stomp
5 Replies
TIMES(3) BSD Library Functions Manual TIMES(3)
NAME
times -- process times
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/times.h>
clock_t
times(struct tms *tp);
DESCRIPTION
This interface is obsoleted by getrusage(2) and gettimeofday(2).
The times() function returns the value of time in CLK_TCK's of a second since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated
Universal Time.
It also fills in the structure pointed to by tp with time-accounting information.
The tms structure is defined as follows:
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
};
The elements of this structure are defined as follows:
tms_utime The CPU time charged for the execution of user instructions.
tms_stime The CPU time charged for execution by the system on behalf of the process.
tms_cutime The sum of the tms_utimes and tms_cutimes of the child processes.
tms_cstime The sum of the tms_stimes and tms_cstimes of the child processes.
All times are in CLK_TCK's of a second.
The times of a terminated child process are included in the tms_cutime and tms_cstime elements of the parent when one of the wait(2) func-
tions returns the process ID of the terminated child to the parent. If an error occurs, times() returns the value ((clock_t)-1), and sets
errno to indicate the error.
ERRORS
The times() function may fail and set the global variable errno for any of the errors specified for the library routines getrusage(2) and
gettimeofday(2).
SEE ALSO
time(1), getrusage(2), gettimeofday(2), wait(2)
STANDARDS
The times() function conforms to IEEE Std 1003.1-1988 (``POSIX.1'').
BSD
December 1, 2008 BSD