LINT: Add cpplint, clang-format and pre-commit support

Change-Id: I3cbb787ef27d90486b212dfb1a8c77c460acc2ac
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Galantsev, Dmitrii
2023-12-04 15:24:34 -06:00
parent 95e057c88d
commit 434e40305d
137 changed files with 9122 additions and 10469 deletions
+17 -18
View File
@@ -22,40 +22,39 @@ THE SOFTWARE.
#ifndef RDCI_INCLUDE_RDCIDIAGSUBSYSTEM_H_
#define RDCI_INCLUDE_RDCIDIAGSUBSYSTEM_H_
#include <signal.h>
#include <map>
#include <vector>
#include <string>
#include <vector>
#include "RdciSubSystem.h"
namespace amd {
namespace rdc {
class RdciDiagSubSystem: public RdciSubSystem {
class RdciDiagSubSystem : public RdciSubSystem {
public:
RdciDiagSubSystem();
~RdciDiagSubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
RdciDiagSubSystem();
~RdciDiagSubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
void show_help() const;
void show_help() const;
std::string get_test_name(
rdc_diag_test_cases_t test_case) const;
std::string get_test_name(rdc_diag_test_cases_t test_case) const;
enum OPERATIONS {
DIAG_UNKNOWN = 0,
DIAG_HELP,
DIAG_RUN,
} diag_ops_;
enum OPERATIONS {
DIAG_UNKNOWN = 0,
DIAG_HELP,
DIAG_RUN,
} diag_ops_;
rdc_gpu_group_t group_id_;
rdc_diag_level_t run_level_;
rdc_gpu_group_t group_id_;
rdc_diag_level_t run_level_;
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCIDIAGSUBSYSTEM_H_
+8 -9
View File
@@ -27,19 +27,18 @@ THE SOFTWARE.
namespace amd {
namespace rdc {
class RdciDiscoverySubSystem: public RdciSubSystem {
class RdciDiscoverySubSystem : public RdciSubSystem {
public:
RdciDiscoverySubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
private:
bool show_help_;
void show_help() const;
};
RdciDiscoverySubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
bool show_help_;
void show_help() const;
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCIDISCOVERYSUBSYSTEM_H_
+34 -35
View File
@@ -22,58 +22,57 @@ THE SOFTWARE.
#ifndef RDCI_INCLUDE_RDCIDMONSUBSYSTEM_H_
#define RDCI_INCLUDE_RDCIDMONSUBSYSTEM_H_
#include <signal.h>
#include <map>
#include <vector>
#include "RdciSubSystem.h"
#include "RdciSubSystem.h"
namespace amd {
namespace rdc {
class RdciDmonSubSystem: public RdciSubSystem {
class RdciDmonSubSystem : public RdciSubSystem {
public:
RdciDmonSubSystem();
~RdciDmonSubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
RdciDmonSubSystem();
~RdciDmonSubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
void show_help() const;
void show_field_usage() const;
void clean_up();
void show_help() const;
void show_field_usage() const;
void clean_up();
void create_temp_group();
void create_temp_field_group();
void create_temp_group();
void create_temp_field_group();
enum OPERATIONS {
DMON_UNKNOWN = 0,
DMON_HELP,
DMON_LIST_FIELDS,
DMON_LIST_ALL_FIELDS,
DMON_MONITOR
} dmon_ops_;
enum OPERATIONS {
DMON_UNKNOWN = 0,
DMON_HELP,
DMON_LIST_FIELDS,
DMON_LIST_ALL_FIELDS,
DMON_MONITOR
} dmon_ops_;
enum OPTIONS {
OPTIONS_UNKNOWN = 0,
OPTIONS_COUNT,
OPTIONS_DELAY,
OPTIONS_FIELD_GROUP_ID,
OPTIONS_GROUP_ID
};
enum OPTIONS {
OPTIONS_UNKNOWN = 0,
OPTIONS_COUNT,
OPTIONS_DELAY,
OPTIONS_FIELD_GROUP_ID,
OPTIONS_GROUP_ID
};
std::map<OPTIONS, uint32_t> options_;
std::vector<rdc_field_t> field_ids_;
std::vector<uint32_t> gpu_indexes_;
bool need_cleanup_;
uint64_t latest_time_stamp_;
bool show_timpstamps_;
static volatile sig_atomic_t is_terminating_;
static void set_terminating(int sig);
std::map<OPTIONS, uint32_t> options_;
std::vector<rdc_field_t> field_ids_;
std::vector<uint32_t> gpu_indexes_;
bool need_cleanup_;
uint64_t latest_time_stamp_;
bool show_timpstamps_;
static volatile sig_atomic_t is_terminating_;
static void set_terminating(int sig);
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCIDMONSUBSYSTEM_H_
+19 -19
View File
@@ -23,37 +23,37 @@ THE SOFTWARE.
#define RDCI_INCLUDE_RDCIFIELDGROUPSUBSYSTEM_H_
#include <string>
#include "RdciSubSystem.h"
namespace amd {
namespace rdc {
class RdciFieldGroupSubSystem: public RdciSubSystem {
class RdciFieldGroupSubSystem : public RdciSubSystem {
public:
RdciFieldGroupSubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
RdciFieldGroupSubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
void show_help() const;
void show_help() const;
enum OPERATIONS {
FIELD_GROUP_UNKNOWN = 0,
FIELD_GROUP_HELP,
FIELD_GROUP_CREATE,
FIELD_GROUP_DELETE,
FIELD_GROUP_LIST,
FIELD_GROUP_INFO
} field_group_ops_;
enum OPERATIONS {
FIELD_GROUP_UNKNOWN = 0,
FIELD_GROUP_HELP,
FIELD_GROUP_CREATE,
FIELD_GROUP_DELETE,
FIELD_GROUP_LIST,
FIELD_GROUP_INFO
} field_group_ops_;
bool is_group_set_;
uint32_t group_id_;
std::string group_name_;
std::string field_ids_;
bool is_group_set_;
uint32_t group_id_;
std::string group_name_;
std::string field_ids_;
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCIFIELDGROUPSUBSYSTEM_H_
+19 -20
View File
@@ -24,39 +24,38 @@ THE SOFTWARE.
#include <map>
#include <string>
#include "RdciSubSystem.h"
namespace amd {
namespace rdc {
class RdciGroupSubSystem: public RdciSubSystem {
class RdciGroupSubSystem : public RdciSubSystem {
public:
RdciGroupSubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
RdciGroupSubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
void show_help() const;
void show_help() const;
enum OPERATIONS {
GROUP_UNKNOWN = 0,
GROUP_HELP,
GROUP_CREATE,
GROUP_DELETE,
GROUP_LIST,
GROUP_ADD_GPUS,
GROUP_INFO
} group_ops_;
enum OPERATIONS {
GROUP_UNKNOWN = 0,
GROUP_HELP,
GROUP_CREATE,
GROUP_DELETE,
GROUP_LIST,
GROUP_ADD_GPUS,
GROUP_INFO
} group_ops_;
bool is_group_set_;
uint32_t group_id_;
std::string group_name_;
std::string gpu_ids_;
bool is_group_set_;
uint32_t group_id_;
std::string group_name_;
std::string gpu_ids_;
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCIGROUPSUBSYSTEM_H_
+23 -25
View File
@@ -22,44 +22,42 @@ THE SOFTWARE.
#ifndef RDCI_INCLUDE_RDCISTATSSUBSYSTEM_H_
#define RDCI_INCLUDE_RDCISTATSSUBSYSTEM_H_
#include <signal.h>
#include <string>
#include "RdciSubSystem.h"
#include <string>
#include "RdciSubSystem.h"
namespace amd {
namespace rdc {
class RdciStatsSubSystem: public RdciSubSystem {
class RdciStatsSubSystem : public RdciSubSystem {
public:
RdciStatsSubSystem();
~RdciStatsSubSystem();
void parse_cmd_opts(int argc, char ** argv) override;
void process() override;
RdciStatsSubSystem();
~RdciStatsSubSystem();
void parse_cmd_opts(int argc, char** argv) override;
void process() override;
private:
void show_help() const;
void show_job_stats(const rdc_gpu_usage_info_t& gpu_info) const;
void show_job_stats_json(const rdc_gpu_usage_info_t& gpu_info) const;
void show_help() const;
void show_job_stats(const rdc_gpu_usage_info_t& gpu_info) const;
void show_job_stats_json(const rdc_gpu_usage_info_t& gpu_info) const;
enum OPERATIONS {
STATS_UNKNOWN = 0,
STATS_HELP,
STATS_START_RECORDING,
STATS_STOP_RECORDING,
STATS_DISPLAY,
STATS_REMOVE,
STATS_REMOVE_ALL
} stats_ops_;
enum OPERATIONS {
STATS_UNKNOWN = 0,
STATS_HELP,
STATS_START_RECORDING,
STATS_STOP_RECORDING,
STATS_DISPLAY,
STATS_REMOVE,
STATS_REMOVE_ALL
} stats_ops_;
std::string job_id_;
uint32_t group_id_;
bool is_verbose_ = false;
std::string job_id_;
uint32_t group_id_;
bool is_verbose_ = false;
};
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCISTATSSUBSYSTEM_H_
+18 -19
View File
@@ -25,38 +25,38 @@ THE SOFTWARE.
#include <memory>
#include <string>
#include <vector>
#include "rdc_lib/rdc_common.h"
#include "rdc/rdc.h"
#include "rdc_lib/rdc_common.h"
namespace amd {
namespace rdc {
class RdciSubSystem {
public:
RdciSubSystem();
virtual void parse_cmd_opts(int argc, char ** argv) = 0;
virtual void connect();
RdciSubSystem();
virtual void parse_cmd_opts(int argc, char** argv) = 0;
virtual void connect();
virtual void process() = 0;
virtual ~RdciSubSystem();
virtual void process() = 0;
virtual ~RdciSubSystem();
bool is_json_output() const;
bool is_json_output() const;
protected:
void set_json_output(bool is_json);
std::vector<std::string> split_string(const std::string& s,
char delimiter) const;
void show_common_usage() const;
rdc_handle_t rdc_handle_;
std::string ip_port_;
void set_json_output(bool is_json);
std::vector<std::string> split_string(const std::string& s, char delimiter) const;
void show_common_usage() const;
rdc_handle_t rdc_handle_;
std::string ip_port_;
bool use_auth_;
std::string root_ca_;
std::string client_cert_;
std::string client_key_;
bool use_auth_;
std::string root_ca_;
std::string client_cert_;
std::string client_key_;
private:
bool is_json_output_;
bool is_json_output_;
};
typedef std::shared_ptr<RdciSubSystem> RdciSubSystemPtr;
@@ -64,5 +64,4 @@ typedef std::shared_ptr<RdciSubSystem> RdciSubSystemPtr;
} // namespace rdc
} // namespace amd
#endif // RDCI_INCLUDE_RDCISUBSYSTEM_H_