Opened 22 months ago

#445 new feature

Add a compute cost stack and a primop to measure the cost of a computation.

Reported by: benl Owned by:
Priority: normal Milestone: memoizer
Component: Runtime System Version: none
Keywords: Cc:


We want a measure# primop that runs a given computation while measuring the runtime cost in both cycles and bytes allocated on the heap.

measure# : forall a. S Pure a -> (a, Cost)
data Cost = Cost {cycles: Word64, bytes: Word64}

We should first add primops to read the native CPU cycle counter, and a count of the number of bytes allocated since the start of the program. To measure the cost of a computation we then store the current cycle count and number of allocated bytes to some temp storage, run the computation, then compare the old values with the new values.

Change History (0)

Note: See TracTickets for help on using tickets.