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
1 change: 1 addition & 0 deletions glinx-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(glinx-core VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Compiler flags for performance
if(MSVC)
Expand Down
8 changes: 5 additions & 3 deletions glinx-core/benchmarks/throughput_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ void producer(SensorBuffer* buffer, size_t messages_per_sec) {
std::strncpy(msg.protocol, "i2c", sizeof(msg.protocol) - 1);
msg.payload_size = 12; // 3 x 4-byte floats

auto interval = duration<double>(1.0 / messages_per_sec);
auto interval = duration_cast<high_resolution_clock::duration>(
duration<double>(1.0 / messages_per_sec)
);
auto next_send = high_resolution_clock::now();

while (running.load()) {
Expand Down Expand Up @@ -95,10 +97,10 @@ int main(int argc, char* argv[]) {
std::cout << "Buffer efficiency: " << ((total_consumed / static_cast<double>(total_produced)) * 100.0) << "%\n";

std::cout << "\n=== Performance Targets ===\n";
std::cout << "Target: 10,000 msgs/sec sustained\n";
std::cout << "Target: " << target_rate << " msgs/sec sustained\n";
std::cout << "Actual: " << actual_rate << " msgs/sec ";

if (actual_rate >= 10000 && loss_rate < 1.0) {
if (actual_rate >= (target_rate * 0.95) && loss_rate < 1.0) {
std::cout << "✓ PASS\n";
return 0;
} else {
Expand Down
18 changes: 16 additions & 2 deletions glinx-core/bindings/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ NB_MODULE(_glinx_core, m) {
// SensorMessage
nb::class_<SensorMessage>(m, "SensorMessage")
.def(nb::init<>())
.def_rw("source_id", &SensorMessage::source_id)
.def_rw("protocol", &SensorMessage::protocol)
.def_prop_rw("source_id",
[](const SensorMessage& self) {
return std::string(self.source_id);
},
[](SensorMessage& self, const std::string& value) {
std::memset(self.source_id, 0, sizeof(self.source_id));
std::strncpy(self.source_id, value.c_str(), sizeof(self.source_id) - 1);
})
.def_prop_rw("protocol",
[](const SensorMessage& self) {
return std::string(self.protocol);
},
[](SensorMessage& self, const std::string& value) {
std::memset(self.protocol, 0, sizeof(self.protocol));
std::strncpy(self.protocol, value.c_str(), sizeof(self.protocol) - 1);
})
.def_rw("timestamp", &SensorMessage::timestamp)
.def_rw("payload_size", &SensorMessage::payload_size)
.def_prop_rw("payload",
Expand Down
1 change: 1 addition & 0 deletions glinx-core/include/glinx/ipc.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include "buffer.hpp"
#include "driver.hpp"
#include <memory>
#include <string>

Expand Down