From e343acc2548fba7670977029da8373a0e58fa25a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Aug 2024 10:40:14 -0700 Subject: Added loads and loads of debugging output to myriad. There's an issue somewhere sometimes and streams are being truncated. My guess is a multi-threaded issue. --- src/tools/myriad.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/tools/myriad.cpp') diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp index 0130b49..ccf3d3b 100644 --- a/src/tools/myriad.cpp +++ b/src/tools/myriad.cpp @@ -23,6 +23,7 @@ enum Mode modeStreamDump, modeStreamPut, modeStreamGet, + modeBlockMap, modeNone }; @@ -49,6 +50,8 @@ public: "Get a file out of a Myriad stream (use --dst)."); addOption( eMode, "put", "Put a file into a Myriad stream (usr --src)."); + addOption( eMode, 'm', "block-map", + "Visualize block usage."); addHelpOption(); addHelpBanner("\nGeneral options:"); @@ -67,6 +70,7 @@ public: setOverride( "dump", modeStreamDump ); setOverride( "put", modeStreamPut ); setOverride( "get", modeStreamGet ); + setOverride( "block-map", modeBlockMap ); parse( argc, argv ); } @@ -242,6 +246,29 @@ int main( int argc, char *argv[] ) } break; + case modeBlockMap: + if( !opts.sFile.isSet() ) + { + sio << "Please specify a file manipulate." << sio.nl; + return 0; + } + { + File fIn( opts.sFile, File::Write|File::Read ); + Myriad m( fIn ); + Bu::BitString bs = m.getBlocksUsed(); + for( int j = 0; j < bs.getSize(); j++ ) + { + if( j>0 && (j%50) == 0 ) + Bu::println(""); + if( bs.getBit( j ) ) + Bu::print("#"); + else + Bu::print("-"); + } + Bu::println("\n"); + } + break; + case modeNone: sio << "Please select a mode, for more info, try --help." << sio.nl << sio.nl; -- cgit v1.2.3