ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | Last change
 on this file since a6f991f was             bf71cfd, checked in by Thierry Delisle <tdelisle@…>, 7 years ago | 
        
          | 
Moved up many directories in source
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            471 bytes | 
      
      
| Line |  | 
|---|
| 1 | package main | 
|---|
| 2 |  | 
|---|
| 3 | import ( | 
|---|
| 4 | "fmt" | 
|---|
| 5 | "time" | 
|---|
| 6 | ) | 
|---|
| 7 |  | 
|---|
| 8 | var shake chan bool = make( chan bool ) | 
|---|
| 9 |  | 
|---|
| 10 | func noop() { | 
|---|
| 11 | shake <- true   // indicate completion | 
|---|
| 12 | } | 
|---|
| 13 |  | 
|---|
| 14 | //======================================= | 
|---|
| 15 | // benchmark driver | 
|---|
| 16 | //======================================= | 
|---|
| 17 |  | 
|---|
| 18 | func main() { | 
|---|
| 19 | const NoOfTimes = 500000 | 
|---|
| 20 | start := time.Now() | 
|---|
| 21 | for i := 1; i <= NoOfTimes; i += 1 { | 
|---|
| 22 | go noop()               // creation | 
|---|
| 23 | } | 
|---|
| 24 | end := time.Now() | 
|---|
| 25 | fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes)) | 
|---|
| 26 | <- shake | 
|---|
| 27 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.