Ignore:
Timestamp:
Aug 9, 2008, 2:14:54 PM (17 years ago)
Author:
[email protected]
Message:

2008-08-09 Cameron Zwarich <[email protected]>

Reviewed by Maciej.

Fix some style issues in the sampling tool.

  • VM/SamplingTool.cpp: (KJS::sleepForMicroseconds): (KJS::SamplingTool::dump):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/SamplingTool.cpp

    r35487 r35653  
    5656static void sleepForMicroseconds(unsigned us)
    5757{
    58     unsigned ms = us/1000;
     58    unsigned ms = us / 1000;
    5959    if (us && !ms)
    6060        ms = 1;
     
    170170    Vector<ScopeSampleRecord*> codeBlockSamples(scopeCount);
    171171    ScopeSampleRecordMap::iterator iter = m_scopeSampleMap->begin();
    172     for (int i=0; i < scopeCount; ++i, ++iter) {
     172    for (int i = 0; i < scopeCount; ++i, ++iter) {
    173173        codeBlockSamples[i] = iter->second;
    174174        totalCodeBlockSamples += codeBlockSamples[i]->m_totalCount;
     
    185185    long long opcodeSampleCounts[numOpcodeIDs] = { 0 };
    186186
    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);
    189189
    190190    for (int i=0; i < scopeCount; i++) {
    191         ScopeSampleRecord *record = codeBlockSamples[i];
     191        ScopeSampleRecord* record = codeBlockSamples[i];
    192192        CodeBlock* codeBlock = record->m_codeBlock;
    193193
     
    197197        if ((blockPercent >= 1) && codeBlock) {
    198198            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);
    200200            if (i < 10) {
    201201                HashMap<unsigned,unsigned> lineCounts;
     
    257257    // (4) Print Opcode sampling results.
    258258   
    259     fprintf(stdout, "\nOpcode sampling results\n\n");
     259    printf("\nOpcode sampling results\n\n");
    260260   
    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");
    263263    for (int i = 0; i < numOpcodeIDs; ++i) {
    264264        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");
    269269    for (int i = 0; i < numOpcodeIDs; ++i) {
    270270        OpcodeID opcode = opcodeSampleInfo[i].opcode;
    271271        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");
    275275}
    276276
Note: See TracChangeset for help on using the changeset viewer.