stamourv/feature-profile

Default feature-grouper not documented

Closed this issue · 1 comments

The default grouping function for custom features assumes that all payloads are source locations. When I create a new feature with a different kind of payload and don't provide my own grouping function, the profiler crashes:

#lang racket

(require feature-profile)
(require syntax/location)

(module feat racket/base
  (provide my-feature
           do-work)

  (require feature-profile/plug-in-lib)

  (define my-mark-key
    (make-continuation-mark-key 'test))

  (define my-feature
    (feature "test"
             my-mark-key
             #f
             #f))

  (define-syntax-rule (do-work e)
    (with-continuation-mark my-mark-key
      1
      (begin (sleep 1) e))))

(define (fact n)
  (cond
    [(zero? n) 1]
    [else (* n (fact (- n 1)))]))

(require 'feat)

(feature-profile #:features (list my-feature)
                 (do-work (fact 20)))

Running results in:

../racket/racket/share/pkgs/feature-profile/profile-helpers.rkt:43:17: vector->list: contract violation
  expected: vector?
  given: 1

And I don't see this requirement documented anywhere.

I agree that this is a problem. I don't have time to look into it at the moment, though.
I just gave you push access to the repo, in case you want to give it a shot.