Skip to content

Commit

Permalink
GH-1085 Exclude cpu_usage_us and net_usage_words reporting for read o…
Browse files Browse the repository at this point in the history
…nly trxs. Add elapsed for read-only trxs. Also remove warning of not confirmed for read-only and dry-run trxs.
  • Loading branch information
heifner committed Jan 24, 2025
1 parent 100a720 commit a0f33bb
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions programs/cleos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,20 +679,33 @@ void print_result( const fc::variant& result ) { try {
}

cerr << status << " transaction: " << transaction_id << " ";
if( net < 0 ) {
cerr << "<unknown>";
} else {
cerr << net;
}
cerr << " bytes ";
if( cpu < 0 ) {
cerr << "<unknown>";
if (!tx_read) {
if( net < 0 ) {
cerr << "<unknown>";
} else {
cerr << net;
}
cerr << " bytes ";
if( cpu < 0 ) {
cerr << "<unknown>";
} else {
cerr << cpu;
}
cerr << " us\n";
} else {
cerr << cpu;
int64_t elapsed = -1;
if (processed.get_object().contains( "elapsed" )) {
elapsed = processed["elapsed"].as_int64();
}
cerr << " elapsed ";
if (elapsed < 0) {
cerr << "<unknown>";
} else {
cerr << elapsed;
}
cerr << " us\n";
}

cerr << " us\n";

if( status == "failed" ) {
auto soft_except = processed["except"].as<std::optional<fc::exception>>();
if( soft_except ) {
Expand All @@ -703,7 +716,8 @@ void print_result( const fc::variant& result ) { try {
for( const auto& a : actions ) {
print_action_tree( a );
}
wlog( "\rwarning: transaction executed locally, but may not be confirmed by the network yet" );
if (!tx_read && !tx_dry_run)
wlog( "\rwarning: transaction executed locally, but may not be confirmed by the network yet" );
}
} else {
cerr << fc::json::to_pretty_string( result ) << endl;
Expand Down

0 comments on commit a0f33bb

Please sign in to comment.