mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-07 02:20:25 +08:00
25 lines
469 B
Go
25 lines
469 B
Go
// Copyright 2022 GoEdge goedge.cdn@gmail.com. All rights reserved.
|
|
|
|
package dbs
|
|
|
|
import "time"
|
|
|
|
type QueryLabel struct {
|
|
manager *QueryStatManager
|
|
query string
|
|
before time.Time
|
|
}
|
|
|
|
func NewQueryLabel(manager *QueryStatManager, query string) *QueryLabel {
|
|
return &QueryLabel{
|
|
manager: manager,
|
|
query: query,
|
|
before: time.Now(),
|
|
}
|
|
}
|
|
|
|
func (this *QueryLabel) End() {
|
|
var cost = time.Since(this.before).Seconds()
|
|
this.manager.AddCost(this.query, cost)
|
|
}
|