Skip to content

Adding bzip2 compression to the ChampSim tracer#663

Open
joshualmashburn wants to merge 1 commit intoChampSim:developfrom
joshualmashburn:feature/tracer-bzip2-compression
Open

Adding bzip2 compression to the ChampSim tracer#663
joshualmashburn wants to merge 1 commit intoChampSim:developfrom
joshualmashburn:feature/tracer-bzip2-compression

Conversation

@joshualmashburn
Copy link
Contributor

I'm opening a PR for visibility and feedback.

Someone asked why we use pipes to compress the tracer output and I remembered I had this mod lying around. Bzip2 is not the most performant algorithm, but it cuts down on IPC overhead and it's a happy medium compression-wise between gz and lzma.

I did have to replace the C++ file I/O API usage with C stdio for compatibility with libbzip2.
Originally I added libbzip2 as a submodule, but I rewrote the README instructions to use the vcpkg package source cache.

I envision further mods in this vein, like "-g" for gzip, "-x" for xz/lzma.

Copy link
Collaborator

@ngober ngober left a comment

Choose a reason for hiding this comment

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

I could be fussy about C++ style here, but PIN is weird, and it's probably not worth it. I wanted to add this in such a long time ago, but never did. Thanks for the patch.

fwrite(buf, 1, sizeof(trace_instr_format_t), outfile);
}

void WriteCurrentInstruction_bz2()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it going to be more efficient to buffer multiple instructions before performing a bz write? When we're just dumping to file it might be fine, but maybe it's different with the compression library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You know, it probably would. When I get some free time (like Thanksgiving-ish, after DAC submissions), I can time some runs of varying buffer sizes.

@joshualmashburn
Copy link
Contributor Author

I'm definitely willing to touch it up if you have feedback on the coding style. And I know the build instructions, at least the monolith of a build command for bzip, could possibly be moved to the makefile.

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.

2 participants