Merge branch 'solistice-properties'
This commit is contained in:
commit
7544850012
@ -27,6 +27,9 @@
|
|||||||
|
|
||||||
#include <ISceneManager.h>
|
#include <ISceneManager.h>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
ProfileWorld::ProfileType ProfileWorld::m_profile_mode=PROFILE_NONE;
|
ProfileWorld::ProfileType ProfileWorld::m_profile_mode=PROFILE_NONE;
|
||||||
int ProfileWorld::m_num_laps = 0;
|
int ProfileWorld::m_num_laps = 0;
|
||||||
float ProfileWorld::m_time = 0.0f;
|
float ProfileWorld::m_time = 0.0f;
|
||||||
@ -197,30 +200,30 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
|
|
||||||
// Print framerate statistics
|
// Print framerate statistics
|
||||||
float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f;
|
float runtime = (irr_driver->getRealTime()-m_start_time)*0.001f;
|
||||||
printf("Number of frames: %d time %f, Average FPS: %f\n",
|
Log::verbose("profile", "Number of frames: %d time %f, Average FPS: %f",
|
||||||
m_frame_count, runtime, (float)m_frame_count/runtime);
|
m_frame_count, runtime, (float)m_frame_count/runtime);
|
||||||
|
|
||||||
// Print geometry statistics if we're not in no-graphics mode
|
// Print geometry statistics if we're not in no-graphics mode
|
||||||
if(!m_no_graphics)
|
if(!m_no_graphics)
|
||||||
{
|
{
|
||||||
printf("Average # drawn nodes %f k\n",
|
Log::verbose("profile", "Average # drawn nodes %f k",
|
||||||
(float)m_num_triangles/m_frame_count);
|
(float)m_num_triangles/m_frame_count);
|
||||||
printf("Average # culled nodes: %f k\n",
|
Log::verbose("profile", "Average # culled nodes: %f k",
|
||||||
(float)m_num_culls/m_frame_count);
|
(float)m_num_culls/m_frame_count);
|
||||||
printf("Average # solid nodes: %f k\n",
|
Log::verbose("profile", "Average # solid nodes: %f k",
|
||||||
(float)m_num_solid/m_frame_count);
|
(float)m_num_solid/m_frame_count);
|
||||||
printf("Average # transparent nodes: %f\n",
|
Log::verbose("profile", "Average # transparent nodes: %f",
|
||||||
(float)m_num_transparent/m_frame_count);
|
(float)m_num_transparent/m_frame_count);
|
||||||
printf("Average # transp. effect nodes: %f\n",
|
Log::verbose("profile", "Average # transp. effect nodes: %f",
|
||||||
(float)m_num_trans_effect/m_frame_count);
|
(float)m_num_trans_effect/m_frame_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print race statistics for each individual kart
|
// Print race statistics for each individual kart
|
||||||
float min_t=999999.9f, max_t=0.0, av_t=0.0;
|
float min_t=999999.9f, max_t=0.0, av_t=0.0;
|
||||||
printf("name,start_position,end_position,time,average_speed,top_speed,"
|
Log::verbose("profile", "name start_position end_position time average_speed top_speed "
|
||||||
"skid_time,rescue_time,rescue_count,brake_count,"
|
"skid_time rescue_time rescue_count brake_count "
|
||||||
"explosion_time,explosion_count,bonus_count,banana_count,"
|
"explosion_time explosion_count bonus_count banana_count "
|
||||||
"small_nitro_count,large_nitro_count,bubblegum_count\n");
|
"small_nitro_count large_nitro_count bubblegum_count");
|
||||||
|
|
||||||
std::set<std::string> all_groups;
|
std::set<std::string> all_groups;
|
||||||
|
|
||||||
@ -231,25 +234,29 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
max_t = std::max(max_t, kart->getFinishTime());
|
max_t = std::max(max_t, kart->getFinishTime());
|
||||||
min_t = std::min(min_t, kart->getFinishTime());
|
min_t = std::min(min_t, kart->getFinishTime());
|
||||||
av_t += kart->getFinishTime();
|
av_t += kart->getFinishTime();
|
||||||
printf("%s %s,", kart->getIdent().c_str(),
|
std::ostringstream ss;
|
||||||
kart->getController()->getControllerName().c_str());
|
ss << kart->getIdent() << " "
|
||||||
|
<< kart->getController()->getControllerName() << " ";
|
||||||
|
ss << 1+(int)i << " " << kart->getPosition() << " "
|
||||||
|
<< kart->getFinishTime() << " ";
|
||||||
|
|
||||||
all_groups.insert(kart->getController()->getControllerName());
|
all_groups.insert(kart->getController()->getControllerName());
|
||||||
printf("%d,%d,%4.2f,", 1 + (int)i, kart->getPosition(), kart->getFinishTime());
|
|
||||||
float distance = (float)(m_profile_mode==PROFILE_LAPS
|
float distance = (float)(m_profile_mode==PROFILE_LAPS
|
||||||
? race_manager->getNumLaps() : 1);
|
? race_manager->getNumLaps() : 1);
|
||||||
distance *= m_track->getTrackLength();
|
distance *= m_track->getTrackLength();
|
||||||
printf("%4.2f,%3.2f,%4.2f,%4.2f,%d,%d,%4.2f,%d,%d,%d,%d,%d,%d,%d\n",
|
ss << distance/kart->getFinishTime() << " " << kart->getTopSpeed() << " ";
|
||||||
distance/kart->getFinishTime(), kart->getTopSpeed(),
|
ss << kart->getSkiddingTime() << " " << kart->getRescueTime() << " ";
|
||||||
kart->getSkiddingTime(), kart->getRescueTime(),
|
ss << kart->getRescueCount() << " " << kart->getBrakeCount() << " ";
|
||||||
kart->getRescueCount(), kart->getBrakeCount(),
|
ss << kart->getExplosionTime() << " " << kart->getExplosionCount() << " ";
|
||||||
kart->getExplosionTime(), kart->getExplosionCount(),
|
ss << kart->getBonusCount() << " " << kart->getBananaCount() << " ";
|
||||||
kart->getBonusCount(), kart->getBananaCount(),
|
ss << kart->getSmallNitroCount() << " " << kart->getLargeNitroCount() << " ";
|
||||||
kart->getSmallNitroCount(), kart->getLargeNitroCount(),
|
ss << kart->getBubblegumCount() << " " << kart->getOffTrackCount() << " ";
|
||||||
kart->getBubblegumCount(), kart->getOffTrackCount() );
|
Log::verbose("profile", ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print group statistics of all karts
|
// Print group statistics of all karts
|
||||||
printf("min %f max %f av %f\n",min_t, max_t, av_t/m_karts.size());
|
Log::verbose("profile", "min %f max %f av %f\n",
|
||||||
|
min_t, max_t, av_t/m_karts.size());
|
||||||
|
|
||||||
// Determine maximum length of group name
|
// Determine maximum length of group name
|
||||||
unsigned int max_len=4; // for 'name' heading
|
unsigned int max_len=4; // for 'name' heading
|
||||||
@ -260,11 +267,11 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
}
|
}
|
||||||
max_len++; // increase by 1 for one additional space after the name
|
max_len++; // increase by 1 for one additional space after the name
|
||||||
|
|
||||||
printf("\nname");
|
std::ostringstream ss;
|
||||||
for(unsigned int j=4; j<max_len; j++)
|
Log::verbose("profile", "");
|
||||||
printf(" ");
|
ss << "name" << std::setw(max_len-4) << " "
|
||||||
printf("Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off\n");
|
<< "Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off";
|
||||||
|
Log::verbose("profile", ss.str().c_str());
|
||||||
for(std::set<std::string>::iterator it = all_groups.begin();
|
for(std::set<std::string>::iterator it = all_groups.begin();
|
||||||
it !=all_groups.end(); it++)
|
it !=all_groups.end(); it++)
|
||||||
{
|
{
|
||||||
@ -281,19 +288,22 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
if(name!=*it)
|
if(name!=*it)
|
||||||
continue;
|
continue;
|
||||||
count ++;
|
count ++;
|
||||||
printf("%s", name.c_str());
|
std::ostringstream ss;
|
||||||
for(unsigned int j=name.size(); j<max_len; j++)
|
ss.setf(std::ios::fixed, std::ios::floatfield);
|
||||||
printf(" ");
|
ss.precision(2);
|
||||||
|
ss << name << std::setw(max_len-name.size()) << " ";
|
||||||
printf("%4d %3d %6.2f ", 1 + i, kart->getPosition(),
|
ss << std::setw(4) << 1 + i
|
||||||
kart->getFinishTime());
|
<< std::setw(4) << kart->getPosition()
|
||||||
|
<< std::setw(7) << kart->getFinishTime();
|
||||||
position_gain += 1+i - kart->getPosition();
|
position_gain += 1+i - kart->getPosition();
|
||||||
|
|
||||||
float distance = (float)(m_profile_mode==PROFILE_LAPS
|
float distance = (float)(m_profile_mode==PROFILE_LAPS
|
||||||
? race_manager->getNumLaps() : 1);
|
? race_manager->getNumLaps() : 1);
|
||||||
distance *= m_track->getTrackLength();
|
distance *= m_track->getTrackLength();
|
||||||
printf(" %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d\n",
|
|
||||||
distance/kart->getFinishTime(),
|
Log::verbose("profile",
|
||||||
|
"%s %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
|
||||||
|
ss.str().c_str(), distance/kart->getFinishTime(),
|
||||||
kart->getTopSpeed(),
|
kart->getTopSpeed(),
|
||||||
kart->getSkiddingTime(), kart->getRescueTime(),
|
kart->getSkiddingTime(), kart->getRescueTime(),
|
||||||
kart->getRescueCount(), kart->getBrakeCount(),
|
kart->getRescueCount(), kart->getBrakeCount(),
|
||||||
@ -302,7 +312,7 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
kart->getSmallNitroCount(), kart->getLargeNitroCount(),
|
kart->getSmallNitroCount(), kart->getLargeNitroCount(),
|
||||||
kart->getBubblegumCount(), kart->getOffTrackCount()
|
kart->getBubblegumCount(), kart->getOffTrackCount()
|
||||||
);
|
);
|
||||||
printf("nitro %f\n", kart->getEnergy());
|
Log::verbose("profile", "nitro %f\n", kart->getEnergy());
|
||||||
av_time += kart->getFinishTime();
|
av_time += kart->getFinishTime();
|
||||||
skidding_time += kart->getSkiddingTime();
|
skidding_time += kart->getSkiddingTime();
|
||||||
rescue_time += kart->getRescueTime();
|
rescue_time += kart->getRescueTime();
|
||||||
@ -317,18 +327,21 @@ void ProfileWorld::enterRaceOverState()
|
|||||||
expl_count += kart->getExplosionCount();
|
expl_count += kart->getExplosionCount();
|
||||||
off_track_count += kart->getOffTrackCount();
|
off_track_count += kart->getOffTrackCount();
|
||||||
} // for i < m_karts.size
|
} // for i < m_karts.size
|
||||||
for(unsigned int j=0; j<max_len + 85; j++)
|
|
||||||
printf("-");
|
|
||||||
printf("\n%s", it->c_str());
|
|
||||||
for(unsigned int j=it->size(); j<max_len; j++)
|
|
||||||
printf(" ");
|
|
||||||
printf("%+4d %6.2f %13s", position_gain, av_time/count, "");
|
|
||||||
|
|
||||||
printf("%6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d\n\n",
|
Log::verbose("profile", std::string(max_len+85, '-').c_str());
|
||||||
skidding_time/count, rescue_time/count, rescue_count,
|
ss.clear();
|
||||||
brake_count, expl_time, expl_count, bonus_count,
|
ss.str("");
|
||||||
|
ss << *it << std::string(max_len-it->size(),' ');
|
||||||
|
ss << std::showpos << std::setw(4) << position_gain
|
||||||
|
<< std::noshowpos << std::setw(13) << av_time/count
|
||||||
|
<< std::string(11,' ');
|
||||||
|
|
||||||
|
Log::verbose("profile", "%s%6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
|
||||||
|
ss.str().c_str(), skidding_time/count, rescue_time/count,
|
||||||
|
rescue_count,brake_count, expl_time, expl_count, bonus_count,
|
||||||
banana_count, s_nitro_count, l_nitro_count, bubble_count,
|
banana_count, s_nitro_count, l_nitro_count, bubble_count,
|
||||||
off_track_count);
|
off_track_count);
|
||||||
|
Log::verbose("profile", "");
|
||||||
} // for it !=all_groups.end
|
} // for it !=all_groups.end
|
||||||
delete this;
|
delete this;
|
||||||
main_loop->abort();
|
main_loop->abort();
|
||||||
|
Loading…
Reference in New Issue
Block a user