• sque@chromium.org's avatar
    metrics: Add random delays to perf collection · 31c4d76b
    sque@chromium.org authored
    When collecting upon resume from suspend or session restore, don't always
    collect right away. Introduce a random delay before collecting.
    
    BUG=chromium:358778
    TEST=Do the following:
    - Add logging to ParseProtoIfValid().
    - Set kResumeSamplingFactor=1 and kRestoreSessionSamplingFactor=1. This makes
      collection happen 100% of the time.
    - Set kPerfProfilingIntervalMs=20000. This makes the periodic collection happen once every 20-second interval.
    - Trigger both types of collections, resume and restore:
      = Suspend and resume the system.
      = Open some tabs in ChromeOS, log out of Chrome, and then log back in so that
        the session is restored.
    - Should see the logging trace displayed in /var/log/ui/ui.LATEST after a
      random delay.
    - Should also see the periodic collections take place.
      = Open an incognito window. It should continue to attempt to collect. (Add a trace to ScheduleIntervalCollection to see that this is the case).
    Signed-off-by: default avatarSimon Que <sque@chromium.org>
    
    Review URL: https://codereview.chromium.org/364913007
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283674 0039d316-1c4b-4281-b951-d872f2087c98
    31c4d76b
perf_provider_chromeos.cc 14.6 KB