1(* Title: Pure/ML/ml_statistics.ML 2 Author: Makarius 3 4ML runtime statistics. 5*) 6 7signature ML_STATISTICS = 8sig 9 val get: unit -> Properties.T 10end; 11 12structure ML_Statistics: ML_STATISTICS = 13struct 14 15fun get () = 16 let 17 val 18 {gcFullGCs, 19 gcPartialGCs, 20 sizeAllocation, 21 sizeAllocationFree, 22 sizeHeap, 23 sizeHeapFreeLastFullGC, 24 sizeHeapFreeLastGC, 25 threadsInML, 26 threadsTotal, 27 threadsWaitCondVar, 28 threadsWaitIO, 29 threadsWaitMutex, 30 threadsWaitSignal, 31 timeGCSystem, 32 timeGCUser, 33 timeNonGCSystem, 34 timeNonGCUser, 35 userCounters} = PolyML.Statistics.getLocalStats (); 36 val user_counters = 37 Vector.foldri 38 (fn (i, j, res) => ("user_counter" ^ Value.print_int i, Value.print_int j) :: res) 39 [] userCounters; 40 in 41 [("full_GCs", Value.print_int gcFullGCs), 42 ("partial_GCs", Value.print_int gcPartialGCs), 43 ("size_allocation", Value.print_int sizeAllocation), 44 ("size_allocation_free", Value.print_int sizeAllocationFree), 45 ("size_heap", Value.print_int sizeHeap), 46 ("size_heap_free_last_full_GC", Value.print_int sizeHeapFreeLastFullGC), 47 ("size_heap_free_last_GC", Value.print_int sizeHeapFreeLastGC), 48 ("threads_in_ML", Value.print_int threadsInML), 49 ("threads_total", Value.print_int threadsTotal), 50 ("threads_wait_condvar", Value.print_int threadsWaitCondVar), 51 ("threads_wait_IO", Value.print_int threadsWaitIO), 52 ("threads_wait_mutex", Value.print_int threadsWaitMutex), 53 ("threads_wait_signal", Value.print_int threadsWaitSignal), 54 ("time_CPU", Value.print_real (Time.toReal timeNonGCSystem + Time.toReal timeNonGCUser)), 55 ("time_GC", Value.print_real (Time.toReal timeGCSystem + Time.toReal timeGCUser))] @ 56 user_counters 57 end; 58 59end; 60