Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOTimeProfileEntry Class Reference

#include <OOJSEngineTimeManagement.h>

+ Inheritance diagram for OOTimeProfileEntry:
+ Collaboration diagram for OOTimeProfileEntry:

Instance Methods

(NSString *) - description
 
(NSString *) - function
 
(NSUInteger) - hitCount
 
(double) - totalTimeSum
 
(double) - selfTimeSum
 
(double) - totalTimeAverage
 
(double) - selfTimeAverage
 
(double) - totalTimeMax
 
(double) - selfTimeMax
 
(BOOL) - isJavaScriptFrame
 
(NSComparisonResult) - compareByTotalTime:
 
(NSComparisonResult) - compareByTotalTimeReverse:
 
(NSComparisonResult) - compareBySelfTime:
 
(NSComparisonResult) - compareBySelfTimeReverse:
 
(id) - initWithCName: [implementation]
 
(void) - dealloc [implementation]
 
(void) - addSampleWithTotalTime:selfTime: [implementation]
 
(jsval) - oo_jsValueInContext: [implementation]
 
(NSDictionary *) - propertyListRepresentation [implementation]
 

Private Attributes

NSString * _function
 
unsigned long _hitCount
 
double _totalTimeSum
 
double _selfTimeSum
 
double _totalTimeMax
 
double _selfTimeMax
 

Detailed Description

Definition at line 139 of file OOJSEngineTimeManagement.h.

Method Documentation

◆ addSampleWithTotalTime:selfTime:

- (void) addSampleWithTotalTime: (OOTimeDelta) totalTime
selfTime: (OOTimeDelta) selfTime 
implementation

Provided by category OOTimeProfileEntry(Private).

Definition at line 591 of file OOJSEngineTimeManagement.m.

849 :(OOTimeDelta)totalTime selfTime:(OOTimeDelta)selfTime
850{
851 _hitCount++;
852 _totalTimeSum += totalTime;
853 _selfTimeSum += selfTime;
854 _totalTimeMax = fmax(_totalTimeMax, totalTime);
855 _selfTimeMax = fmax(_selfTimeMax, selfTime);
856}
double OOTimeDelta
Definition OOTypes.h:224

References addSampleWithTotalTime:selfTime:, EXPECT_NOT, nil, OOHighResTimeDeltaInSeconds(), OOLogOutdent(), sProfileInfo, sProfileStack, and sTracing.

Referenced by OOTimeProfileEntry(Private)::addSampleWithTotalTime:selfTime:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compareBySelfTime:

- (NSComparisonResult) compareBySelfTime: (OOTimeProfileEntry *) other

Definition at line 591 of file OOJSEngineTimeManagement.m.

969 :(OOTimeProfileEntry *)other
970{
971 return -[self compareBySelfTimeReverse:other];
972}
return self

◆ compareBySelfTimeReverse:

- (NSComparisonResult) compareBySelfTimeReverse: (OOTimeProfileEntry *) other

Definition at line 591 of file OOJSEngineTimeManagement.m.

975 :(OOTimeProfileEntry *)other
976{
977 double selfTotal = [self selfTimeSum];
978 double otherTotal = [other selfTimeSum];
979
980 if (selfTotal < otherTotal) return NSOrderedDescending;
981 if (selfTotal > otherTotal) return NSOrderedAscending;
982 return NSOrderedSame;
983}

◆ compareByTotalTime:

- (NSComparisonResult) compareByTotalTime: (OOTimeProfileEntry *) other

Definition at line 591 of file OOJSEngineTimeManagement.m.

952 :(OOTimeProfileEntry *)other
953{
954 return -[self compareByTotalTimeReverse:other];
955}

◆ compareByTotalTimeReverse:

- (NSComparisonResult) compareByTotalTimeReverse: (OOTimeProfileEntry *) other

Definition at line 591 of file OOJSEngineTimeManagement.m.

958 :(OOTimeProfileEntry *)other
959{
960 double selfTotal = [self totalTimeSum];
961 double otherTotal = [other totalTimeSum];
962
963 if (selfTotal < otherTotal) return NSOrderedDescending;
964 if (selfTotal > otherTotal) return NSOrderedAscending;
965 return NSOrderedSame;
966}

◆ dealloc

- (void) dealloc
implementation

Definition at line 591 of file OOJSEngineTimeManagement.m.

842{
844
845 [super dealloc];
846}
#define DESTROY(x)
Definition OOCocoa.h:77

◆ description

- (NSString *) description

Definition at line 591 of file OOJSEngineTimeManagement.m.

860{
861 if (_hitCount == 0) return [NSString stringWithFormat:@"%@: --", _function];
862
863 // Convert everything to milliseconds.
864 float totalTimeSum = _totalTimeSum * 1000.0;
865 float selfTimeSum = _selfTimeSum * 1000.0;
866 float totalTimeMax = _totalTimeMax * 1000.0;
867 float selfTimeMax = _selfTimeMax * 1000.0;
868
870 {
871 if (_hitCount == 1)
872 {
873 return [NSString stringWithFormat:@"%@: 1 time, %g ms", _function, totalTimeSum];
874 }
875 else
876 {
877 return [NSString stringWithFormat:@"%@: %lu times, total %g ms, avg %g ms, max %g ms", _function, _hitCount, totalTimeSum, totalTimeSum / _hitCount, totalTimeMax];
878 }
879 }
880 else
881 {
882 if (_hitCount == 1)
883 {
884 return [NSString stringWithFormat:@"%@: 1 time, %g ms (self %g ms)", _function, totalTimeSum, selfTimeSum];
885 }
886 else
887 {
888 return [NSString stringWithFormat:@"%@: %lu times, total %g ms (self %g ms), avg %g ms (self %g ms), max %g ms, max self %g ms", _function, _hitCount, totalTimeSum, selfTimeSum, totalTimeSum / _hitCount, selfTimeSum / _hitCount, totalTimeMax, selfTimeMax];
889 }
890 }
891}

