OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 function totalHitCount(node) { | 568 function totalHitCount(node) { |
569 var result = node.hitCount; | 569 var result = node.hitCount; |
570 for (var i = 0; i < node.children.length; i++) | 570 for (var i = 0; i < node.children.length; i++) |
571 result += totalHitCount(node.children[i]); | 571 result += totalHitCount(node.children[i]); |
572 return result; | 572 return result; |
573 } | 573 } |
574 profile.totalHitCount = totalHitCount(profile.head); | 574 profile.totalHitCount = totalHitCount(profile.head); |
575 | 575 |
576 var durationMs = 1000 * profile.endTime - 1000 * profile.startTime; | 576 var durationMs = 1000 * profile.endTime - 1000 * profile.startTime; |
577 var samplingRate = profile.totalHitCount / durationMs; | 577 var samplingRate = profile.totalHitCount / durationMs; |
| 578 this.samplesPerMs = samplingRate; |
578 | 579 |
579 function calculateTimesForNode(node) { | 580 function calculateTimesForNode(node) { |
580 node.selfTime = node.hitCount * samplingRate; | 581 node.selfTime = node.hitCount * samplingRate; |
581 var totalTime = node.selfTime; | 582 var totalTime = node.selfTime; |
582 for (var i = 0; i < node.children.length; i++) | 583 for (var i = 0; i < node.children.length; i++) |
583 totalTime += calculateTimesForNode(node.children[i]); | 584 totalTime += calculateTimesForNode(node.children[i]); |
584 node.totalTime = totalTime; | 585 node.totalTime = totalTime; |
585 return totalTime; | 586 return totalTime; |
586 } | 587 } |
587 calculateTimesForNode(profile.head); | 588 calculateTimesForNode(profile.head); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 this.title = file.name; | 926 this.title = file.name; |
926 this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); | 927 this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); |
927 this.sidebarElement.wait = true; | 928 this.sidebarElement.wait = true; |
928 | 929 |
929 var fileReader = new WebInspector.ChunkedFileReader(file, 10000000, this
); | 930 var fileReader = new WebInspector.ChunkedFileReader(file, 10000000, this
); |
930 fileReader.start(this); | 931 fileReader.start(this); |
931 }, | 932 }, |
932 | 933 |
933 __proto__: WebInspector.ProfileHeader.prototype | 934 __proto__: WebInspector.ProfileHeader.prototype |
934 } | 935 } |
OLD | NEW |