跳到主要内容

pstool.cpu

声明

public map cpu()

参数

参数名描述

作用

该接口用来回调gmserver的请求,转发gm命令到相应模块

数据样例

{ /* sizeof() == 2 */
"used" : 12.456699,
"used_by_me" : 0.0,
}

使用方式

cpu.gs

import gs.lang.*;
import gs.util.*;
import pkg.gtest;
import pkg.pstool;

object _pt = nil;

void create()
{
load_static(pkg.pstool, this_domain());
_pt = pstool.new_one();
}

void destruct()
{
if (!_pt)
{
_pt.close();
_pt = nil;
}
}

public bool cpu()
{
map data = _pt.cpu();
write(data, "\n");
return is_map(data);
}

返回文档