◆ function

- (NSString *) function

Definition at line 591 of file OOJSEngineTimeManagement.m.

895{
896 return _function;
897}

◆ hitCount

- (NSUInteger) hitCount

Definition at line 591 of file OOJSEngineTimeManagement.m.

901{
902 return _hitCount;
903}

◆ initWithCName:

- (id) initWithCName: (const char *) name
implementation

Provided by category OOTimeProfileEntry(Private).

Definition at line 591 of file OOJSEngineTimeManagement.m.

786 :(const char *)name
787{
788 NSAssert(sProfiling, @"Can't create profile entries while not profiling.");
789
790 if ((self = [super init]))
791 {
792 if (name != NULL)
793 {
794 _function = [[NSString stringWithUTF8String:name] retain];
795 }
796 }
797
798 return self;
799}
static BOOL sProfiling

◆ isJavaScriptFrame

- (BOOL) isJavaScriptFrame

Definition at line 591 of file OOJSEngineTimeManagement.m.

943{
944#if MOZ_TRACE_JSCALLS
945 return _jsFunction != NULL;
946#else
947 return NO;
948#endif
949}

◆ oo_jsValueInContext:

- (jsval) oo_jsValueInContext: (JSContext *) context
implementation

Definition at line 591 of file OOJSEngineTimeManagement.m.

986 :(JSContext *)context
987{
989}
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
NSDictionary * propertyListRepresentation()

◆ propertyListRepresentation

- (NSDictionary *) propertyListRepresentation
implementation

Provided by category OOTimeProfileEntry(Private).

Definition at line 591 of file OOJSEngineTimeManagement.m.

993{
994 return [NSDictionary dictionaryWithObjectsAndKeys:
995 _function, @"name",
996 [NSNumber numberWithUnsignedInteger:[self hitCount]], @"hitCount",
997 [NSNumber numberWithDouble:[self totalTimeSum]], @"totalTimeSum",
998 [NSNumber numberWithDouble:[self selfTimeSum]], @"selfTimeSum",
999 [NSNumber numberWithDouble:[self totalTimeAverage]], @"totalTimeAverage",
1000 [NSNumber numberWithDouble:[self selfTimeAverage]], @"selfTimeAverage",
1001 [NSNumber numberWithDouble:[self totalTimeMax]], @"totalTimeMax",
1002 [NSNumber numberWithDouble:[self selfTimeMax]], @"selfTimeMax",
1003 [NSNumber numberWithBool:[self isJavaScriptFrame]], @"isJavaScriptFrame",
1004 nil];
1005}

◆ selfTimeAverage

- (double) selfTimeAverage

Definition at line 591 of file OOJSEngineTimeManagement.m.

925{
926 return _hitCount ? (_selfTimeSum / _hitCount) : 0.0;
927}

◆ selfTimeMax

- (double) selfTimeMax

Definition at line 591 of file OOJSEngineTimeManagement.m.

937{
938 return _selfTimeMax;
939}

◆ selfTimeSum

- (double) selfTimeSum

Definition at line 591 of file OOJSEngineTimeManagement.m.

913{
914 return _selfTimeSum;
915}

◆ totalTimeAverage

- (double) totalTimeAverage

Definition at line 591 of file OOJSEngineTimeManagement.m.

919{
920 return _hitCount ? (_totalTimeSum / _hitCount) : 0.0;
921}

◆ totalTimeMax

- (double) totalTimeMax

Definition at line 591 of file OOJSEngineTimeManagement.m.

931{
932 return _totalTimeMax;
933}

◆ totalTimeSum

- (double) totalTimeSum

Definition at line 591 of file OOJSEngineTimeManagement.m.

907{
908 return _totalTimeSum;
909}

Member Data Documentation

◆ _function

- (NSString*) _function
private

Definition at line 142 of file OOJSEngineTimeManagement.h.

◆ _hitCount

- (unsigned long) _hitCount
private

Definition at line 143 of file OOJSEngineTimeManagement.h.

◆ _selfTimeMax

- (double) _selfTimeMax
private

Definition at line 147 of file OOJSEngineTimeManagement.h.

◆ _selfTimeSum

- (double) _selfTimeSum
private

Definition at line 145 of file OOJSEngineTimeManagement.h.

◆ _totalTimeMax

- (double) _totalTimeMax
private

Definition at line 146 of file OOJSEngineTimeManagement.h.

◆ _totalTimeSum

- (double) _totalTimeSum
private

Definition at line 144 of file OOJSEngineTimeManagement.h.


The documentation for this class was generated from the following files: