mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-22 01:27:32 +08:00
Merge branch 'master' of https://github.com/duanhf2012/origin
This commit is contained in:
@@ -494,3 +494,8 @@ func (slf *CCluster) AddLocalService(iservice service.IService) {
|
|||||||
servicename = parts[1]
|
servicename = parts[1]
|
||||||
slf.innerLocalServiceList[servicename] = true
|
slf.innerLocalServiceList[servicename] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNodeName(nodeid int) string {
|
||||||
|
//
|
||||||
|
return _self.cfg.GetNodeNameByNodeId(nodeid)
|
||||||
|
}
|
||||||
|
|||||||
@@ -156,3 +156,12 @@ func IsExistsNode(nodelist []CNode, pNode *CNode) bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (slf *ClusterConfig) GetNodeNameByNodeId(nodeid int) string {
|
||||||
|
node, ok := slf.mapIdNode[nodeid]
|
||||||
|
if ok == false {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return node.NodeName
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/duanhf2012/origin/service"
|
"github.com/duanhf2012/origin/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PProfService struct {
|
type PProfService struct {
|
||||||
service.BaseService
|
service.BaseService
|
||||||
|
fisttime int
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfileData struct {
|
type ProfileData struct {
|
||||||
@@ -18,11 +20,19 @@ type ProfileData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Profilestruct struct {
|
type Profilestruct struct {
|
||||||
|
Fisttime int
|
||||||
ProfileList []ProfileData
|
ProfileList []ProfileData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (slf *PProfService) OnInit() error {
|
||||||
|
slf.fisttime = (int)(time.Now().UnixNano())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (slf *PProfService) GetPprof() ([]byte, error) {
|
func (slf *PProfService) GetPprof() ([]byte, error) {
|
||||||
var pfiles Profilestruct
|
var pfiles Profilestruct
|
||||||
|
pfiles.Fisttime = slf.fisttime
|
||||||
|
|
||||||
for _, p := range pprof.Profiles() {
|
for _, p := range pprof.Profiles() {
|
||||||
pfiles.ProfileList = append(pfiles.ProfileList, ProfileData{
|
pfiles.ProfileList = append(pfiles.ProfileList, ProfileData{
|
||||||
Name: p.Name(),
|
Name: p.Name(),
|
||||||
@@ -44,6 +54,7 @@ func (slf *PProfService) HTTP_DebugPProf(request *HttpRequest, resp *HttpRespone
|
|||||||
|
|
||||||
func (slf *PProfService) RPC_DebugPProf(arg *string, ret *Profilestruct) error {
|
func (slf *PProfService) RPC_DebugPProf(arg *string, ret *Profilestruct) error {
|
||||||
|
|
||||||
|
ret.Fisttime = slf.fisttime
|
||||||
for _, p := range pprof.Profiles() {
|
for _, p := range pprof.Profiles() {
|
||||||
ret.ProfileList = append(ret.ProfileList, ProfileData{
|
ret.ProfileList = append(ret.ProfileList, ProfileData{
|
||||||
Name: p.Name(),
|
Name: p.Name(),
|
||||||
|
|||||||
Reference in New Issue
Block a user