|
|
|
@ -13,6 +13,16 @@ type Dtm struct { |
|
|
|
Alloc string `json:"alloc"` |
|
|
|
} |
|
|
|
|
|
|
|
// for rpc
|
|
|
|
type Args struct { |
|
|
|
FilePath string |
|
|
|
} |
|
|
|
|
|
|
|
// 返回的参数
|
|
|
|
type Reply struct { |
|
|
|
FilePath string `json:"file_path"` |
|
|
|
} |
|
|
|
|
|
|
|
// 获取内存信息
|
|
|
|
func Dtmem(w http.ResponseWriter, r *http.Request) { |
|
|
|
var m runtime.MemStats |
|
|
|
@ -27,7 +37,8 @@ func Dtmem(w http.ResponseWriter, r *http.Request) { |
|
|
|
} |
|
|
|
// 调用远程方法
|
|
|
|
var reply string |
|
|
|
err = client.Call("core.FileRpc.GetFilePath", "/www", &reply) |
|
|
|
var args = Args{"/www"} |
|
|
|
err = client.Call("FileRpcService.GetFilePath", args, &reply) |
|
|
|
if err != nil { |
|
|
|
fmt.Fprintf(w, "jsonrpc call faild %v", err) |
|
|
|
return |
|
|
|
|