mirror of
https://github.com/gnustep/libs-performance.git
synced 2025-02-21 02:41:01 +00:00
Add new duration recording method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@24073 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fc2ce5e06c
commit
f7a943baea
3 changed files with 53 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-11-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* GSThroughput.h: New ([add:duration:]) method.
|
||||||
|
* GSThroughput.m: Method to add multiple events with a total
|
||||||
|
duration (eg where recording individual event times has too
|
||||||
|
high an overhead).
|
||||||
|
|
||||||
2006-11-09 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-11-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* GNUmakefile: update version
|
* GNUmakefile: update version
|
||||||
|
|
|
@ -99,6 +99,18 @@
|
||||||
*/
|
*/
|
||||||
- (void) add: (unsigned)count;
|
- (void) add: (unsigned)count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a record for multiple events of the specified
|
||||||
|
* <em>total</em> duration.<br />
|
||||||
|
* This is useful where you know a lot of similar events have completed
|
||||||
|
* in a particular period of time, but can't afford to measure the
|
||||||
|
* duration of the individual events because the timing overheads
|
||||||
|
* would be too great.<br />
|
||||||
|
* You may use this method only if the receiver was initialised with
|
||||||
|
* duration logging turned on.
|
||||||
|
*/
|
||||||
|
- (void) add: (unsigned)count duration: (NSTimeInterval)length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a record for a single event of the specified duration.<br />
|
* Adds a record for a single event of the specified duration.<br />
|
||||||
* You may use this method only if the receiver was initialised with
|
* You may use this method only if the receiver was initialised with
|
||||||
|
|
|
@ -381,6 +381,40 @@ typedef struct {
|
||||||
cseconds[my->second].cnt += count;
|
cseconds[my->second].cnt += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) add: (unsigned)count duration: (NSTimeInterval)length
|
||||||
|
{
|
||||||
|
NSAssert(my->supportDurations == YES, @"not configured for durations");
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
NSTimeInterval total = length;
|
||||||
|
DInfo *info;
|
||||||
|
|
||||||
|
info = &dseconds[my->second];
|
||||||
|
length /= count;
|
||||||
|
if (info->cnt == 0)
|
||||||
|
{
|
||||||
|
info->cnt = count;
|
||||||
|
info->min = length;
|
||||||
|
info->max = length;
|
||||||
|
info->sum = total;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info->cnt += count;
|
||||||
|
info->sum += total;
|
||||||
|
if (length > info->max)
|
||||||
|
{
|
||||||
|
info->max = length;
|
||||||
|
}
|
||||||
|
if (length < info->min)
|
||||||
|
{
|
||||||
|
info->min = length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) addDuration: (NSTimeInterval)length
|
- (void) addDuration: (NSTimeInterval)length
|
||||||
{
|
{
|
||||||
DInfo *info;
|
DInfo *info;
|
||||||
|
|
Loading…
Reference in a new issue