Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add xavier agx support #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
8 changes: 7 additions & 1 deletion gtop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,20 @@ 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;

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));
Expand Down
2 changes: 1 addition & 1 deletion gtop.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <sys/stat.h>
#include <wordexp.h>

enum jetson_version {TK1, TX1, TX2};
enum jetson_version {TK1, TX1, TX2, AGX};

struct tegrastats {
int mem_usage;
Expand Down