Sponsored Content
Full Discussion: semaphore access speed
Top Forums Programming semaphore access speed Post 302238994 by migurus on Monday 22nd of September 2008 03:07:44 PM
Old 09-22-2008
Quote:
Originally Posted by otheus
That's strange. Any chance you're running a different program that's elsewhere in the path? Try for instance running "./tstloop".

Also, for gprof, use the -l option (small L). I get:

.
to Jim:

tstloop is the only program, I did re-run
$ ./tstloop
$ gprof -l ./tstloop
gprof: gmon.out file is missing call-graph data

Thank you for taking it to other forum.

to Otheus:

tstloop compiled with profiling:
Code:
 
$ /usr/bin/time -vv ./tstloop
125000.00 semop/s [0,0]
Command exited with non-zero status 24
        Command being timed: "tstloop"
        User time (seconds): 15.05
        System time (seconds): 24.33
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:39.39
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 0
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 121
        Voluntary context switches: 1
        Involuntary context switches: 326
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 24

and here are results from program compiled without profiling

Code:
 
$ /usr/bin/time -vv ./tstloop
128205.13 semop/s [0,0]
Command exited with non-zero status 24
        Command being timed: "./tstloop"
        User time (seconds): 15.39
        System time (seconds): 23.19
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:38.59
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 0
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 101
        Voluntary context switches: 1
        Involuntary context switches: 112
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 24

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

semaphore

hi, is there any command where we can monitor semaphores? (1 Reply)
Discussion started by: yls177
1 Replies

2. UNIX for Dummies Questions & Answers

Semaphore

Hi, I'm new to UNIX. I need to know what's a semaphore Do reply. Thanks VJ (3 Replies)
Discussion started by: vjsony
3 Replies

3. Filesystems, Disks and Memory

dmidecode, RAM speed = "Current Speed: Unknown"

Hello, I have a Supermicro server with a P4SCI mother board running Debian Sarge 3.1. This is the "dmidecode" output related to RAM info: RAM speed information is incomplete.. "Current Speed: Unknown", is there anyway/soft to get the speed of installed RAM modules? thanks!! Regards :)... (0 Replies)
Discussion started by: Santi
0 Replies

4. Shell Programming and Scripting

Semaphore

Hi, I am looking to use a semaphore for the first time in one of my scripts. I am just wondering if there are any simple examples or tutorials around? I am a beginner so the simpler the better :) Thanks -Jaken (2 Replies)
Discussion started by: Jaken
2 Replies

5. UNIX for Dummies Questions & Answers

semaphore

what is semaphore? can any body explain it in a more simple way than the manual ?? replies appreciated Regards raguram R (7 Replies)
Discussion started by: raguramtgr
7 Replies

6. Filesystems, Disks and Memory

data from blktrace: read speed V.S. write speed

I analysed disk performance with blktrace and get some data: read: 8,3 4 2141 2.882115217 3342 Q R 195732187 + 32 8,3 4 2142 2.882116411 3342 G R 195732187 + 32 8,3 4 2144 2.882117647 3342 I R 195732187 + 32 8,3 4 2145 ... (1 Reply)
Discussion started by: W.C.C
1 Replies

7. Shell Programming and Scripting

semaphore

Control two exclusively shared resources(semaphore). The two resources are two files. The producer will write even numbers to one file, and odd numbers to another one. The consumer respectively reads from each file until it gets 5 even numbers and 5 odd numbers. Can any one help me with the... (0 Replies)
Discussion started by: gokult
0 Replies

8. Programming

Semaphore

If I create a semaphore and then I fork a number of child processes then all the child process use that same semaphore. Since the process address spaces are different rfom each other then how all the child process are able to access the same semaphore? I understand that semaphore/mutex is at os... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

9. UNIX for Beginners Questions & Answers

Semaphore

I was asked to add this piece of code to a c program which I will execute through the shell: for(long i = 0; i < NITER; i++) { sem_wait( &sema); count++; sem_post( &sema); } I didn't get it, which is the critical section ? if it's "count++" how would a thread wake up in order to enter it... (1 Reply)
Discussion started by: uniran
1 Replies
TIME(1) 							Linux User's Manual							   TIME(1)

NAME
time - time a simple command or give resource usage SYNOPSIS
time [options] command [arguments...] DESCRIPTION
The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard error giving timing statistics about this program run. These statistics consist of (i) the elapsed real time between invocation and termi- nation, (ii) the user CPU time (the sum of the tms_utime and tms_cutime values in a struct tms as returned by times(2)), and (iii) the sys- tem CPU time (the sum of the tms_stime and tms_cstime values in a struct tms as returned by times(2)). Note: some shells (e.g., bash(1)) have a built-in time command that provides less functionality than the command described here. To access the real command, you may need to specify its pathname (something like /usr/bin/time). OPTIONS
-p When in the POSIX locale, use the precise traditional format "real %f user %f sys %f " (with numbers in seconds) where the number of decimals in the output for %f is unspecified but is sufficient to express the clock tick accuracy, and at least one. EXIT STATUS
If command was invoked, the exit status is that of command. Otherwise it is 127 if command could not be found, 126 if it could be found but could not be invoked, and some other nonzero value (1-125) if something else went wrong. ENVIRONMENT
The variables LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_NUMERIC, NLSPATH, and PATH are used. The last one to search for command. The remaining ones for the text and formatting of the output. GNU VERSION
Below a description of the GNU 1.7 version of time. Disregarding the name of the utility, GNU makes it output lots of useful information, not only about time used, but also on other resources like memory, I/O and IPC calls (where available). The output is formatted using a format string that can be specified using the -f option or the TIME environment variable. The default format string is: %Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps When the -p option is given the (portable) output format real %e user %U sys %S is used. The format string The format is interpreted in the usual printf-like way. Ordinary characters are directly copied, tab, newline and backslash are escaped using , and \, a percent sign is represented by %%, and otherwise % indicates a conversion. The program time will always add a trailing newline itself. The conversions follow. All of those used by tcsh(1) are supported. Time %E Elapsed real time (in [hours:]minutes:seconds). %e (Not in tcsh.) Elapsed real time (in seconds). %S Total number of CPU-seconds that the process spent in kernel mode. %U Total number of CPU-seconds that the process spent in user mode. %P Percentage of the CPU that this job got, computed as (%U + %S) / %E. Memory %M Maximum resident set size of the process during its lifetime, in Kbytes. %t (Not in tcsh.) Average resident set size of the process, in Kbytes. %K Average total (data+stack+text) memory use of the process, in Kbytes. %D Average size of the process's unshared data area, in Kbytes. %p (Not in tcsh.) Average size of the process's unshared stack space, in Kbytes. %X Average size of the process's shared text space, in Kbytes. %Z (Not in tcsh.) System's page size, in bytes. This is a per-system constant, but varies between systems. %F Number of major page faults that occurred while the process was running. These are faults where the page has to be read in from disk. %R Number of minor, or recoverable, page faults. These are faults for pages that are not valid but which have not yet been claimed by other virtual pages. Thus the data in the page is still valid but the system tables must be updated. %W Number of times the process was swapped out of main memory. %c Number of times the process was context-switched involuntarily (because the time slice expired). %w Number of waits: times that the program was context-switched voluntarily, for instance while waiting for an I/O operation to com- plete. I/O %I Number of file system inputs by the process. %O Number of file system outputs by the process. %r Number of socket messages received by the process. %s Number of socket messages sent by the process. %k Number of signals delivered to the process. %C (Not in tcsh.) Name and command-line arguments of the command being timed. %x (Not in tcsh.) Exit status of the command. GNU Options -f FORMAT, --format=FORMAT Specify output format, possibly overriding the format specified in the environment variable TIME. -p, --portability Use the portable output format. -o FILE, --output=FILE Do not send the results to stderr, but overwrite the specified file. -a, --append (Used together with -o.) Do not overwrite but append. -v, --verbose Give very verbose output about all the program knows about. GNU Standard Options --help Print a usage message on standard output and exit successfully. -V, --version Print version information on standard output, then exit successfully. -- Terminate option list. BUGS
Not all resources are measured by all versions of Unix, so some of the values might be reported as zero. The present selection was mostly inspired by the data provided by 4.2 or 4.3BSD. GNU time version 1.7 is not yet localized. Thus, it does not implement the POSIX requirements. The environment variable TIME was badly chosen. It is not unusual for systems like autoconf(1) or make(1) to use environment variables with the name of a utility to override the utility to be used. Uses like MORE or TIME for options to programs (instead of program path- names) tend to lead to difficulties. It seems unfortunate that -o overwrites instead of appends. (That is, the -a option should be the default.) Mail suggestions and bug reports for GNU time to bug-utils@prep.ai.mit.edu Please include the version of time, which you can get by running time --version and the operating system and C compiler you used. SEE ALSO
tcsh(1), times(2), wait3(2) COLOPHON
This page is part of release 3.25 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/. 2008-11-14 TIME(1)
All times are GMT -4. The time now is 10:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy