Sponsored Content
Top Forums Shell Programming and Scripting Measure thread execution (in C, unix) Post 302507492 by Tinkh on Thursday 24th of March 2011 06:37:19 AM
Old 03-24-2011
Thank you for reply Smilie

I already try to use CLOCK_THREAD_CPUTIME_ID but it does'nt work with Solaris 8.
I'm trying to use getrusage with RUSAGE_SELF (RUSAGE_LWP is not available in sys/resource.h, there's just RUSEGE_SELF and RUSAGE_CHILDREN). I hope it's a way to find solution ...

---------- Post updated at 11:37 AM ---------- Previous update was at 11:36 AM ----------

Bad news, I have a strange behaviour with getrusage.
My old function GET_TIME :


Code:
void GET_TIME(SYSTEM_TIME_TYPE * SystemTime, RETURN_CODE_TYPE * ReturnCode)
{ 
* SystemTime = gethrtime(); *ReturnCode=NO_ERROR;
}

The new one :



Code:
void GET_TIME2(SYSTEM_TIME_TYPE * SystemTime, RETURN_CODE_TYPE * ReturnCode)
{
    ret = getrusage(RUSAGE_SELF, &usage);
    * SystemTime = (usage.ru_utime.tv_sec*1000000 + usage.ru_utime.tv_usec)*1000;
    *ReturnCode=NO_ERROR;
}

Between two GET_TIME, time is 200 000 ns approximately.
With GET_TIME2, this value can reach 10 000 000 or -7000 and it's equal to 0 majority... Smilie

Last edited by Tinkh; 03-24-2011 at 10:17 AM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

CPU load unit of measure?

If unix says my cpu load is 2.15 exactly what does that mean? --Jason (1 Reply)
Discussion started by: Mac J
1 Replies

2. Forum Support Area for Unregistered Users & Account Problems

How to post a new thread (Regarding Unix related doubts) in Unix Forums

How to post a new thread (Regarding Unix related doubts) in Unix Forums. I registered my id but I am unable to post my Questions to Forum. Thanks & Regards, indusri (1 Reply)
Discussion started by: indusri
1 Replies

3. Shell Programming and Scripting

Is there a command to measure compile speed?

Hello Ive written 2 programs in shell and I need to compare their speed (Compile) against one another. what methods could I go about doing this? Is there a feature in shell do accommodate this? (2 Replies)
Discussion started by: Darklight
2 Replies

4. UNIX for Advanced & Expert Users

How to measure g++ performance?

