Sponsored Content
Top Forums Programming How to calculate compilation time using c? Post 302742205 by Corona688 on Monday 10th of December 2012 06:56:52 PM
Old 12-10-2012
%i and %d mean integer, float or double would be %f.

I usually use this code:

Code:
#include <sys/time.h>
#include <sys/types.h>
#include <stdio.h>

/* returns a timestamp in microseconds */
int64_t micro(void)
{
	int64_t val;
	struct timeval tv;
	gettimeofday(&tv, NULL);
	val=tv.tv_sec;
	val*=1000000;
	val+=tv.tv_usec;
	return(val);
}

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. HP-UX

how to calculate CPU time under HP-UX

Hi, I am loking for a c++ function that calculate CPU time under HP-UX Thank you (1 Reply)
Discussion started by: limame
1 Replies

2. AIX

calculate time

Hi, How do I calculate time? I need to create an alert if a process is running more than 30 minutes. I need to get the first time and then get another, calculate it if more than 30 mins and then alert it to pager. Can't find it in internet. Thanks in advance, itik (2 Replies)
Discussion started by: itik
2 Replies

3. Shell Programming and Scripting

How to calculate the time difference...

Hi All, I've written a script which reads all the systems backup information and saves it in a log file. ssh -l ora${sid} ${primaryhost} "tail -2 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" |head -1 | awk '{print echo "PREVIOUS:-- Start Date&Time: " $3,$4,echo "|| End Date&Time:... (1 Reply)
Discussion started by: suri.tyson
1 Replies

4. Shell Programming and Scripting

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 do # Add one to the iteration... (3 Replies)
Discussion started by: zainab
3 Replies

5. UNIX for Dummies Questions & Answers

calculate the time

hello i want to display the time firstly when i run my shell script and after 25 min i want to display a message it says that the time left is 5 min. When the calculated time is 30 mins, the script should exit. can any one help me with that! Thanks in advance Regards :o (5 Replies)
Discussion started by: dndoon
5 Replies

6. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

7. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

8. Shell Programming and Scripting

How to calculate time

Hello Guys, I am trying to calculate total hours and minutes a given user has used the system since the beginning of the current month. #!/usr/bin/sh hr=0 min=0 last $1 | grep -w `date "+%b"` | grep -v '\(0:.*\)' | grep -vw sshd | cut -c 66- | tr -d "\(\)" | cut -f1 -d ":" | grep -v '.*' |... (9 Replies)
Discussion started by: kasparov
9 Replies

9. Shell Programming and Scripting

Calculate time difference

I have time in a file in HH:MM:SS format as it contents(its not the file creation time). i need this to be converted to epoch time or time since 1970. The time is written into that file by a script, which i cannot modify. Im using AIX machine $ cat abc.txt 10:29:34 (2 Replies)
Discussion started by: gpk_newbie
2 Replies

10. Shell Programming and Scripting

Calculate Time diff in milli milliseconds(Time format : HH:MM:SS,NNN)

Hi All, I have one file which contains time for request and response. I want to calculate time difference in milliseconds for each line. This file can contain 10K lines. Sample file with 4 lines. for first line. Request Time: 15:23:45,255 Response Time: 15:23:45,258 Time diff... (6 Replies)
Discussion started by: Raza Ali
6 Replies
nvpair_value_byte(9F)					   Kernel Functions for Drivers 				     nvpair_value_byte(9F)

NAME
nvpair_value_byte, nvpair_value_nvlist, nvpair_value_int8, nvpair_value_int16, nvpair_value_int32, nvpair_value_int64, nvpair_value_uint8, nvpair_value_uint16, nvpair_value_uint32, nvpair_value_uint64, nvpair_value_string, nvpair_value_boolean_array, nvpair_value_byte_array, nvpair_value_nvlist_array, nvpair_value_int8_array, nvpair_value_int16_array, nvpair_value_int32_array, nvpair_value_int64_array, nvpair_value_uint8_array, nvpair_value_uint16_array, nvpair_value_uint32_array, nvpair_value_uint64_array, nvpair_value_string_array - retrieve value from a name-value pair SYNOPSIS
#include <sys/nvpair.h> int nvpair_value_boolean_value(nvpair_t *nvpair, boolean_t *val); int nvpair_value_byte(nvpair_t *nvpair, uchar_t *val); int nvpair_value_int8(nvpair_t *nvpair, int8_t *val); int nvpair_value_uint8(nvpair_t *nvpair, uint8_t *val); int nvpair_value_int16(nvpair_t *nvpair, int16_t *val); int nvpair_value_uint16(nvpair_t *nvpair, uint16_t *val); int nvpair_value_int32(nvpair_t *nvpair, int32_t *val); int nvpair_value_uint32(nvpair_t *nvpair, uint32_t *val); int nvpair_value_int64(nvpair_t *nvpair, int64_t *val); int nvpair_value_uint64(nvpair_t *nvpair, uint64_t *val); int nvpair_value_string(nvpair_t *nvpair, char **val); int nvpair_value_nvlist(nvpair_t *nvpair, nvlist_t **val); int nvpair_value_boolean_array(nvpair_t *nvpair, boolean_t **val, uint_t *nelem); int nvpair_value_byte_array(nvpair_t *nvpair, uchar_t **val, uint_t *nelem); int nvpair_value_int8_array(nvpair_t *nvpair, int8_t **val, uint_t *nelem); int nvpair_value_uint8_array(nvpair_t *nvpair, uint8_t **val, uint_t *nelem); int nvpair_value_int16_array(nvpair_t *nvpair, int16_t **val, uint_t *nelem); int nvpair_value_uint16_array(nvpair_t *nvpair, uint16_t **val, uint_t *nelem); int nvpair_value_int32_array(nvpair_t *nvpair, int32_t **val, uint_t *nelem); int nvpair_value_uint32_array(nvpair_t *nvpair, uint32_t **val, uint_t *nelem); int nvpair_value_int64_array(nvpair_t *nvpair, int64_t **val, uint_t *nelem); int nvpair_value_uint64_array(nvpair_t *nvpair, uint64_t **val, uint_t *nelem); int nvpair_value_string_array(nvpair_t *nvpair, char ***val, uint_t *nelem); int nvpair_value_nvlist_array(nvpair_t *nvpair, nvlist_t ***val, uint_t *nelem); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
nvpair Name-value pair (nvpair) to be processed. nelem Address to store the number of elements in value. val Address to store the value or starting address of array value. DESCRIPTION
These functions retrieve the value of nvpair. The data type of nvpair must match the function name for the call to be successful. There is no nvpair_value_boolean(); the existence of the name implies the value is true. For array data types, including string, the memory containing the data is managed by the library and references to the value remains valid until nvlist_free() is called on the nvlist_t from which nvpair is obtained. See nvlist_free(9F) The value of an nvpair may not be retrieved after the nvpair having been removed from or replaced in an nvlist. Replacement can happen dur- ing pair addition on nvlists created with NV_UNIQUE_NAME_TYPE and NV_UNIQUE_NAME. See nvlist_alloc(9F) for more details. RETURN VALUES
0 Success EINVAL Either one of the arguments is NULL or type of nvpair does not match the interface name. CONTEXT
These functions can be called from user or interrupt context. SunOS 5.10 2 Feb 2004 nvpair_value_byte(9F)
All times are GMT -4. The time now is 12:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy