-
Notifications
You must be signed in to change notification settings - Fork 9
JSON Reporting #80
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
JSON Reporting #80
Conversation
| assert(globals._odrv_count == violations.size()); | ||
|
|
||
| if (json_mode && globals._fp.is_open()) { | ||
| globals._fp << orc::to_json(violations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the JSON object is serialized to the file.
| std::forward<F>(f)(s); | ||
| if (globals::instance()._fp.is_open()) { | ||
| std::forward<F>(f)(globals::instance()._fp); | ||
| if (settings::instance()._output_file_mode == settings::output_file_mode::json) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This circumvents writing anything to the file if we're in json output mode.
leethomason
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This PR adds a new flag to ORC's config file,
output_file_mode. Fixes #79.The flag determines what format should be used for content written to external report files defined by either
output_fileorrelative_output_file. The options aretextorjson.textwill mirror all output sent tostdoutandstderrto the file.jsonwill limit output file contents to the ODRV report. This mode enumerates all object files with conflicting symbols, so can be quite verbose. It is intended for programmatic consumption. The default value istext.This PR also removes the
resource_metricscapability of the tool. It's been decided Tracy is a better solution to meet such a need. Therefore the flag and the code associated with supporting it have been pulled out.An example snippet of the JSON output looks something like:
{ "synopsis": { "dies_processed": 163925, "dies_skipped": 122239, "dies_skipped_pct": 74.57007777947231, "object_files_scanned": 92, "unique_symbols": 3435, "violations": 11 }, "violations": { "example_struct": { "attributes": [ "structure:byte_size", "structure:calling_convention" ], "definitions": [ { "attributes": { "byte_size": 624 }, "count": 33, "locations": { "/path/to/library/header.h:430": { "/path/to/library.a": [ "foo.o", "bar.o", "baz.o", ...