Sponsored Content
Top Forums Programming Efficient logging of time measurements Post 302767743 by expl on Thursday 7th of February 2013 11:24:25 AM
Old 02-07-2013
Quote:
Originally Posted by tamil.pamaran
Which one will be better to send measurements from measured thread to logging thread?
Shared memory with mutex or Non blocking messages(pipe,...)
Well that would depend on what exact 'shared memory' model you are going to use and frequency of the logging code. Also you might want to consider sampling algorithm if the code runs at very high frequency on a production platform, that basically means that you only measure every Nth run and its much more suitable for logging for extended amount of time a piece of code that is very frequent.

Another suggestion:
Sometimes real time execution results can be not very meaningful for fast sections of code due to thread scheduler making them apear random on a busy system, you should probably instead log CPU time (CPU Time - The GNU C Library) as it has more meaning.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Efficient Dispatching

Does anyone know what's new with Efficient dispatching in the Solaris 2.8 release (vs Solaris 2.6) release? Specifically, does anyone know of a good website to get detailed information on thread dispatching using efficient dispatching in solaris 2.8? Thank you. (1 Reply)
Discussion started by: uchachra
1 Replies

2. Shell Programming and Scripting

Is there a more efficient way?

I'm using korn shell to connect to oracle, retrieve certain values, put them in a list, and iterate through them. While this method works, I can't help but think there is an easier method. If you know of one, please suggest a shorter, more efficient method. ############### FUNCTIONS ... (6 Replies)
Discussion started by: SelectSplat
6 Replies

3. Shell Programming and Scripting

Efficient way of Awk

Hi, Can someone let me know if the below AWK can be made much simpler / efficient ? I have 200 fields, I need to substr only the last fields. So i'm printing awk -F~ 'print {$1, $2, $3....................................$196,$197 , susbstr($198,1,3999), substr($199,1,3999)..}' Is there a... (4 Replies)
Discussion started by: braindrain
4 Replies

4. Shell Programming and Scripting

Can you suggest a more efficient way for this?

Hi I have the following at the end of a service shutdown script used in part of an active-passive failover setup: ### # Shutdown all primary Network Interfaces # associated with failover ### # get interface names based on IP's # and shut them down to simulate loss of # heartbeatd ... (1 Reply)
Discussion started by: mikie
1 Replies

5. Shell Programming and Scripting

Is there a way to make this more efficient

I have the following code. printf "Test Message Report" > report.txt while read line do msgid=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*ex:Msg\(.*\)ex:Msg.*|\1|') putdate=$(printf "%n" "$line" | cut -c1-6000| sed -e 's///g' -e 's|.*PutDate\(.*\)PutTime.*|\1|')... (9 Replies)
Discussion started by: gugs
9 Replies

6. UNIX for Advanced & Expert Users

efficient repace

