Skip to content

Refinement iteration printing #5237

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 3 commits into from
Feb 21, 2020

Conversation

thk123
Copy link
Contributor

@thk123 thk123 commented Feb 20, 2020

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

I'm not totally convinced by my approach for finding out whether XML is turned on. I'm not really clear on why you can't always just pipe some xml to the message handler, and let it figure out what to do with it. (Ideally, for example, if you send xml to json-ui, then it outputs equivalent json)
Went for something much simpler, might raise a seperate PR to make the handling of this stuff less ad-hoc.

@thk123 thk123 force-pushed the refinement-iteration-printing branch from 3faf008 to c20f285 Compare February 20, 2020 11:35
@@ -19,7 +19,8 @@ symex_bmc_incremental_one_loopt::symex_bmc_incremental_one_loopt(
symex_target_equationt &target,
const optionst &options,
path_storaget &path_storage,
guard_managert &guard_manager)
guard_managert &guard_manager,
ui_message_handlert::uit output_xml)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the name could be made more accurate.

@@ -10,6 +10,7 @@
#define CPROVER_GOTO_CHECKER_SYMEX_BMC_INCREMENTAL_ONE_LOOP_H

#include "symex_bmc.h"
#include <util/ui_message.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Guess you don't need this one anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed for ui_message_handlert::uit declaration

@thk123 thk123 force-pushed the refinement-iteration-printing branch from c20f285 to 89203e2 Compare February 20, 2020 11:45
@thk123
Copy link
Contributor Author

thk123 commented Feb 20, 2020

@xbauch comments addressed

xmlt xml("current-unwinding");
xml.data = std::to_string(unwind);
log.statistics() << xml;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also output a current-unwinding item for PLAIN and JSON_UI? So the same information is output independent of the ui.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@xbauch xbauch left a comment

Choose a reason for hiding this comment

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

Looks good.

@thk123 thk123 force-pushed the refinement-iteration-printing branch from eb4bef2 to 019afa7 Compare February 20, 2020 13:20
const std::string unwind_num = std::to_string(unwind);
switch(output_ui)
{
case ui_message_handlert::uit::PLAIN:
Copy link
Contributor

@chrisr-diffblue chrisr-diffblue Feb 20, 2020

Choose a reason for hiding this comment

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

I know there are a few other places in the codebase where this sort of switch happens, so I'm not going to block this PR on this issue :-) But it's really ugly in general... I'm wondering if we could come up with an API extension to message handlers. Perhaps some pseudo code like this:

/// Individual implementations inside message handlers
keyValueMessagePair(string[] words, string value) {
/// words == ["current","unwinding"]
/// output would be:
/// "Current unwinding: value" for PLAIN
/// xmlt xml("current-unwinding"); xml.data = value; for XML
/// json_objectt json; json["currentUnwinding"] = json_numbert(value); for JSON
}

// then as a client, we could just use:
log.statistics() << output_ui.keyValueMessagePair(["current","unwinding"],unwind) << messaget::eom;

Obviously suitable C++ plumbing needed :-) - but hopefully that explains the idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I started having a go at making just a general way of logging structured data, but didn't want to hold up this PR for t

Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

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

It's a shame we have to do all the message handler faff, but thats an API gap, rather than anything specific to this PR, so ignoring that, I'm happy for this to go in.

@thk123 thk123 merged commit a3c58a4 into diffblue:develop Feb 21, 2020
@thk123 thk123 deleted the refinement-iteration-printing branch February 21, 2020 10:43
@thk123 thk123 mentioned this pull request Feb 21, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants