Oolite 1.91.0.7668-250429-8542c40
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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 849 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

Referenced by UpdateProfileForFrame().

+ Here is the caller graph for this function:

◆ compareBySelfTime:

- (NSComparisonResult) compareBySelfTime: (OOTimeProfileEntry *) other

Definition at line 969 of file OOJSEngineTimeManagement.m.

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

References compareBySelfTimeReverse:.

+ Here is the call graph for this function:

◆ compareBySelfTimeReverse:

- (NSComparisonResult) compareBySelfTimeReverse: (OOTimeProfileEntry *) other

Definition at line 975 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}

References selfTimeSum.

Referenced by compareBySelfTime:.

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

◆ compareByTotalTime:

- (NSComparisonResult) compareByTotalTime: (OOTimeProfileEntry *) other

Definition at line 952 of file OOJSEngineTimeManagement.m.

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

References compareByTotalTimeReverse:.

+ Here is the call graph for this function:

◆ compareByTotalTimeReverse:

- (NSComparisonResult) compareByTotalTimeReverse: (OOTimeProfileEntry *) other

Definition at line 958 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}

References totalTimeSum.

Referenced by compareByTotalTime:.

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 841 of file OOJSEngineTimeManagement.m.

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

References _function, dealloc, and DESTROY.

Referenced by dealloc.

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

◆ description

- (NSString *) description

Definition at line 859 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}

References _hitCount, _selfTimeMax, _selfTimeSum, _totalTimeMax, _totalTimeSum, description, selfTimeMax, selfTimeSum, totalTimeMax, and totalTimeSum.

Referenced by description.

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

◆ function

- (NSString *) function

Definition at line 894 of file OOJSEngineTimeManagement.m.

895{
896 return _function;
897}

References _function, and function.

Referenced by OOTimeProfile::description, and function.

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

◆ hitCount

- (NSUInteger) hitCount

Definition at line 900 of file OOJSEngineTimeManagement.m.

901{
902 return _hitCount;
903}

References _hitCount, and hitCount.

Referenced by OOTimeProfile::description, hitCount, and OOTimeProfileEntry(Private)::propertyListRepresentation.

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

◆ initWithCName:

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

Provided by category OOTimeProfileEntry(Private).

Definition at line 786 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

References sProfiling.

◆ isJavaScriptFrame

- (BOOL) isJavaScriptFrame

Definition at line 942 of file OOJSEngineTimeManagement.m.

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

References isJavaScriptFrame.

Referenced by OOTimeProfile::description, isJavaScriptFrame, and OOTimeProfileEntry(Private)::propertyListRepresentation.

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

◆ oo_jsValueInContext:

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

Definition at line 986 of file OOJSEngineTimeManagement.m.

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

References OOJSValueFromNativeObject(), and propertyListRepresentation.

+ Here is the call graph for this function:

◆ propertyListRepresentation

- (NSDictionary *) propertyListRepresentation
implementation

Provided by category OOTimeProfileEntry(Private).

Definition at line 992 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}

References hitCount, isJavaScriptFrame, OOTimeProfileEntry(Private)::propertyListRepresentation, selfTimeAverage, selfTimeMax, selfTimeSum, totalTimeAverage, totalTimeMax, and totalTimeSum.

Referenced by oo_jsValueInContext:, OOTimeProfile(Private)::propertyListRepresentation, and OOTimeProfileEntry(Private)::propertyListRepresentation.

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

◆ selfTimeAverage

- (double) selfTimeAverage

Definition at line 924 of file OOJSEngineTimeManagement.m.

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

References _hitCount, _selfTimeSum, and selfTimeAverage.

Referenced by OOTimeProfileEntry(Private)::propertyListRepresentation, and selfTimeAverage.

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

◆ selfTimeMax

- (double) selfTimeMax

Definition at line 936 of file OOJSEngineTimeManagement.m.

937{
938 return _selfTimeMax;
939}

References _selfTimeMax, and selfTimeMax.

Referenced by OOTimeProfile::description, description, OOTimeProfileEntry(Private)::propertyListRepresentation, and selfTimeMax.

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

◆ selfTimeSum

- (double) selfTimeSum

Definition at line 912 of file OOJSEngineTimeManagement.m.

913{
914 return _selfTimeSum;
915}

References _selfTimeSum, and selfTimeSum.

Referenced by compareBySelfTimeReverse:, OOTimeProfile::description, description, OOTimeProfileEntry(Private)::propertyListRepresentation, and selfTimeSum.

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

◆ totalTimeAverage

- (double) totalTimeAverage

Definition at line 918 of file OOJSEngineTimeManagement.m.

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

References _hitCount, _totalTimeSum, and totalTimeAverage.

Referenced by OOTimeProfileEntry(Private)::propertyListRepresentation, and totalTimeAverage.

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

◆ totalTimeMax

- (double) totalTimeMax

Definition at line 930 of file OOJSEngineTimeManagement.m.

931{
932 return _totalTimeMax;
933}

References _totalTimeMax, and totalTimeMax.

Referenced by description, OOTimeProfileEntry(Private)::propertyListRepresentation, and totalTimeMax.

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

◆ totalTimeSum

- (double) totalTimeSum

Definition at line 906 of file OOJSEngineTimeManagement.m.

907{
908 return _totalTimeSum;
909}

References _totalTimeSum, and totalTimeSum.

Referenced by compareByTotalTimeReverse:, OOTimeProfile::description, description, OOTimeProfileEntry(Private)::propertyListRepresentation, and totalTimeSum.

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

Member Data Documentation

◆ _function

- (NSString*) _function
private

Definition at line 142 of file OOJSEngineTimeManagement.h.

Referenced by dealloc, and function.

◆ _hitCount

- (unsigned long) _hitCount
private

Definition at line 143 of file OOJSEngineTimeManagement.h.

Referenced by description, hitCount, selfTimeAverage, and totalTimeAverage.

◆ _selfTimeMax

- (double) _selfTimeMax
private

Definition at line 147 of file OOJSEngineTimeManagement.h.

Referenced by description, and selfTimeMax.

◆ _selfTimeSum

- (double) _selfTimeSum
private

Definition at line 145 of file OOJSEngineTimeManagement.h.

Referenced by description, selfTimeAverage, and selfTimeSum.

◆ _totalTimeMax

- (double) _totalTimeMax
private

Definition at line 146 of file OOJSEngineTimeManagement.h.

Referenced by description, and totalTimeMax.

◆ _totalTimeSum

- (double) _totalTimeSum
private

Definition at line 144 of file OOJSEngineTimeManagement.h.

Referenced by description, totalTimeAverage, and totalTimeSum.


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