mirror of
https://github.com/OPSnet/Ocelot.git
synced 2026-11-07 22:55:01 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
feaadb87ef | ||
|
|
0337402c36 |
No files matched your search
@@ -1,3 +1,11 @@
|
||||
-- 2.1.2 (2024-02-17)
|
||||
FEATURES
|
||||
* show resource usage in Gazelle and Grafana report endpoints
|
||||
|
||||
-- 2.1.1 (2024-02-15)
|
||||
BUILD
|
||||
* Detabbed source code in first step towards having the code lint cleanly, no code changes
|
||||
|
||||
-- 2.1.0 (2024-02-11)
|
||||
FEATURES
|
||||
* announce jitter is now a uniform distribution and can be modified on the fly
|
||||
|
||||
+34
-1
@@ -1,6 +1,9 @@
|
||||
// Copyright [2017-2024] Orpheus
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip> // for std::setfill() and std::setw()
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
|
||||
@@ -47,6 +50,21 @@ std::string report(params_type ¶ms, user_list &users_list, client_opts_t &cl
|
||||
<< announce_interval << " announce interval\n"
|
||||
<< announce_jitter << " announce jitter\n"
|
||||
;
|
||||
|
||||
struct rusage r;
|
||||
if (getrusage(RUSAGE_SELF, &r) == 0) {
|
||||
output << r.ru_utime.tv_sec << '.' << std::setfill('0') << std::setw(6) << r.ru_utime.tv_usec << " user time\n"
|
||||
<< r.ru_stime.tv_sec << '.' << std::setfill('0') << std::setw(6) << r.ru_stime.tv_usec << " system time\n"
|
||||
<< r.ru_maxrss << " maximum resident set size\n"
|
||||
<< r.ru_minflt << " minor page faults\n"
|
||||
<< r.ru_majflt << " major page faults\n"
|
||||
<< r.ru_inblock << " blocks in\n"
|
||||
<< r.ru_oublock << " blocks out\n"
|
||||
<< r.ru_nvcsw << " voluntary context switches\n"
|
||||
<< r.ru_nivcsw << " involuntary context switches\n"
|
||||
;
|
||||
}
|
||||
|
||||
} else if (action == "prom_stats") {
|
||||
time_t uptime = time(NULL) - stats.start_time;
|
||||
output << "ocelot_uptime " << uptime << "\n"
|
||||
@@ -65,7 +83,22 @@ std::string report(params_type ¶ms, user_list &users_list, client_opts_t &cl
|
||||
<< "ocelot_snatch_queue " << stats.snatch_queue_size << "\n"
|
||||
<< "ocelot_token_queue " << stats.token_queue_size << "\n"
|
||||
<< "ocelot_bytes_read " << stats.bytes_read << "\n"
|
||||
<< "ocelot_bytes_written " << stats.bytes_written << "\n#";
|
||||
<< "ocelot_bytes_written " << stats.bytes_written << "\n";
|
||||
|
||||
struct rusage r;
|
||||
if (getrusage(RUSAGE_SELF, &r) == 0) {
|
||||
output << "ocelot_time_user " << r.ru_utime.tv_sec << '.' << std::setfill('0') << std::setw(6) << r.ru_utime.tv_usec << "\n"
|
||||
"ocelot_time_system " << r.ru_stime.tv_sec << '.' << std::setfill('0') << std::setw(6) << r.ru_stime.tv_usec << "\n"
|
||||
"ocelot_max_rss " << r.ru_maxrss << "\n"
|
||||
"ocelot_minor_fault " << r.ru_minflt << "\n"
|
||||
"ocelot_major_fault " << r.ru_majflt << "\n"
|
||||
"ocelot_blk_in " << r.ru_inblock << "\n"
|
||||
"ocelot_blk_out " << r.ru_oublock << "\n"
|
||||
"ocelot_nvcsw " << r.ru_nvcsw << "\n"
|
||||
"ocelot_nivcsw " << r.ru_nivcsw << "\n"
|
||||
;
|
||||
}
|
||||
output << '#';
|
||||
} else if (action == "user") {
|
||||
std::string key = params["key"];
|
||||
if (key.empty()) {
|
||||
|
||||
Reference in new issue
Block a user