|
15 | 15 | REPLICAS=$(echo "$f" | sed -r -e 's!'$REGEXP'!\3!') |
16 | 16 | MEMORY=$(echo "$f" | sed -r -e 's!'$REGEXP'!\4!') |
17 | 17 |
|
18 | | - LOAD_TIME=$(head -n1 "$f" | tr -d "\n") |
19 | | - DATA_SIZE=$(tail -n1 "$f" | tr -d "\n") |
20 | | - RESULT_BODY=$(grep -F "[" "$f" | head -c-2) |
| 18 | + # benchmark-common.sh emits "Load time:", "Data size:", "Concurrent QPS:" |
| 19 | + # and "Concurrent error ratio:" lines, plus one "[t1,t2,t3]," per query. |
| 20 | + LOAD_TIME=$(grep -E '^Load time:' "$f" | tail -n1 | awk '{print $3}') |
| 21 | + DATA_SIZE=$(grep -E '^Data size:' "$f" | tail -n1 | awk '{print $3}') |
| 22 | + CONCURRENT_QPS=$(grep -E '^Concurrent QPS:' "$f" | tail -n1 | awk '{print $3}') |
| 23 | + CONCURRENT_ERROR_RATIO=$(grep -E '^Concurrent error ratio:' "$f" | tail -n1 | awk '{print $4}') |
| 24 | + RESULT_BODY=$(grep -E '^\[' "$f" | head -c-2) |
21 | 25 |
|
22 | 26 | # Skip when the raw result file is incomplete — load time / data size must |
23 | 27 | # be plain numbers and the result body must be non-empty. Otherwise the |
|
29 | 33 | continue |
30 | 34 | fi |
31 | 35 |
|
| 36 | + # QPS fields are optional — older runs predate them. When missing or |
| 37 | + # null, emit JSON null so the website code can treat them uniformly. |
| 38 | + [[ "$CONCURRENT_QPS" =~ ^[0-9]+(\.[0-9]+)?$ ]] || CONCURRENT_QPS=null |
| 39 | + [[ "$CONCURRENT_ERROR_RATIO" =~ ^[0-9]+(\.[0-9]+)?$ ]] || CONCURRENT_ERROR_RATIO=null |
| 40 | + |
32 | 41 | OUT="results/$YYYYMMDD/${PROVIDER}.${REPLICAS}.${MEMORY}.json" |
33 | 42 | echo ' |
34 | 43 | { |
|
45 | 54 |
|
46 | 55 | "load_time": '$LOAD_TIME', |
47 | 56 | "data_size": '$DATA_SIZE', |
| 57 | + "concurrent_qps": '$CONCURRENT_QPS', |
| 58 | + "concurrent_error_ratio": '$CONCURRENT_ERROR_RATIO', |
48 | 59 |
|
49 | 60 | "result": [ |
50 | 61 | '"$RESULT_BODY"' |
|
0 commit comments