Changeset fe97de26 for benchmark/readyQ/locality.go
- Timestamp:
- Dec 22, 2020, 9:16:13 AM (3 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/readyQ/locality.go
r0285efe rfe97de26 18 18 // ================================================== 19 19 type MyData struct { 20 _p1 [16]uint64 // padding 20 21 ttid int 21 22 id int 22 23 data [] uint64 24 _p2 [16]uint64 // padding 23 25 } 24 26 … … 29 31 data[i] = 0 30 32 } 31 return &MyData{ syscall.Gettid(), id, data}33 return &MyData{[16]uint64{0}, syscall.Gettid(), id, data,[16]uint64{0}} 32 34 } 33 35 … … 46 48 // ================================================== 47 49 type MyCtx struct { 50 _p1 [16]uint64 // padding 48 51 s * semaphore.Weighted 49 52 d unsafe.Pointer … … 51 54 ttid int 52 55 id int 56 _p2 [16]uint64 // padding 53 57 } 54 58 55 59 func NewCtx( data * MyData, id int ) (MyCtx) { 56 r := MyCtx{ semaphore.NewWeighted(1), unsafe.Pointer(data), context.Background(), syscall.Gettid(), id}60 r := MyCtx{[16]uint64{0},semaphore.NewWeighted(1), unsafe.Pointer(data), context.Background(), syscall.Gettid(), id,[16]uint64{0}} 57 61 r.s.Acquire(context.Background(), 1) 58 62 return r … … 71 75 // May exchanges data 72 76 type Spot struct { 77 _p1 [16]uint64 // padding 73 78 ptr uintptr // atomic variable use fo MES 74 79 id int // id for debugging 80 _p2 [16]uint64 // padding 75 81 } 76 82 … … 215 221 func main() { 216 222 // 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")223 work_sizeOpt := flag.Uint64("w", 2 , "Size of the array for each threads, in words (64bit)") 224 countOpt := flag.Uint64("c", 2 , "Number of words to touch when working (random pick, cells can be picked more than once)") 219 225 shareOpt := flag.Bool ("s", false, "Pass the work data to the next thread when blocking") 220 226 … … 239 245 channels := make([]Spot, nthreads - nprocs) // Number of spots 240 246 for i := range channels { 241 channels[i] = Spot{ uintptr(0), i} // init spots247 channels[i] = Spot{[16]uint64{0},uintptr(0), i,[16]uint64{0}} // init spots 242 248 } 243 249 … … 266 272 267 273 // Join and accumulate results 268 global_result:= NewResult()274 results := NewResult() 269 275 for i := 0; i < nthreads; i++ { 270 276 r := <- result 271 global_result.count += r.count272 global_result.gmigs += r.gmigs273 global_result.dmigs += r.dmigs277 results.count += r.count 278 results.gmigs += r.gmigs 279 results.dmigs += r.dmigs 274 280 } 275 281 … … 280 286 p.Printf("Number of threads : %d\n", nthreads); 281 287 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 } 288 p.Printf("Total Operations(ops) : %15d\n", results.count) 289 p.Printf("Total G Migrations : %15d\n", results.gmigs) 290 p.Printf("Total D Migrations : %15d\n", results.dmigs) 291 p.Printf("Ops per second : %18.2f\n", float64(results.count) / delta.Seconds()) 292 p.Printf("ns per ops : %18.2f\n", float64(delta.Nanoseconds()) / float64(results.count)) 293 p.Printf("Ops per threads : %15d\n", results.count / uint64(nthreads)) 294 p.Printf("Ops per procs : %15d\n", results.count / uint64(nprocs)) 295 p.Printf("Ops/sec/procs : %18.2f\n", (float64(results.count) / float64(nprocs)) / delta.Seconds()) 296 p.Printf("ns per ops/procs : %18.2f\n", float64(delta.Nanoseconds()) / (float64(results.count) / float64(nprocs))) 297 }
Note: See TracChangeset
for help on using the changeset viewer.