#include "tMemManager.h"
#include "tLinkedList.h"
#include "tSysTime.h"
#include <iostream>
Go to the source code of this file.
Classes | |
class | test3 |
class | test |
class | test2 |
class | A |
class | B |
class | C |
Defines | |
#define | MAX 100 |
#define | LEN 100000 |
#define | ELEM 3 |
Functions | |
void | test_max_a () |
void | test_max_b () |
int | main () |
Variables | |
test3 * | anchor |
test3 | a |
test3 | b |
test3 | c |
test3 | d |
#define ELEM 3 |
#define LEN 100000 |
#define MAX 100 |
Definition at line 7 of file memtest.cpp.
int main | ( | ) |
Definition at line 150 of file memtest.cpp.
References MAX, NULL, tc, test_max_a(), test_max_b(), tSysTimeFloat(), x, and A::x.
00150 { 00151 float ta = tSysTimeFloat(); 00152 test_max_b(); 00153 float tb = tSysTimeFloat(); 00154 test_max_a(); 00155 float tc = tSysTimeFloat(); 00156 00157 std::cout << tb-ta << " , " << tc-tb << '\n'; 00158 00159 00160 00161 C c; 00162 std::cout << c.x << '\n'; 00163 00164 int i; 00165 test *x[MAX]; 00166 00167 test *y=new test2; 00168 delete y; 00169 00170 for(i=0;i<MAX;i++) 00171 x[i]=new test; 00172 00173 for (i=0;i<MAX;i++) 00174 if (i%4 !=0){ 00175 delete x[i]; 00176 x[i]=NULL; 00177 } 00178 00179 for(i=0;i<MAX;i++) 00180 if (!x[i]) 00181 x[i]=new test; 00182 00183 for(i=0;i<MAX;i++) 00184 delete x[i]; 00185 00186 return 0; 00187 }
void test_max_a | ( | ) |
Definition at line 83 of file memtest.cpp.
References ELEM, LEN, max(), and x.
Referenced by main().
00083 { 00084 float x[LEN][ELEM]; 00085 int i,j; 00086 00087 for (i=LEN-1; i>=0; i--) 00088 { 00089 x[i][0] = 100; 00090 x[i][1] = 150-i; 00091 x[i][2] = 75+i; 00092 } 00093 00094 for (int k=99; k>=0; k--) 00095 for (i=LEN-1; i>=0; i--) 00096 { 00097 float max = -10000; 00098 float min = 10000; 00099 00100 for (j=ELEM; j>=0; j--) 00101 { 00102 float y = x[i][j]; 00103 float ymi = min-y; 00104 float yma = y-max; 00105 00106 min -= (ymi + fabs(ymi))*.5; 00107 max += (yma + fabs(yma))*.5; 00108 /* 00109 if (min > x[i][j]) 00110 min = x[i][j]; 00111 else 00112 min = min; 00113 00114 if (max < x[i][j]) 00115 max = x[i][j]; 00116 else 00117 max = max; 00118 */ 00119 } 00120 } 00121 }
void test_max_b | ( | ) |
Definition at line 123 of file memtest.cpp.
References ELEM, LEN, max(), and x.
Referenced by main().
00123 { 00124 float x[LEN][ELEM]; 00125 int i,j; 00126 00127 for (i=LEN-1; i>=0; i--) 00128 { 00129 x[i][0] = 100; 00130 x[i][1] = 150-i; 00131 x[i][2] = 75+i; 00132 } 00133 00134 for (int k=99; k>=0; k--) 00135 for (i=LEN-1; i>=0; i--) 00136 { 00137 float max = -10000; 00138 float min = 10000; 00139 00140 for (j=ELEM; j>=0; j--) 00141 { 00142 min = (min > x[i][j] ? x[i][j] : min); 00143 max = (max < x[i][j] ? x[i][j] : max); 00144 } 00145 } 00146 }
Definition at line 18 of file memtest.cpp.
Definition at line 9 of file memtest.cpp.
Definition at line 18 of file memtest.cpp.
Definition at line 18 of file memtest.cpp.
Definition at line 18 of file memtest.cpp.