libs-performance/GSThroughput.h
Richard Frith-Macdonald 9b80b6621c More flexibility about the period over which stats are maintained
Better differentiation between duration/noduration logging


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@21901 72102866-910b-0410-8b05-ffd578937521
2005-10-29 09:23:09 +00:00

133 lines
3.7 KiB
Objective-C

/**
Copyright (C) 2005 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: October 2005
This file is part of the Performance Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$Date$ $Revision$
*/
#ifndef INCLUDED_GSThroughput_H
#define INCLUDED_GSThroughput_H
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
/**
* The GSThroughput class is used maintain statistics about the number
* of events or the duration of operations in your software.
*/
@interface GSThroughput : NSObject
{
}
/**
* Return all the current throughput measuring objects ...
* useful if you want to do to all instances in your process.
*/
+ (NSArray*) allInstances;
/**
* Return a report on all GSThroughput instances ... calls
* the [GSThroughput-description] * method of the individual
* instances to get a report on each one.
*/
+ (NSString*) description;
/**
* Instructs the minitoring system to use a timer at the specified interval
* for keeping its idea of the current time up to date.
*/
+ (void) setTick: (NSTimeInterval)interval;
/**
* Updates the monitoring system's notion of the current time.<br />
* This should be called at the start of each (or more often) if
* you want accurate monitoring by the second.
*/
+ (void) tick;
/**
* Add to the count of the number of transactions in the current second.<br />
* You may use this method only if the receiver was initialised with
* duration logging turned off.
*/
- (void) add: (unsigned)count;
/**
* Adds a record for a single event of the specified duration.<br />
* You may use this method only if the receiver was initialised with
* duration logging turned on.
*/
- (void) addDuration: (NSTimeInterval)length;
/**
* Returns a string describing the status of the receiver for debug/reporting.
*/
- (NSString*) description;
/**
* Ends duration recording for the current event started by a matching
* call to -startDuration.<br />
* You may use this method only if the receiver was initialised with
* duration logging turned on.
*/
- (void) endDuration;
/**
* Initialises the receiver for duration logging for fifteen minute
* periods over the last twentyfour hours.
*/
- (id) init;
/** <init />
* Initialises the receiver to maintain stats over a particular time range,
* specifying whether duration statistics are to be maintained, or just
* event/transation counts.
*/
- (id) initWithDurations: (BOOL)aFlag
forPeriods: (unsigned)numberOfPeriods
ofLength: (unsigned)minutesPerPeriod;
/**
* Return the name of this instance (as set using -setName:)
*/
- (NSString*) name;
/**
* Sets the name of this instance.
*/
- (void) setName: (NSString*)name;
/**
* Starts recording the duration of an event. This must be followed by
* a matching call to -endDuration.<br />
* You may use this method only if the receiver was initialised with
* duration logging turned on.
*/
- (void) startDuration;
/**
* Internal method called by +tick in order to update stats for this instance.
*/
- (void) update;
@end
#endif