some of the data i receive has been typed in manually due to which there are often places where i find 8 instead of ( and the incorrect use of case what according to you is the best way to correct such data. The data has around 20,000 records. The value i want to change is in the 4th field.... (2 Replies)
Discussion started by: VGR
2 Replies

7. Post Here to Contact Site Administrators and Moderators

Constant Logging In (After Logging Out)

Hi Everyone. First, I want to thank all of you for letting me participate in this great group. I am having a bit of a problem. After I get an email from a responder, I login to make my reply. In the mean time I get another response by email from another member, I go to reply to them and I... (6 Replies)
Discussion started by: Ccccc
6 Replies

8. UNIX for Advanced & Expert Users

Efficient way to grep

Hi Experts, I've been trying simple grep to search for a string in a huge number of files in a directory. grep <pattern> * this gives the search results as well as the following - grep: <filename>: Permission denied grep: <filename>: Permission denied for files which I don't have... (4 Replies)
Discussion started by: sumoka
4 Replies

9. Shell Programming and Scripting

Help with Efficient Looping

Hello guys My requirement is to read a file with parent-child relationship we need to iterate through each row to find its latest child. for eg. parent child ABC PQR PQR DEF DEF XYZ Expected Output ABC XYZ PQR XYZ DEF XYZ Script Logic : read parent from file seach child... (4 Replies)
Discussion started by: joshiamit
4 Replies

10. Linux

Syslog not logging successful logging while unlocking server's console

When unlocking a Linux server's console there's no event indicating successful logging Is there a way I can fix this ? I have the following in my rsyslog.conf auth.info /var/log/secure authpriv.info /var/log/secure (1 Reply)
Discussion started by: walterthered
1 Replies
pthread_mutexattr_getspin_np(3T)										  pthread_mutexattr_getspin_np(3T)

NAME
pthread_mutexattr_getspin_np(), pthread_mutexattr_setspin_np(), pthread_mutex_getyieldfreq_np(), pthread_mutex_setyieldfreq_np(), pthread_mutexattr_disable_handoff_np(), pthread_mutex_disable_handoff_np() - get and set mutex spin and yield frequency attributes; disable mutex-specific or process-wide mutex handoff mode SYNOPSIS
PARAMETERS
attr Pointer to the mutex attributes object whose attributes are to be set/retrieved. spin This parameter either specifies the new value of the spin attribute (set function) or points to the memory location where the spin attribute of attr is to be returned (get function). yield This parameter either specifies the new value of the yield frequency process-wide attribute (set function) or points to the mem- ory location where the yield frequency process-wide attribute is to be returned (get function). DESCRIPTION
These attributes are used to tune the mutex locking behavior for optimized application performance on multiprocessor systems. For and the attributes object attr must have previously been initialized with the function before these functions are called. Attribute: spin Mutexes can be initialized with a spin value which is used by for busy-wait iterations on the mutex lock. It is effective only on multi- processor systems. It is ignored on uniprocessor systems. For bound threads, the procedure to block on a busy mutex is quite costly. On a multiprocessor system, the thread holding the mutex may be a few instruction cycles away from releasing it. By performing a brief busy-wait before actually blocking, the lock path can avoid a great deal of overhead in these situations. For many applications, these situations are not rare. Consider a mutex used to protect a short sequence of code (e.g., to increment a counter). The mutex is held only for a few instruction cycles (plus the function call overhead for The ability to set the spin attribute allows the application writer to adjust the busy-wait to suit the duration of the common-case criti- cal section protected by each mutex. The legal values for the spin attribute are: The function will busy-wait on the mutex lock for the specified number of iterations before blocking the thread, unless the lock is acquired sooner. Larger spin values would be appropriate for mutexes associated with longer critical sections. Inhibits blocking on the mutex lock altogether. The function will busy-wait on the mutex lock until it is acquired. Uses a built-in default value for the number of busy-wait iterations. Attribute: yield Note that the yield attribute is not a per-mutex attribute, but is process-wide. That is, it affects the behavior of all mutexes. The yield attribute specifies, for the busy-wait, how frequently the processor should be yielded (via allowing other threads to execute. When the number of threads exceeds the number of processors in a system, a busy-wait on a mutex can sometimes have an adverse effect. The busy-wait itself can prevent the thread holding the lock from completing the associated critical section of code. By yielding the proces- sor on occasion, the thread attempting the lock may allow the thread holding the lock to reach the point at which it can release the lock. However, it still avoids the costly path to block on the mutex. The legal values for the yield attribute are: The busy-wait loop in will yield the processor after each specified number of iterations of the spin loop (where the total number of iterations is con- trolled by the per-mutex spin attribute). Inhibits yielding in the mutex lock altogether. Uses a built-in default value for the frequency of yields in the busy-wait loop. The and functions are provided for binary compatibility purposes only. They will not have any noticeable effect on mutexes. RETURN VALUE
and return the following values: Successful completion. Failure. The returned value is an error number defined in the ERRORS section. (The variable is not set). ERRORS
If an error is detected, and return one of the following error numbers. The value specified by attr, spin, or yield is invalid. was called after the process became multithreaded. WARNINGS
The settings of the spin and yield attributes can, as well as improve application performance, easily lead to degraded performance. The CPU consumption of the application may be increased. Settings which work well for a small number of threads may do poorly for larger num- bers of threads. The optimal settings will vary depending upon hardware and operating system configuration. Minor changes in the applica- tion itself may require retuning of these attributes. The programmer must analyze performance carefully to obtain an understanding of mutex contention within the application. Then, experiment with different attribute values, evaluating how mutex contention is affected, response time, and CPU consumption. AUTHOR
and were developed by HP. SEE ALSO
pthread_create(3T), pthread_mutex_init(3T), pthread_mutexattr_init(3T), rtsched(2) STANDARDS CONFORMANCE
Pthread Library pthread_mutexattr_getspin_np(3T)
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy