Files
egutierrez 477bcd00f0 chore: auto-commit (13 archivos)
- CMakeLists.txt
- agent_protocol.cpp
- agent_protocol.h
- app.md
- appicon.ico
- hosts_db.cpp
- hosts_db.h
- http_client.cpp
- http_client.h
- main.cpp
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 00:31:32 +02:00

40 lines
801 B
C++

#pragma once
#include <string>
#include <vector>
#include <cstdint>
struct sqlite3;
namespace pex {
struct Sample {
int64_t host_id = 0;
int64_t unix_ts = 0;
float cpu_pct = 0.0f;
float ram_used_mb = 0.0f;
float ram_total_mb = 0.0f;
float disk_read_mb_s = 0.0f;
float disk_write_mb_s = 0.0f;
float net_rx_mb_s = 0.0f;
float net_tx_mb_s = 0.0f;
float gpu_pct = 0.0f;
};
class SamplesDb {
public:
SamplesDb();
~SamplesDb();
bool open(const std::string& path);
void close();
bool insert(const Sample& s);
// Devuelve muestras del host en ventana [unix_from, unix_to], ordenadas asc.
std::vector<Sample> query_range(int64_t host_id, int64_t unix_from, int64_t unix_to);
private:
sqlite3* db_ = nullptr;
};
} // namespace pex