Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
b062b349
Commit
b062b349
authored
Oct 06, 2017
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X microbenchmark CPU first
parent
f7e23ed8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
6 deletions
+158
-6
go/neo/t/.gitignore
go/neo/t/.gitignore
+2
-0
go/neo/t/neotest
go/neo/t/neotest
+39
-6
go/neo/t/tsha1.go
go/neo/t/tsha1.go
+66
-0
go/neo/t/tsha1.py
go/neo/t/tsha1.py
+51
-0
No files found.
go/neo/t/.gitignore
View file @
b062b349
...
...
@@ -2,4 +2,6 @@
/var
/zhash
/zhash_go
/tsha1
/tsha1_go
/ioping.tmp
go/neo/t/neotest
View file @
b062b349
...
...
@@ -600,8 +600,8 @@ cpustat() {
ustartv
=(
`
statev_usage
`
)
#echo >&2 "--------"
#sleep 1
out
=
"
$(
"
$@
"
2>&1
)
"
ret
=
$?
ret
=
0
out
=
"
$(
"
$@
"
2>&1
)
"
||
ret
=
$?
uendv
=(
`
statev_usage
`
)
stat
=
"#"
...
...
@@ -654,12 +654,22 @@ runpar() {
$profile
_runpar
"
$@
"
}
# bench_disk - print disk identification and benchmark direct (uncached) and cached random reads
# bench_cpu - microbenchmark CPU
bench_cpu
()
{
nrun sh
-c
"python -m test.pystone |tail -1"
nrun ./tsha1.py 1024
nrun ./tsha1_go 1024
nrun ./tsha1.py 4096
nrun ./tsha1_go 4096
}
# bench_disk - benchmark direct (uncached) and cached random reads
bench_disk
()
{
echo
-e
"
\n
***
random direct (no kernel cache) 4K-read disk
latency"
echo
-e
"
\n
***
disk: random direct (no kernel cache) 4K-read
latency"
nrun ioping
-D
-i
0ms
-s
4k
-S
1024M
-w
3s
-q
-k
.
echo
-e
"
\n
***
random cached 4K-read disk
latency"
echo
-e
"
\n
***
disk: random cached 4K-read
latency"
# warmup so kernel puts the file into pagecache
for
i
in
`
seq
3
`
;
do
cat
ioping.tmp
>
/dev/null
...
...
@@ -709,6 +719,8 @@ bench_go() {
cmd_bench-local
()
{
echo
-e
">>> bench-local"
system_info
echo
-e
"
\n
*** cpu:
\n
"
bench_cpu
bench_disk
install_trap
gen_data
...
...
@@ -763,6 +775,12 @@ cmd_bench-cluster() {
echo
-e
"
\n
# client:"
on
$url
./neotest info-local
echo
-e
"
\n
*** server cpu:"
bench_cpu
echo
-e
"
\n
*** client cpu:"
on
$url
./neotest bench-cpu
echo
-e
"
\n
*** server disk:"
bench_disk
...
...
@@ -862,6 +880,16 @@ cmd_run-client() {
test
-z
"
$goonly
"
&&
bench
$url
||
bench_go
$url
}
# command: benchmark local disk
cmd_bench-disk
()
{
bench_disk
}
# command: benchmark local cpu
cmd_bench-cpu
()
{
bench_cpu
}
# command: print information about local node
cmd_info-local
()
{
init_net
...
...
@@ -891,6 +919,8 @@ The commands are:
bench-cluster run benchmarks when server is local and client is on another node
run-client run client benchmarks against separate server
bench-disk benchmark local disk (already part of bench-{local,cluster})
bench-cpu benchmark local cpu (already part of bench-{local,cluster})
deploy deploy NEO & needed software for tests to remote host
deploy-local deploy NEO & needed software for tests locally
...
...
@@ -903,8 +933,10 @@ EOF
case
"
$1
"
in
# commands that require build
bench-local
|
\
bench-cluster
|
\
run-client
|
\
bench-cluster
)
bench-disk
|
\
bench-cpu
)
;;
info
)
...
...
@@ -934,6 +966,7 @@ esac
# neo/py, wendelin.core, ... - must be pip install'ed - `neotest deploy` cares about that
go
install
-v
lab.nexedi.com/kirr/neo/go/...
go build
-o
zhash_go zhash.go
go build
-o
tsha1_go tsha1.go
# setup network & fs environment
init_net
...
...
go/neo/t/tsha1.go
0 → 100644
View file @
b062b349
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// +build ignore
// tsha1 - benchmark sha1
package
main
import
(
"crypto/sha1"
"fmt"
"log"
"os"
"strconv"
"time"
)
func
dieusage
()
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Usage: tsha1 <block-size>
\n
"
)
os
.
Exit
(
1
)
}
func
main
()
{
if
len
(
os
.
Args
)
!=
2
{
dieusage
()
}
blksize
,
err
:=
strconv
.
Atoi
(
os
.
Args
[
1
])
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
data
:=
make
([]
byte
,
blksize
)
h
:=
sha1
.
New
()
n
:=
int
(
1E6
)
if
blksize
>
1024
{
n
=
n
*
1024
/
blksize
// assumes 1K ~= 1μs
}
tstart
:=
time
.
Now
()
for
i
:=
0
;
i
<
n
;
i
++
{
h
.
Write
(
data
)
}
tend
:=
time
.
Now
()
δt
:=
tend
.
Sub
(
tstart
)
fmt
.
Printf
(
"sha1(%dB) ~= %s x=tsha1.go
\n
"
,
blksize
,
δt
/
time
.
Duration
(
n
))
}
go/neo/t/tsha1.py
0 → 100755
View file @
b062b349
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""tsha1 - benchmark sha1"""
from
__future__
import
print_function
import
sys
import
hashlib
from
time
import
time
def
main
():
blksize
=
int
(
sys
.
argv
[
1
])
data
=
'
\
0
'
*
blksize
h
=
hashlib
.
sha1
()
tstart
=
time
()
n
=
int
(
1E6
)
if
blksize
>
1024
:
n
=
n
*
1024
/
blksize
# assumes 1K ~= 1μs
i
=
0
while
i
<
n
:
h
.
update
(
data
)
i
+=
1
tend
=
time
()
dt
=
tend
-
tstart
print
(
'sha1(%dB) ~= %.1fμs x=tsha1.py'
%
(
blksize
,
dt
*
1E6
/
n
))
if
__name__
==
'__main__'
:
main
()
Kirill Smelkov
@kirr
mentioned in commit
a60c472c
·
Jul 12, 2018
mentioned in commit
a60c472c
mentioned in commit a60c472c76da315f918afeb06f994c8610cf7c84
Toggle commit list
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