aboutsummaryrefslogtreecommitdiff
path: root/ui/src/common/track_helper.ts
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-05-07 23:07:26 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-05-07 23:07:26 +0000
commit3b971a8771e2297882f37fa34b601e294d47c95b (patch)
treed3d29c9b7bc209c05e18b07deab6bb9890203c74 /ui/src/common/track_helper.ts
parent73898b17256af788050ba599577bfce1848e36b3 (diff)
parentc8e4b77c020be9a650bfe4ad8c043b20c1046907 (diff)
downloadperfetto-3b971a8771e2297882f37fa34b601e294d47c95b.tar.gz
Snap for 11812660 from c8e4b77c020be9a650bfe4ad8c043b20c1046907 to sdk-release
Change-Id: Ia4526b06f3291c90258186ffd7ab0dbf78927391
Diffstat (limited to 'ui/src/common/track_helper.ts')
-rw-r--r--ui/src/common/track_helper.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/src/common/track_helper.ts b/ui/src/common/track_helper.ts
index 4adeee62e..0b58e01f1 100644
--- a/ui/src/common/track_helper.ts
+++ b/ui/src/common/track_helper.ts
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+import {BigintMath} from '../base/bigint_math';
import {Disposable} from '../base/disposable';
import {duration, Time, time, TimeSpan} from '../base/time';
export {Store} from '../base/store';
@@ -62,9 +63,14 @@ export class TimelineFetcher<Data> implements Disposable {
async requestData(timespan: TimeSpan, resolution: duration): Promise<void> {
if (this.shouldLoadNewData(timespan, resolution)) {
// Over request data, one page worth to the left and right.
- const start = Time.sub(timespan.start, timespan.duration);
- const end = Time.add(timespan.end, timespan.duration);
- this.latestTimespan = new TimeSpan(start, end);
+ const start = timespan.start - timespan.duration;
+ const end = timespan.end + timespan.duration;
+
+ // Quantize up and down to the bounds of |resolution|.
+ const startQ = Time.fromRaw(BigintMath.quantFloor(start, resolution));
+ const endQ = Time.fromRaw(BigintMath.quantCeil(end, resolution));
+
+ this.latestTimespan = new TimeSpan(startQ, endQ);
this.latestResolution = resolution;
await this.loadData();
}