I am working on an application with some rather interesting build performance issues. If we build on Solaris/Linux x86/AMD64 the build is rather fast, but it takes more than five times as long on our Solaris Sparc servers (single-threaded builds on the workstations, but multi-threaded on the... (5 Replies)
Discussion started by: Elric of Grans
5 Replies

5. Solaris

What exactly does 'zpool iostat' measure?

hi there, i'd like to know what exactly zpool's iostat (-v) output measure, especially the writes. Is it only the writes to the ZIL or all writes (including commmits) to the disks? if anyone knows, that'd be helpful roti (1 Reply)
Discussion started by: rotunda
1 Replies

6. UNIX for Advanced & Expert Users

Implementing thread in UNIX

Hi For our load testing , we are using stubs (unix shell script) which send the response to the request coming from the application. As the unix stub is single threaded , it is responding to only one request whereas multiple requests come in parallely. I haven't worked on thread concepts... (5 Replies)
Discussion started by: jenanee
5 Replies

7. AIX

How to measure waiting time in run queue?

Hello guys, I am doing a performance analysis on one of our psystem. Most of time I am using Nmon analyser to do my trend graph. But I can't find any help with it. We are interesting in the time spend by tasks in Aix run queue. After looking the Aix documentation, I am pessimist to find any... (3 Replies)
Discussion started by: GiiGii
3 Replies

8. Solaris

How to measure IOPS?

Hi I have a system running solaris 10, and I intend to use a NetApp as its storage system. The application requires a throughput between the server and the storage 7000 disk IOPS (random IO sustained throughput with response time of 20 mili second and 16k block size). How to make sure that I... (6 Replies)
Discussion started by: fretagi
6 Replies

9. Shell Programming and Scripting

Python Thread Execution Issue . . .

Greetings! I set up a basic threading specimen which does the job:#!/usr/bin/python import threading class a(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print("thread a finished") class b(threading.Thread): ... (0 Replies)
Discussion started by: LinQ
0 Replies
PTHREAD(3)						   BSD Library Functions Manual 						PTHREAD(3)

NAME
pthread -- POSIX Threads Library LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> cc [flags] files -lpthread [libraries] DESCRIPTION
The pthread library provides an implementation of the standard POSIX threads library. The NetBSD implementation is based on 1:1 thread model, therefore each pthread has a kernel thread, called a light-weight process (LWP). Note that the system private thread interfaces upon which the pthread library is built are subject to change without notice. In order to remain compatible with future NetBSD releases, programs must be linked against the dynamic version of the thread library. Statically linked programs using the POSIX threads framework may not work when run on a future version of the system. FUNCTIONS
The following functions comprise the core of the pthread library: Function Description pthread_attr(3) thread attribute operations pthread_barrier_destroy(3) destroy a barrier pthread_barrier_init(3) create a barrier pthread_barrier_wait(3) wait for a barrier pthread_barrierattr(3) barrier attribute operations pthread_cancel(3) cancel the execution of a thread pthread_cleanup_push(3) add or remove cleanup functions pthread_cond_broadcast(3) unblock one or more threads pthread_cond_destroy(3) destroy a condition variable pthread_cond_init(3) create a condition variable pthread_cond_wait(3) wait for a condition variable pthread_condattr(3) condition attribute operations pthread_create(3) create a new thread pthread_detach(3) detach a thread pthread_equal(3) compare thread identifiers pthread_exit(3) terminate the calling thread pthread_getspecific(3) get a thread-specific data value pthread_join(3) wait for thread termination pthread_key_create(3) thread-specific data key creation pthread_key_delete(3) delete a thread-specific data key pthread_kill(3) send a signal to a specific thread pthread_mutex_destroy(3) free a mutex pthread_mutex_init(3) create a mutex pthread_mutex_lock(3) acquire a lock on a mutex pthread_mutex_unlock(3) unlock a mutex pthread_mutexattr(3) mutex attribute operations pthread_once(3) dynamic package initialization pthread_rwlock_destroy(3) destroy a read/write lock pthread_rwlock_init(3) initialize a read/write lock pthread_rwlock_rdlock(3) acquire a read/write lock for reading pthread_rwlock_unlock(3) release a read/write lock pthread_rwlock_wrlock(3) acquire a read/write lock for writing pthread_rwlockattr(3) read/write lock attribute operations pthread_schedparam(3) thread scheduling manipulation pthread_self(3) get the ID of the calling thread pthread_setspecific(3) get a thread-specific data value pthread_sigmask(3) manipulate a thread's signal mask pthread_spin_destroy(3) destroy a spin lock pthread_spin_init(3) initialize a spin lock pthread_spin_lock(3) acquire a spin lock pthread_spin_unlock(3) release a spin lock pthread_testcancel(3) set cancelability state ENVIRONMENT
The following environment variables affect the behavior of the library: PTHREAD_DIAGASSERT Possible values are any combinations of: A Report errors to application by error return, but do not abort. a Abort on errors, creating a core dump for further debugging. E Do not log errors to stdout. e Log errors to stdout. L Do not log errors via syslogd(8). l Log errors via syslogd(8). If not set in the environment, the pthread library behaves as if AEL has been specified. PTHREAD_STACKSIZE Integer value giving the stack size in kilobytes. This allows to set a smaller stack size than the default stack size. The default stack size is the current limit on the stack size as set with the shell's command to change limits (limit for csh(1), or ulimit for sh(1)). SEE ALSO
David R. Butenhof, Programming with POSIX(R) Threads, Addison-Wesley, 1997. STANDARDS
The pthread library conforms to IEEE Std 1003.1-2001 (``POSIX.1''). CAVEATS
Due to limitations in the current pthread implementation, makecontext(3) and sigaltstack(2) should not be used in programs which link against the pthread library (whether threads are used or not). BSD
May 16, 2010 BSD
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy