Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

#include "config.h"

#include <climits>
#include <cstdint>
#include <filesystem>
#include <string>

#include "config_reader.h"

using namespace std;

namespace config {

std::string log_file = "";
Expand Down
7 changes: 3 additions & 4 deletions config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

#pragma once

#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

#include <stdint.h>

#include <cstdint>
#include <string>

#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

namespace config {
enum ConfigOption {
USE_QAT_COMPRESS,
Expand Down
2 changes: 2 additions & 0 deletions config/config_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "config_reader.h"

#include <algorithm>
#include <cstdint>
#include <exception>
#include <fstream>
#include <regex>
#include <sstream>
Expand Down
5 changes: 2 additions & 3 deletions config/config_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

#pragma once

#include <stdint.h>

#include <iostream>
#include <cstdint>
#include <map>
#include <string>

// The responsibility of this class is to parse the
// Config file and store it in the std::map
Expand Down
13 changes: 8 additions & 5 deletions iaa.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
// Copyright (C) 2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#ifdef USE_IAA

#include "iaa.h"

#include <cstdint>
#include <memory>
#include <new>
#include <thread>
#include <utility>

#include "config/config.h"
#include "logging.h"
#include "utils.h"

using namespace config;

#ifdef USE_IAA

#include "utils.h"

void IAAJob::InitJob(qpl_path_t execution_path) {
uint32_t size;
qpl_status status = qpl_get_job_size(execution_path, &size);
Expand Down
4 changes: 3 additions & 1 deletion iaa.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
#pragma once

#ifdef USE_IAA
#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

#include <cstdint>
#include <memory>
#include <vector>

#include "qpl/qpl.h"

#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

inline constexpr unsigned int PREPENDED_BLOCK_LENGTH = 5;
inline constexpr unsigned int MAX_BUFFER_SIZE = (2 << 20);

Expand Down
1 change: 1 addition & 0 deletions logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <fstream>
#include <iostream>
#include <memory>
Expand Down
10 changes: 7 additions & 3 deletions qat.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// Copyright (C) 2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#ifdef USE_QAT

#include "qat.h"

#include <cstdint>
#include <cstring>
#include <new>
#include <utility>

#include "config/config.h"
#include "logging.h"
#include "utils.h"

using namespace config;

#ifdef USE_QAT

void QATJob::QzSessionDeleter::operator()(QzSession_T *qzSession) const {
if (!qzSession) {
return;
Expand Down
4 changes: 3 additions & 1 deletion qat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
#pragma once

#ifdef USE_QAT
#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

#include <qatzip.h>

#include <cstdint>
#include <memory>

#include "utils.h"

#define VISIBLE_FOR_TESTING __attribute__((visibility("default")))

inline constexpr unsigned int QAT_HW_BUFF_SZ = QZ_HW_BUFF_MAX_SZ;

class QATJob {
Expand Down
12 changes: 5 additions & 7 deletions sharded_map.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2025 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#ifndef SHARDED_MAP_H
#define SHARDED_MAP_H
#pragma once

#include <memory>
#include <mutex>
#include <functional>
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <utility>

static const int SHARDS = 64;
static constexpr int SHARDS = 64;

template <typename Key, typename Value>
class ShardedMap {
Expand Down Expand Up @@ -45,5 +45,3 @@ class ShardedMap {
std::shared_mutex shard_mutexes[SHARDS];
std::hash<std::string> hash;
};

#endif // SHARDED_MAP_H
10 changes: 6 additions & 4 deletions statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
// SPDX-License-Identifier: Apache-2.0

#include "statistics.h"

#ifdef ENABLE_STATISTICS
#include <algorithm>

#include <array>
#include <sstream>
#include <cstddef>
#include <cstdint>
#include <thread>

#include "config/config.h"
#include "logging.h"

using namespace config;

const std::array<const char*, STATS_COUNT> stat_names{
Expand All @@ -27,8 +30,7 @@ void PrintStats() {
if (total_operations % configs[LOG_STATS_SAMPLES] != 0) {
return;
}
LogStats("Thread: ",
(std::ostringstream() << std::this_thread::get_id()).str(), "\n");
LogStats("Thread: ", std::this_thread::get_id(), "\n");
for (size_t i = 0; i < stats.size(); ++i) {
LogStats(stat_names[i], " = ", stats[i], "\n");
}
Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#include "test_utils.h"

#include <cstring>
#include <iostream>
#include <string>

#ifdef DEBUG_LOG
void Log(std::string message) { std::cout << message << std::endl; }
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include <cstring>
#include <cstddef>
#include <string>

#include "../zlib_accel.h"
Expand Down
2 changes: 2 additions & 0 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "utils.h"

#include <cstdint>

CompressedFormat GetCompressedFormat(int window_bits) {
if (window_bits >= -15 && window_bits <= -8) {
return CompressedFormat::DEFLATE_RAW;
Expand Down
5 changes: 3 additions & 2 deletions utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

#include <cstdint>

#define GZIP_EXT_XHDR_SIZE 14
#define GZIP_EXT_HDRFTR_SIZE 32 // size of header + footer for gzip ext format
inline constexpr uint32_t GZIP_EXT_XHDR_SIZE = 14;
inline constexpr uint32_t GZIP_EXT_HDRFTR_SIZE =
32; // size of header + footer for gzip ext format

enum class CompressedFormat { DEFLATE_RAW, ZLIB, GZIP, INVALID };

Expand Down
11 changes: 5 additions & 6 deletions zlib_accel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
#include <sys/param.h>
#include <unistd.h>

#include <cstdint>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <mutex>
#include <shared_mutex>
#include <unordered_map>
#include <memory>
#include <string>
#include <utility>

#include "config/config.h"
#include "logging.h"
Expand All @@ -28,6 +26,7 @@
#include "statistics.h"

using namespace config;

// Disable cfi-icall as it makes calls to orig* functions fail
#if defined(__clang__)
#pragma clang attribute push(__attribute__((no_sanitize("cfi-icall"))), \
Expand Down