pstool系统环境查询工具
使用方法
- import pkg.pstool;
- 调用 object psobject = pstool.new_one(); 生成一个pstool的对象
- 调用 psobject.xxx 即可获取相应的系统环境数据,详见下方组件接口
例子:
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 memory()
{
return is_map(_pt.memory());
}
public bool cpu()
{
return is_map(_pt.cpu());
}
public bool disk()
{
return is_map(_pt.disk());
}
public bool net()
{
return is_map(_pt.net());
}
public bool proc()
{
return is_map(_pt.proc());
}
public void test_run()
{
gtest.test_func((: memory :), true);
gtest.test_func((: cpu :), true);
gtest.test_func((: disk :), true);
gtest.test_func((: net :), true);
gtest.test_func((: proc :), true);
}
组件接口
函数原型 | 函数作用 |
---|---|
map memory() | 该接口用来获取内存的使用情况 |
map cpu() | 该接口用来获取cpu的使用情况 |
map disk() | 该接口用来获取硬盘的使用情况 |
map net() | 该接口用来获取网络的使用情况 |
map proc() | 该接口用来获取进程的状态 |