Changeset 5218
- Timestamp:
- 02/04/08 11:04:38 (8 months ago)
- Files:
-
- Tuna/trunk/English.lproj/InfoPlist.strings (modified) (1 diff)
- Tuna/trunk/NSDocumentController-TNAdditions.h (modified) (1 diff)
- Tuna/trunk/NSDocumentController-TNAdditions.m (modified) (1 diff)
- Tuna/trunk/TNDocument.h (modified) (1 diff)
- Tuna/trunk/TNDocument.m (modified) (1 diff)
- Tuna/trunk/TNFunction.h (modified) (1 diff)
- Tuna/trunk/TNFunction.m (modified) (1 diff)
- Tuna/trunk/TNMainController.h (modified) (1 diff)
- Tuna/trunk/TNMainController.m (modified) (1 diff)
- Tuna/trunk/TNNode.h (modified) (1 diff)
- Tuna/trunk/TNNode.m (modified) (11 diffs)
- Tuna/trunk/TNParser.h (modified) (1 diff)
- Tuna/trunk/TNParser.m (modified) (1 diff)
- Tuna/trunk/TNProfilerController.h (modified) (1 diff)
- Tuna/trunk/TNProfilerController.m (modified) (1 diff)
- Tuna/trunk/TNSessionController.h (modified) (1 diff)
- Tuna/trunk/TNSessionController.m (modified) (1 diff)
- Tuna/trunk/TNSettings.h (modified) (1 diff)
- Tuna/trunk/TNSettings.m (modified) (1 diff)
- Tuna/trunk/TNTree.h (modified) (1 diff)
- Tuna/trunk/TNTree.m (modified) (1 diff)
- Tuna/trunk/main.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Tuna/trunk/English.lproj/InfoPlist.strings
r4995 r5218 2 2 CFBundleName = "Tuna"; 3 3 CFBundleShortVersionString = "1.0.2"; 4 CFBundleGetInfoString = "Tuna 1.0.2, Copyright © 2005-200 7Zanka Software.";5 NSHumanReadableCopyright = "Copyright © 2005-200 7Zanka Software.";4 CFBundleGetInfoString = "Tuna 1.0.2, Copyright © 2005-2008 Zanka Software."; 5 NSHumanReadableCopyright = "Copyright © 2005-2008 Zanka Software."; Tuna/trunk/NSDocumentController-TNAdditions.h
r2814 r5218 2 2 3 3 /* 4 * Copyright (c) 2005 Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/NSDocumentController-TNAdditions.m
r2814 r5218 2 2 3 3 /* 4 * Copyright (c) 2005 Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNDocument.h
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNDocument.m
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNFunction.h
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNFunction.m
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNMainController.h
r5208 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNMainController.m
r5217 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNNode.h
r5215 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNNode.m
r5217 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * … … 32 32 @interface TNNode(Private) 33 33 34 - (void)joinWithNode:(TNNode *)node; 35 36 - (void)addNodesMatchingLibrary:(NSString *)library toArray:(NSMutableArray *)array; 37 - (TNNode *)nodeMatchingSymbolSubstring:(NSString *)string beforeNode:(TNNode *)beforeNode haveReached:(BOOL *)reached afterNode:(TNNode *)afterNode havePassed:(BOOL *)passed; 34 - (void)_joinWithNode:(TNNode *)node; 35 - (void)_addNodesMatchingLibrary:(NSString *)library toArray:(NSMutableArray *)array; 36 - (TNNode *)_nodeMatchingSymbolSubstring:(NSString *)string beforeNode:(TNNode *)beforeNode haveReached:(BOOL *)reached afterNode:(TNNode *)afterNode havePassed:(BOOL *)passed; 38 37 39 38 @end … … 41 40 42 41 @implementation TNNode(Private) 42 43 - (void)_joinWithNode:(TNNode *)node { 44 TNNode *child, *subchild; 45 NSUInteger i, count; 46 47 _calls++; 48 _percent = (_percent + node->_percent) / 2.0; 49 _cumulativePercent = (_cumulativePercent + node->_cumulativePercent) / 2.0; 50 51 count = [node->_children count]; 52 53 for(i = 0; i < count; i++) { 54 child = [node->_children objectAtIndex:i]; 55 subchild = [self childWithFunctionIdenticalTo:child->_function]; 56 57 if(subchild) 58 [subchild _joinWithNode:child]; 59 else 60 [self addChild:child]; 61 } 62 } 63 64 65 66 - (void)_addNodesMatchingLibrary:(NSString *)library toArray:(NSMutableArray *)array { 67 TNNode *node; 68 NSUInteger i, count; 69 70 count = [_children count]; 71 72 for(i = 0; i < count; i++) { 73 node = [_children objectAtIndex:i]; 74 75 if([node->_function->_library hasPrefix:library]) 76 [array addObject:node]; 77 else 78 [node _addNodesMatchingLibrary:library toArray:array]; 79 } 80 } 81 82 83 84 - (TNNode *)_nodeMatchingSymbolSubstring:(NSString *)string beforeNode:(TNNode *)beforeNode haveReached:(BOOL *)reached afterNode:(TNNode *)afterNode havePassed:(BOOL *)passed { 85 TNNode *node; 86 NSUInteger i, count; 87 88 if(beforeNode == self) { 89 *reached = YES; 90 91 return NULL; 92 } 93 94 if(!afterNode || *passed) { 95 if([[_function symbol] containsSubstring:string options:NSCaseInsensitiveSearch]) 96 return self; 97 } 98 99 if(afterNode == self) 100 *passed = YES; 101 102 count = [_children count]; 103 104 for(i = 0; i < count; i++) { 105 node = [[_children objectAtIndex:i] _nodeMatchingSymbolSubstring:string 106 beforeNode:beforeNode 107 haveReached:reached 108 afterNode:afterNode 109 havePassed:passed]; 110 111 if(node) 112 return node; 113 114 if(*reached) 115 break; 116 } 117 118 return NULL; 119 } 43 120 44 121 @end … … 277 354 278 355 if([node isEqualToNode:nextNode]) { 279 [node joinWithNode:nextNode];356 [node _joinWithNode:nextNode]; 280 357 281 358 [_children removeObjectAtIndex:j]; … … 293 370 294 371 295 - (void)joinWithNode:(TNNode *)node {296 TNNode *child, *subchild;297 NSUInteger i, count;298 299 _calls++;300 _percent = (_percent + node->_percent) / 2.0;301 _cumulativePercent = (_cumulativePercent + node->_cumulativePercent) / 2.0;302 303 count = [node->_children count];304 305 for(i = 0; i < count; i++) {306 child = [node->_children objectAtIndex:i];307 subchild = [self childWithFunctionIdenticalTo:child->_function];308 309 if(subchild)310 [subchild joinWithNode:child];311 else312 [self addChild:child];313 }314 }315 316 317 318 372 - (void)unlink { 319 373 [((TNNode *) _parent)->_children removeObject:self]; … … 345 399 346 400 array = [[NSMutableArray alloc] initWithCapacity:1000]; 347 [self addNodesMatchingLibrary:library toArray:array];401 [self _addNodesMatchingLibrary:library toArray:array]; 348 402 349 403 return [array autorelease]; 350 }351 352 353 354 - (void)addNodesMatchingLibrary:(NSString *)library toArray:(NSMutableArray *)array {355 TNNode *node;356 NSUInteger i, count;357 358 count = [_children count];359 360 for(i = 0; i < count; i++) {361 node = [_children objectAtIndex:i];362 363 if([node->_function->_library hasPrefix:library])364 [array addObject:node];365 else366 [node addNodesMatchingLibrary:library toArray:array];367 }368 404 } 369 405 … … 375 411 reached = passed = NO; 376 412 377 return [self nodeMatchingSymbolSubstring:string beforeNode:beforeNode haveReached:&reached afterNode:NULL havePassed:&passed];413 return [self _nodeMatchingSymbolSubstring:string beforeNode:beforeNode haveReached:&reached afterNode:NULL havePassed:&passed]; 378 414 } 379 415 … … 385 421 reached = passed = NO; 386 422 387 return [self nodeMatchingSymbolSubstring:string beforeNode:NULL haveReached:&reached afterNode:afterNode havePassed:&passed]; 388 } 389 390 391 392 - (TNNode *)nodeMatchingSymbolSubstring:(NSString *)string beforeNode:(TNNode *)beforeNode haveReached:(BOOL *)reached afterNode:(TNNode *)afterNode havePassed:(BOOL *)passed { 393 TNNode *node; 394 NSUInteger i, count; 395 396 if(beforeNode == self) { 397 *reached = YES; 398 399 return NULL; 400 } 401 402 if(!afterNode || *passed) { 403 if([[_function symbol] containsSubstring:string options:NSCaseInsensitiveSearch]) 404 return self; 405 } 406 407 if(afterNode == self) 408 *passed = YES; 409 410 count = [_children count]; 411 412 for(i = 0; i < count; i++) { 413 node = [[_children objectAtIndex:i] nodeMatchingSymbolSubstring:string 414 beforeNode:beforeNode 415 haveReached:reached 416 afterNode:afterNode 417 havePassed:passed]; 418 419 if(node) 420 return node; 421 422 if(*reached) 423 break; 424 } 425 426 return NULL; 423 return [self _nodeMatchingSymbolSubstring:string beforeNode:NULL haveReached:&reached afterNode:afterNode havePassed:&passed]; 427 424 } 428 425 … … 501 498 @implementation TNPerlNode(Private) 502 499 500 - (void)joinWithNode:(TNPerlNode *)node { 501 _time += node->_time; 502 _cumulativeTime += node->_cumulativeTime; 503 504 [super _joinWithNode:node]; 505 } 506 507 508 509 - (void)refreshPercentForTotalTime:(NSTimeInterval)time { 510 NSUInteger i, count; 511 512 _percent = time > 0.0 ? (_time / time) * 100.0 : 100.0; 513 _cumulativePercent = time > 0.0 ? (_cumulativeTime / time) * 100.0 : 100.0; 514 515 count = [_children count]; 516 517 for(i = 0; i < count; i++) 518 [[_children objectAtIndex:i] refreshPercentForTotalTime:time]; 519 } 520 503 521 @end 504 522 … … 545 563 #pragma mark - 546 564 547 - (void)joinWithNode:(TNPerlNode *)node {548 _time += node->_time;549 _cumulativeTime += node->_cumulativeTime;550 551 [super joinWithNode:node];552 }553 554 555 556 565 - (void)unlink { 557 566 TNPerlNode *node; … … 589 598 590 599 [self refreshPercentForTotalTime:time]; 591 }592 593 594 595 - (void)refreshPercentForTotalTime:(NSTimeInterval)time {596 NSUInteger i, count;597 598 _percent = time > 0.0 ? (_time / time) * 100.0 : 100.0;599 _cumulativePercent = time > 0.0 ? (_cumulativeTime / time) * 100.0 : 100.0;600 601 count = [_children count];602 603 for(i = 0; i < count; i++)604 [[_children objectAtIndex:i] refreshPercentForTotalTime:time];605 600 } 606 601 Tuna/trunk/TNParser.h
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNParser.m
r5207 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNProfilerController.h
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNProfilerController.m
r5217 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNSessionController.h
r5208 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNSessionController.m
r5217 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNSettings.h
r4995 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNSettings.m
r4995 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNTree.h
r5206 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/TNTree.m
r5217 r5218 2 2 3 3 /* 4 * Copyright (c) 2005-200 7Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 * Tuna/trunk/main.m
r2814 r5218 2 2 3 3 /* 4 * Copyright (c) 2005 Axel Andersson4 * Copyright (c) 2005-2008 Axel Andersson 5 5 * All rights reserved. 6 6 *
