MCPcopy Create free account
hub / github.com/acl-dev/acl / test

Function test

lib_acl_cpp/samples/class_counter/main.cpp:65–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63};
64
65static void test(size_t max, bool use_typeid) {
66 std::vector<myobj*> objs;
67
68 struct timeval begin, end;
69 gettimeofday(&begin, NULL);
70
71 for (size_t i = 0; i < max; i++) {
72 myobj* o = new myobj1(use_typeid);
73 objs.push_back(o);
74 }
75
76 for (size_t i = 0; i < max; i++) {
77 myobj* o = new myobj2(use_typeid);
78 objs.push_back(o);
79 }
80
81 gettimeofday(&end, NULL);
82 double tc = acl::stamp_sub(end, begin);
83
84 printf("After add, time cost=%.2f ms, obj: %lld, obj1: %lld, obj2: %lld\r\n",
85 tc, ACL_COUNTER_COUNT(myobj), ACL_COUNTER_COUNT(myobj1),
86 ACL_COUNTER_COUNT(myobj2));
87
88 ACL_COUNTER_PRINT();
89
90 printf("Enter any key to continue...\r\n");
91 getchar();
92
93 for (std::vector<myobj*>::iterator it = objs.begin();
94 it != objs.end(); ++it) {
95 delete *it;
96 }
97
98 printf("After del objs: %lld\r\n", ACL_COUNTER_COUNT(myobj));
99 ACL_COUNTER_PRINT();
100}
101
102int main(int argc, char *argv[]) {
103 // ��ʼ�� acl ��

Callers 1

mainFunction · 0.70

Calls 5

beginMethod · 0.80
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
push_backMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…