coding style formatting

This commit is contained in:
Evgeny
2017-11-29 13:53:12 -06:00
parent 841616f595
commit cb3a591826
31 changed files with 734 additions and 702 deletions
+14 -11
View File
@@ -7,24 +7,27 @@
#include <sstream>
#include <string>
#define EXC_RAISING(error, stream) { \
std::ostringstream oss; oss << __FUNCTION__ << "(), " << stream; \
throw rocprofiler::util::exception(error, oss.str()); \
}
#define EXC_RAISING(error, stream) \
{ \
std::ostringstream oss; \
oss << __FUNCTION__ << "(), " << stream; \
throw rocprofiler::util::exception(error, oss.str()); \
}
#define AQL_EXC_RAISING(error, stream) { \
const char* error_string = NULL; \
const rocprofiler::pfn_t* api = util::HsaRsrcFactory::Instance().AqlProfileApi(); \
api->hsa_ven_amd_aqlprofile_error_string(&error_string); \
EXC_RAISING(error, stream << ", " << error_string); \
}
#define AQL_EXC_RAISING(error, stream) \
{ \
const char* error_string = NULL; \
const rocprofiler::pfn_t* api = util::HsaRsrcFactory::Instance().AqlProfileApi(); \
api->hsa_ven_amd_aqlprofile_error_string(&error_string); \
EXC_RAISING(error, stream << ", " << error_string); \
}
namespace rocprofiler {
namespace util {
class exception : public std::exception {
public:
explicit exception(const uint32_t &status, const std::string& msg) : status_(status), str_(msg) {}
explicit exception(const uint32_t& status, const std::string& msg) : status_(status), str_(msg) {}
const char* what() const throw() { return str_.c_str(); }
uint32_t status() const throw() { return status_; }
+6 -5
View File
@@ -124,11 +124,11 @@ const AgentInfo* HsaRsrcFactory::AddAgentInfo(const hsa_agent_t agent) {
hsa_agent_get_info(agent, HSA_AGENT_INFO_QUEUE_MAX_SIZE, &agent_info->max_queue_size);
agent_info->profile = hsa_profile_t(108);
hsa_agent_get_info(agent, HSA_AGENT_INFO_PROFILE, &agent_info->profile);
// Initialize memory regions to zero
agent_info->kernarg_region.handle = 0;
agent_info->coarse_region.handle = 0;
// Find and Bind Memory regions of the Gpu agent
hsa_agent_iterate_regions(agent, FindMemRegionsCallback, agent_info);
@@ -216,7 +216,8 @@ bool HsaRsrcFactory::GetCpuAgentInfo(uint32_t idx, const AgentInfo** agent_info)
//
// @return bool true if successful, false otherwise
//
bool HsaRsrcFactory::CreateQueue(const AgentInfo* agent_info, uint32_t num_pkts, hsa_queue_t** queue) {
bool HsaRsrcFactory::CreateQueue(const AgentInfo* agent_info, uint32_t num_pkts,
hsa_queue_t** queue) {
hsa_status_t status;
status = hsa_queue_create(agent_info->dev_id, num_pkts, HSA_QUEUE_TYPE_MULTI, NULL, NULL,
UINT32_MAX, UINT32_MAX, queue);
@@ -388,5 +389,5 @@ bool HsaRsrcFactory::PrintGpuAgents(const std::string& header) {
HsaRsrcFactory* HsaRsrcFactory::instance_ = NULL;
HsaRsrcFactory::mutex_t HsaRsrcFactory::mutex_;
} // namespace util
} // namespace rocprofiler
} // namespace util
} // namespace rocprofiler
+2 -2
View File
@@ -256,7 +256,7 @@ class HsaRsrcFactory {
hsa_ven_amd_aqlprofile_1_00_pfn_t aqlprofile_api_;
};
} // namespace util
} // namespace rocprofiler
} // namespace util
} // namespace rocprofiler
#endif // SRC_UTIL_HSA_RSRC_FACTORY_H_
+17 -21
View File
@@ -134,30 +134,26 @@ class Logger {
} // namespace util
} // namespace rocprofiler
#define ERR_LOGGING(stream) { \
rocprofiler::util::Logger::Instance() \
<< "error: " \
<< rocprofiler::util::Logger::begm \
<< stream \
<< rocprofiler::util::Logger::endl; \
}
#define ERR_LOGGING(stream) \
{ \
rocprofiler::util::Logger::Instance() << "error: " << rocprofiler::util::Logger::begm \
<< stream << rocprofiler::util::Logger::endl; \
}
#define INFO_LOGGING(stream) { \
rocprofiler::util::Logger::Instance() \
<< "info: " \
<< rocprofiler::util::Logger::begm \
<< stream \
<< rocprofiler::util::Logger::endl; \
}
#define INFO_LOGGING(stream) \
{ \
rocprofiler::util::Logger::Instance() << "info: " << rocprofiler::util::Logger::begm << stream \
<< rocprofiler::util::Logger::endl; \
}
#ifdef DEBUG
# define DBG_LOGGING(stream) { \
rocprofiler::util::Logger::Instance() << rocprofiler::util::Logger::begm \
<< "debug: \"" << stream << "\"" << \
<< " in " << __FUNCTION__ \
<< " at " << __FILE__ << " line " << __LINE__ \
<< rocprofiler::util::Logger::endl; \
}
#define DBG_LOGGING(stream) \
{ \
rocprofiler::util::Logger::Instance() << rocprofiler::util::Logger::begm << "debug: \"" \
<< stream << "\"" < < < < \
" in " << __FUNCTION__ << " at " << __FILE__ << " line " << __LINE__ \
<< rocprofiler::util::Logger::endl; \
}
#endif
#endif // SRC_UTIL_LOGGER_H_