• Etienne Pierre-doray's avatar
    [Clank SSM]: Make StackCopierSignal robust to TimeTicks failures. · 8bf9fbd7
    Etienne Pierre-doray authored
    Sampling profiler uses TimeTicks::Now in signal handler to get a
    timestamp associated with the sample.
    When called from signal handler, TimeTicks::Now occasionally crashes
    the  following check:
    CHECK(clock_gettime(clk_id, &ts) == 0)
    
    In order to get good time precision in profiler, we'd like to get
    a timestamp while the sampled thread is paused. Since failures are rare,
    a solution is to allow clock_gettime to fail, and fallback to getting
    an 'async' timestamp after resume.
    
    To reuse some of the ConvertTimespecToMicros boilerplate common with
    TimeTicks::Now, this CL exposes
    subtle::MaybeTimeTicksNowIgnoringOverride() on posix, used in
    stack_coper_signal.
    
    
    Bug: 1155269
    Change-Id: I4d8f5a3e050f5285b87297f13dfd29e888e40257
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584603
    Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
    Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
    Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#836298}
    8bf9fbd7
stack_copier_signal.cc 8.85 KB