Skip to content

Emit timestamps on each line of output #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/cbmc/all_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Author: Daniel Kroening, [email protected]

#include "all_properties_class.h"

#include <util/time_stopping.h>
#include <chrono>

#include <util/xml.h>
#include <util/json.h>

Expand Down Expand Up @@ -56,8 +57,8 @@ safety_checkert::resultt bmc_all_propertiest::operator()()

solver.set_message_handler(get_message_handler());

// stop the time
absolute_timet sat_start=current_time();
auto now = std::chrono::steady_clock::now();
auto sat_start = std::chrono::time_point_cast<std::chrono::seconds>(now);

bmc.do_conversion();

Expand Down Expand Up @@ -131,12 +132,12 @@ safety_checkert::resultt bmc_all_propertiest::operator()()
g.second.status=goalt::statust::SUCCESS;
}

// output runtime

{
absolute_timet sat_stop=current_time();
status() << "Runtime decision procedure: "
<< (sat_stop-sat_start) << "s" << eom;
now = std::chrono::steady_clock::now();
auto sat_stop = std::chrono::time_point_cast<std::chrono::seconds>(now);

status() << "Runtime decision procedure: " << (sat_stop - sat_start).count()
<< "s" << eom;
}

// report
Expand Down
14 changes: 7 additions & 7 deletions src/cbmc/bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Author: Daniel Kroening, [email protected]

#include "bmc.h"

#include <chrono>
#include <fstream>
#include <iostream>
#include <memory>

#include <util/string2int.h>
#include <util/source_location.h>
#include <util/string_utils.h>
#include <util/time_stopping.h>
#include <util/message.h>
#include <util/json.h>
#include <util/cprover_prefix.h>
Expand Down Expand Up @@ -154,20 +154,20 @@ bmct::run_decision_procedure(prop_convt &prop_conv)

prop_conv.set_message_handler(get_message_handler());

// stop the time
absolute_timet sat_start=current_time();
auto now = std::chrono::steady_clock::now();
auto sat_start = std::chrono::time_point_cast<std::chrono::seconds>(now);

do_conversion();

status() << "Running " << prop_conv.decision_procedure_text() << eom;

decision_proceduret::resultt dec_result=prop_conv.dec_solve();
// output runtime

{
absolute_timet sat_stop=current_time();
status() << "Runtime decision procedure: "
<< (sat_stop-sat_start) << "s" << eom;
now = std::chrono::steady_clock::now();
auto sat_stop = std::chrono::time_point_cast<std::chrono::seconds>(now);
status() << "Runtime decision procedure: " << (sat_stop - sat_start).count()
<< "s" << eom;
}

return dec_result;
Expand Down
16 changes: 8 additions & 8 deletions src/cbmc/bmc_cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Author: Daniel Kroening, [email protected]

#include "bmc.h"

#include <util/time_stopping.h>
#include <chrono>

#include <util/xml.h>
#include <util/xml_expr.h>
#include <util/json.h>
Expand Down Expand Up @@ -191,8 +192,8 @@ bool bmc_covert::operator()()

solver.set_message_handler(get_message_handler());

// stop the time
absolute_timet sat_start=current_time();
auto now = std::chrono::steady_clock::now();
auto sat_start = std::chrono::time_point_cast<std::chrono::seconds>(now);

// Collect _all_ goals in `goal_map'.
// This maps property IDs to 'goalt'
Expand Down Expand Up @@ -251,12 +252,11 @@ bool bmc_covert::operator()()

cover_goals();

// output runtime

{
absolute_timet sat_stop=current_time();
status() << "Runtime decision procedure: "
<< (sat_stop-sat_start) << "s" << eom;
now = std::chrono::steady_clock::now();
auto sat_stop = std::chrono::time_point_cast<std::chrono::seconds>(now);
status() << "Runtime decision procedure: " << (sat_stop - sat_start).count()
<< "s" << eom;
}

// report
Expand Down
1 change: 1 addition & 0 deletions src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ void cbmc_parse_optionst::help()
" --json-ui use JSON-formatted output\n"
HELP_GOTO_TRACE
" --verbosity # verbosity level\n"
HELP_TIMESTAMP
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to goto-analyzer, goto-diff as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that would be lovely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done

"\n";
// clang-format on
}
2 changes: 2 additions & 0 deletions src/cbmc/cbmc_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]

#include <util/ui_message.h>
#include <util/parse_options.h>
#include <util/timestamper.h>

#include <langapi/language.h>

Expand Down Expand Up @@ -62,6 +63,7 @@ class optionst;
"(version)" \
"(cover):(symex-coverage-report):" \
"(mm):" \
OPT_TIMESTAMP \
"(i386-linux)(i386-macos)(i386-win32)(win32)(winx64)(gcc)" \
"(ppc-macos)(unsigned-char)" \
"(arrays-uf-always)(arrays-uf-never)" \
Expand Down
14 changes: 8 additions & 6 deletions src/cbmc/fault_localization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ Author: Peter Schrammel

#include "fault_localization.h"

#include <chrono>

#include <util/threeval.h>
#include <util/arith_tools.h>
#include <util/symbol.h>
#include <util/std_expr.h>
#include <util/message.h>
#include <util/time_stopping.h>
#include <util/xml_expr.h>

#include <solvers/prop/minimize.h>
Expand Down Expand Up @@ -245,8 +246,8 @@ fault_localizationt::run_decision_procedure(prop_convt &prop_conv)

prop_conv.set_message_handler(bmc.get_message_handler());

// stop the time
absolute_timet sat_start=current_time();
auto now = std::chrono::steady_clock::now();
auto sat_start = std::chrono::time_point_cast<std::chrono::seconds>(now);

bmc.do_conversion();

Expand All @@ -259,9 +260,10 @@ fault_localizationt::run_decision_procedure(prop_convt &prop_conv)
// output runtime

{
absolute_timet sat_stop=current_time();
status() << "Runtime decision procedure: "
<< (sat_stop-sat_start) << "s" << eom;
now = std::chrono::steady_clock::now();
auto sat_stop = std::chrono::time_point_cast<std::chrono::seconds>(now);
status() << "Runtime decision procedure: " << (sat_stop - sat_start).count()
<< "s" << eom;
}

return dec_result;
Expand Down
8 changes: 6 additions & 2 deletions src/cbmc/symex_coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Date: March 2016

#include "symex_coverage.h"

#include <chrono>
#include <iostream>
#include <fstream>
#include <sstream>

#include <util/time_stopping.h>
#include <util/xml.h>
#include <util/string2int.h>
#include <util/cprover_prefix.h>
Expand Down Expand Up @@ -387,6 +387,10 @@ void symex_coveraget::build_cobertura(
std::string overall_branch_rate_str=
rate(overall_cov.branches_covered, overall_cov.branches_total);

auto now = std::chrono::system_clock::now();
auto current_time = std::chrono::time_point_cast<std::chrono::seconds>(now);
std::time_t tt = std::chrono::system_clock::to_time_t(current_time);

// <coverage line-rate="0.0" branch-rate="0.0" lines-covered="1"
// lines-valid="1" branches-covered="1"
// branches-valid="1" complexity="0.0"
Expand All @@ -404,7 +408,7 @@ void symex_coveraget::build_cobertura(
xml_coverage.set_attribute("complexity", "0.0");
xml_coverage.set_attribute("version", "2.1.1");
xml_coverage.set_attribute("timestamp",
std::to_string(current_time().get_t()));
std::to_string(tt));

xmlt &packages=xml_coverage.new_element("packages");

Expand Down
1 change: 1 addition & 0 deletions src/goto-analyzer/goto_analyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,5 +906,6 @@ void goto_analyzer_parse_optionst::help()
"\n"
"Other options:\n"
" --version show version and exit\n"
HELP_TIMESTAMP
"\n";
}
2 changes: 2 additions & 0 deletions src/goto-analyzer/goto_analyzer_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Author: Daniel Kroening, [email protected]

