diff options
| author | Mistivia <i@mistivia.com> | 2025-11-05 15:34:49 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-11-05 15:34:49 +0800 |
| commit | 95caa5bdaff4e5b5a924a9141b51c756a57abc0f (patch) | |
| tree | bb0ff8eddfe8a06558317464cea14405e76b7ebc /deprecated-webircgateway/plugins | |
| parent | 8532af453ccc9071ddc919b063788d6b496af991 (diff) | |
remove deprecated
Diffstat (limited to 'deprecated-webircgateway/plugins')
| -rw-r--r-- | deprecated-webircgateway/plugins/example/plugin.go | 11 | ||||
| -rw-r--r-- | deprecated-webircgateway/plugins/stats/plugin.go | 52 |
2 files changed, 0 insertions, 63 deletions
diff --git a/deprecated-webircgateway/plugins/example/plugin.go b/deprecated-webircgateway/plugins/example/plugin.go deleted file mode 100644 index 085d9e3..0000000 --- a/deprecated-webircgateway/plugins/example/plugin.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import ( - "sync" - - "github.com/kiwiirc/webircgateway/pkg/webircgateway" -) - -func Start(gateway *webircgateway.Gateway, pluginsQuit *sync.WaitGroup) { - gateway.Log(1, "Example gateway plugin %s", webircgateway.Version) -}
\ No newline at end of file diff --git a/deprecated-webircgateway/plugins/stats/plugin.go b/deprecated-webircgateway/plugins/stats/plugin.go deleted file mode 100644 index bdafc41..0000000 --- a/deprecated-webircgateway/plugins/stats/plugin.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "fmt" - "math" - "os" - "runtime" - "sync" - "time" - - "github.com/kiwiirc/webircgateway/pkg/webircgateway" -) - -func Start(gateway *webircgateway.Gateway, pluginsQuit *sync.WaitGroup) { - gateway.Log(2, "Stats reporting plugin loading") - go reportUsage(gateway) - - pluginsQuit.Done() -} - -func reportUsage(gateway *webircgateway.Gateway) { - started := time.Now() - - out := func(line string) { - file, _ := os.OpenFile("stats_"+fmt.Sprintf("%v", started.Unix())+".csv", - os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - file.WriteString(line) - file.Close() - } - - out("time,rss,heapinuse,heapalloc,numroutines,numclients\n") - - for { - time.Sleep(time.Second * 5) - - numClients := gateway.Clients.Count() - mem := &runtime.MemStats{} - runtime.ReadMemStats(mem) - - line := fmt.Sprintf( - "%v,%v,%v,%v,%v,%v\n", - math.Round(time.Now().Sub(started).Seconds()), - mem.Sys/1024, - mem.HeapInuse/1024, - mem.HeapAlloc/1024, - runtime.NumGoroutine(), - numClients, - ) - - out(line) - } -} |
