addind dist tri

This commit is contained in:
Federico Ponchio 2005-04-13 14:01:17 +00:00
parent b3e2bf3ba7
commit 7d982c7cf5
3 changed files with 39 additions and 2 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.37 2005/03/02 10:40:17 ponchio
Extraction rewrittten (to fix recusive problems).
Revision 1.36 2005/02/22 10:38:06 ponchio Revision 1.36 2005/02/22 10:38:06 ponchio
Debug, cleaning and optimization. Debug, cleaning and optimization.
@ -72,7 +75,7 @@ using namespace vcg;
using namespace std; using namespace std;
void Stats::Start() { void Stats::Start() {
tri = extr = 0; tri = extr = disk_tri = 0;
watch.Start(); watch.Start();
} }
@ -211,6 +214,7 @@ void NexusMt::Render(Extraction &extraction, DrawContest &contest,
if(stats) { if(stats) {
stats->Error(extraction.max_error); stats->Error(extraction.max_error);
stats->Disk(preload.disk); stats->Disk(preload.disk);
stats->disk_tri += preload.disk_tri;
preload.disk = 0; preload.disk = 0;
} }

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.24 2005/02/17 15:39:44 ponchio
Reorderes statistics a bit.
Revision 1.23 2005/02/14 17:11:07 ponchio Revision 1.23 2005/02/14 17:11:07 ponchio
aggiunta delle sphere aggiunta delle sphere
@ -69,6 +72,7 @@ namespace nxs {
//per frame data... //per frame data...
float tri; //k triangles rendered. float tri; //k triangles rendered.
float extr; //k triangles extracted float extr; //k triangles extracted
float disk_tri; //k triangles readed from disk
int log_size; int log_size;

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.46 2005/04/04 14:27:53 ponchio
*** empty log message ***
Revision 1.45 2005/03/02 10:40:17 ponchio Revision 1.45 2005/03/02 10:40:17 ponchio
Extraction rewrittten (to fix recusive problems). Extraction rewrittten (to fix recusive problems).
@ -261,6 +264,7 @@ int main(int argc, char *argv[]) {
int level = 0; int level = 0;
int apatch = -1; int apatch = -1;
float error = 4; float error = 4;
string file;
Trackball track; Trackball track;
@ -275,6 +279,7 @@ int main(int argc, char *argv[]) {
<< "-w <pixels>: window width\n" << "-w <pixels>: window width\n"
<< "-h <pixels>: window height\n" << "-h <pixels>: window height\n"
<< "-f : fullscreen mode\n" << "-f : fullscreen mode\n"
<< "-l <file> : log timing on file\n"
<< "-o namefile: ouput stats"; << "-o namefile: ouput stats";
return -1; return -1;
} }
@ -308,13 +313,14 @@ int main(int argc, char *argv[]) {
sprintf(window_name,"%s", argv[1]); sprintf(window_name,"%s", argv[1]);
int option; int option;
while((option = getopt(argc, argv, "e:m:x:r:d:o:w:h:p:f")) != EOF) { while((option = getopt(argc, argv, "e:m:x:r:d:l:o:w:h:p:f")) != EOF) {
switch(option) { switch(option) {
case 'e': extraction.target_error = atof(optarg); break; case 'e': extraction.target_error = atof(optarg); break;
case 'm': nexus.MaxRam() = atoi(optarg); break; case 'm': nexus.MaxRam() = atoi(optarg); break;
case 'x': extraction.extr_max = atoi(optarg); break; case 'x': extraction.extr_max = atoi(optarg); break;
case 'r': extraction.draw_max = atoi(optarg); break; case 'r': extraction.draw_max = atoi(optarg); break;
case 'd': extraction.disk_max = atoi(optarg); break; case 'd': extraction.disk_max = atoi(optarg); break;
case 'l': file = optarg; break;
case 'o': output_stats = true; sprintf(output_filename,"%s",optarg); break; case 'o': output_stats = true; sprintf(output_filename,"%s",optarg); break;
case 'w': width = atoi(optarg); break; case 'w': width = atoi(optarg); break;
case 'h': height = atoi(optarg); break; case 'h': height = atoi(optarg); break;
@ -325,6 +331,16 @@ int main(int argc, char *argv[]) {
} }
} }
FILE *fp = NULL;
if(file != "") {
fp = fopen(file.c_str(), "rwb+");
if(!fp) {
cerr << "Could not open log file: " << file << endl;
return -1;
}
fprintf(fp, "timeMs, error, extrTri, drawTri, diskTri, diskKb\n");
}
if(!init(window_name)) { if(!init(window_name)) {
cerr << "Could not init SDL window\n"; cerr << "Could not init SDL window\n";
return -1; return -1;
@ -704,7 +720,20 @@ int main(int argc, char *argv[]) {
} }
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
if(fp && stats.time.size()) {
//fprintf(fp, "timeMs, error, extrTri, drawTri, diskTri, diskKb\n");
assert(stats.time.size() && stats.error.size() && stats.disk.size());
fprintf(fp, "%d, %f, %d, %d, %d, %d\n",
(*stats.time.begin())*1000,
stats.error.begin(),
(int)stats.extr,
(int)stats.tri,
(int)stats.disk_tri,
(int)((*stats.disk.begin())/1024)*nexus.chunk_size);
} }
}
if(fp)
fclose(fp);
SDL_Quit(); SDL_Quit();
return -1; return -1;