Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae33a13
commit de2c95e
Showing
11 changed files
with
118 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
chronicle-queue/src/main/java/net/openhft/chronicle/queue/QueueDumpMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,36 @@ | |||
package net.openhft.chronicle.queue; | |||
|
|||
import net.openhft.chronicle.bytes.Bytes; | |||
import net.openhft.chronicle.bytes.BytesUtil; | |||
import net.openhft.chronicle.bytes.MappedFile; | |||
import net.openhft.chronicle.wire.Wires; | |||
|
|||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.PrintWriter; | |||
|
|||
public class QueueDumpMain { | |||
static final String[] SBP_TYPES = "data,meta-data,not-ready-data,not-ready-meta-data".split(","); | |||
|
|||
public static void dump(File filename, PrintWriter pw) throws FileNotFoundException { | |||
MappedFile mappedFile = MappedFile.mappedFile(filename, 64 << 20, 16 << 20); | |||
Bytes bytes = mappedFile.bytes(); | |||
pw.print("# Magic: "); | |||
for (int i = 0; i < 8; i++) | |||
pw.print((char) bytes.readUnsignedByte()); | |||
pw.println(); | |||
while (true) { | |||
long spb = bytes.readUnsignedInt(); | |||
if (!Wires.isKnownLength(spb)) | |||
break; | |||
pw.print("--- !"); | |||
pw.print(SBP_TYPES[((int) (spb >>> 30))]); | |||
pw.println(); | |||
long start = bytes.position(); | |||
BytesUtil.toString(bytes, pw, start, start, start + Wires.lengthOf(spb)); | |||
pw.println(); | |||
bytes.skip(Wires.lengthOf(spb)); | |||
} | |||
pw.flush(); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eue/src/main/java/net/openhft/chronicle/queue/impl/ringbuffer/ZippedDocumentAppender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.