Skip to content
  • Daniel Gröber (dxld)'s avatar
    rts: ProfHeap: Fix wrong time in last heap profile sample · ec77b2f1
    Daniel Gröber (dxld) authored and Marge Bot's avatar Marge Bot committed
    We've had this longstanding issue in the heap profiler, where the time of
    the last sample in the profile is sometimes way off causing the rendered
    graph to be quite useless for long runs.
    
    It seems to me the problem is that we use mut_user_time() for the last
    sample as opposed to getRTSStats(), which we use when calling heapProfile()
    in GC.c.
    
    The former is equivalent to getProcessCPUTime() but the latter does
    some additional stuff:
    
        getProcessCPUTime() - end_init_cpu - stats.gc_cpu_ns -
        stats.nonmoving_gc_cpu_ns
    
    So to fix this just use getRTSStats() in both places.
    ec77b2f1