Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
a00f0c44
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a00f0c44
编写于
7月 14, 2016
作者:
M
Maksim Shabunin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6821 from sturkmen72:TickMeter_class_addition
上级
7d007d21
d2bad6fe
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
119 addition
and
61 deletion
+119
-61
modules/core/include/opencv2/core/utility.hpp
modules/core/include/opencv2/core/utility.hpp
+119
-1
samples/gpu/cascadeclassifier.cpp
samples/gpu/cascadeclassifier.cpp
+0
-2
samples/gpu/generalized_hough.cpp
samples/gpu/generalized_hough.cpp
+0
-2
samples/gpu/stereo_multi.cpp
samples/gpu/stereo_multi.cpp
+0
-2
samples/gpu/super_resolution.cpp
samples/gpu/super_resolution.cpp
+0
-2
samples/gpu/tick_meter.hpp
samples/gpu/tick_meter.hpp
+0
-48
samples/gpu/video_reader.cpp
samples/gpu/video_reader.cpp
+0
-2
samples/gpu/video_writer.cpp
samples/gpu/video_writer.cpp
+0
-2
未找到文件。
modules/core/include/opencv2/core/utility.hpp
浏览文件 @
a00f0c44
...
...
@@ -251,7 +251,8 @@ CV_EXPORTS_W const String& getBuildInformation();
The function returns the number of ticks after the certain event (for example, when the machine was
turned on). It can be used to initialize RNG or to measure a function execution time by reading the
tick count before and after the function call. See also the tick frequency.
tick count before and after the function call.
@sa getTickFrequency, TickMeter
*/
CV_EXPORTS_W
int64
getTickCount
();
...
...
@@ -264,9 +265,126 @@ execution time in seconds:
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();
@endcode
@sa getTickCount, TickMeter
*/
CV_EXPORTS_W
double
getTickFrequency
();
/** @brief a Class to measure passing time.
The class computes passing time by counting the number of ticks per second. That is, the following code computes the
execution time in seconds:
@code
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm.getTimeSec();
@endcode
@sa getTickCount, getTickFrequency
*/
class
CV_EXPORTS_W
TickMeter
{
public:
//! the default constructor
CV_WRAP
TickMeter
()
{
reset
();
}
/**
starts counting ticks.
*/
CV_WRAP
void
start
()
{
startTime
=
cv
::
getTickCount
();
}
/**
stops counting ticks.
*/
CV_WRAP
void
stop
()
{
int64
time
=
cv
::
getTickCount
();
if
(
startTime
==
0
)
return
;
++
counter
;
sumTime
+=
(
time
-
startTime
);
startTime
=
0
;
}
/**
returns counted ticks.
*/
CV_WRAP
int64
getTimeTicks
()
const
{
return
sumTime
;
}
/**
returns passed time in microseconds.
*/
CV_WRAP
double
getTimeMicro
()
const
{
return
getTimeMilli
()
*
1e3
;
}
/**
returns passed time in milliseconds.
*/
CV_WRAP
double
getTimeMilli
()
const
{
return
getTimeSec
()
*
1e3
;
}
/**
returns passed time in seconds.
*/
CV_WRAP
double
getTimeSec
()
const
{
return
(
double
)
getTimeTicks
()
/
getTickFrequency
();
}
/**
returns internal counter value.
*/
CV_WRAP
int64
getCounter
()
const
{
return
counter
;
}
/**
resets internal values.
*/
CV_WRAP
void
reset
()
{
startTime
=
0
;
sumTime
=
0
;
counter
=
0
;
}
private:
int64
counter
;
int64
sumTime
;
int64
startTime
;
};
/** @brief output operator
@code
TickMeter tm;
tm.start();
// do something ...
tm.stop();
std::cout << tm;
@endcode
*/
static
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
TickMeter
&
tm
)
{
return
out
<<
tm
.
getTimeSec
()
<<
"sec"
;
}
/** @brief Returns the number of CPU ticks.
The function returns the current number of CPU ticks on some architectures (such as x86, x64,
...
...
samples/gpu/cascadeclassifier.cpp
浏览文件 @
a00f0c44
...
...
@@ -13,8 +13,6 @@
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/cudawarping.hpp"
#include "tick_meter.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
cuda
;
...
...
samples/gpu/generalized_hough.cpp
浏览文件 @
a00f0c44
...
...
@@ -8,8 +8,6 @@
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/highgui.hpp"
#include "tick_meter.hpp"
using
namespace
std
;
using
namespace
cv
;
...
...
samples/gpu/stereo_multi.cpp
浏览文件 @
a00f0c44
...
...
@@ -17,8 +17,6 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/cudastereo.hpp"
#include "tick_meter.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
cuda
;
...
...
samples/gpu/super_resolution.cpp
浏览文件 @
a00f0c44
...
...
@@ -11,8 +11,6 @@
#include "opencv2/superres/optical_flow.hpp"
#include "opencv2/opencv_modules.hpp"
#include "tick_meter.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
superres
;
...
...
samples/gpu/tick_meter.hpp
已删除
100644 → 0
浏览文件 @
7d007d21
#ifndef OPENCV_CUDA_SAMPLES_TICKMETER_
#define OPENCV_CUDA_SAMPLES_TICKMETER_
class
CV_EXPORTS
TickMeter
{
public:
TickMeter
();
void
start
();
void
stop
();
int64
getTimeTicks
()
const
;
double
getTimeMicro
()
const
;
double
getTimeMilli
()
const
;
double
getTimeSec
()
const
;
int64
getCounter
()
const
;
void
reset
();
private:
int64
counter
;
int64
sumTime
;
int64
startTime
;
};
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
TickMeter
&
tm
);
TickMeter
::
TickMeter
()
{
reset
();
}
int64
TickMeter
::
getTimeTicks
()
const
{
return
sumTime
;
}
double
TickMeter
::
getTimeMicro
()
const
{
return
getTimeMilli
()
*
1e3
;}
double
TickMeter
::
getTimeMilli
()
const
{
return
getTimeSec
()
*
1e3
;
}
double
TickMeter
::
getTimeSec
()
const
{
return
(
double
)
getTimeTicks
()
/
cv
::
getTickFrequency
();}
int64
TickMeter
::
getCounter
()
const
{
return
counter
;
}
void
TickMeter
::
reset
()
{
startTime
=
0
;
sumTime
=
0
;
counter
=
0
;
}
void
TickMeter
::
start
(){
startTime
=
cv
::
getTickCount
();
}
void
TickMeter
::
stop
()
{
int64
time
=
cv
::
getTickCount
();
if
(
startTime
==
0
)
return
;
++
counter
;
sumTime
+=
(
time
-
startTime
);
startTime
=
0
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
TickMeter
&
tm
)
{
return
out
<<
tm
.
getTimeSec
()
<<
"sec"
;
}
#endif
samples/gpu/video_reader.cpp
浏览文件 @
a00f0c44
...
...
@@ -14,8 +14,6 @@
#include <opencv2/cudacodec.hpp>
#include <opencv2/highgui.hpp>
#include "tick_meter.hpp"
int
main
(
int
argc
,
const
char
*
argv
[])
{
if
(
argc
!=
2
)
...
...
samples/gpu/video_writer.cpp
浏览文件 @
a00f0c44
...
...
@@ -11,8 +11,6 @@
#include "opencv2/cudacodec.hpp"
#include "opencv2/highgui.hpp"
#include "tick_meter.hpp"
int
main
(
int
argc
,
const
char
*
argv
[])
{
if
(
argc
!=
2
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录