diff --git a/display.cc b/display.cc index a3da1fe..8df670f 100644 --- a/display.cc +++ b/display.cc @@ -114,7 +114,7 @@ void display_cpu_stats(const int & row, const tegrastats & ts) { if (ts.version == TX1) display_bars(row+idx, BAR_OFFSET, u, ts.cpu_freq.at(0)); - else if (ts.version == TX2) + else // TX2, AGX display_bars(row+idx, BAR_OFFSET, u, ts.cpu_freq.at(idx)); idx++; diff --git a/gtop.cc b/gtop.cc index d511ebc..a1b8cb2 100644 --- a/gtop.cc +++ b/gtop.cc @@ -116,7 +116,9 @@ tegrastats parse_tegrastats(const char * buffer) { tegrastats ts; auto stats = tokenize(buffer, ' '); - if (stats.size() >= 15) + if (stats.size() >= 28) + ts.version = AGX; + else if (stats.size() >= 15) ts.version = TX1; else ts.version = TX2; @@ -124,6 +126,10 @@ tegrastats parse_tegrastats(const char * buffer) { get_mem_stats(ts, stats.at(1)); switch (ts.version) { + case AGX: + get_cpu_stats_tx2(ts, stats.at(9)); + get_gpu_stats(ts, stats.at(13)); + break; case TX1: get_cpu_stats_tx1(ts, stats.at(5)); get_gpu_stats(ts, stats.at(15)); diff --git a/gtop.hh b/gtop.hh index f601067..1e8f49e 100644 --- a/gtop.hh +++ b/gtop.hh @@ -21,7 +21,7 @@ #include "display.hh" #include "utils.hh" -const int STATS_BUFFER_SIZE = 256; +const int STATS_BUFFER_SIZE = 512; const std::string TEGRASTATS_PATH = "~/tegrastats"; const std::string TEGRASTATSFAKE_PATH = "./tegrastats_fake"; diff --git a/utils.hh b/utils.hh index 71e7522..ca56be4 100644 --- a/utils.hh +++ b/utils.hh @@ -10,7 +10,7 @@ #include #include -enum jetson_version {TK1, TX1, TX2}; +enum jetson_version {TK1, TX1, TX2, AGX}; struct tegrastats { int mem_usage;