clang-format-6.0

This commit is contained in:
Tatsuhiro Tsujikawa 2018-06-09 16:02:26 +09:00
parent 159c5e446a
commit fc94018b97
4 changed files with 44 additions and 32 deletions

View File

@ -26,7 +26,7 @@ Coding style
We use clang-format to format source code consistently. The We use clang-format to format source code consistently. The
clang-format configuration file .clang-format is located at the root clang-format configuration file .clang-format is located at the root
directory. Since clang-format produces slightly different results directory. Since clang-format produces slightly different results
between versions, we currently use clang-format-5.0. between versions, we currently use clang-format-6.0.
To detect any violation to the coding style, we recommend to setup git To detect any violation to the coding style, we recommend to setup git
pre-commit hook to check coding style of the changes you introduced. pre-commit hook to check coding style of the changes you introduced.
@ -34,7 +34,7 @@ The pre-commit file is located at the root directory. Copy it under
.git/hooks and make sure that it is executable. The pre-commit script .git/hooks and make sure that it is executable. The pre-commit script
uses clang-format-diff.py to detect any style errors. If it is not in uses clang-format-diff.py to detect any style errors. If it is not in
your PATH or it exists under different name (e.g., your PATH or it exists under different name (e.g.,
clang-format-diff-5.0 in debian), either add it to PATH variable or clang-format-diff-6.0 in debian), either add it to PATH variable or
add git option ``clangformatdiff.binary`` to point to the script. add git option ``clangformatdiff.binary`` to point to the script.
For emacs users, integrating clang-format to emacs is very easy. For emacs users, integrating clang-format to emacs is very easy.

View File

@ -1799,10 +1799,12 @@ Options:
-c, --clients=<N> -c, --clients=<N>
Number of concurrent clients. With -r option, this Number of concurrent clients. With -r option, this
specifies the maximum number of connections to be made. specifies the maximum number of connections to be made.
Default: )" << config.nclients << R"( Default: )"
<< config.nclients << R"(
-t, --threads=<N> -t, --threads=<N>
Number of native threads. Number of native threads.
Default: )" << config.nthreads << R"( Default: )"
<< config.nthreads << R"(
-i, --input-file=<PATH> -i, --input-file=<PATH>
Path of a file with multiple URIs are separated by EOLs. Path of a file with multiple URIs are separated by EOLs.
This option will disable URIs getting from command-line. This option will disable URIs getting from command-line.
@ -1825,7 +1827,8 @@ Options:
-W, --connection-window-bits=<N> -W, --connection-window-bits=<N>
Sets the connection level initial window size to Sets the connection level initial window size to
(2**<N>)-1. (2**<N>)-1.
Default: )" << config.connection_window_bits << R"( Default: )"
<< config.connection_window_bits << R"(
-H, --header=<HEADER> -H, --header=<HEADER>
Add/Override a header to the requests. Add/Override a header to the requests.
--ciphers=<SUITE> --ciphers=<SUITE>
@ -1836,8 +1839,8 @@ Options:
-p, --no-tls-proto=<PROTOID> -p, --no-tls-proto=<PROTOID>
Specify ALPN identifier of the protocol to be used when Specify ALPN identifier of the protocol to be used when
accessing http URI without SSL/TLS. accessing http URI without SSL/TLS.
Available protocols: )" << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID Available protocols: )"
<< R"( and )" << NGHTTP2_H1_1 << R"( << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"( and )" << NGHTTP2_H1_1 << R"(
Default: )" Default: )"
<< NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"( << NGHTTP2_CLEARTEXT_PROTO_VERSION_ID << R"(
-d, --data=<PATH> -d, --data=<PATH>
@ -1921,7 +1924,8 @@ Options:
NPN. The parameter must be delimited by a single comma NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of only and any white spaces are treated as a part of
protocol string. protocol string.
Default: )" << DEFAULT_NPN_LIST << R"( Default: )"
<< DEFAULT_NPN_LIST << R"(
--h1 Short hand for --npn-list=http/1.1 --h1 Short hand for --npn-list=http/1.1
--no-tls-proto=http/1.1, which effectively force --no-tls-proto=http/1.1, which effectively force
http/1.1 for both http and https URI. http/1.1 for both http and https URI.
@ -1949,7 +1953,8 @@ Options:
The <DURATION> argument is an integer and an optional unit (e.g., 1s The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit (hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)" << std::endl; is omitted, a second is used as unit.)"
<< std::endl;
} }
} // namespace } // namespace
@ -2686,14 +2691,14 @@ int main(int argc, char **argv) {
finished in )" finished in )"
<< util::format_duration(duration) << ", " << rps << " req/s, " << util::format_duration(duration) << ", " << rps << " req/s, "
<< util::utos_funit(bps) << R"(B/s << util::utos_funit(bps) << R"(B/s
requests: )" << stats.req_todo << " total, " requests: )" << stats.req_todo
<< stats.req_started << " started, " << stats.req_done << " done, " << " total, " << stats.req_started << " started, " << stats.req_done
<< stats.req_status_success << " succeeded, " << stats.req_failed << " done, " << stats.req_status_success << " succeeded, "
<< " failed, " << stats.req_error << " errored, " << stats.req_failed << " failed, " << stats.req_error
<< stats.req_timedout << R"( timeout << " errored, " << stats.req_timedout << R"( timeout
status codes: )" << stats.status[2] << " 2xx, " status codes: )"
<< stats.status[3] << " 3xx, " << stats.status[4] << " 4xx, " << stats.status[2] << " 2xx, " << stats.status[3] << " 3xx, "
<< stats.status[5] << R"( 5xx << stats.status[4] << " 4xx, " << stats.status[5] << R"( 5xx
traffic: )" << util::utos_funit(stats.bytes_total) traffic: )" << util::utos_funit(stats.bytes_total)
<< "B (" << stats.bytes_total << ") total, " << "B (" << stats.bytes_total << ") total, "
<< util::utos_funit(stats.bytes_head) << "B (" << stats.bytes_head << util::utos_funit(stats.bytes_head) << "B (" << stats.bytes_head
@ -2701,12 +2706,12 @@ traffic: )" << util::utos_funit(stats.bytes_total)
<< "%), " << util::utos_funit(stats.bytes_body) << "B (" << "%), " << util::utos_funit(stats.bytes_body) << "B ("
<< stats.bytes_body << R"() data << stats.bytes_body << R"() data
min max mean sd +/- sd min max mean sd +/- sd
time for request: )" << std::setw(10) time for request: )"
<< util::format_duration(ts.request.min) << " " << std::setw(10) << std::setw(10) << util::format_duration(ts.request.min) << " "
<< util::format_duration(ts.request.max) << " " << std::setw(10) << std::setw(10) << util::format_duration(ts.request.max) << " "
<< util::format_duration(ts.request.mean) << " " << std::setw(10) << std::setw(10) << util::format_duration(ts.request.mean) << " "
<< util::format_duration(ts.request.sd) << std::setw(9) << std::setw(10) << util::format_duration(ts.request.sd)
<< util::dtos(ts.request.within_sd) << "%" << std::setw(9) << util::dtos(ts.request.within_sd) << "%"
<< "\ntime for connect: " << std::setw(10) << "\ntime for connect: " << std::setw(10)
<< util::format_duration(ts.connect.min) << " " << std::setw(10) << util::format_duration(ts.connect.min) << " " << std::setw(10)
<< util::format_duration(ts.connect.max) << " " << std::setw(10) << util::format_duration(ts.connect.max) << " " << std::setw(10)

View File

@ -174,7 +174,8 @@ Options:
--mime-types-file=<PATH> --mime-types-file=<PATH>
Path to file that contains MIME media types and the Path to file that contains MIME media types and the
extensions that represent them. extensions that represent them.
Default: )" << config.mime_types_file << R"( Default: )"
<< config.mime_types_file << R"(
--no-content-length --no-content-length
Don't send content-length header field. Don't send content-length header field.
--version Display version information and exit. --version Display version information and exit.

View File

@ -1897,7 +1897,8 @@ Connections:
Performance: Performance:
-n, --workers=<N> -n, --workers=<N>
Set the number of worker threads. Set the number of worker threads.
Default: )" << config->num_worker << R"( Default: )"
<< config->num_worker << R"(
--single-thread --single-thread
Run everything in one thread inside the worker process. Run everything in one thread inside the worker process.
This feature is provided for better debugging This feature is provided for better debugging
@ -2078,7 +2079,8 @@ SSL/TLS:
--client-ciphers=<SUITE> --client-ciphers=<SUITE>
Set allowed cipher list for backend connection. The Set allowed cipher list for backend connection. The
format of the string is described in OpenSSL ciphers(1). format of the string is described in OpenSSL ciphers(1).
Default: )" << config->tls.client.ciphers << R"( Default: )"
<< config->tls.client.ciphers << R"(
--ecdh-curves=<LIST> --ecdh-curves=<LIST>
Set supported curve list for frontend connections. Set supported curve list for frontend connections.
<LIST> is a colon separated list of curve NID or names <LIST> is a colon separated list of curve NID or names
@ -2134,7 +2136,8 @@ SSL/TLS:
NPN. The parameter must be delimited by a single comma NPN. The parameter must be delimited by a single comma
only and any white spaces are treated as a part of only and any white spaces are treated as a part of
protocol string. protocol string.
Default: )" << DEFAULT_NPN_LIST Default: )"
<< DEFAULT_NPN_LIST
<< R"( << R"(
--verify-client --verify-client
Require and verify client certificate. Require and verify client certificate.
@ -2539,7 +2542,8 @@ Logging:
Set path to write error log. To reopen file, send USR1 Set path to write error log. To reopen file, send USR1
signal to nghttpx. stderr will be redirected to the signal to nghttpx. stderr will be redirected to the
error log file unless --errorlog-syslog is used. error log file unless --errorlog-syslog is used.
Default: )" << config->logging.error.file << R"( Default: )"
<< config->logging.error.file << R"(
--errorlog-syslog --errorlog-syslog
Send error log to syslog. If this option is used, Send error log to syslog. If this option is used,
--errorlog-file option is ignored. --errorlog-file option is ignored.
@ -2671,8 +2675,8 @@ HTTP:
Specify the port number which appears in Location header Specify the port number which appears in Location header
field when redirect to HTTPS URI is made due to field when redirect to HTTPS URI is made due to
"redirect-if-not-tls" parameter in --backend option. "redirect-if-not-tls" parameter in --backend option.
Default: )" << config->http.redirect_https_port Default: )"
<< R"( << config->http.redirect_https_port << R"(
API: API:
--api-max-request-body=<SIZE> --api-max-request-body=<SIZE>
@ -2751,7 +2755,8 @@ Misc:
Load configuration from <PATH>. Please note that Load configuration from <PATH>. Please note that
nghttpx always tries to read the default configuration nghttpx always tries to read the default configuration
file if --conf is not given. file if --conf is not given.
Default: )" << config->conf_path << R"( Default: )"
<< config->conf_path << R"(
--include=<PATH> --include=<PATH>
Load additional configurations from <PATH>. File <PATH> Load additional configurations from <PATH>. File <PATH>
is read when configuration parser encountered this is read when configuration parser encountered this
@ -2769,7 +2774,8 @@ Misc:
The <DURATION> argument is an integer and an optional unit (e.g., 1s The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively). If a unit (hours, minutes, seconds and milliseconds, respectively). If a unit
is omitted, a second is used as unit.)" << std::endl; is omitted, a second is used as unit.)"
<< std::endl;
} }
} // namespace } // namespace