src/Pure/ML-Systems/ml_profiling_polyml-5.6.ML
author wenzelm
Sun, 20 Dec 2015 12:48:56 +0100
changeset 61874 a942e237c9e8
parent 61715 5dc95d957569
child 61885 acdfc76a6c33
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
61715
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/ML-Systems/ml_profiling_polyml-5.6.ML
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     3
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     4
Profiling for Poly/ML 5.6.
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     5
*)
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     6
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     7
fun profile 0 f x = f x
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     8
  | profile n f x =
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
     9
      let
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    10
        val mode =
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    11
          (case n of
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    12
            1 => PolyML.Profiling.ProfileTime
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    13
          | 2 => PolyML.Profiling.ProfileAllocations
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    14
          | 3 => PolyML.Profiling.ProfileLongIntEmulation
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    15
          | 6 => PolyML.Profiling.ProfileTimeThisThread
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    16
          | _ => raise Fail ("Bad profile mode: " ^ Int.toString n));
5dc95d957569 speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff changeset
    17
      in PolyML.Profiling.profile mode f x end;