Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Canread
Gopsutil
提交
9f2c985a
G
Gopsutil
项目概览
Canread
/
Gopsutil
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gopsutil
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9f2c985a
编写于
11月 27, 2014
作者:
W
WAKAYAMA Shirou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix windows build.
上级
a1c1d7b2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
30 addition
and
21 deletion
+30
-21
common/common_windows.go
common/common_windows.go
+4
-4
cpu/cpu_windows.go
cpu/cpu_windows.go
+6
-4
disk/disk_windows.go
disk/disk_windows.go
+4
-4
host/host_windows.go
host/host_windows.go
+7
-4
mem/mem_windows.go
mem/mem_windows.go
+3
-1
net/net_windows.go
net/net_windows.go
+1
-1
process/process_windows.go
process/process_windows.go
+5
-3
未找到文件。
common/common_windows.go
浏览文件 @
9f2c985a
...
...
@@ -8,11 +8,11 @@ import (
)
var
(
m
odkernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
m
odNt
=
syscall
.
NewLazyDLL
(
"ntdll.dll"
)
M
odkernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
M
odNt
=
syscall
.
NewLazyDLL
(
"ntdll.dll"
)
procGetSystemTimes
=
m
odkernel32
.
NewProc
(
"GetSystemTimes"
)
procNtQuerySystemInformation
=
m
odNt
.
NewProc
(
"NtQuerySystemInformation"
)
ProcGetSystemTimes
=
M
odkernel32
.
NewProc
(
"GetSystemTimes"
)
ProcNtQuerySystemInformation
=
M
odNt
.
NewProc
(
"NtQuerySystemInformation"
)
)
type
FILETIME
struct
{
...
...
cpu/cpu_windows.go
浏览文件 @
9f2c985a
...
...
@@ -5,16 +5,18 @@ package gopsutil
import
(
"syscall"
"unsafe"
common
"github.com/shirou/gopsutil/common"
)
// TODO: Get percpu
func
CPUTimes
(
percpu
bool
)
([]
CPUTimesStat
,
error
)
{
var
ret
[]
CPUTimesStat
var
lpIdleTime
FILETIME
var
lpKernelTime
FILETIME
var
lpUserTime
FILETIME
r
,
_
,
_
:=
p
rocGetSystemTimes
.
Call
(
var
lpIdleTime
common
.
FILETIME
var
lpKernelTime
common
.
FILETIME
var
lpUserTime
common
.
FILETIME
r
,
_
,
_
:=
common
.
P
rocGetSystemTimes
.
Call
(
uintptr
(
unsafe
.
Pointer
(
&
lpIdleTime
)),
uintptr
(
unsafe
.
Pointer
(
&
lpKernelTime
)),
uintptr
(
unsafe
.
Pointer
(
&
lpUserTime
)))
...
...
disk/disk_windows.go
浏览文件 @
9f2c985a
...
...
@@ -11,10 +11,10 @@ import (
)
var
(
procGetDiskFreeSpaceExW
=
m
odkernel32
.
NewProc
(
"GetDiskFreeSpaceExW"
)
procGetLogicalDriveStringsW
=
m
odkernel32
.
NewProc
(
"GetLogicalDriveStringsW"
)
procGetDriveType
=
m
odkernel32
.
NewProc
(
"GetDriveTypeW"
)
provGetVolumeInformation
=
m
odkernel32
.
NewProc
(
"GetVolumeInformationW"
)
procGetDiskFreeSpaceExW
=
common
.
M
odkernel32
.
NewProc
(
"GetDiskFreeSpaceExW"
)
procGetLogicalDriveStringsW
=
common
.
M
odkernel32
.
NewProc
(
"GetLogicalDriveStringsW"
)
procGetDriveType
=
common
.
M
odkernel32
.
NewProc
(
"GetDriveTypeW"
)
provGetVolumeInformation
=
common
.
M
odkernel32
.
NewProc
(
"GetVolumeInformationW"
)
)
var
(
...
...
host/host_windows.go
浏览文件 @
9f2c985a
...
...
@@ -6,11 +6,14 @@ import (
"os"
"syscall"
"unsafe"
common
"github.com/shirou/gopsutil/common"
process
"github.com/shirou/gopsutil/process"
)
var
(
procGetSystemTimeAsFileTime
=
m
odkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procGetTickCount
=
m
odkernel32
.
NewProc
(
"GetTickCount"
)
procGetSystemTimeAsFileTime
=
common
.
M
odkernel32
.
NewProc
(
"GetSystemTimeAsFileTime"
)
procGetTickCount
=
common
.
M
odkernel32
.
NewProc
(
"GetTickCount"
)
)
func
HostInfo
()
(
*
HostInfoStat
,
error
)
{
...
...
@@ -28,7 +31,7 @@ func HostInfo() (*HostInfoStat, error) {
ret
.
Uptime
=
uint64
(
uptimemsec
)
/
1000
procs
,
err
:=
Pids
()
procs
,
err
:=
process
.
Pids
()
if
err
!=
nil
{
return
ret
,
err
}
...
...
@@ -39,7 +42,7 @@ func HostInfo() (*HostInfoStat, error) {
}
func
BootTime
()
(
uint64
,
error
)
{
var
lpSystemTimeAsFileTime
FILETIME
var
lpSystemTimeAsFileTime
common
.
FILETIME
r
,
_
,
_
:=
procGetSystemTimeAsFileTime
.
Call
(
uintptr
(
unsafe
.
Pointer
(
&
lpSystemTimeAsFileTime
)))
if
r
==
0
{
...
...
mem/mem_windows.go
浏览文件 @
9f2c985a
...
...
@@ -5,10 +5,12 @@ package gopsutil
import
(
"syscall"
"unsafe"
common
"github.com/shirou/gopsutil/common"
)
var
(
procGlobalMemoryStatusEx
=
m
odkernel32
.
NewProc
(
"GlobalMemoryStatusEx"
)
procGlobalMemoryStatusEx
=
common
.
M
odkernel32
.
NewProc
(
"GlobalMemoryStatusEx"
)
)
type
MEMORYSTATUSEX
struct
{
...
...
net/net_windows.go
浏览文件 @
9f2c985a
...
...
@@ -44,7 +44,7 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
for
_
,
ifi
:=
range
ifs
{
name
:=
ifi
.
Name
for
;
ai
!=
nil
;
ai
=
ai
.
Next
{
name
=
b
ytePtrToString
(
&
ai
.
Description
[
0
])
name
=
common
.
B
ytePtrToString
(
&
ai
.
Description
[
0
])
c
:=
NetIOCountersStat
{
Name
:
name
,
}
...
...
process/process_windows.go
浏览文件 @
9f2c985a
...
...
@@ -10,6 +10,8 @@ import (
"github.com/shirou/w32"
common
"github.com/shirou/gopsutil/common"
cpu
"github.com/shirou/gopsutil/cpu"
net
"github.com/shirou/gopsutil/net"
)
const
(
...
...
@@ -130,7 +132,7 @@ func (p *Process) Threads() (map[string]string, error) {
ret
:=
make
(
map
[
string
]
string
,
0
)
return
ret
,
common
.
NotImplementedError
}
func
(
p
*
Process
)
CPUTimes
()
(
*
CPUTimesStat
,
error
)
{
func
(
p
*
Process
)
CPUTimes
()
(
*
cpu
.
CPUTimesStat
,
error
)
{
return
nil
,
common
.
NotImplementedError
}
func
(
p
*
Process
)
CPUPercent
()
(
int32
,
error
)
{
...
...
@@ -157,7 +159,7 @@ func (p *Process) OpenFiles() ([]OpenFilesStat, error) {
return
nil
,
common
.
NotImplementedError
}
func
(
p
*
Process
)
Connections
()
([]
NetConnectionStat
,
error
)
{
func
(
p
*
Process
)
Connections
()
([]
net
.
NetConnectionStat
,
error
)
{
return
nil
,
common
.
NotImplementedError
}
...
...
@@ -249,7 +251,7 @@ func getProcInfo(pid int32) (*SystemProcessInformation, error) {
buffer
:=
make
([]
byte
,
bufferSize
)
var
sysProcInfo
SystemProcessInformation
ret
,
_
,
_
:=
p
rocNtQuerySystemInformation
.
Call
(
ret
,
_
,
_
:=
common
.
P
rocNtQuerySystemInformation
.
Call
(
uintptr
(
unsafe
.
Pointer
(
&
sysProcInfo
)),
uintptr
(
unsafe
.
Pointer
(
&
buffer
[
0
])),
uintptr
(
unsafe
.
Pointer
(
&
bufferSize
)),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录