【新增】MNN依赖库
This commit is contained in:
58
3rd/win/mnn/include/MNN/AutoTime.hpp
Normal file
58
3rd/win/mnn/include/MNN/AutoTime.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// AutoTime.hpp
|
||||
// MNN
|
||||
//
|
||||
// Created by MNN on 2018/07/27.
|
||||
// Copyright © 2018, Alibaba Group Holding Limited
|
||||
//
|
||||
|
||||
#ifndef AutoTime_hpp
|
||||
#define AutoTime_hpp
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <MNN/MNNDefine.h>
|
||||
|
||||
namespace MNN {
|
||||
|
||||
class MNN_PUBLIC Timer {
|
||||
public:
|
||||
Timer();
|
||||
~Timer();
|
||||
Timer(const Timer&) = delete;
|
||||
Timer(const Timer&&) = delete;
|
||||
Timer& operator=(const Timer&) = delete;
|
||||
Timer& operator=(const Timer&&) = delete;
|
||||
|
||||
// reset timer
|
||||
void reset();
|
||||
// get duration (us) from init or latest reset.
|
||||
uint64_t durationInUs();
|
||||
|
||||
protected:
|
||||
uint64_t mLastResetTime;
|
||||
};
|
||||
|
||||
/** time tracing util. prints duration between init and deinit. */
|
||||
class MNN_PUBLIC AutoTime : Timer {
|
||||
public:
|
||||
AutoTime(int line, const char* func);
|
||||
~AutoTime();
|
||||
AutoTime(const AutoTime&) = delete;
|
||||
AutoTime(const AutoTime&&) = delete;
|
||||
AutoTime& operator=(const AutoTime&) = delete;
|
||||
AutoTime& operator=(const AutoTime&&) = delete;
|
||||
|
||||
private:
|
||||
int mLine;
|
||||
char* mName;
|
||||
};
|
||||
} // namespace MNN
|
||||
|
||||
#ifdef MNN_OPEN_TIME_TRACE
|
||||
#define AUTOTIME MNN::AutoTime ___t(__LINE__, __func__)
|
||||
#else
|
||||
#define AUTOTIME
|
||||
#endif
|
||||
|
||||
#endif /* AutoTime_hpp */
|
||||
Reference in New Issue
Block a user