Skip to content

Commit

Permalink
[perf] delete useless line. change Uint->UInt.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunelFeng committed Aug 3, 2024
1 parent b3c0396 commit 32270c1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/CBasic/CValType.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

using CChar = CGraph::internal::CCHAR;
using CCharPtr = CGraph::internal::CCHAR *;
using CUint = CGraph::internal::CUINT;
using CUInt = CGraph::internal::CUINT;
using CSize = CGraph::internal::CSIZE;
using CVoid = CGraph::internal::CVOID;
using CVoidPtr = CGraph::internal::CVOID *;
Expand Down
18 changes: 9 additions & 9 deletions src/DomainCtrl/Ann/DAnnNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ DAnnNode::DAnnNode() {
setType(GNodeType::CPU); // 计算密集型算子

/** 初始化函数映射关系 */
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_TRAIN)] = &DAnnNode::train;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_SEARCH)] = &DAnnNode::search;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_INSERT)] = &DAnnNode::insert;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_UPDATE)] = &DAnnNode::update;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_REMOVE)] = &DAnnNode::remove;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_LOAD_MODEL)] = &DAnnNode::loadModel;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_SAVE_MODEL)] = &DAnnNode::saveModel;
ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_EDITION)] = &DAnnNode::edition;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_TRAIN)] = &DAnnNode::train;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_SEARCH)] = &DAnnNode::search;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_INSERT)] = &DAnnNode::insert;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_UPDATE)] = &DAnnNode::update;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_REMOVE)] = &DAnnNode::remove;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_LOAD_MODEL)] = &DAnnNode::loadModel;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_SAVE_MODEL)] = &DAnnNode::saveModel;
ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_EDITION)] = &DAnnNode::edition;
}


Expand All @@ -39,7 +39,7 @@ CStatus DAnnNode::run() {
CGRAPH_RETURN_ERROR_STATUS("error ann function type")
}

status = (this->*ann_func_arr_[static_cast<CUint>(funcType)])();
status = (this->*ann_func_arr_[static_cast<CUInt>(funcType)])();
CGRAPH_FUNCTION_CHECK_STATUS

status = refreshParam();
Expand Down
2 changes: 1 addition & 1 deletion src/DomainCtrl/Ann/DAnnNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DAnnNode : public DAnnObject, public GNode {

private:
typedef CStatus (DAnnNode::*DAnnNodeFuncPtr)();
DAnnNodeFuncPtr ann_func_arr_[static_cast<CUint>(DAnnFuncType::ANN_MAX_SIZE)]{}; // ann函数映射关系
DAnnNodeFuncPtr ann_func_arr_[static_cast<CUInt>(DAnnFuncType::ANN_MAX_SIZE)]{}; // ann函数映射关系
};

