func (t *Trace) String() string {
	return fmt.Sprintf("[Total=%+q, Start=%+q, End=%+q]", t.EndTime.Sub(t.StartTime), t.StartTime, t.EndTime)
}
String returns the giving trace timestamp for the execution time.
package metrics
import (
	"fmt"
	"path/filepath"
	"runtime"
	"strings"
	"time"
)
var (
	stackSize = 1 << 6
	question  = "???"
)
type Trace struct {
	File       string    `json:"file"`
	Package    string    `json:"Package"`
	Function   string    `json:"function"`
	LineNumber int       `json:"line_number"`
	BeginStack []byte    `json:"begin_stack"`
	EndStack   []byte    `json:"end_stack"`
	Comments   []string  `json:"comments"`
	StartTime  time.Time `json:"start_time"`
	EndTime    time.Time `json:"end_time"`
}
func NewTrace(comments ...string) *Trace {
	trace := make([]byte, stackSize)
	trace = trace[:runtime.Stack(trace, false)]
	_, file, line, ok := runtime.Caller(1)
	if !ok {
		file = question
	}
	var pkg, pkgFile string
	pkgFileBase := file
	if file != question {
		pkgPieces := strings.SplitAfter(pkgFileBase, "/src/")
		if len(pkgPieces) > 1 {
			pkgFileBase = pkgPieces[1]
		}
		pkg = filepath.Dir(pkgFileBase)
		pkgFile = filepath.Base(pkgFileBase)
	}
	functionName, _, _ := getFunctionName(3)
	return &Trace{
		Package:    pkg,
		LineNumber: line,
		BeginStack: trace,
		Comments:   comments,
		StartTime:  time.Now(),
		File:       pkgFile,
		Function:   functionName,
	}
}
func NewTraceWithCallDepth(depth int, comments ...string) *Trace {
	trace := make([]byte, stackSize)
	trace = trace[:runtime.Stack(trace, false)]
	_, file, line, ok := runtime.Caller(depth)
	if !ok {
		file = question
	}
	var pkg, pkgFile string
	pkgFileBase := file
	if file != question {
		pkgPieces := strings.SplitAfter(pkgFileBase, "/src/")
		if len(pkgPieces) > 1 {
			pkgFileBase = pkgPieces[1]
		}
		pkg = filepath.Dir(pkgFileBase)
		pkgFile = filepath.Base(pkgFileBase)
	}
	functionName, _, _ := getFunctionName(3)
	return &Trace{
		Package:    pkg,
		LineNumber: line,
		BeginStack: trace,
		File:       pkgFile,
		Comments:   comments,
		StartTime:  time.Now(),
		Function:   functionName,
	}
}