Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the cpu usage per core in Windows #6

Closed
monicasarbu opened this issue Nov 19, 2015 · 6 comments · Fixed by #55
Closed

Get the cpu usage per core in Windows #6

monicasarbu opened this issue Nov 19, 2015 · 6 comments · Fixed by #55

Comments

@monicasarbu
Copy link

The following function needs to be implemented.

func (self *CpuList) Get() error {
    return notImplemented()
}

Getting cpu usage per core under Unix systems is implemented in the PR: https://github.com/elastic/topbeat/pull/130

@monicasarbu monicasarbu changed the title Get the cpu usage per core in Windows Get the cpu usage per thread in Windows Nov 19, 2015
@monicasarbu monicasarbu changed the title Get the cpu usage per thread in Windows Get the cpu usage per core in Windows Nov 19, 2015
@monicasarbu
Copy link
Author

Requested by https://github.com/elastic/topbeat/issues/40 as well.

@vjsamuel
Copy link

https://github.com/UhuruSoftware/gosigar/blob/master/sigar_windows.go is a possible implementation which we could go for.

@monicasarbu
Copy link
Author

@vjsamuel Thank you. I'll give it a try and let you know if it works.

@vjsamuel
Copy link

How do you generally test in windows environment? If I know how to do that then I can try it out myself.

@monicasarbu
Copy link
Author

You can use the virtual machine from https://github.com/elastic/winlogbeat/blob/master/Vagrantfile and then install gcc by using choco install mingw64.

@andrewkroh
Copy link
Member

@vjsamuel FYI we have an updated Vagrantfile in the elastic/beats repo that has the development environment fully setup for compiling Topbeat and gosigar. It should be as simple as:

vagrant up
vagrant ssh
cd C:\Gopath\src\github.com\elastic\beats\topbeat
go build

@andrewkroh andrewkroh removed the v1.1.0 label Oct 26, 2016
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Oct 27, 2016
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
- Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
- Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
andrewkroh added a commit to andrewkroh/gosigar that referenced this issue Oct 27, 2016
- Fixes elastic#53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes elastic#6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
- Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
ruflin pushed a commit that referenced this issue Oct 28, 2016
- Fixes #53 (ProcStatus.PPID value is wrong on Windows). The code was incorrectly using `CreateToolhelp32Snapshot` + `Process32First`. This could have been fixed, but it would have required iterating over each process until finding the PPID of process we were interested it. Instead the code has been changed to use `NtQueryInformationProcess` to get the PPID given a process token.
- Fixes #6 (Get the cpu usage per core in Windows). I used `NtQuerySystemInformation` to collect the timing information on a per CPU basis.
- Adds OS version checks to the functions that make certain WMI calls. The `Win32_Process` data is only available on Vista and newer. On XP and Win2003, these methods will return `ErrNotImplemented`. This will help address elastic/beats#1704.
- Implements `Uptime.Get` for Windows.
- Implements `Swap.Get` for Windows based on page file metrics.
- Removes cgo usage for Windows.
- Adds support to `github.com/gosigar/sys/windows` for querying and enabling privileges in a process token. This will help in addressing elastic/beats#1897.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants