Ignore:
Timestamp:
Dec 22, 2020, 9:16:13 AM (3 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
797a193
Parents:
0285efe (diff), 3f8baf4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/bench.go

    r0285efe rfe97de26  
    55        "flag"
    66        "fmt"
     7        "log"
    78        "os"
    89        "runtime"
     10        "runtime/pprof"
    911        "sync/atomic"
    1012        "time"
     
    4345}
    4446
    45 func bench_init() {
     47func bench_init() func() {
    4648        nprocsOpt := flag.Int("p", 1, "The number of processors")
    4749        nthreadsOpt := flag.Int("t", 1, "The number of threads")
    4850        durationOpt := flag.Float64("d", 0, "Duration of the experiment in seconds")
    4951        stopOpt := flag.Uint64("i", 0, "Duration of the experiment in iterations")
     52        cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file")
    5053
    5154        flag.Parse()
     
    7275
    7376        runtime.GOMAXPROCS(nprocs)
     77
     78        if (*cpuprofile) != "" {
     79                f, err := os.Create(*cpuprofile)
     80                if err != nil {
     81                    log.Fatal(err)
     82                }
     83                pprof.StartCPUProfile(f)
     84        }
     85
     86        return func() {
     87                if (*cpuprofile) != "" {
     88                        pprof.StopCPUProfile()
     89                }
     90        }
    7491}
Note: See TracChangeset for help on using the changeset viewer.