forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-performance-02.cpp
More file actions
39 lines (34 loc) · 991 Bytes
/
test-performance-02.cpp
File metadata and controls
39 lines (34 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: test-performance-02.cpp
@Time: 2023/12/3 18:28
@Desc:
***************************/
#include "../_Materials/TestInclude.h"
using namespace CGraph;
void test_performance_02() {
// 串行执行32次,对应第二个例子,1thread,32串行,1000w次
GPipelinePtr pipeline = GPipelineFactory::create();
CStatus status;
GElementPtr arr[32];
pipeline->registerGElement<TestAdd1GNode>(&arr[0]);
for (int i = 1; i < 32; i++) {
pipeline->registerGElement<TestAdd1GNode>(&arr[i], {arr[i - 1]});
}
pipeline->makeSerial();
pipeline->setAutoCheck(false);
status += pipeline->init();
{
UTimeCounter counter("test_performance_02");
for (int t = 0; t < 1000000; t++) {
pipeline->run();
}
}
status += pipeline->destroy();
GPipelineFactory::remove(pipeline);
}
int main() {
test_performance_02();
return 0;
}