File: api_reports.t

package info (click to toggle)
sysbench 1.0.20%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,840 kB
  • sloc: ansic: 11,830; sh: 1,752; xml: 736; makefile: 195
file content (109 lines) | stat: -rw-r--r-- 3,320 bytes parent folder | download | duplicates (4)
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
########################################################################
Tests for custom report hooks
########################################################################

# Trigger one intermediate and one cumulative report
  $ SB_ARGS="api_reports.lua --time=5 --report-interval=2 --verbosity=1"

########################################################################
# Default human-readable format via a custom hook
########################################################################

  $ cat >api_reports.lua <<EOF
  > ffi.cdef[[int usleep(unsigned int);]]
  > 
  > function event()
  >   ffi.C.usleep(1000)
  > end
  > 
  > sysbench.hooks.report_intermediate = sysbench.report_default
  > sysbench.hooks.report_cumulative = sysbench.report_default
  > EOF

  $ sysbench $SB_ARGS run
  \[ 2s \] thds: 1 tps: [0-9]*\.[0-9]* qps: 0\.00 \(r\/w\/o: 0\.00\/0\.00\/0\.00\) lat \(ms,95%\): [1-9][0-9]*\.[0-9]* err\/s 0\.00 reconn\/s: 0\.00 (re)
  \[ 4s \] thds: 1 tps: [0-9]*\.[0-9]* qps: 0\.00 \(r\/w\/o: 0\.00\/0\.00\/0\.00\) lat \(ms,95%\): [1-9][0-9]*\.[0-9]* err\/s 0\.00 reconn\/s: 0\.00 (re)
  \[ 5s \] thds: 0 tps: [0-9]*\.[0-9]* qps: 0\.00 \(r\/w\/o: 0\.00\/0\.00\/0\.00\) lat \(ms,95%\): [1-9][0-9]*\.[0-9]* err\/s 0\.00 reconn\/s: 0\.00 (re)

########################################################################
# CSV format via a custom hook
########################################################################

  $ cat >api_reports.lua <<EOF
  > ffi.cdef[[int usleep(unsigned int);]]
  > 
  > function event()
  >   ffi.C.usleep(1000)
  > end
  > 
  > sysbench.hooks.report_intermediate = sysbench.report_csv
  > sysbench.hooks.report_cumulative = sysbench.report_csv
  > EOF

  $ sysbench $SB_ARGS run
  2,1,[0-9]*\.[0-9]*,0\.00,0\.00,0\.00,0\.00,[1-9][0-9]*\.[0-9]*,0\.00,0\.00 (re)
  4,1,[0-9]*\.[0-9]*,0\.00,0\.00,0\.00,0\.00,[1-9][0-9]*\.[0-9]*,0\.00,0\.00 (re)
  5,0,[0-9]*\.[0-9]*,0\.00,0\.00,0\.00,0\.00,[1-9][0-9]*\.[0-9]*,0\.00,0\.00 (re)

########################################################################
# JSON format via a custom hook
########################################################################

  $ cat >api_reports.lua <<EOF
  > ffi.cdef[[int usleep(unsigned int);]]
  > 
  > function event()
  >   ffi.C.usleep(1000)
  > end
  > 
  > sysbench.hooks.report_intermediate = sysbench.report_json
  > sysbench.hooks.report_cumulative = sysbench.report_json
  > EOF

  $ sysbench $SB_ARGS run
  [
    {
      "time":    2,
      "threads": 1,
      "tps": *.*, (glob)
      "qps": {
        "total": 0.00,
        "reads": 0.00,
        "writes": 0.00,
        "other": 0.00
      },
      "latency": [1-9][0-9]*\.[0-9]*, (re)
      "errors": 0.00,
      "reconnects": 0.00
    },
    {
      "time":    4,
      "threads": 1,
      "tps": *.*, (glob)
      "qps": {
        "total": 0.00,
        "reads": 0.00,
        "writes": 0.00,
        "other": 0.00
      },
      "latency": [1-9][0-9]*\.[0-9]*, (re)
      "errors": 0.00,
      "reconnects": 0.00
    }
  ]
  [
    {
      "time":    5,
      "threads": 0,
      "tps": *.*, (glob)
      "qps": {
        "total": 0.00,
        "reads": 0.00,
        "writes": 0.00,
        "other": 0.00
      },
      "latency": [1-9][0-9]*\.[0-9]*, (re)
      "errors": 0.00,
      "reconnects": 0.00
    }
  ]