CGRAPH_NAMESPACE_END
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphElement/GElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ CStatus GElement::addDependGElements(const GElementPtrSet& elements) {
CStatus GElement::addElementInfo(const GElementPtrSet& dependElements,
const std::string& name, CSize loop) {
CGRAPH_FUNCTION_BEGIN
CGRAPH_ASSERT_INIT_THROW_ERROR(false)
CGRAPH_ASSERT_INIT(false)

// 添加依赖的时候,可能会出现异常情况。故在这里提前添加 && 做判定
status = this->addDependGElements(dependElements);
Expand Down
3 changes: 0 additions & 3 deletions src/GraphCtrl/GraphElement/GGroup/GRegion/GRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
@Desc:
***************************/

#include <functional>

#include "GRegion.h"
// #include "GraphCtrl/GraphElement/_GOptimizer/GOptimizerInclude.h"
#include "../../_GOptimizer/GOptimizerInclude.h"
CGRAPH_NAMESPACE_BEGIN

Expand Down
8 changes: 4 additions & 4 deletions src/GraphCtrl/GraphMessage/GMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

CGRAPH_NAMESPACE_BEGIN

template<typename T, CUint capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE,
template<typename T, CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE,
c_enable_if_t<std::is_base_of<GMessageParam, T>::value, int> = 0>
class GMessage : public GMessageObject {
public:
explicit GMessage(CUint size = capacity) {
explicit GMessage(CUInt size = capacity) {
queue_.setCapacity(size);
}

Expand Down Expand Up @@ -86,7 +86,7 @@ class GMessage : public GMessageObject {
* 获取容量大小
* @return
*/
CUint getCapacity() const {
CUInt getCapacity() const {
return queue_.getCapacity();
}

Expand All @@ -95,7 +95,7 @@ class GMessage : public GMessageObject {
};


template<typename T, CUint capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE>
template<typename T, CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE>
using GMessagePtr = GMessage<T, capacity> *;

CGRAPH_NAMESPACE_END
Expand Down
8 changes: 4 additions & 4 deletions src/GraphCtrl/GraphMessage/GMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GMessageManager : public GMessageObject,
*/
template<typename TImpl,
c_enable_if_t<std::is_base_of<T, TImpl>::value, int> = 0>
CStatus createTopic(const std::string& topic, CUint size) {
CStatus createTopic(const std::string& topic, CUInt size) {
CGRAPH_FUNCTION_BEGIN

auto innerTopic = internal::SEND_RECV_PREFIX + topic; // 中间做一层映射,用来区分是 PubSub的,还是SendRecv的
Expand All @@ -45,7 +45,7 @@ class GMessageManager : public GMessageObject,
? CStatus() : CErrStatus("create topic [" + topic + "] duplicate");
} else {
// 创建一个 topic信息
auto message = UAllocator::safeMallocTemplateCObject<GMessage<TImpl>, CUint>(size);
auto message = UAllocator::safeMallocTemplateCObject<GMessage<TImpl>, CUInt>(size);
send_recv_message_map_.insert(std::pair<const std::string&, GMessagePtr<T> >(innerTopic, GMessagePtr<T>(message)));
}

Expand Down Expand Up @@ -190,9 +190,9 @@ class GMessageManager : public GMessageObject,
*/
template<typename TImpl,
c_enable_if_t<std::is_base_of<T, TImpl>::value, int> = 0>
CIndex bindTopic(const std::string& topic, CUint size) {
CIndex bindTopic(const std::string& topic, CUInt size) {
auto innerTopic = internal::PUB_SUB_PREFIX + topic;
auto message = UAllocator::safeMallocTemplateCObject<GMessage<TImpl>, CUint>(size);
auto message = UAllocator::safeMallocTemplateCObject<GMessage<TImpl>, CUInt>(size);

CGRAPH_LOCK_GUARD lock(bind_mutex_);
CIndex connId = (++cur_conn_id_);
Expand Down
2 changes: 1 addition & 1 deletion src/GraphCtrl/GraphPipeline/_GPerf/GPerfDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
CGRAPH_NAMESPACE_BEGIN

struct GPerfInfo : public CStruct {
CUint loop_ = 0; // 循环数
CUInt loop_ = 0; // 循环数
CFMSec first_start_ts_ = 0.0; // 开始的时间戳
CFMSec last_finish_ts_ = 0.0; // 最后一次结束的时间(需要考虑多次执行,或者多次被循环执行的情况)
CFMSec accu_cost_ts_ = 0.0; // 总体的耗时信息(累计值)
Expand Down
12 changes: 6 additions & 6 deletions src/UtilsCtrl/ThreadPool/Queue/UAtomicRingBufferQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

CGRAPH_NAMESPACE_BEGIN

template<typename T, CUint capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE>
template<typename T, CUInt capacity = CGRAPH_DEFAULT_RINGBUFFER_SIZE>
class UAtomicRingBufferQueue : public UQueueObject {
public:
explicit UAtomicRingBufferQueue() {
Expand All @@ -37,7 +37,7 @@ class UAtomicRingBufferQueue : public UQueueObject {
* @return
* @notice 谨慎使用,push信息之后,不推荐使用
*/
UAtomicRingBufferQueue* setCapacity(CUint size) {
UAtomicRingBufferQueue* setCapacity(CUInt size) {
capacity_ = size;
ring_buffer_queue_.resize(capacity_);
return this;
Expand All @@ -47,7 +47,7 @@ class UAtomicRingBufferQueue : public UQueueObject {
* 获取容量信息
* @return
*/
CUint getCapacity() const {
CUInt getCapacity() const {
return capacity_;
}

Expand Down Expand Up @@ -199,9 +199,9 @@ class UAtomicRingBufferQueue : public UQueueObject {
CGRAPH_NO_ALLOWED_COPY(UAtomicRingBufferQueue)

private:
CUint head_; // 头结点位置
CUint tail_; // 尾结点位置
CUint capacity_; // 环形缓冲的容量大小
CUInt head_; // 头结点位置
CUInt tail_; // 尾结点位置
CUInt capacity_; // 环形缓冲的容量大小

std::condition_variable push_cv_; // 写入的条件变量。为了保持语义完整,也考虑今后多入多出的可能性,不使用 父类中的 cv_了
std::condition_variable pop_cv_; // 读取的条件变量
Expand Down
2 changes: 1 addition & 1 deletion src/UtilsCtrl/ThreadPool/UThreadPoolDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static const int CGRAPH_THREAD_SCHED_FIFO = 0;
static const CInt CGRAPH_THREAD_MIN_PRIORITY = 0; // 线程最低优先级
static const CInt CGRAPH_THREAD_MAX_PRIORITY = 99; // 线程最高优先级
static const CMSec CGRAPH_MAX_BLOCK_TTL = 1999999999; // 最大阻塞时间,单位为ms
static const CUint CGRAPH_DEFAULT_RINGBUFFER_SIZE = 64; // 默认环形队列的大小
static const CUInt CGRAPH_DEFAULT_RINGBUFFER_SIZE = 64; // 默认环形队列的大小
static const CIndex CGRAPH_MAIN_THREAD_ID = -1; // 启动线程id标识(非上述主线程)
static const CIndex CGRAPH_SECONDARY_THREAD_COMMON_ID = -2; // 辅助线程统一id标识
static const CInt CGRAPH_DEFAULT_PRIORITY = 0; // 默认优先级
Expand Down

0 comments on commit 32270c1

Please sign in to comment.