From 3e787ee1f2292ed333af816616e47008f55ad43f Mon Sep 17 00:00:00 2001 From: Maxim Fedorov Date: Sat, 13 Apr 2024 12:49:53 -0700 Subject: [PATCH] Updated argparse to 2.0.0 --- CHANGELOG.md | 4 ++++ README.md | 8 ++++---- rebar.lock | 6 +++--- src/erlperf.app.src | 2 +- src/erlperf_cli.erl | 6 +++--- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c1bfac..43a91cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.2.1 +- tested with OTP 26 and 27 +- updated to argparse 2.0.0 + ## 2.2.0 - added extended and full reporting capabilities - implemented additional statistics (standard deviation, median, p99) diff --git a/README.md b/README.md index 94fe29c..0e339a7 100644 --- a/README.md +++ b/README.md @@ -311,16 +311,16 @@ on disk. Use `-pa` argument to add an extra code path. Example: ```bash - $ ./erlperf 'argparse:parse([], #{}).' -pa _build/test/lib/argparse/ebin + $ ./erlperf 'args:parse([], #{}).' -pa _build/test/lib/argparse/ebin Code || QPS Time - argparse:parse([], #{}). 1 955 Ki 1047 ns + args:parse([], #{}). 1 955 Ki 1047 ns ``` If you need to add multiple released applications, supply `ERL_LIBS` environment variable instead: ```bash - $ ERL_LIBS="_build/test/lib" erlperf 'argparse:parse([], #{}).' + $ ERL_LIBS="_build/test/lib" erlperf 'args:parse([], #{}).' Code || QPS Time - argparse:parse([], #{}). 1 735 Ki 1361 ns + args:parse([], #{}). 1 735 Ki 1361 ns ``` ### Usage in production diff --git a/rebar.lock b/rebar.lock index 3e81148..9c3263f 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,8 +1,8 @@ {"1.2.0", -[{<<"argparse">>,{pkg,<<"argparse">>,<<"1.2.4">>},0}]}. +[{<<"argparse">>,{pkg,<<"argparse">>,<<"2.0.0">>},0}]}. [ {pkg_hash,[ - {<<"argparse">>, <<"A31E7C5D9F8814AFCD9B42C1B98C21DA6F851F93F2C8C00C107F6201668A0A7D">>}]}, + {<<"argparse">>, <<"3EDF299FB5BC089E6AF2F1A7C6532104B4CD6136E0147C6CF9622E6E4A741434">>}]}, {pkg_hash_ext,[ - {<<"argparse">>, <<"AC6FDB7183EA20ADEB7EB66E34B21F2E8C4C6925913EE0C0765D339D97009FFE">>}]} + {<<"argparse">>, <<"525979122BEA3641A1DD3ABC53F2ADD19F7F427D507018F8C7CAF0693A6E78C8">>}]} ]. diff --git a/src/erlperf.app.src b/src/erlperf.app.src index 091b56e..e59d81b 100644 --- a/src/erlperf.app.src +++ b/src/erlperf.app.src @@ -1,6 +1,6 @@ {application, erlperf, [{description, "Erlang Performance & Benchmarking Suite"}, - {vsn, "2.2.0"}, + {vsn, "2.2.1"}, {registered, [ erlperf_sup, erlperf_job_sup, erlperf_monitor, erlperf_history, erlperf_file_log, erlperf_cluster_monitor diff --git a/src/erlperf_cli.erl b/src/erlperf_cli.erl index fdd3fb6..9006635 100644 --- a/src/erlperf_cli.erl +++ b/src/erlperf_cli.erl @@ -102,7 +102,7 @@ format(Reports, Options) -> main(Args) -> Prog = #{progname => "erlperf"}, try - ParsedOpts = argparse:parse(Args, arguments(), Prog), + ParsedOpts = args:parse(Args, arguments(), Prog), Verbose = maps:get(verbose, ParsedOpts, false), @@ -149,8 +149,8 @@ main(Args) -> Formatted = format(Results, FormatOpts#{viewport_width => viewport_width()}), io:format(Formatted) catch - error:{argparse, Reason} -> - Fmt = argparse:format_error(Reason, arguments(), Prog), + error:{args, Reason} -> + Fmt = args:format_error(Reason, arguments(), Prog), format(info, "Error: ~s", [Fmt]); throw:{parse, FunName, Other} -> format(error, "Unable to read file named '~s' (expected to contain call chain recording)~nReason: ~p\n"