go在win系统下如何获取cpu使用率,内存使用等数据?

601 views
Skip to first unread message

teemo

unread,
Sep 2, 2012, 8:05:20 AM9/2/12
to golang...@googlegroups.com
RT
必须要调用系统API吗?

--
nameisports.com 让你的职业生涯更长些 - 纳美运动健身.

Wendal Chen

unread,
Sep 2, 2012, 8:46:29 AM9/2/12
to golang...@googlegroups.com
内存使用可以通过runtime库获取

cpu使用率不知道 

2012/9/2 teemo <opy...@gmail.com>

--
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina



--
Wendal Chen
GuangDong China

minux

unread,
Sep 2, 2012, 2:11:59 PM9/2/12
to golang...@googlegroups.com

On Sun, Sep 2, 2012 at 8:05 PM, teemo <opy...@gmail.com> wrote:
RT
必须要调用系统API吗?
是指这个进程的还是整个系统的?

teemo

unread,
Sep 2, 2012, 9:47:35 PM9/2/12
to golang...@googlegroups.com
整个系统的

--
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina

Tongjie Li

unread,
Sep 3, 2012, 12:08:20 AM9/3/12
to golang...@googlegroups.com
有个 go snmp 的项目, https://github.com/alouca/gosnmp  可以试试。如果windows系统装了snmp服务就可以获取CPU和内存了。

minux

unread,
Sep 3, 2012, 10:27:35 AM9/3/12
to golang...@googlegroups.com

2012/9/3 teemo <opy...@gmail.com>
整个系统的
用syscall包自己调用Win32 API吧。

syscall 里面有一个ExampleLoadLibrary。

minux

unread,
Sep 3, 2012, 11:47:20 AM9/3/12
to golang...@googlegroups.com

2012/9/3 minux <minu...@gmail.com>
补充:这个只有在default分支才有,如果装的release版,那么看

Ajay Zhou

unread,
Nov 10, 2017, 3:02:15 AM11/10/17
to Golang-China
您好,请问下,如果是获取单独进程的cpu使用率,还可以用wmi来查么?或者是通过cgo或dll来查?


在 2012年9月3日星期一 UTC+8上午2:11:59,minux写道:

Haowee Shen

unread,
Mar 30, 2018, 1:59:02 AM3/30/18
to Golang-China
可以用psutil库

在 2012年9月2日星期日 UTC+8下午8:05:20,red写道:
Reply all
Reply to author
Forward
0 new messages