Hello, I was trying to confirm my suspicion that profile needs to be manually setup in each place for profiling.
So I created (based on the example in the manual) ;; places-profile.rkt #lang racket (define (main) (define p (dynamic-place "any-double.rkt" 'place-entry)) (for ([i (in-range 1000)]) (define l (build-list (random 100) (lambda (_) (random 100)))) (place-channel-put p l) (printf "~a: ~a: ~a~n" i l (place-channel-get p)))) (main) ;; any-double.rkt #lang racket (provide place-entry) (define (any-double? l) (for/or ([i (in-list l)]) (for/or ([i2 (in-list l)]) (= i2 (* 2 i))))) (define (place-entry ch) (let loop () (define l (place-channel-get ch)) (define l-double? (any-double? l)) (place-channel-put ch l-double?) (loop))) Then in the command line: $ raco profile --all-threads --use-errortrace --total places-profile.rkt ... Profiling results ----------------- Total cpu time observed: 142ms (out of 432ms) Number of samples taken: 7 (once every 20ms) ============================================================ Caller Idx Total Self Name+src Local% ms(pct) ms(pct) Callee ============================================================ [1] 39(27.4%) 0(0.0%) (main ...) ...e/pmatos/tmp/places-profile.rkt:12:0 (for ...) [2] 100.0% ------------------------------------------------------------ (main ...) [1] 100.0% [2] 39(27.4%) 0(0.0%) (for ...) /home/pmatos/tmp/places-profile.rkt:7:2 (printf ...) [3] 100.0% ------------------------------------------------------------ (for ...) [2] 100.0% [3] 39(27.4%) 0(0.0%) (printf ...) ...pmatos/tmp/places-profile.rkt:10:4 (place-channel-get ...) [4]100.0% ------------------------------------------------------------ (printf ...) [3] 100.0% [4] 39(27.4%) 39(27.4%) (place-channel-get ...) ...laces-profile.rkt:10:29 ------------------------------------------------------------ I didn't expect this to work, i.e. to get profiling information for any-double? procedure. I am now wondering if there's any example out there on how to actually perform the profiling. From the docs, I can imagine how I could setup something like this: 1. setup a profile command line argument that's passed to places-profile.rkt 2. send a flag indicating if we need profiling in any-double? 3. then use profile-thunk on the function if profiling is required, or nothing if profiling is not required. Is this a possibility or is there something out there to make this easier? Also, profile-thunk says that: "To track all threads, specify a non-#f value for the threads? argument—this will execute the computation in a fresh custodian, and keep track of all threads under this custodian." But what happens if the place itself creates its own custodian to launch threads? Kind regards, -- Paulo Matos -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.