Changeset f4f79dd


Ignore:
Timestamp:
Dec 18, 2020, 12:04:39 PM (10 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
720b1a9
Parents:
41cde266
Message:

Minor clean-up in benchmarks

Location:
benchmark/readyQ
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/bench.go

    r41cde266 rf4f79dd  
    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}
  • benchmark/readyQ/cycle.rs

    r41cde266 rf4f79dd  
    1414use tokio::time;
    1515
    16 extern crate isatty;
    1716use isatty::stdout_isatty;
    1817
    19 extern crate num_format;
    2018use num_format::{Locale, ToFormattedString};
    2119
    22 extern crate clap;
    2320use clap::{Arg, App};
    2421
  • benchmark/readyQ/locality.go

    r41cde266 rf4f79dd  
    215215func main() {
    216216        // Benchmark specific command line arguments
    217         work_sizeOpt := flag.Uint64("w", 2    , "Number of words (uint64) per threads")
    218         countOpt     := flag.Uint64("c", 2    , "Number of words (uint64) to touch")
     217        work_sizeOpt := flag.Uint64("w", 2    , "Size of the array for each threads, in words (64bit)")
     218        countOpt     := flag.Uint64("c", 2    , "Number of words to touch when working (random pick, cells can be picked more than once)")
    219219        shareOpt     := flag.Bool  ("s", false, "Pass the work data to the next thread when blocking")
    220220
     
    266266
    267267        // Join and accumulate results
    268         global_result := NewResult()
     268        results := NewResult()
    269269        for i := 0; i < nthreads; i++ {
    270270                r := <- result
    271                 global_result.count += r.count
    272                 global_result.gmigs += r.gmigs
    273                 global_result.dmigs += r.dmigs
     271                results.count += r.count
     272                results.gmigs += r.gmigs
     273                results.dmigs += r.dmigs
    274274        }
    275275
     
    280280        p.Printf("Number of threads      : %d\n", nthreads);
    281281        p.Printf("Work size (64bit words): %d\n", size);
    282         p.Printf("Total Operations(ops)  : %15d\n", global_result.count)
    283         p.Printf("Total G Migrations     : %15d\n", global_result.gmigs)
    284         p.Printf("Total D Migrations     : %15d\n", global_result.dmigs)
    285         p.Printf("Ops per second         : %18.2f\n", float64(global_result.count) / delta.Seconds())
    286         p.Printf("ns per ops             : %18.2f\n", float64(delta.Nanoseconds()) / float64(global_result.count))
    287         p.Printf("Ops per threads        : %15d\n", global_result.count / uint64(nthreads))
    288         p.Printf("Ops per procs          : %15d\n", global_result.count / uint64(nprocs))
    289         p.Printf("Ops/sec/procs          : %18.2f\n", (float64(global_result.count) / float64(nprocs)) / delta.Seconds())
    290         p.Printf("ns per ops/procs       : %18.2f\n", float64(delta.Nanoseconds()) / (float64(global_result.count) / float64(nprocs)))
    291 }
     282        p.Printf("Total Operations(ops)  : %15d\n", results.count)
     283        p.Printf("Total G Migrations     : %15d\n", results.gmigs)
     284        p.Printf("Total D Migrations     : %15d\n", results.dmigs)
     285        p.Printf("Ops per second         : %18.2f\n", float64(results.count) / delta.Seconds())
     286        p.Printf("ns per ops             : %18.2f\n", float64(delta.Nanoseconds()) / float64(results.count))
     287        p.Printf("Ops per threads        : %15d\n", results.count / uint64(nthreads))
     288        p.Printf("Ops per procs          : %15d\n", results.count / uint64(nprocs))
     289        p.Printf("Ops/sec/procs          : %18.2f\n", (float64(results.count) / float64(nprocs)) / delta.Seconds())
     290        p.Printf("ns per ops/procs       : %18.2f\n", float64(delta.Nanoseconds()) / (float64(results.count) / float64(nprocs)))
     291}
Note: See TracChangeset for help on using the changeset viewer.