Changeset 35653 in webkit for trunk/JavaScriptCore/VM/SamplingTool.cpp
- Timestamp:
- Aug 9, 2008, 2:14:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/SamplingTool.cpp
r35487 r35653 56 56 static void sleepForMicroseconds(unsigned us) 57 57 { 58 unsigned ms = us /1000;58 unsigned ms = us / 1000; 59 59 if (us && !ms) 60 60 ms = 1; … … 170 170 Vector<ScopeSampleRecord*> codeBlockSamples(scopeCount); 171 171 ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin(); 172 for (int i =0; i < scopeCount; ++i, ++iter) {172 for (int i = 0; i < scopeCount; ++i, ++iter) { 173 173 codeBlockSamples[i] = iter->second; 174 174 totalCodeBlockSamples += codeBlockSamples[i]->m_totalCount; … … 185 185 long long opcodeSampleCounts[numOpcodeIDs] = { 0 }; 186 186 187 fprintf(stdout,"\nBlock sampling results\n\n");188 fprintf(stdout,"Total blocks sampled (total samples): %lld (%lld)\n\n", totalCodeBlockSamples, m_totalSamples);187 printf("\nBlock sampling results\n\n"); 188 printf("Total blocks sampled (total samples): %lld (%lld)\n\n", totalCodeBlockSamples, m_totalSamples); 189 189 190 190 for (int i=0; i < scopeCount; i++) { 191 ScopeSampleRecord *record = codeBlockSamples[i];191 ScopeSampleRecord* record = codeBlockSamples[i]; 192 192 CodeBlock* codeBlock = record->m_codeBlock; 193 193 … … 197 197 if ((blockPercent >= 1) && codeBlock) { 198 198 Instruction* code = codeBlock->instructions.begin(); 199 fprintf(stdout, "#%d: %s:%d: sampled %d times - %.3f%% (%.3f%%)\n", i+1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForVPC(code), record->m_totalCount, blockPercent, totalPercent);199 printf("#%d: %s:%d: sampled %d times - %.3f%% (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForVPC(code), record->m_totalCount, blockPercent, totalPercent); 200 200 if (i < 10) { 201 201 HashMap<unsigned,unsigned> lineCounts; … … 257 257 // (4) Print Opcode sampling results. 258 258 259 fprintf(stdout,"\nOpcode sampling results\n\n");259 printf("\nOpcode sampling results\n\n"); 260 260 261 fprintf(stdout,"Total opcodes sampled (total samples): %lld (%lld)\n\n", totalOpcodeSamples, m_totalSamples);262 fprintf(stdout,"Opcodes in order:\n\n");261 printf("Total opcodes sampled (total samples): %lld (%lld)\n\n", totalOpcodeSamples, m_totalSamples); 262 printf("Opcodes in order:\n\n"); 263 263 for (int i = 0; i < numOpcodeIDs; ++i) { 264 264 long long count = opcodeSampleCounts[i]; 265 fprintf(stdout, "%s:%s%6lld\t%.3f%%\t(%.3f%%)\n", opcodeNames[i], padOpcodeName((OpcodeID)i, 20), count, ((double)count * 100)/totalOpcodeSamples, ((double)count * 100)/m_totalSamples);266 } 267 fprintf(stdout,"\n");268 fprintf(stdout,"Opcodes by sample count:\n\n");265 printf("%s:%s%6lld\t%.3f%%\t(%.3f%%)\n", opcodeNames[i], padOpcodeName(reinterpret_cast<OpcodeID>(i), 20), count, (static_cast<double>(count) * 100) / totalOpcodeSamples, (static_cast<double>(count) * 100) / m_totalSamples); 266 } 267 printf("\n"); 268 printf("Opcodes by sample count:\n\n"); 269 269 for (int i = 0; i < numOpcodeIDs; ++i) { 270 270 OpcodeID opcode = opcodeSampleInfo[i].opcode; 271 271 long long count = opcodeSampleInfo[i].count; 272 fprintf(stdout, "%s:%s%6lld\t%.3f%%\t(%.3f%%)\n", opcodeNames[opcode], padOpcodeName(opcode, 20), count, ((double)count * 100)/totalOpcodeSamples, ((double)count * 100)/m_totalSamples);273 } 274 fprintf(stdout,"\n");272 printf("%s:%s%6lld\t%.3f%%\t(%.3f%%)\n", opcodeNames[opcode], padOpcodeName(opcode, 20), count, (static_cast<double>(count) * 100) / totalOpcodeSamples, (static_cast<double>(count) * 100) / m_totalSamples); 273 } 274 printf("\n"); 275 275 } 276 276
Note:
See TracChangeset
for help on using the changeset viewer.