Skip to content
Snippets Groups Projects
Unverified Commit 83657a19 authored by Luca Moser's avatar Luca Moser Committed by GitHub
Browse files

Makes pprof profiling a plugin (#342)


* makes pprof profiling a plugin

* Update plugins/profiling/plugin.go

Co-Authored-By: default avatarAngelo Capossele <angelocapossele@gmail.com>

* Update pluginmgr/core/plugins.go

Co-Authored-By: default avatarAngelo Capossele <angelocapossele@gmail.com>

Co-authored-by: default avatarAngelo Capossele <angelocapossele@gmail.com>
parent 5cdedebb
No related branches found
No related tags found
No related merge requests found
package main package main
import ( import (
"net/http"
_ "net/http/pprof" _ "net/http/pprof"
"github.com/iotaledger/goshimmer/pluginmgr/core" "github.com/iotaledger/goshimmer/pluginmgr/core"
...@@ -13,8 +12,6 @@ import ( ...@@ -13,8 +12,6 @@ import (
) )
func main() { func main() {
go http.ListenAndServe("localhost:6061", nil) // pprof Server for Debbuging Mutexes
node.Run( node.Run(
core.PLUGINS, core.PLUGINS,
research.PLUGINS, research.PLUGINS,
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
"github.com/iotaledger/goshimmer/plugins/messagelayer" "github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/iotaledger/goshimmer/plugins/metrics" "github.com/iotaledger/goshimmer/plugins/metrics"
"github.com/iotaledger/goshimmer/plugins/portcheck" "github.com/iotaledger/goshimmer/plugins/portcheck"
"github.com/iotaledger/goshimmer/plugins/profiling"
"github.com/iotaledger/hive.go/node" "github.com/iotaledger/hive.go/node"
) )
...@@ -23,6 +24,7 @@ var PLUGINS = node.Plugins( ...@@ -23,6 +24,7 @@ var PLUGINS = node.Plugins(
logger.PLUGIN, logger.PLUGIN,
cli.PLUGIN, cli.PLUGIN,
portcheck.PLUGIN, portcheck.PLUGIN,
profiling.Plugin,
database.PLUGIN, database.PLUGIN,
autopeering.PLUGIN, autopeering.PLUGIN,
messagelayer.PLUGIN, messagelayer.PLUGIN,
......
package profiling
import (
"net/http"
_ "net/http/pprof"
"github.com/iotaledger/goshimmer/plugins/config"
"github.com/iotaledger/hive.go/node"
flag "github.com/spf13/pflag"
)
var (
Plugin = node.NewPlugin("Profiling", node.Enabled, configure, run)
)
const CfgProfilingBindAddress = "profiling.bindAddress"
func init() {
flag.String(CfgProfilingBindAddress, "localhost:6061", "bind address for the pprof server")
}
func configure(_ *node.Plugin) {}
func run(_ *node.Plugin) {
go http.ListenAndServe(config.Node.GetString(CfgProfilingBindAddress), nil)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment