-
Notifications
You must be signed in to change notification settings - Fork 6
/
sysbench.sh
executable file
·2018 lines (1839 loc) · 158 KB
/
sysbench.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#########################################################
# sysbench install and benchmark for centminmod.com
# https://github.com/akopytov/sysbench/releases
# # written by George Liu (eva2000) https://centminmod.com
#########################################################
# variables
#############
DT=$(date +"%d%m%y-%H%M%S")
VER='2.8'
# default tests single thread + max cpu threads if set to
# TEST_SINGLETHREAD='n'
# if set to TEST_SINGLETHREAD='y' only test single thread
# skip max cpu threads tests
TEST_SINGLETHREAD='n'
CPU_MAXPRIME='10000'
# 1K
MEM_BLOCKSIZE='1'
# gigabyte = G
MEM_TOTALSIZE='1'
FILEIO_SLEEP='5'
# in megabytes
FILEIO_FILESIZE='2048'
# number of files to create default = 128
FILEIO_FILENUM='128'
# sync, dsync or direct
FILEIO_EXTRAFLAGS='direct'
FILEIO_BLOCKSIZE='4096'
# --file-io-mode= choices sync, async, fastmmap, slowmmap
FILEIO_MODE='sync'
FILEIO_TIME='10'
# sequential read
FILEIO_SEQRD='y'
# sequential write
FILEIO_SEQWR='y'
# sequent rewrite
FILEIO_SEQREWR='n'
# random read
FILEIO_RNDRD='y'
# random write
FILEIO_RNDWR='y'
# random read/write
FILEIO_RNDRW='n'
# fileio fsync test duration
FILEIO_FSYNCTIME='30'
MYSQL_HOST='localhost'
MYSQL_PORT='3306'
MYSQL_USESOCKET='y'
MYSQL_SOCKET='/var/lib/mysql/mysql.sock'
MYSQL_LOGIN='y'
MYSQL_USER='sbtest'
MYSQL_PASS='sbtestpass'
MYSQL_DBNAME='sbt'
MYSQL_ENGINE='InnoDB'
MYSQL_TIME='30'
# max cpu threads detected via nproc output
MYSQL_THREADS="$(nproc)"
MYSQL_TABLECOUNT='8'
MYSQL_OLTPTABLESIZE='150000'
MYSQL_SCALE='100'
# mysql SSL
MYSQL_SSL='n'
MYSQL_SSL_CIPHER=''
COLLECT_MYSQLSTATS='y'
COLLECT_DISKSTATS='y'
COLLECT_PIDSTATS='y'
SYSBENCH_DIR='/home/sysbench'
SYSBENCH_FILEIODIR="${SYSBENCH_DIR}/fileio"
#########################################################
# functions
#########################################################
SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
#########################################################
if [ -f /etc/os-release ]; then
ELID=$(grep '^VERSION_ID=' /etc/os-release | awk -F '=' '{print $2}' | sed -e 's|"||g' | cut -d . -f1)
OSID=$(grep '^ID=' /etc/os-release | awk -F '=' '{print $2}' | sed -e 's|"||g' | egrep -i 'almalinux|rocky'|uniq)
fi
if [ -f /usr/bin/apt ]; then
MYSQL_SOCKET='/var/run/mysqld/mysqld.sock'
fi
if [ ! -d "$SYSBENCH_DIR" ]; then
mkdir -p "${SYSBENCH_DIR}"
fi
if [ ! -d "${SYSBENCH_FILEIODIR}" ]; then
mkdir -p "${SYSBENCH_FILEIODIR}"
fi
if [ ! -d "${SYSBENCH_DIR}/mysql" ]; then
mkdir -p "${SYSBENCH_DIR}/mysql"
fi
if [ -f "${SCRIPT_DIR}/sysbench.ini" ]; then
source "${SCRIPT_DIR}/sysbench.ini"
fi
if [[ "$MYSQL_USESOCKET" = [yY] ]]; then
MYSQL_USESOCKETOPT=" --mysql-socket=${MYSQL_SOCKET}"
MYSQLCLIENT_USESOCKETOPT="${MYSQL_SOCKET}"
else
MYSQL_USESOCKETOPT=""
MYSQLCLIENT_USESOCKETOPT=""
fi
if [ -f /usr/bin/sysbench ]; then
SYSBENCH_GETVER=$(sysbench --version | awk '{print $2}' | cut -d . -f1,3 | sed -e 's|\.||g')
fi
if [ -f /usr/lib64/libjemalloc.so.2 ]; then
JEMALLOC_FILE='/usr/lib64/libjemalloc.so.2'
elif [ -f /usr/lib64/libjemalloc.so.1 ]; then
JEMALLOC_FILE='/usr/lib64/libjemalloc.so.1'
fi
set_login() {
if [[ "$MYSQL_LOGIN" = [yY] ]]; then
MYSQL_LOGINOPT=" --mysql-user=${MYSQL_USER} --mysql-password=${MYSQL_PASS}"
else
MYSQL_LOGINOPT=""
fi
}
build_ssl_opts() {
if [[ "$MYSQL_SSL" == [yY] ]]; then
SSL_OPTS=" --mysql-ssl=on"
MYSQL_HOST='127.0.0.1'
if [ -n "$MYSQL_SSL_CIPHER" ]; then
SSL_OPTS="$SSL_OPTS --mysql-ssl-cipher=$MYSQL_SSL_CIPHER"
fi
else
SSL_OPTS=""
fi
}
tools_setup() {
# wget -q -O /usr/local/bin/tlbstat https://github.com/brendangregg/pmc-cloud-tools/raw/master/tlbstat
wget -q -O /usr/local/bin/pmcarch https://github.com/brendangregg/pmc-cloud-tools/raw/master/pmcarch
wget -q -O /usr/local/bin/cpucache https://github.com/brendangregg/pmc-cloud-tools/raw/master/cpucache
wget -q -O /usr/local/bin/syscount https://github.com/brendangregg/perf-tools/raw/master/syscount
wget -q -O /usr/local/bin/iosnoop https://github.com/brendangregg/perf-tools/raw/master/iosnoop
wget -q -O /usr/local/bin/funccount https://github.com/brendangregg/perf-tools/raw/master/kernel/funccount
# chmod +x /usr/local/bin/tlbstat
chmod +x /usr/local/bin/pmcarch
chmod +x /usr/local/bin/cpucache
chmod +x /usr/local/bin/syscount
chmod +x /usr/local/bin/iosnoop
chmod +x /usr/local/bin/funccount
}
get_mysqlstats(){
mysqltag=$1
if [[ "$COLLECT_MYSQLSTATS" = [yY] ]]; then
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} ext -i10 > "$SYSBENCH_DIR/mysqlstats-${mysqltag}.log" &
getmysqlstats_pid=$!
fi
}
get_diskstats(){
disktag=$1
if [[ "$COLLECT_DISKSTATS" = [yY] ]]; then
vmstat 1 > "$SYSBENCH_DIR/diskstats-${disktag}.log" &
getdiskstats_pid=$!
fi
}
get_pidstats(){
pidstattag=$1
if [[ "$COLLECT_PIDSTATS" = [yY] ]]; then
pidstat -durh 1 | egrep 'sysbench|mysqld|UID' > "$SYSBENCH_DIR/pidstat-${pidstattag}.log" &
getpidstat_pid=$!
fi
}
mysqlsettings() {
echo
echo "MySQL Buffers"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | awk -F '|' '/buffer/ {print $2,$3}' | tr -s ' '| column -t
echo
echo "MySQL Limits"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | awk -F '|' '/limit/ {print $2,$3}' | tr -s ' '| column -t
echo
echo "MySQL Maxes"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | awk -F '|' '/max/ {print $2,$3}' | tr -s ' '| egrep -v 'limit|buffer|performance_schema'| column -t
echo
echo "MySQL Concurrency"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | awk -F '|' '/concurr/ {print $2,$3}' | tr -s ' ' | egrep -v 'limit|buffer|performance_schema' | column -t
echo
echo "MySQL Read/Write"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | egrep 'reads|write' | grep -v thread | awk -F '|' '{print $2,$3}' | tr -s ' ' | egrep -v 'limit|buffer|performance_schema' | column -t
echo
echo "MySQL Threads"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | egrep 'thread' | awk -F '|' '{print $2,$3}' | tr -s ' ' | column -t
echo
echo "MySQL Binlog"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | egrep 'binlog|log_bin' | awk -F '|' '{print $2,$3}' | tr -s ' ' | column -t
echo
echo "MySQL InnoDB"
mysqladmin -P ${MYSQL_PORT} -S ${MYSQLCLIENT_USESOCKETOPT} var | egrep 'innodb' | awk -F '|' '{print $2,$3}' | tr -s ' ' | column -t
echo
}
baseinfo() {
echo "-------------------------------------------"
echo "System Information"
echo "-------------------------------------------"
echo
uname -r
echo
if [ -f /etc/redhat-release ]; then
cat /etc/redhat-release
elif [ -f /etc/lsb-release ]; then
cat /etc/lsb-release
fi
echo
if [ -f /etc/centminmod-release ]; then
echo -n "Centmin Mod "
cat /etc/centminmod-release 2>&1 >/dev/null
echo
fi
if [ ! -f /proc/user_beancounters ]; then
CPUFLAGS=$(cat /proc/cpuinfo | grep '^flags' | cut -d: -f2 | awk 'NR==1')
lscpu
echo
echo "CPU Flags"
echo "$CPUFLAGS"
else
CPUNAME=$(cat /proc/cpuinfo | grep "model name" | cut -d ":" -f2 | tr -s " " | head -n 1)
CPUCOUNT=$(cat /proc/cpuinfo | grep "model name" | cut -d ":" -f2 | wc -l)
CPUFLAGS=$(cat /proc/cpuinfo | grep '^flags' | cut -d: -f2 | awk 'NR==1')
echo "CPU: $CPUCOUNT x$CPUNAME"
uname -m
echo
echo "CPU Flags"
echo "$CPUFLAGS"
fi
echo
if [ ! -f /proc/user_beancounters ]; then
lscpu -e
echo
fi
# cat /proc/cpuinfo
# s
free -ml
echo
df -h
echo
}
sysbench_update() {
echo
if [ -d /etc/yum.repos.d ]; then
echo "update sysbench from yum repo"
if [ -f /etc/yum.repos.d/epel.repo ]; then
echo "yum -y update sysbench --disablerepo=epel"
yum -y update sysbench --disablerepo=epel
else
echo "yum -y update sysbench"
yum -y update sysbench
fi
elif [ -f /usr/bin/apt ]; then
echo "update sysbench from apt"
sudo apt -y install sysbench
fi
echo
}
sysbench_install_el9() {
# check for almalinux/rocky linux 9
if [ -f /etc/os-release ]; then
if [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
# source compile for el9 OSes only
echo "Install sysbench dependencies..."
yum -q -y install make automake libtool pkgconfig libaio-devel
echo "sysbench dependencies installed"
echo
echo "Install sysbench for EL9"
echo
mkdir -p /svr-setup
pushd /svr-setup
wget https://github.com/akopytov/sysbench/archive/refs/tags/1.0.20.tar.gz -O sysbench-1.0.20.tar.gz
tar -xzf sysbench-1.0.20.tar.gz
cd sysbench-1.0.20
make clean
./autogen.sh
./configure
make -j$(nproc)
make install
# lua files
mkdir -p /usr/share/sysbench/
\cp -fa tests /usr/share/sysbench/
\cp -fa src/lua/*.lua /usr/share/sysbench/
popd
fi
fi
}
sysbench_install() {
# check for almalinux/rocky linux 9
if [[ ! -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
sysbench_install_el9
elif [[ -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
echo "/usr/local/bin/sysbench already installed"
elif [[ ! -f /usr/bin/sysbench || "$SYSBENCH_GETVER" -lt '100' ]]; then
if [ -d /etc/yum.repos.d ]; then
echo
echo "install sysbench from yum repo"
# ensure sysbench version is latest
if [[ -f /usr/bin/sysbench && "$SYSBENCH_GETVER" -lt '100' ]]; then
yum -y -q remove sysbench
fi
if [[ -f /etc/yum.repos.d/epel.repo && ! "$(grep sysbench /etc/yum.repos.d/epel.repo)" ]]; then
excludevalue=$(grep '^exclude=' /etc/yum.repos.d/epel.repo | head -n1)
sed -i "s/exclude=.*/${excludevalue} sysbench/" /etc/yum.repos.d/epel.repo
fi
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | bash
if [ -f /etc/yum.repos.d/epel.repo ]; then
echo "yum -y install sysbench --disablerepo=epel"
yum -y install sysbench --disablerepo=epel
else
echo "yum -y install sysbench"
yum -y install sysbench
fi
elif [ -f /usr/bin/apt ]; then
echo
echo "install sysbench from apt"
# ensure sysbench version is latest
if [[ -f /usr/bin/sysbench && "$SYSBENCH_GETVER" -lt '100' ]]; then
apt-get -y -q remove sysbench
fi
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash
echo "sudo apt -y install sysbench"
sudo apt -y install sysbench
fi
echo
else
echo
echo "sysbench already installed"
echo
fi
}
sysbench_cpu() {
if [[ ! -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
sysbench_install_el9
elif [[ -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
echo
elif [[ ! -f /usr/bin/sysbench || "$SYSBENCH_GETVER" -lt '100' ]]; then
sysbench_install
fi
echo
cd "$SYSBENCH_DIR"
# echo "threads: 1";
echo "sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=1 run" | tee "$SYSBENCH_DIR/sysbench-cpu-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=1 run | egrep 'sysbench |Number of threads:|Prime numbers limit:|events per second:|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's|Prime numbers limit|prime|' -e 's|events per second|events/s|' -e 's|total time:|time:|' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-1.log"
else
sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=1 run | egrep 'sysbench |Number of threads:|Prime numbers limit:|events per second:|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's|Prime numbers limit|prime|' -e 's|events per second|events/s|' -e 's|total time:|time:|' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-1.log"
fi
echo
echo -n "| cpu "; cat "$SYSBENCH_DIR/sysbench-cpu-threads-1.log" | grep -v prime | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-cpu-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-cpu-threads-1.log" | grep -v prime | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-cpu-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-cpu-threads-1-csv.log"
if [[ "$TEST_SINGLETHREAD" != [yY] ]]; then
echo
# echo "threads: $(nproc)";
echo "sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=$(nproc) run" | tee "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=$(nproc) run | egrep 'sysbench |Number of threads:|Prime numbers limit:|events per second:|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's|Prime numbers limit|prime|' -e 's|events per second|events/s|' -e 's|total time:|time:|' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc).log"
else
sysbench cpu --cpu-max-prime=${CPU_MAXPRIME} --threads=$(nproc) run | egrep 'sysbench |Number of threads:|Prime numbers limit:|events per second:|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's|Prime numbers limit|prime|' -e 's|events per second|events/s|' -e 's|total time:|time:|' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc).log"
fi
echo
echo -n "| cpu "; cat "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc).log" | grep -v prime | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc).log" | grep -v prime | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-csv.log"
cat "$SYSBENCH_DIR/sysbench-cpu-threads-1-csv.log" "$SYSBENCH_DIR/sysbench-cpu-threads-$(nproc)-csv.log" > "$SYSBENCH_DIR/sysbench-cpu-threads-concat-csv.log"
fi
}
sysbench_mem() {
if [[ ! -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
sysbench_install_el9
elif [[ -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
echo
elif [[ ! -f /usr/bin/sysbench || "$SYSBENCH_GETVER" -lt '100' ]]; then
sysbench_install
fi
echo
cd "$SYSBENCH_DIR"
# echo "threads: 1";
echo "sysbench memory --threads=1 --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run" | tee "$SYSBENCH_DIR/sysbench-mem-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench memory --threads=1 --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run | egrep 'sysbench |Number of threads:|block size:|total size:|operation:|scope:|Total operations:|transferred|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|Total operations:|total-ops:|' -e 's|total time:|time:|' -e 's|1024.00 MiB||' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-mem-threads-1.log"
else
sysbench memory --threads=1 --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run | egrep 'sysbench |Number of threads:|block size:|total size:|operation:|scope:|Total operations:|transferred|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|Total operations:|total-ops:|' -e 's|total time:|time:|' -e 's|1024.00 MiB||' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-mem-threads-1.log"
fi
echo
echo -n "| memory "; cat "$SYSBENCH_DIR/sysbench-mem-threads-1.log" | egrep -v 'scope:' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-mem-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-mem-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-mem-threads-1.log" | egrep -v 'scope:' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | sed -e 's|(||' | tee -a "$SYSBENCH_DIR/sysbench-mem-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-mem-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-mem-threads-1-csv.log"
if [[ "$TEST_SINGLETHREAD" != [yY] ]]; then
echo
# echo "threads: $(nproc)";
echo "sysbench memory --threads=$(nproc) --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run" | tee "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench memory --threads=$(nproc) --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run | egrep 'sysbench |Number of threads:|block size:|total size:|operation:|scope:|Total operations:|transferred|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|Total operations:|total-ops:|' -e 's|total time:|time:|' -e 's|1024.00 MiB||' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc).log"
else
sysbench memory --threads=$(nproc) --memory-block-size=${MEM_BLOCKSIZE}K --memory-scope=global --memory-total-size=${MEM_TOTALSIZE}G --memory-oper=read run | egrep 'sysbench |Number of threads:|block size:|total size:|operation:|scope:|Total operations:|transferred|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|Total operations:|total-ops:|' -e 's|total time:|time:|' -e 's|1024.00 MiB||' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc).log"
fi
echo
echo -n "| memory "; cat "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc).log" | egrep -v 'scope:' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc).log" | egrep -v 'scope:' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs| sed -e 's|(||' | tee -a "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-csv.log"
cat "$SYSBENCH_DIR/sysbench-mem-threads-1-csv.log" "$SYSBENCH_DIR/sysbench-mem-threads-$(nproc)-csv.log" > "$SYSBENCH_DIR/sysbench-mem-threads-concat-csv.log"
fi
}
sysbench_fileio() {
check_fsync=$1
if [[ ! -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
sysbench_install_el9
elif [[ -f /usr/local/bin/sysbench ]] && [[ "$ELID" -eq '9' ]] && [[ "$OSID" = 'almalinux' || "$OSID" = 'rocky' ]]; then
echo
elif [[ ! -f /usr/bin/sysbench || "$SYSBENCH_GETVER" -lt '100' ]]; then
sysbench_install
fi
tt_ram=$(awk '/MemTotal:/ {print $2}' /proc/meminfo)
tt_swap=$(awk '/SwapTotal:/ {print $2}' /proc/meminfo)
# 5% more
#fileio_getfilesize=$(((($tt_ram)*105)/100))
fileio_getfilesize=$(((($tt_ram)*10)/100))
#fileio_filesize=$(($fileio_getfilesize/1024))
if [[ "$check_fsync" && "$check_fsync" != 'fsync' ]]; then
if [[ "$check_fsync" -eq '16' ]]; then
FILEIO_BLOCKSIZE=16384
elif [[ "$check_fsync" -eq '64' ]]; then
FILEIO_BLOCKSIZE=65536
elif [[ "$check_fsync" -eq '512' ]]; then
FILEIO_BLOCKSIZE=524288
elif [[ "$check_fsync" -eq '1024' ]]; then
FILEIO_BLOCKSIZE=1048576
else
FILEIO_BLOCKSIZE=${FILEIO_BLOCKSIZE}
fi
fi
fileio_filesize=${FILEIO_FILESIZE}
checkdisk_space=$(df -mP /home | tail -1 | awk '{print $4}')
if [[ "$fileio_filesize" -ge "$checkdisk_space" ]]; then
echo
echo "warning: fileio required disk space $fileio_filesize MB"
echo " is larger than /home disk free space $checkdisk_space"
echo " aborting test..."
echo
exit
fi
cd "${SYSBENCH_FILEIODIR}"
if [[ "$check_fsync" = 'fsync' || "$check_fsync" = 'fsync-16' ]]; then
if [[ "$check_fsync" = 'fsync-16' ]]; then
FILEIO_BLOCKSIZE=16384
FSYNC_LABEL=fsync-16
else
FILEIO_BLOCKSIZE=${FILEIO_BLOCKSIZE}
FSYNC_LABEL=fsync
fi
# sequential read
FILEIO_SEQRD='n'
# sequential write
FILEIO_SEQWR='n'
# sequent rewrite
FILEIO_SEQREWR='n'
# random read
FILEIO_RNDRD='n'
# random write
FILEIO_RNDWR='n'
# random read/write
FILEIO_RNDRW='n'
echo
echo "sysbench fileio fsync prepare"
echo "sysbench fileio --time=$FILEIO_FSYNCTIME --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} --file-fsync-all=on --file-test-mode=rndwr --file-fsync-freq=0 --file-fsync-end=0 --threads=1 --percentile=99 prepare"
sysbench fileio --time=$FILEIO_FSYNCTIME --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} --file-fsync-all=on --file-test-mode=rndwr --file-fsync-freq=0 --file-fsync-end=0 --threads=1 --percentile=99 prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --time=$FILEIO_FSYNCTIME --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} --file-fsync-all=on --file-test-mode=rndwr --file-fsync-freq=0 --file-fsync-end=0 --percentile=99 run" | tee "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --time=$FILEIO_FSYNCTIME --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} --file-fsync-all=on --file-test-mode=rndwr --file-fsync-freq=0 --file-fsync-end=0 --percentile=99 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-raw.log"
else
sysbench fileio --threads=1 --time=$FILEIO_FSYNCTIME --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} --file-fsync-all=on --file-test-mode=rndwr --file-fsync-freq=0 --file-fsync-end=0 --percentile=99 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|99th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-${FSYNC_LABEL}-threads-1-csv.log"
echo
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} cleanup"
sysbench fileio --file-num=1 --file-extra-flags= --file-total-size=4096 --file-block-size=${FILEIO_BLOCKSIZE} cleanup >/dev/null 2>&1
fi
if [[ "$FILEIO_SEQRD" = [yY] ]]; then
# sleep $FILEIO_SLEEP
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrd prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrd prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-csv.log"
echo
fi
if [[ "$FILEIO_SEQWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqwr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqwr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-csv.log"
echo
fi
if [[ "$FILEIO_SEQREWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrewr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrewr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-csv.log"
echo
fi
if [[ "$FILEIO_RNDRD" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrd prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrd prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-csv.log"
echo
fi
if [[ "$FILEIO_RNDWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndwr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndwr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-csv.log"
echo
fi
if [[ "$FILEIO_RNDRW" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrw prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrw prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1.log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-raw.log"
else
sysbench fileio --threads=1 --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1.log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1.log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-csv.log"
fi
# concat fileio csv files 1 thread
> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
if [[ "$FILEIO_SEQRD" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_SEQWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_SEQREWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDRD" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDRW" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-1-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$TEST_SINGLETHREAD" != [yY] ]]; then
echo
# echo "threads: $(nproc)";
if [[ "$FILEIO_SEQRD" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrd prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrd prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-csv.log"
echo
fi
if [[ "$FILEIO_SEQWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqwr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqwr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-csv.log"
echo
fi
if [[ "$FILEIO_SEQREWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrewr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=seqrewr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=seqrewr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-csv.log"
echo
fi
if [[ "$FILEIO_RNDRD" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrd prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrd prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrd --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-csv.log"
echo
fi
if [[ "$FILEIO_RNDWR" = [yY] ]]; then
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndwr prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndwr prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndwr --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-csv.log"
echo
fi
if [[ "$FILEIO_RNDRW" = [yY] ]]; then
sleep $FILEIO_SLEEP
sleep $FILEIO_SLEEP
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "sysbench fileio prepare"
echo "sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrw prepare"
sysbench fileio --file-total-size=${fileio_filesize}M --file-test-mode=rndrw prepare >/dev/null 2>&1
echo
echo "sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run" | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc).log"
if [ -f "$JEMALLOC_FILE" ]; then
LD_PRELOAD="$JEMALLOC_FILE" sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-raw.log"
else
sysbench fileio --threads=$(nproc) --file-num=${FILEIO_FILENUM} --file-total-size=${fileio_filesize}M --file-block-size=${FILEIO_BLOCKSIZE} --file-io-mode=${FILEIO_MODE} --file-extra-flags=${FILEIO_EXTRAFLAGS} --file-test-mode=rndrw --time=${FILEIO_TIME} --events=0 run 2>&1 > "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-raw.log"
fi
echo "raw log saved: $SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-raw.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-raw.log" | egrep 'sysbench |Number of threads:|Block size|ratio |mode|Doing |reads/s:|writes/s:|fsyncs/s:|read, | written,|total time:|min:|avg:|max:|95th percentile:' | sed -e 's|Number of threads|threads|' -e 's| size|-size|' -e 's|total time:|time:|' -e 's|, MiB/s|-MiB/s|g' -e 's| percentile||' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -s ' '| tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc).log"
echo
echo -n "| fileio "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{ for (i=1;i<=NF;i+=2) print $i" |" }' | xargs | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-markdown.log"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |" | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-markdown.log"
echo -n "| "; cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc).log" | grep -v 'ratio' | sed -e 's|Using ||' -e 's| mode||' -e 's|Doing ||' -e 's| test||' | awk '{print $1,$2}' | xargs | awk '{for (i=2; i<=NF; i+=2)print $i" |" }' | xargs | tee -a "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-markdown.log"
echo
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-markdown.log" | grep -v '\-\-\-' | sed -e 's| \| |,|g' -e 's|\:||g' -e 's|\|||' | tee "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-csv.log"
fi
fi
if [[ ! "$check_fsync" ]]; then
echo
echo "sysbench fileio cleanup"
echo "sysbench fileio --file-total-size=${fileio_filesize}M cleanup"
sysbench fileio --file-total-size=${fileio_filesize}M cleanup >/dev/null 2>&1
echo
echo "| fileio sysbench | sysbench | threads: | Block-size | synchronous | sequential | reads/s: | writes/s: | fsyncs/s: | read-MiB/s: | written-MiB/s: | time: | min: | avg: | max: | 95th: |"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |"
ls -rt /home/sysbench/ | grep 'sysbench-fileio' | grep 'markdown' | grep 'seq' | while read f; do echo -n '|'; grep 'fileio' /home/sysbench/$f; done
echo
echo "| fileio sysbench | sysbench | threads: | Block-size | synchronous | random | reads/s: | writes/s: | fsyncs/s: | read-MiB/s: | written-MiB/s: | time: | min: | avg: | max: | 95th: |"
echo "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |"
ls -rt /home/sysbench/ | grep 'sysbench-fileio' | grep 'markdown' | grep 'rnd' | while read f; do echo -n '|'; grep 'fileio' /home/sysbench/$f; done
echo
fi
# concat fileio csv files max threads
if [[ "$FILEIO_SEQRD" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqrd-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_SEQWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqwr-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_SEQREWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-seqrewr-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDRD" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndrd-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDWR" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndwr-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
if [[ "$FILEIO_RNDRW" = [yY] ]]; then
if [ -f "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-csv.log" ]; then
cat "$SYSBENCH_DIR/sysbench-fileio-rndrw-threads-$(nproc)-csv.log" >> "$SYSBENCH_DIR/sysbench-fileio-concat-csv.log"
fi
fi
}
sysbench_mysqltpcc() {
cd "$SYSBENCH_DIR/mysql"
echo
echo "download sysbench tpcc scripts"
wget -4 -cnv https://github.com/Percona-Lab/sysbench-tpcc/raw/master/tpcc_check.lua -O tpcc_check.lua && chmod +x tpcc_check.lua
wget -4 -cnv https://github.com/Percona-Lab/sysbench-tpcc/raw/master/tpcc_common.lua -O tpcc_common.lua && chmod +x tpcc_common.lua
wget -4 -cnv https://github.com/Percona-Lab/sysbench-tpcc/raw/master/tpcc_run.lua -O tpcc_run.lua && chmod +x tpcc_run.lua
wget -4 -cnv https://github.com/Percona-Lab/sysbench-tpcc/raw/master/tpcc.lua -O tpcc.lua && chmod +x tpcc.lua
echo
echo "setup $MYSQL_DBNAME database & user"
echo y | mysqladmin drop $MYSQL_DBNAME
echo "mysqladmin create $MYSQL_DBNAME"
mysqladmin create $MYSQL_DBNAME
echo
mysql -e "show grants for '$MYSQL_USER'@'$MYSQL_HOST';" >/dev/null 2>&1
CHECKUSER=$?
if [[ "$CHECKUSER" -ne '0' ]]; then
if [[ "$MYSQL_SSL" == [yY] ]]; then
echo "CREATE USER '$MYSQL_USER'@'$MYSQL_HOST' IDENTIFIED BY '$MYSQL_PASS' REQUIRE SSL; GRANT ALL PRIVILEGES ON \`$MYSQL_DBNAME\`.* TO '$MYSQL_USER'@'$MYSQL_HOST'; flush privileges; show grants for '$MYSQL_USER'@'$MYSQL_HOST';" | mysql
else
echo "CREATE USER '$MYSQL_USER'@'$MYSQL_HOST' IDENTIFIED BY '$MYSQL_PASS'; GRANT ALL PRIVILEGES ON \`$MYSQL_DBNAME\`.* TO '$MYSQL_USER'@'$MYSQL_HOST'; flush privileges; show grants for '$MYSQL_USER'@'$MYSQL_HOST';" | mysql
fi
fi
if [[ "$MYSQL_LOGIN" = [yY] ]]; then
MYSQL_LOGINOPT=" --mysql-user=${MYSQL_USER} --mysql-password=${MYSQL_PASS}"
else
MYSQL_LOGINOPT=""
fi
if [[ "$MYSQL_USESOCKET" = [yY] ]]; then
MYSQL_USESOCKETOPT=" --mysql-socket=${MYSQL_SOCKET}"
else
MYSQL_USESOCKETOPT=""
fi
echo
echo "./tpcc.lua --mysql-host=${MYSQL_HOST} --mysql-port=${MYSQL_PORT}${MYSQL_USESOCKETOPT}${MYSQL_LOGINOPT} --mysql-db=${MYSQL_DBNAME} --mysql-table-engine=${MYSQL_ENGINE} --time=${MYSQL_TIME} --threads=${MYSQL_THREADS} --report-interval=1 --tables=${MYSQL_TABLECOUNT} --scale=${MYSQL_SCALE} --db-driver=mysql prepare"
./tpcc.lua --mysql-host=${MYSQL_HOST} --mysql-port=${MYSQL_PORT}${MYSQL_USESOCKETOPT}${MYSQL_LOGINOPT} --mysql-db=${MYSQL_DBNAME} --mysql-table-engine=${MYSQL_ENGINE} --time=${MYSQL_TIME} --threads=${MYSQL_THREADS} --report-interval=1 --tables=${MYSQL_TABLECOUNT} --scale=${MYSQL_SCALE} --db-driver=mysql prepare
echo