Skip to content

Instantly share code, notes, and snippets.

@dollarkillerx
Created March 28, 2020 15:31
Show Gist options
  • Save dollarkillerx/169e9e878e635bb5df6425ac28e1214b to your computer and use it in GitHub Desktop.
Save dollarkillerx/169e9e878e635bb5df6425ac28e1214b to your computer and use it in GitHub Desktop.
统计go方法耗时
package main

import (
    "fmt"
    "time"
)

func StartCac() {
    t1 := time.Now() // get current time
    //logic handlers
    for i := 0; i < 1000; i++ {
        fmt.Print("*")
    }
    elapsed := time.Since(t1)
    fmt.Println("App elapsed: ", elapsed)
}

func main(){
    StartCac()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment