MCPcopy Index your code
hub / github.com/nodejs/node / printStatistics

Method printStatistics

deps/v8/tools/tickprocessor.mjs:904–982  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

902 }
903
904 printStatistics() {
905 if (this.preprocessJson) {
906 this.profile_.writeJson();
907 return;
908 }
909
910 print(`Statistical profiling result from ${this.lastLogFileName_}` +
911 `, (${this.ticks_.total} ticks, ${this.ticks_.unaccounted} unaccounted, ` +
912 `${this.ticks_.excluded} excluded).`);
913
914
915 if (this.ticks_.total == 0) return;
916
917 const flatProfile = this.profile_.getFlatProfile();
918 const flatView = this.viewBuilder_.buildView(flatProfile);
919 // Sort by self time, desc, then by name, desc.
920 flatView.sort((rec1, rec2) =>
921 rec2.selfTime - rec1.selfTime ||
922 (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1));
923 let totalTicks = this.ticks_.total;
924 if (this.ignoreUnknown_) {
925 totalTicks -= this.ticks_.unaccounted;
926 }
927 const printAllTicks = !this.onlySummary_;
928
929 // Count library ticks
930 const flatViewNodes = flatView.head.children;
931
932 let libraryTicks = 0;
933 if (printAllTicks) this.printHeader('Shared libraries');
934 this.printEntries(flatViewNodes, totalTicks, null,
935 name => this.isSharedLibrary(name),
936 (rec) => { libraryTicks += rec.selfTime; }, printAllTicks);
937 const nonLibraryTicks = totalTicks - libraryTicks;
938
939 let jsTicks = 0;
940 if (printAllTicks) this.printHeader('JavaScript');
941 this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
942 name => this.isJsCode(name),
943 (rec) => { jsTicks += rec.selfTime; }, printAllTicks);
944
945 let cppTicks = 0;
946 if (printAllTicks) this.printHeader('C++');
947 this.printEntries(flatViewNodes, totalTicks, nonLibraryTicks,
948 name => this.isCppCode(name),
949 (rec) => { cppTicks += rec.selfTime; }, printAllTicks);
950
951 this.printHeader('Summary');
952 this.printLine('JavaScript', jsTicks, totalTicks, nonLibraryTicks);
953 this.printLine('C++', cppTicks, totalTicks, nonLibraryTicks);
954 this.printLine('GC', this.ticks_.gc, totalTicks, nonLibraryTicks);
955 this.printLine('Shared libraries', libraryTicks, totalTicks, null);
956 if (!this.ignoreUnknown_ && this.ticks_.unaccounted > 0) {
957 this.printLine('Unaccounted', this.ticks_.unaccounted,
958 this.ticks_.total, null);
959 }
960
961 if (printAllTicks) {

Callers 3

testExpectationsFunction · 0.80
testEndToEndFunction · 0.80

Calls 13

printHeaderMethod · 0.95
printEntriesMethod · 0.95
isSharedLibraryMethod · 0.95
isJsCodeMethod · 0.95
isCppCodeMethod · 0.95
printLineMethod · 0.95
printHeavyProfHeaderMethod · 0.95
printHeavyProfileMethod · 0.95
getFlatProfileMethod · 0.80
sortMethod · 0.80
getCEntryProfileMethod · 0.80
getBottomUpProfileMethod · 0.80

Tested by

no test coverage detected