//synchronized
void PerfTraceEvent::End(
    /* [in] */ String name,
    /* [in] */ IMemoryInfo* memoryInfo)
{
    AutoLock lock(this);
    Int64 eventId = name.HashCode();
    TraceEvent::FinishAsync(name, eventId);
    if (sEnabled && MatchesFilter(name)) {
        if (sTrackTiming) {
            SavePerfString(name, eventId, EventType::FINISH, FALSE);
        }
        // Done after calculating the instant perf data to ensure calculating the memory usage
        // does not influence the timing data.
        Int64 timestampUs = (System::NanoTime() - sBeginNanoTime) / 1000;
        SavePerfString(MakeMemoryTraceNameFromTimingName(name), eventId, EventType::FINISH,
                timestampUs, memoryInfo);
    }
}
Esempio n. 2
0
//synchronized
void PerfTraceEvent::Begin(
    /* [in] */ String name)
{
    AutoLock lock(this);
    const Int64 eventId = name.HashCode();
    TraceEvent::StartAsync(name, eventId);
    if (sEnabled && MatchesFilter(name)) {
        // Done before calculating the starting perf data to ensure calculating the memory usage
        // does not influence the timing data.
        if (sTrackMemory) {
            SavePerfString(MakeMemoryTraceNameFromTimingName(name), eventId, EventType::START,
                    TRUE);
        }
        if (sTrackTiming) {
            SavePerfString(name, eventId, EventType::START, FALSE);
        }
    }
}
Esempio n. 3
0
//synchronized
void PerfTraceEvent::End(
    /* [in] */ String name)
{
    AutoLock lock(this);
    const Int64 eventId = name.HashCode();
    TraceEvent::FinishAsync(name, eventId);
    if (sEnabled && MatchesFilter(name)) {
        if (sTrackTiming) {
            SavePerfString(name, eventId, EventType.FINISH, FALSE);
        }
        // Done after calculating the ending perf data to ensure calculating the memory usage
        // does not influence the timing data.
        if (sTrackMemory) {
            SavePerfString(MakeMemoryTraceNameFromTimingName(name), eventId, EventType::FINISH,
                    TRUE);
        }
    }
}
Esempio n. 4
0
//synchronized
void PerfTraceEvent::Instant(
    /* [in] */ String name)
{
    AutoLock lock(this);
    // Instant doesn't really need/take an event id, but this should be okay.
    Int64 eventId = name.HashCode();
    TraceEvent::Instant(name);
    if (sEnabled && MatchesFilter(name)) {
        SavePerfString(name, eventId, EventType::INSTANT, FALSE);
    }
}
Esempio n. 5
0
/**
 * Save a perf trace event as a JSON dict.  The format mirrors a TraceEvent dict.
 *
 * @param name The trace data
 * @param id The id of the event
 * @param type the type of trace event (I, S, F)
 * @param includeMemory Whether to include current browser process memory usage in the trace.
 */
void PerfTraceEvent::SavePerfString(
    /* [in] */ String name,
    /* [in] */ Int64 id,
    /* [in] */ String type,
    /* [in] */ Boolean includeMemory)
{
    Int64 timestampUs = (System::NanoTime() - sBeginNanoTime) / 1000;
    AutoPtr<IMemoryInfo> memInfo;
    if (includeMemory) {
        CMemoryInfo::New((IMemoryInfo**)&memInfo);
        Debug::GetMemoryInfo(memInfo);
    }
    SavePerfString(name, id, type, timestampUs, memInfo);
}