#include <util/ui_message.h>
#include <util/parse_options.h>
#include <util/timestamper.h>

#include <langapi/language.h>

Expand Down Expand Up @@ -135,6 +136,7 @@ class optionst;
"(show-local-may-alias)" \
"(json):(xml):" \
"(text):(dot):" \
OPT_TIMESTAMP \
"(unreachable-instructions)(unreachable-functions)" \
"(reachable-functions)" \
"(intervals)(show-intervals)" \
Expand Down
1 change: 1 addition & 0 deletions src/goto-diff/goto_diff_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,5 +501,6 @@ void goto_diff_parse_optionst::help()
"Other options:\n"
" --version show version and exit\n"
" --json-ui use JSON-formatted output\n"
HELP_TIMESTAMP
"\n";
}
2 changes: 2 additions & 0 deletions src/goto-diff/goto_diff_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Author: Peter Schrammel

#include <util/ui_message.h>
#include <util/parse_options.h>
#include <util/timestamper.h>

#include <goto-programs/goto_model.h>
#include <goto-programs/show_goto_functions.h>
Expand All @@ -27,6 +28,7 @@ class optionst;
"(json-ui)" \
OPT_SHOW_GOTO_FUNCTIONS \
"(verbosity):(version)" \
OPT_TIMESTAMP \
"u(unified)(change-impact)(forward-impact)(backward-impact)" \
"(compact-output)"

Expand Down
1 change: 1 addition & 0 deletions src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,5 +1568,6 @@ void goto_instrument_parse_optionst::help()
" --version show version and exit\n"
" --xml-ui use XML-formatted output\n"
" --json-ui use JSON-formatted output\n"
HELP_TIMESTAMP
"\n";
}
2 changes: 2 additions & 0 deletions src/goto-instrument/goto_instrument_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]

#include <util/ui_message.h>
#include <util/parse_options.h>
#include <util/timestamper.h>

#include <goto-programs/goto_functions.h>
#include <goto-programs/show_goto_functions.h>
Expand Down Expand Up @@ -66,6 +67,7 @@ Author: Daniel Kroening, [email protected]
"(show-claims)(show-properties)(property):" \
"(show-symbol-table)(show-points-to)(show-rw-set)" \
"(cav11)" \
OPT_TIMESTAMP \
"(show-natural-loops)(accelerate)(havoc-loops)" \
"(error-label):(string-abstraction)" \
"(verbosity):(version)(xml-ui)(json-ui)(show-loops)" \
Expand Down
1 change: 1 addition & 0 deletions src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,5 +956,6 @@ void jbmc_parse_optionst::help()
" --json-ui use JSON-formatted output\n"
HELP_GOTO_TRACE
" --verbosity # verbosity level\n"
HELP_TIMESTAMP
"\n";
}
2 changes: 2 additions & 0 deletions src/jbmc/jbmc_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]

#include <util/ui_message.h>
#include <util/parse_options.h>
#include <util/timestamper.h>

#include <langapi/language.h>

Expand Down Expand Up @@ -60,6 +61,7 @@ class optionst;
"(verbosity):" \
"(version)" \
"(cover):(symex-coverage-report):" \
OPT_TIMESTAMP \
"(i386-linux)(i386-macos)(i386-win32)(win32)(winx64)" \
"(ppc-macos)" \
"(arrays-uf-always)(arrays-uf-never)" \
Expand Down
3 changes: 1 addition & 2 deletions src/util/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ SRC = arith_tools.cpp \
tempdir.cpp \
tempfile.cpp \
threeval.cpp \
time_stopping.cpp \
timer.cpp \
timestamper.cpp \
type.cpp \
type_eq.cpp \
typecheck.cpp \
Expand Down
69 changes: 0 additions & 69 deletions src/util/time_stopping.cpp

This file was deleted.

Loading