]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve 优化性能响应
authorqydysky <qydysky@foxmail.com>
Sat, 25 Nov 2023 12:17:27 +0000 (20:17 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 25 Nov 2023 12:17:27 +0000 (20:17 +0800)
CV/Var.go

index e3fc12a5de788209a892ab6190975a88d639e70a..7591ee416850c895ee7aab45a01380030960cd78 100644 (file)
--- a/CV/Var.go
+++ b/CV/Var.go
@@ -8,6 +8,7 @@ import (
        "flag"
        "fmt"
        "io"
+       "math"
        "net/http"
        "net/url"
        "os"
@@ -255,12 +256,18 @@ func (t *Common) Init() *Common {
 
        t.ReqPool = pool.New(
                func() *reqf.Req {
+                       // if pc, file, line, ok := runtime.Caller(2); ok {
+                       //      fmt.Printf("call by %s\n\t%s:%d\n", runtime.FuncForPC(pc).Name(), file, line)
+                       // }
                        return reqf.New()
                },
                func(t *reqf.Req) bool {
                        return t.IsLive()
                },
                func(t *reqf.Req) *reqf.Req {
+                       // if pc, file, line, ok := runtime.Caller(2); ok {
+                       //      fmt.Printf("call by %s\n\t%s:%d\n", runtime.FuncForPC(pc).Name(), file, line)
+                       // }
                        return t
                },
                func(t *reqf.Req) *reqf.Req {
@@ -387,7 +394,7 @@ func (t *Common) Init() *Common {
                                                                "inuse":    reqState[2],
                                                                "nouse":    reqState[3],
                                                                "sum":      reqState[4],
-                                                               "qts":      reqState[5],
+                                                               "qts":      math.Round(reqState[5].(float64)*100) / 100,
                                                        },
                                                        "numGoroutine": runtime.NumGoroutine(),
                                                        "goVersion":    runtime.Version(),