-
Notifications
You must be signed in to change notification settings - Fork 0
/
RPSampleSession.m
65 lines (45 loc) · 1.43 KB
/
RPSampleSession.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// RPSampleSession.m
// Rampler
//
// Created by Bertrand Guiheneuf on 6/6/13.
//
//
#import "RPSampleSession.h"
@implementation RPSampleSession
- (RPCallTree *)copyWithParent:(RPCallTree*)parent withRoot:(RPCallTree*)root
{
RPSampleSession* treeCopy = (RPSampleSession*)[super copyWithParent:parent withRoot:root];
treeCopy.sessionDurationPerTick = self.sessionDurationPerTick;
return treeCopy;
}
- (id)copy
{
RPSampleSession* treeCopy = (RPSampleSession*)[super copy];
treeCopy.sessionDurationPerTick = self.sessionDurationPerTick;
return treeCopy;
}
- (RPSampleSession*)sessionByFocussingOnSubTree:(RPCallTree*)subTree
{
RPSampleSession* newSession = [self copy];
RPCallTree* treeCopy = [subTree copyWithParent:newSession withRoot:newSession];
[newSession addSubTree:treeCopy];
[newSession freeze];
return newSession;
}
- (RPSampleSession*)callTreeByMergingDownIdenticalCalls:(RPCallTree*)call
{
RPSampleSession* result = [[RPSampleSession alloc] init];
result.sessionDurationPerTick = self.sessionDurationPerTick;
[self recursivelyMergeIdenticalCalls:call into:result];
[result freeze];
return result;
}
- (RPSampleSession *)sessionByFlatteningRecursion
{
RPSampleSession* result = (RPSampleSession*)[self copyWithParent:nil withRoot:nil];
[result mergeRecursionsWithMaxRecursionHops:6];
[result freeze];
return result;
}
@end