Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
misc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
misc
Commits
2aad0793
Commit
2aad0793
authored
Jun 03, 2017
by
Kirill Smelkov
Committed by
Kirill Smelkov
Mar 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cpuburn: Utility to load all cores
Debian's cpuburn was removed from the distribution.
parent
563a6128
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
bin/cpuburn.go
bin/cpuburn.go
+44
-0
No files found.
bin/cpuburn.go
0 → 100644
View file @
2aad0793
// #!/usr/bin/env -S go run
// cpuburn loads all cpu cores.
//
// Reason for this program: cpuburn Debian package got bitrotted.
//
// Note: one can also simulate 1 core burn by `yes >/dev/null`.
package
main
import
(
"runtime"
"sync"
)
func
work
()
{
var
i
[
3
]
int
var
x
[
3
]
float64
i
[
0
],
i
[
1
],
i
[
2
]
=
1
,
2
,
3
x
[
0
],
x
[
1
],
x
[
2
]
=
3.14
,
2.17
,
1.61
for
j
:=
0
;
;
j
++
{
// ALU
kp
:=
j
%
3
k
:=
(
kp
+
1
)
%
3
// FPU
x
[
k
]
+=
float64
(
i
[
kp
])
*
x
[
kp
]
}
}
func
main
()
{
wg
:=
sync
.
WaitGroup
{}
njob
:=
runtime
.
NumCPU
()
for
i
:=
0
;
i
<
njob
;
i
++
{
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
work
()
}()
}
wg
.
Wait
()
}
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