On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
> 
> 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.
> 

I have attempted this:
;; places-profile.rkt

#lang racket

(define (main)
  (define p
    (dynamic-place "any-double.rkt" 'place-entry))

  ;; enable profiling
  (place-channel-put p #t)

  (for ([i (in-range 10000000)])
    (define l (build-list (random 10000) (lambda (_) (random 100))))
    (place-channel-put p l)
    (place-channel-get p))

  (place-kill p))

(main)

;; any-double.rkt

#lang racket

(require profile)
(require profile/render-text)

(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)
  (define profile? (place-channel-get ch))

  (profile-thunk
   (thunk
    (let loop ()
      (define l (place-channel-get ch))
      (define l-double? (any-double? l))
      (place-channel-put ch l-double?)
      (loop)))
   #:periodic-renderer (list 4 render)
   #:use-errortrace? #t
   #:threads #t))



Unfortunately, every 4 secs I see:
Profiling results
-----------------
  Total cpu time observed: 185393ms (out of 188238ms)
  Number of samples taken: 3727 (once every 50ms)

====================================
                        Caller
Idx  Total    Self    Name+srcLocal%
     ms(pct)  ms(pct)   Callee
====================================


Absolutely no results. Why?

Also, if I reduce the number of iterations in places-profile.rkt to
1000, and remove the periodic-render, there's absolutely no output from
the profiler. Is this related with the killing of the place via
place-kill? Is there a nice way to kill a place and still preserve
profiling information?

-- 
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.

Reply via email to