-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rbd-replay: Convert prep-for-replay.py to rbd-replay-prep.cc
Signed-off-by: Adam Crume <[email protected]>
- Loading branch information
Showing
10 changed files
with
1,189 additions
and
539 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
../../src/rbd-replay-prep traces/ust/uid/10002/64-bit replay.bin |
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 | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ Makefile | |
/rbd | ||
/rbd-fuse | ||
/rbd-replay | ||
/rbd-replay-prep | ||
/rest-bench | ||
/sample.fetch_config | ||
/TAGS | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2014 Adam Crume <[email protected]> | ||
* | ||
* This is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License version 2.1, as published by the Free Software | ||
* Foundation. See file COPYING. | ||
* | ||
*/ | ||
|
||
#include "Ser.hpp" | ||
#include <arpa/inet.h> | ||
#include <cstdlib> | ||
#include <endian.h> | ||
|
||
|
||
rbd_replay::Ser::Ser(std::ostream &out) | ||
: m_out(out) { | ||
} | ||
|
||
void rbd_replay::Ser::write_uint8_t(uint8_t data) { | ||
m_out.write(reinterpret_cast<char*>(&data), sizeof(data)); | ||
} | ||
|
||
void rbd_replay::Ser::write_uint16_t(uint16_t data) { | ||
data = htons(data); | ||
m_out.write(reinterpret_cast<char*>(&data), sizeof(data)); | ||
} | ||
|
||
void rbd_replay::Ser::write_uint32_t(uint32_t data) { | ||
data = htonl(data); | ||
m_out.write(reinterpret_cast<char*>(&data), sizeof(data)); | ||
} | ||
|
||
void rbd_replay::Ser::write_uint64_t(uint64_t data) { | ||
#if __BYTE_ORDER == __LITTLE_ENDIAN | ||
data = (static_cast<uint64_t>(htonl(data)) << 32 | htonl(data >> 32)); | ||
#endif | ||
m_out.write(reinterpret_cast<char*>(&data), sizeof(data)); | ||
} | ||
|
||
void rbd_replay::Ser::write_string(const std::string& data) { | ||
write_uint32_t(data.length()); | ||
m_out.write(data.data(), data.length()); | ||
} | ||
|
||
void rbd_replay::Ser::write_bool(bool data) { | ||
write_uint8_t(data ? 1 : 0); | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2014 Adam Crume <[email protected]> | ||
* | ||
* This is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License version 2.1, as published by the Free Software | ||
* Foundation. See file COPYING. | ||
* | ||
*/ | ||
|
||
#ifndef _INCLUDED_RBD_REPLAY_SER_HPP | ||
#define _INCLUDED_RBD_REPLAY_SER_HPP | ||
|
||
#include <iostream> | ||
#include <stdint.h> | ||
|
||
namespace rbd_replay { | ||
|
||
class Ser { | ||
public: | ||
Ser(std::ostream &out); | ||
|
||
void write_uint8_t(uint8_t); | ||
|
||
void write_uint16_t(uint16_t); | ||
|
||
void write_uint32_t(uint32_t); | ||
|
||
void write_uint64_t(uint64_t); | ||
|
||
void write_string(const std::string&); | ||
|
||
void write_bool(bool b); | ||
|
||
private: | ||
std::ostream &m_out; | ||
}; | ||
|
||
} | ||
|
||
#endif |
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.