Skip to content

Commit

Permalink
Update Result class to include file extent count
Browse files Browse the repository at this point in the history
  • Loading branch information
janjurca committed May 5, 2024
1 parent 3917c10 commit 76d6bcc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
22 changes: 10 additions & 12 deletions include/filestorm/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class Result {
std::string _path;
DataSize<DataUnit::B> _size;
std::chrono::nanoseconds _duration;
int64_t _extents_count;
std::vector<extents> _extents;
int64_t _total_extents_count;
int64_t _file_extent_count;

public:
Result(int iteration, Action action, Operation operation, std::string path, DataSize<DataUnit::B> size, std::chrono::nanoseconds duration, int64_t extents_count)
: _iteration(iteration), _action(action), _operation(operation), _path(path), _size(size), _duration(duration), _extents_count(extents_count) {}
Result(int iteration, Action action, Operation operation, std::string path, DataSize<DataUnit::B> size, std::chrono::nanoseconds duration, int64_t extents_count, int64_t file_extent_count)
: _iteration(iteration), _action(action), _operation(operation), _path(path), _size(size), _duration(duration), _total_extents_count(extents_count), _file_extent_count(file_extent_count) {}
Result() = default;

int getIteration() const { return _iteration; }
Expand All @@ -36,7 +36,8 @@ class Result {
std::string getPath() const { return _path; }
DataSize<DataUnit::B> getSize() const { return _size; }
std::chrono::nanoseconds getDuration() const { return _duration; }
int64_t getExtentsCount() const { return _extents_count; }
int64_t getExtentsCount() const { return _total_extents_count; }
int64_t getFileExtentCount() const { return _file_extent_count; }

// setters
void setIteration(int iteration) { _iteration = iteration; }
Expand All @@ -45,12 +46,8 @@ class Result {
void setPath(std::string path) { _path = path; }
void setSize(DataSize<DataUnit::B> size) { _size = size; }
void setDuration(std::chrono::nanoseconds duration) { _duration = duration; }
void setExtentsCount(int64_t extents_count) { _extents_count = extents_count; }
void setExtents(std::vector<extents> extents) {
for (auto& extent : extents) {
_extents.push_back(extent);
}
}
void setExtentsCount(int64_t extents_count) { _total_extents_count = extents_count; }
void setFileExtentCount(int64_t file_extent_count) { _file_extent_count = file_extent_count; }

void commit() { results.push_back(*this); }

Expand Down Expand Up @@ -97,7 +94,8 @@ class Result {
jsonResult["path"] = result.getPath();
jsonResult["size"] = result.getSize().get_value();
jsonResult["duration"] = result.getDuration().count();
jsonResult["extents_count"] = result.getExtentsCount();
jsonResult["_total_extents_count"] = result.getExtentsCount();
jsonResult["_file_extent_count"] = result.getFileExtentCount();
jsonResults.push_back(jsonResult);
}
file << jsonResults.dump(2);
Expand Down
3 changes: 3 additions & 0 deletions source/scenarios/aging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ void AgingScenario::run() {
if (!file->isPunchable(get_block_size().convert<DataUnit::B>().get_value())) {
tree.removeFromPunchableFiles(file);
}
if (file->path(true) == result.getPath()) {
result.setFileExtentCount(updated_extents);
}
}
logger.debug("Total extents count: {}, File Count {}, F avail files {}, free space {} MB", tree.total_extents_count, tree.all_files.size(), tree.files_for_fallocate.size(),
fs_utils::get_fs_status(getParameter("directory").get_string()).available / 1024 / 1024);
Expand Down

0 comments on commit 76d6bcc

Please sign in to comment.