• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2016 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# format argument via
17# $ echo '{...}' | python -mjson.tool
18read -r -d '' SCENARIOS_JSON_ARG <<'EOF'
19{
20    "scenarios": [
21        {
22            "benchmark_seconds": 60,
23            "warmup_seconds": 5,
24            "client_config": {
25                "client_channels": 100,
26                "client_type": "ASYNC_CLIENT",
27                "histogram_params": {
28                    "max_possible": 60000000000.0,
29                    "resolution": 0.01
30                },
31                "load_params": {
32                    "closed_loop": {}
33                },
34                "outstanding_rpcs_per_channel": 100,
35                "payload_config": {
36                    "simple_params": {
37                        "req_size": 0,
38                        "resp_size": 0
39                    }
40                },
41                "rpc_type": "UNARY",
42                "security_params": null
43            },
44            "name": "name_goes_here",
45            "num_clients": 1,
46            "num_servers": 1,
47            "server_config": {
48                "security_params": null,
49                "server_type": "ASYNC_SERVER"
50            },
51            "spawn_local_worker_count": -2
52        }
53    ]
54}
55
56EOF
57
58set -ex
59
60cd $(dirname $0)/../../..
61
62CPUS=`python -c 'import multiprocessing; print multiprocessing.cpu_count()'`
63
64# try to use pypy for generating reports
65# each trace dumps 7-8gig of text to disk, and processing this into a report is
66# heavyweight - so any speed boost is worthwhile
67# TODO(ctiller): consider rewriting report generation in C++ for performance
68if which pypy >/dev/null; then
69  PYTHON=pypy
70else
71  PYTHON=python2.7
72fi
73
74export config=mutrace
75
76make CONFIG=$config -j$CPUS qps_json_driver
77
78sudo perf record -F 997 -g bins/$config/qps_json_driver --scenarios_json="$SCENARIOS_JSON_ARG"
79sudo perf report
80
81