Skip to content

Commit

Permalink
test load delay
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Sep 4, 2024
1 parent d03cced commit 654cca8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/chunk_manager/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ export class ChunkQueueManager extends SharedObjectCounterpart {
computeCapacity: AvailableCapacity;

enablePrefetch: SharedWatchableValue<boolean>;
loadDelay: SharedWatchableValue<number>;

/**
* Set of chunk sources associated with this queue manager.
Expand Down Expand Up @@ -737,6 +738,7 @@ export class ChunkQueueManager extends SharedObjectCounterpart {
getCapacity(options.downloadCapacity),
];
this.computeCapacity = getCapacity(options.computeCapacity);
this.loadDelay = rpc.get(options.loadDelay);
}

scheduleUpdate() {
Expand Down Expand Up @@ -1201,10 +1203,11 @@ export class ChunkManager extends SharedObjectCounterpart {
}

scheduleUpdateChunkPriorities() {
console.log("load delay", this.queueManager.loadDelay.value);
if (this.updatePending === null) {
this.updatePending = setTimeout(
this.recomputeChunkPriorities_.bind(this),
0,
this.queueManager.loadDelay.value,
);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/chunk_manager/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { TrackableValue } from "#src/trackable_value.js";
import type { CancellationToken } from "#src/util/cancellation.js";
import { CANCELED } from "#src/util/cancellation.js";
import type { Borrowed } from "#src/util/disposable.js";
import { stableStringify } from "#src/util/json.js";
import { stableStringify, verifyInt } from "#src/util/json.js";
import { StringMemoize } from "#src/util/memoize.js";
import { getObjectId } from "#src/util/object_id.js";
import { NullarySignal } from "#src/util/signal.js";
Expand Down Expand Up @@ -113,6 +113,7 @@ export class ChunkQueueManager extends SharedObject {
chunkUpdateDelay = 30;

enablePrefetch = new TrackableBoolean(true, true);
loadDelay = new TrackableValue<number>(0, verifyInt);

constructor(
rpc: RPC,
Expand Down Expand Up @@ -146,6 +147,9 @@ export class ChunkQueueManager extends SharedObject {
enablePrefetch: this.registerDisposer(
SharedWatchableValue.makeFromExisting(rpc, this.enablePrefetch),
).rpcId,
loadDelay: this.registerDisposer(
SharedWatchableValue.makeFromExisting(rpc, this.loadDelay),
).rpcId,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/ui/viewer_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class ViewerSettingsPanel extends SidePanel {
);
addCheckbox("Wire frame rendering", viewer.wireFrame);
addCheckbox("Enable prefetching", viewer.chunkQueueManager.enablePrefetch);
addLimitWidget("Load delay", viewer.chunkQueueManager.loadDelay);
addCheckbox(
"Enable adaptive downsampling",
viewer.enableAdaptiveDownsampling,
Expand Down
1 change: 1 addition & 0 deletions src/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ class TrackableViewerState extends CompoundTrackable {
viewer.dataContext.chunkQueueManager.capacities.gpuMemory.sizeLimit,
);
this.add("prefetch", viewer.dataContext.chunkQueueManager.enablePrefetch);
this.add("loadDelay", viewer.dataContext.chunkQueueManager.loadDelay);
this.add(
"systemMemoryLimit",
viewer.dataContext.chunkQueueManager.capacities.systemMemory.sizeLimit,
Expand Down

0 comments on commit 654cca8

Please sign in to comment.