package main

import (
    "log"
    "time"
)

func f() {
    defer timeoutCheck("f slow", time.Now())
    time.Sleep(time.Second)
}

func timeoutCheck(tag string, start time.Time) {
    dis := time.Since(start).Seconds()
    if dis > 1 { 
        log.Println(tag, dis, "s")
    }   
}

func main() {
    f() 
}

  

相关文章:

  • 2021-06-18
  • 2021-07-13
  • 2021-07-11
  • 2022-12-23
  • 2021-06-02
  • 2022-01-09
  • 2021-11-11
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-10-13
  • 2022-02-06
  • 2021-11-15
相关资源
相似解决方案