Closed Fourdee closed 6 years ago
@Fourdee
Nice idea. We can combine this with dietpi-survey
, e.g. dietpi-benchmark
allows user to choose upload, then creates some flag (which could be simply the data within /tmp/dietpi-benchmark/upload.txt) and starts dietpi-survey. dietpi-survey then checks for the flag and in case adds benchmark results die survey upload.
Hmm, but needs different handling, as relation between device data and results is needed 🤔.
@MichaIng
Excellent 👍
Once https://github.com/Fourdee/DietPi/issues/1768 is completed, i'll make a start on this.
Consider implementing this into the stats for each device under the download section of dietpi.com It's very hard to get a picture of real-world performance of a SBC before purchase not to mention accessory hardware performance in relation to a particular SBC.
@LexiconCode
Great idea, love it 👍 We'll definitely consider doing this.
My PHP experience is somewhat limited, so we may have to simply link the URL in the downloads section.
@MichaIng Benchmark suite code done, just need to impliment how we are to upload this to dietpi.com. Use of survey and send, if the generated results file exists?
Currently, the file exported is below:
cat << _EOF_ > /var/lib/dietpi/dietpi-benchmark/upload_results
$CPUBENCH_TIME
$rootfs_write
$rootfs_read
$ram_write
$ram_read
_EOF_
root@DietPi:~# cat /var/lib/dietpi/dietpi-benchmark/upload_results
9.27
37.1
198
542
387
Is it possible for rootfs benchmark to determine what type of hardware like MMC, hard drive, SD card?
In addition which interface it's using USB 2. 0, 3. 0, sata...
@LexiconCode
Is it possible for rootfs benchmark to determine what type of hardware like MMC, hard drive, SD card?
Unsure, however, good suggestion, i'll take a look 👍
@Fourdee Ah sorry, was a bid busy since last weekend, missed that one.
First I agree with @LexiconCode that the values have more meaning, if connected with related hardware info.
grep -m1 '^model name' <<< "$(</proc/cpuinfo)" | sed 's/model name[[:blank:]]*: //'
?lshw
or dmidecode
cat /sys/block/mmcblk0/device/name
does not always existcat /sys/block/sda/device/model
sometimes empty, also does not always existAbout file scheme:
aBENCH_CPU[$G_HW_MODEL_DESCRIPTION]=$(( ${aBENCH_CPU[$G_HW_MODEL_DESCRIPTION]:=0} + $CPU_BENCH_RESULT )) && (( ${aDEVICE_COUNT[$G_HW_MODEL_DESCRIPTION]}++))
After looping through all upload files:
for i in ${#aDEVICE_COUNT[@]}; do ${aBENCH_CPU_AVG[$i]}=$(( ${aBENCH_CPU[$i]} / ${aDEVICE_COUNT[$i]} )); done
@MichaIng
We could probably do this using a 2D array?
((aBENCH_CPU_TIME[$G_HW_MODEL_DESCRIPTION,$(sed -n 1p $fp_dietpi_benchmark)]++))
That way, results are linked to the $G_HW_MODEL_DESCRIPTION
# -------------------------
# DietPi-Benchmark
# -------------------------
((aBENCH_CPU_TIME[Odroid C2 (aarch64),17.15]++))
((aBENCH_ROOTFS_WRITE[Odroid C2 (aarch64),26.6]++))
((aBENCH_ROOTFS_READ[Odroid C2 (aarch64),110]++))
((aBENCH_RAM_WRITE[Odroid C2 (aarch64),473]++))
((aBENCH_RAM_READ[Odroid C2 (aarch64),480]++))
I'am still unsure how you scrape the above into the survey file, but, i'd probably do it this way. Using UUID as the array index
aBENCH_DEVICE[$UUID]=$G_HW_MODEL_DESCRIPTION
aBENCH_CPU_TIME[$UUID]=$(sed -n 1p $fp_dietpi_benchmark)
Or even:
for (( i=0;i<total_file_count;i++))
do
. UUID $i
done
from
# -------------------------
# DietPi-Benchmark
# -------------------------
index=$1
aBENCH_DEVICE[$index]=$G_HW_MODEL_DESCRIPTION
aBENCH_CPU_TIME[$index]=$(sed -n 1p $fp_dietpi_benchmark)
aBENCH_ROOTFS_WRITE[$index]=$(sed -n 2p $fp_dietpi_benchmark)
aBENCH_ROOTFS_READ[$index]=$(sed -n 3p $fp_dietpi_benchmark)
aBENCH_RAM_WRITE[$index]=$(sed -n 4p $fp_dietpi_benchmark)
aBENCH_RAM_READ[$index]=$(sed -n 5p $fp_dietpi_benchmark)
Then we can work with the array's above.
root@DietPi:~# cat bench
# -------------------------
# DietPi-Benchmark
# -------------------------
index=$1
aBENCH_DEVICE[$index]='Odroid C2 (aarch64)'
aBENCH_CPU_TIME[$index]='17.15'
aBENCH_ROOTFS_WRITE[$index]='26.6'
aBENCH_ROOTFS_READ[$index]='110'
aBENCH_RAM_WRITE[$index]='473'
aBENCH_RAM_READ[$index]='480'
root@DietPi:~# . bench 0
Ok made a start on this code for this, basic code working well.
We end up with arrays of:
BENCH_RESULT_CPU_MIN[$HW_MODEL]
BENCH_RESULT_CPU_MAX[$HW_MODEL]
BENCH_RESULT_CPU_AVG[$HW_MODEL]
Which we can use to print some nice HTML stuff afterwards (which I have no clue where to start lol)
root@DietPi:/var/www/downloads/testing# ./dietpi-survey_report
#system 1
17.09
72.1
110
468
489
#system 2 (copy of system 1 upload)
17.09
72.1
110
468
489
BENCH_RESULT_CPU_AVG for HW_MODEL 12 = 17.0
Temps not printing once added to array, but the original var is?
@MichaIng
Whoop whoop 🥂
@Fourdee Niiiice.
Maybe we can merge the results as additional columns into the "Devices" install count table, what you think?
@MichaIng
Maybe we can merge the results as additional columns into the "Devices" install count table, what you think?
Good idea 👍
Only issue is, i'll need to create about 4/5 of these tables, as, adding all the info on 1 table makes it too squashed.
I'll have a play bit later.
Also really want it this way, but can't figure it out yet:
Some issues with server, needs a reboot:
[10535890.095824] TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies. Check SNMP counters.
[10538980.248728] TCP: request_sock_TCP: Possible SYN flooding on port 80. Sending cookies. Check SNMP counters.
[12131781.922070] INFO: task jbd2/sda1-8:410 blocked for more than 120 seconds.
[12131781.922074] Not tainted 4.9.0-6-amd64 #1 Debian 4.9.82-1+deb9u3
[12131781.922074] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[12131781.922076] jbd2/sda1-8 D 0 410 2 0x00000000
[12131781.922098] ffff8c6cbacac000 0000000000000000 ffff8c6c769030c0 ffff8c6cbfc18940
[12131781.922124] ffffffff9da11500 ffffabcbc04b7ca0 ffffffff9d40c649 ffff8c6c76e7e888
[12131781.922126] 0000000000000246 ffff8c6cbfc18940 ffffabcbc04b7d80 ffff8c6c769030c0
[12131781.922129] Call Trace:
[12131781.922252] [<ffffffff9d40c649>] ? __schedule+0x239/0x6f0
[12131781.922269] [<ffffffff9ceb9c50>] ? prepare_to_wait_event+0xf0/0xf0
[12131781.922271] [<ffffffff9d40cb32>] ? schedule+0x32/0x80
[12131781.922326] [<ffffffffc02f428f>] ? jbd2_journal_commit_transaction+0x25f/0x17b0 [jbd2]
[12131781.922329] [<ffffffff9ceb9c50>] ? prepare_to_wait_event+0xf0/0xf0
[12131781.922333] [<ffffffffc02f9c02>] ? kjournald2+0xc2/0x260 [jbd2]
[12131781.922335] [<ffffffff9ceb9c50>] ? prepare_to_wait_event+0xf0/0xf0
[12131781.922338] [<ffffffffc02f9b40>] ? commit_timeout+0x10/0x10 [jbd2]
[12131781.922346] [<ffffffff9ce970c9>] ? kthread+0xd9/0xf0
[12131781.922349] [<ffffffff9ce96ff0>] ? kthread_park+0x60/0x60
[12131781.922355] [<ffffffff9ce7c3d0>] ? SyS_exit_group+0x10/0x10
[12131781.922357] [<ffffffff9d411537>] ? ret_from_fork+0x57/0x70
[12131781.922370] INFO: task mysqld:24660 blocked for more than 120 seconds.
[12131781.922371] Not tainted 4.9.0-6-amd64 #1 Debian 4.9.82-1+deb9u3
[12131781.922372] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
root@DietPi:/var/www/downloads/testing# netstat -s
Ip:
Forwarding: 2
2092417752 total packets received
14006058 with invalid addresses
0 forwarded
26 with unknown protocol
0 incoming packets discarded
2059706761 incoming packets delivered
1870713670 requests sent out
40 outgoing packets dropped
673460 dropped because of missing route
182 reassemblies required
91 packets reassembled ok
26 fragments failed
Icmp:
66821 ICMP messages received
2453 input ICMP message failed
InCsumErrors: 39
ICMP input histogram:
destination unreachable: 41795
timeout in transit: 1538
echo requests: 23377
echo replies: 72
99260 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 75884
echo replies: 23376
IcmpMsg:
InType0: 72
InType3: 41795
InType8: 23377
InType11: 1538
OutType0: 23376
OutType3: 75884
Tcp:
5589296 active connection openings
37983973 passive connection openings
145804 failed connection attempts
5531654 connection resets received
7 connections established
2081679398 segments received
5236087781 segments sent out
52396075 segments retransmitted
33289 bad segments received
7526591 resets sent
InCsumErrors: 32707
Udp:
400670 packets received
77623 packets to unknown port received
113 packet receive errors
391943 packets sent
0 receive buffer errors
0 send buffer errors
InCsumErrors: 113
IgnoredMulti: 20273762
UdpLite:
TcpExt:
1074141 SYN cookies sent
9125102 SYN cookies received
723124 invalid SYN cookies received
145004 resets received for embryonic SYN_RECV sockets
246 ICMP packets dropped because they were out-of-window
8656124 TCP sockets finished time wait in fast timer
1215248 packetes rejected in established connections because of timestamp
3210833 delayed acks sent
19825 delayed acks further delayed because of locked socket
Quick ack mode was activated 468480 times
14330436 times the listen queue of a socket overflowed
14940709 SYNs to LISTEN sockets dropped
44418 packets directly queued to recvmsg prequeue
276408 bytes directly in process context from backlog
TCPDirectCopyFromPrequeue: 13783
52279651 packet headers predicted
155 packet headers predicted and directly queued to user
926133001 acknowledgments not containing data payload received
787114555 predicted acknowledgments
4366 times recovered from packet loss due to fast retransmit
TCPSackRecovery: 5262837
TCPSACKReneging: 2904
Detected reordering 44248 times using FACK
Detected reordering 1845103 times using SACK
Detected reordering 1592 times using reno fast retransmit
Detected reordering 152248 times using time stamp
34303 congestion windows fully recovered without slow start
124914 congestion windows partially recovered using Hoe heuristic
TCPDSACKUndo: 117757
722787 congestion windows recovered without slow start after partial ack
TCPLostRetransmit: 980038
710 timeouts after reno fast retransmit
TCPSackFailures: 917323
239687 timeouts in loss state
39121399 fast retransmits
3053065 forward retransmits
2621607 retransmits in slow start
TCPTimeouts: 5765772
TCPLossProbes: 1769261
TCPLossProbeRecovery: 145940
TCPRenoRecoveryFail: 740
TCPSackRecoveryFail: 347299
TCPDSACKOldSent: 457720
TCPDSACKOfoSent: 4058
TCPDSACKRecv: 13748494
TCPDSACKOfoRecv: 258584
5301177 connections reset due to unexpected data
72478 connections reset due to early user close
188155 connections aborted due to timeout
3 times unable to send RST due to no memory
TCPSACKDiscard: 17370
TCPDSACKIgnoredOld: 507873
TCPDSACKIgnoredNoUndo: 1323291
TCPSpuriousRTOs: 680006
TCPSackShifted: 144424895
TCPSackMerged: 87101372
TCPSackShiftFallback: 64126953
TCPDeferAcceptDrop: 37059644
TCPReqQFullDoCookies: 1958200
TCPRetransFail: 3783
TCPRcvCoalesce: 10550775
TCPOFOQueue: 1136028
TCPOFOMerge: 2984
TCPChallengeACK: 17615
TCPSYNChallenge: 1582
TCPFastOpenCookieReqd: 3503
TCPAutoCorking: 2010
TCPFromZeroWindowAdv: 2
TCPToZeroWindowAdv: 2
TCPWantZeroWindowAdv: 8
TCPSynRetrans: 3062891
TCPOrigDataSent: 5098952431
TCPHystartTrainDetect: 27286
TCPHystartTrainCwnd: 5349343
TCPHystartDelayDetect: 394714
TCPHystartDelayCwnd: 33381101
TCPACKSkippedSynRecv: 4515
TCPACKSkippedPAWS: 1073376
TCPACKSkippedSeq: 59730
TCPACKSkippedFinWait2: 229
TCPACKSkippedTimeWait: 2729
TCPACKSkippedChallenge: 19627
TCPWinProbe: 697466
TCPKeepAlive: 108
IpExt:
InMcastPkts: 5
InBcastPkts: 20283769
InOctets: 165045175955
OutOctets: 7222217202331
InMcastOctets: 160
InBcastOctets: 1172424085
InNoECTPkts: 2090911592
InECT1Pkts: 64073
InECT0Pkts: 1536471
InCEPkts: 1353760
@MichaIng
Server offline for backup.
Might also upgrade it to 4cores 4GB 😉 | wont let me upgrade, ticket sent. We can pay the difference (£5 + month)
@Fourdee
Also really want it this way, but can't figure it out yet:
Use colspan
to spread a cell over multiple columns. rowspan
could be used to spread the first "Device" cell over the first two lines then:
<table>
<tr>
<th rowspan="2">Device:</th>
<th colspan="3">CPU time</th>
</tr>
<tr>
<th>avg</td>
<th>min</td>
<th>max</td>
</tr>
<tr>
<td>RPi</td>
<td>123</td>
<td>56</td>
<td>203</td>
</tr>
</table>
Server offline for backup.
Hmm Cloudflare's Always Online does not work here 🤔.
Boom boom:
@Fourdee Looks nice.
However this could be presented much nicer on the new java survey page with nice charts. Maybe @userdeveloper98 finds some time to implement this by times? 😜
Color me up sally:
@MichaIng
However this could be presented much nicer on the new java survey page with nice charts. Maybe @userdeveloper98 finds some time to implement this by times? 😜
Yep agree, we'll need to wait and see if @userdeveloper98 is up for it :)
Getting alot of this during update: Was occurring before any of my changes.
TOSTART_OPTION[]: bad array subscript
/tmp/dietpi-survey_report/11f218f5-2ba7-4835-af54-b3e1da5f2e91.txt: line 17: aSOFTWARE[${aSOFTWARE_NAME6_10[]}]++: bad substitution
line 19: aSOFTWARE[]: bad array subscript
#!/bin/bash
# -------------------------
((aSURVEY_VERSION[6]++))
# -------------------------
((aSURVEY_SENTCOUNT[5]++))
((aDIETPI_VERSION[6.9]++))
((aDEVICE_NAME[RPi 3 Model B (armv7l)]++))
((aCPU_ARCH[armv7l]++))
((aCPU_COUNT[4]++))
((aDISTRO_VERSION[stretch]++))
((aAUTOSTART_OPTION[${aAUTOSTART_NAME[5]}]++))
((aAUTO_SETUP_AUTOMATED[0]++))
((aNETWORK_INTERFACE[eth0]++))
# -------------------------
# DietPi-Software Installed
# -------------------------
((aSOFTWARE[${aSOFTWARE_NAME6_9[5]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[6]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[31]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[44]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[96]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[103]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[104]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_9[152]}]++))
line 17: aSOFTWARE[${aSOFTWARE_NAME6_10[]}]++: bad substitution
#!/bin/bash
# -------------------------
((aSURVEY_VERSION[6]++))
# -------------------------
((aSURVEY_SENTCOUNT[1]++))
((aDIETPI_VERSION[6.10]++))
((aDEVICE_NAME[NanoPi NEO 2 (aarch64)]++))
((aCPU_ARCH[aarch64]++))
((aCPU_COUNT[4]++))
((aDISTRO_VERSION[stretch]++))
((aAUTOSTART_OPTION[${aAUTOSTART_NAME[0]}]++))
((aAUTO_SETUP_AUTOMATED[0]++))
((aNETWORK_INTERFACE[eth0]++))
# -------------------------
# DietPi-Software Installed
# -------------------------
((aSOFTWARE[${aSOFTWARE_NAME6_10[]}]++))
lol?
Ok we need to check min/max.
((aAUTOSTART_OPTION[${aAUTOSTART_NAME[28]}]++))
@Fourdee Jep known issues.
On earlier versions for it was possible that survey added an empty string as installed software ID. I guess it was due to first run survey, if not .installed file was created yet, or at least nothing yet marked as installed.
The other issue is due to DietPi subversion integer being wrong sometimes in updater. So DietPi is actually v6.10+, thus survey uploads new survey file scheme, but version string added is wrong, so no special aSOFTWARE_NAME array exist for this.
I anyway though that we could clean the survey files a bid, removing those that were not changed for time X. But not urgent, since the errors above do not break anything, just a few software installs are dropped.
6103e95d-3a09-4729-b7dd-6bd9f3cb2e7c.txt: line 17: aSOFTWARE[]: bad array subscript
((aSOFTWARE[${aSOFTWARE_NAME_12[5]}]++))
@MichaIng
since the errors above do not break anything
Adding checks for bad files and skipping them 👍
root@DietPi:/var/www/downloads/testing# /etc/cron.minutely/dietpi-survey_report
Bad file contains array with no index ([]), skipping: /tmp/dietpi-survey_report/00fa6266-cc32-410c-9017-df2ce5003b85.txt
since the errors above do not break anything
~Might possibly be the cause~ why only 1 benchmark result is showing, i've done 4, unsure yet: https://dietpi.com/survey/#benchmark
Appears, the upload completes, but file does not exist on server.
[ OK ] DietPi-Survey | Connection test: ssh.dietpi.com
#!/bin/bash
# -------------------------
((aSURVEY_VERSION[6]++))
# -------------------------
((aSURVEY_SENTCOUNT[23]++))
((aDIETPI_VERSION[6.17]++))
((aDEVICE_NAME[RPi 3 Model B+ (armv7l)]++))
((aCPU_ARCH[armv7l]++))
((aCPU_COUNT[4]++))
((aDISTRO_VERSION[stretch]++))
((aAUTOSTART_OPTION[${aAUTOSTART_NAME[0]}]++))
((aAUTO_SETUP_AUTOMATED[0]++))
((aNETWORK_INTERFACE[eth0]++))
# -------------------------
# DietPi-Software Installed
# -------------------------
((aSOFTWARE[${aSOFTWARE_NAME6_17[0]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_17[103]}]++))
((aSOFTWARE[${aSOFTWARE_NAME6_17[105]}]++))
# -------------------------
# DietPi-Benchmark
# -------------------------
BENCH_HW_MODEL=3
BENCH_CPU=21.30
BENCH_ROOTFS_WRITE=7.2
BENCH_ROOTFS_READ=20.0
BENCH_RAM_WRITE=506
BENCH_RAM_READ=159
BENCH_CPU_TEMP_START=44
BENCH_CPU_TEMP_END=59
[ .... ] DietPi-Survey | (1/5) Testing connection to ssh.dietpi.com, please wait[ OK ] DietPi-Survey | Connection test: ssh.dietpi.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 830 0 0 100 830 0 812 0:00:01 0:00:01 --:--:-- 812
100 830 0 0 100 830 0 812 0:00:01 0:00:01 --:--:-- 812
[ OK ] DietPi-Survey | Successfully sent survey data
root@DietPi:/var/www/downloads/testing# sync
root@DietPi:/var/www/downloads/testing# nano /home/dietpi-survey/survey/dce3cbc9-d3c5-4506-a654-c475184786bd.txt
#no file
Aha http://www.manpagez.com/man/5/sshd_config/ MaxSessions
Idiot moment, resolved below 🈯️
Completed, all issues resolved 🈯️
You can run a quick benchmark and upload with:
/DietPi/dietpi/func/dietpi-benchmark 2
View results: https://dietpi.com/survey#benchmark
@Fourdee
What do you think about creating results file in a shell source-able way, so it can be directly cat
into the dietpi-survey upload file and sourced by other scripts as well. Generally I like to do this for most of our data/settings/results files, as sourcing should always be much faster then using sed
or grep
to catch content. Also the same values are then forced to have the same variable names across scripts, to have increased consistency.
https://github.com/Fourdee/DietPi/blob/dev/dietpi/func/dietpi-benchmark#L253-L261
@MichaIng
Yep, makes sense, i'll make the change.
@MichaIng
Done, cleaned up and now sourced vars.
Tested fine.
@Fourdee Currently upload is done automatically, so no "optional uploads". Can we have a switch to have results saved locally or upload them? Or two separate selections for bench only and upload only?
I am thinking as well, if it is okay to bench single devices as well, e.g. CPU only, but then we need to handle empty entries in report.
And currently on VM, 1° CPU temperature is shown. Would be good to not only show N/A on report page, but as well in dietpi-benchmark menu header/results window. At best the temp test is simple skipped then in case of empty values, show N/A.
@MichaIng
I am thinking as well, if it is okay to bench single devices as well, e.g. CPU only, but then we need to handle empty entries in report.
The whole purpose of this was to reduce available options, and, support benchmark uploads via 1 menu item.
I removed the option to manually run CPU/rootfs/RAM as its contained within the suite option, which, we want users to run as share/view their results.
Currently upload is done automatically, so no "optional uploads"
Yep, intended, its part of the survey. However, we should change the "Ok" to run bench, have it a "Yes/No":
And currently on VM, 1° CPU temperature is shown.
Yep, i'll see if I can clean it up.
🈯️
Completed.
@Fourdee
The whole purpose of this was to reduce available options, and, support benchmark uploads via 1 menu item.
Hmm, I still think we should allow to run benchmarks without upload. Even that our survey is anonym and safe, I don't like it from end user perspective to be forced to transfer any data. Nothing against reducing options for simplicity, but there should be always a choice, if it's about sharing your data. E.g. I purged free version of 3dmark instantly from my Windows, after recognizing that bench results are automatically uploaded 😉.
@MichaIng
Thought the same eariler.
~2 tests:~
Ok so:
I'll make the change.
Completed.
Similar to dietpi-survey. Have an option to run:
Then option to upload scores to http://dietpi.com/benchmark Simple database to compare your scores against HW models etc.
@MichaIng Thoughts?