StopWatch: Declare a stop_watch variable while timing
* A variable is needed to hold the reference of stop watch in the current scope. The variable will be freed once the current scope exits * Without such a variable, the constructed stopwatch will only exist as a temporary stack variable and freed immediately after the declaration line, making the stop watch only timing the time needed for construction and immediate destruction. As result, current stop watch all show very minimum durations. * Commands used: * find ./ -type f -exec sed -i 's/StopWatchLegacy(__func__);/StopWatchLegacy stop_watch(__func__);/g' {} \; * find ./ -type f -exec sed -i 's/common::StopWatch(/common::StopWatch stop_watch(/g' {} \; Bug: 207608879 Test: GD presubmit and make Tag: #gd-refactor Change-Id: Ia38cf3d1473f750c6a08ba4d6551d7fafba4345a
Loading
Please register or sign in to comment