Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
42e02ac0
Unverified
Commit
42e02ac0
authored
Mar 26, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metrics: disable CPU stats (gosigar) on iOS
parent
39f50232
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
12 deletions
+54
-12
cpu.go
metrics/cpu.go
+0
-12
cpu_disabled.go
metrics/cpu_disabled.go
+23
-0
cpu_enabled.go
metrics/cpu_enabled.go
+31
-0
No files found.
metrics/cpu.go
View file @
42e02ac0
...
...
@@ -16,21 +16,9 @@
package
metrics
import
"github.com/elastic/gosigar"
// CPUStats is the system and process CPU stats.
type
CPUStats
struct
{
GlobalTime
int64
// Time spent by the CPU working on all processes
GlobalWait
int64
// Time spent by waiting on disk for all processes
LocalTime
int64
// Time spent by the CPU working on this process
}
// ReadCPUStats retrieves the current CPU stats.
func
ReadCPUStats
(
stats
*
CPUStats
)
{
global
:=
gosigar
.
Cpu
{}
global
.
Get
()
stats
.
GlobalTime
=
int64
(
global
.
User
+
global
.
Nice
+
global
.
Sys
)
stats
.
GlobalWait
=
int64
(
global
.
Wait
)
stats
.
LocalTime
=
getProcessCPUTime
()
}
metrics/cpu_disabled.go
0 → 100644
View file @
42e02ac0
// Copyright 2020 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// +build ios
package
metrics
// ReadCPUStats retrieves the current CPU stats. Internally this uses `gosigar`,
// which is not supported on the platforms in this file.
func
ReadCPUStats
(
stats
*
CPUStats
)
{}
metrics/cpu_enabled.go
0 → 100644
View file @
42e02ac0
// Copyright 2020 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// +build !ios
package
metrics
import
"github.com/elastic/gosigar"
// ReadCPUStats retrieves the current CPU stats.
func
ReadCPUStats
(
stats
*
CPUStats
)
{
global
:=
gosigar
.
Cpu
{}
global
.
Get
()
stats
.
GlobalTime
=
int64
(
global
.
User
+
global
.
Nice
+
global
.
Sys
)
stats
.
GlobalWait
=
int64
(
global
.
Wait
)
stats
.
LocalTime
=
getProcessCPUTime
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment