real-time vs. user-time 
Author Message
 real-time vs. user-time

hi,

if have some program for benchmarking and therefore i
limit time and memory resources from the shell (sh) using
ulimit.
I've also included some code, to give some message on
STDOUT when time limit is exceeded:

void
ntrTimeExit(
 int timeSignal )
{
 struct rlimit *tLimit = malloc( sizeof( struct rlimit ) );
 getrlimit( RLIMIT_CPU, tLimit );
 printf( "time limit %9dsec exceeded\n", (int)tLimit->rlim_cur );
 free( tLimit );
 exit( 1 );

Quote:
}

To activate ntrTimeExit() I use the following function:

ntrTimeLimit()
{
 struct rlimit *tLimit = malloc( sizeof( struct rlimit ) );
 getrlimit( RLIMIT_CPU, tLimit );
 signal( SIGALRM, ntrTimeExit );
 alarm( tLimit->rlim_cur );
 free( tLimit );

Quote:
}

ntrTimeLimit() is called at the very beginning of main().

Now I've observed the following "mismatch" of the /usr/bin/time
command (the cpu-time limit was set to 10 minutes (ulimit -t 600)):

When I do NOT call ntrTimeLimit() on one benchmark I got the /usr/bin/time
result:

real 3641.73, user 333.16, system 268.15, user+system 601.31

That is, a real time of more than 1 hour and (user+system) time that matches
the given cpu-time limit.

When I call the ntrTimeLimit() on this benchmark I got the result:

real 600.32, user 99.01, system 82.92, user+system 181.93

That is, a real time that matches the given cpu-time limit and a
(user+system) time that is far less from the cpu-time limit.

By the way, in both cases the program aborts on this benchmark.

If your question is now about the size of the process and the percentage,
than this is a good question: In both cases, the CPU percentages are about 5-10%
(yes, it's a hard problem and memory is full (about 1GB)).

But the problem is the different behaviour when I use ntrTimeLimit() and
alarm(), respectively. I was thinking that I really set the alarm function
according to the cpu-time limit given from the shell, but obviously this
is not the case.

Does anyone has an explanation to this?

Thanks in advance,

marc



Tue, 12 Oct 2004 20:23:49 GMT  
 real-time vs. user-time
On 26 Apr 2002 05:23:49 -0700,

Quote:
> hi,

> if have some program for benchmarking and therefore i
> limit time and memory resources from the shell (sh) using
> ulimit.

You should post this question in comp.unix.programmer. You are asking
questions about functions and programs that exist on Unix platforms, but
not in the ISO-C standard.

Quote:
> Does anyone has an explanation to this?

The people in comp.unix.programmer might.

Martien
--
                        |
Martien Verbruggen      | Make it idiot proof and someone will make a
                        | better idiot.
                        |



Tue, 12 Oct 2004 20:45:08 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Real-time dyn allctn (was: Ada vs C++ vs Java)

2. Help!: problem with fast timing for real-time application on PC

3. Finding System/User/Real times on Win32 - URGENT!

4. Real time From Time Zone information

5. Finding System/User/Real times on Win32 - URGENT!

6. Real Time and Timing

7. Get Real Time Clock (RTC) time/date

8. URGENT: Debug mode vs. Real Time

9. How to obtain the login time and the idle time of the user

10. how to obtain the login time and the idle time of the users

11. Is timing reproducible ? (Re: times vs clock)

12. Design-time vs Run-time mode

 

 
Powered by phpBB® Forum Software