Index: trunk/src/core/profiler.cc
===================================================================
--- trunk/src/core/profiler.cc	(revision 369)
+++ trunk/src/core/profiler.cc	(revision 371)
@@ -5,11 +5,14 @@
 #include "nv/core/profiler.hh"
 
-#include <iomanip>
-#include <ios>
 #include "nv/core/time.hh"
 #include "nv/core/logging.hh"
+#include <cstdio>
+#include <cstdlib>
 
 using namespace nv;
 
+#ifdef NV_MSVC
+#define snprintf sprintf_s
+#endif
 
 profiler::profiler()
@@ -25,5 +28,5 @@
 }
 
-void profiler::start_profile( const char* tag )
+void profiler::start_profile( const string_ref& tag )
 {
 	if ( tag != m_current->m_tag )
@@ -42,6 +45,6 @@
 }
 
-profiler::node::node( const char* tag, node* parent ) 
-	: m_tag( tag )
+profiler::node::node( const string_ref& tag, node* parent )
+	: m_tag( tag.to_string() )
 	, m_parent( parent )
 	, m_recusion( 0 )
@@ -53,7 +56,8 @@
 }
 
-profiler::node* profiler::node::request_child( const char* tag )
+profiler::node* profiler::node::request_child( const string_ref& tag )
 {
-	auto it = m_children.find( tag );
+	std::string stag( tag.to_string() );
+	auto it = m_children.find( stag );
 	if ( it != m_children.end() ) 
 		return it->second;
@@ -61,5 +65,5 @@
 	{
 		node* result = new node( tag, this );
-		m_children[ tag ] = result;
+		m_children[ stag ] = result;
 		return result;
 	}
@@ -101,17 +105,16 @@
 {
 	m_root->stop();
-	NV_LOG_INFO( "-- PROFILER REPORT -----------------------------------------" );
-	NV_LOG_STREAM( LOG_INFO, std::left << std::setw(24) << "TAG" 
-		<< std::setw(7) << "%PARNT" 
-		<< std::setw(7) << "CALLS" 
-		<< std::setw(10) << "TOTAL(ms)" 
-		<< std::setw(10) << "AVG(ms)" );
-	log_node_children( "", m_root );
-	NV_LOG_INFO( "-- PROFILER REPORT END -------------------------------------" );
+	NV_LOG_INFO( "-- PROFILER REPORT -------------------------------------" );
+	char buffer[128];
+	snprintf( buffer, 128, "%-23s %6s %6s %9s %6s", "TAG", "%PARNT", "CALLS", "TOTAL(ms)", "AVG(ms)" );
+	NV_LOG_INFO( string_ref( buffer, strlen(buffer) ) );
+ 	log_node_children( 0, m_root );
+	NV_LOG_INFO( "-- PROFILER REPORT END ---------------------------------" );
 	m_root->start();
 }
 
-void profiler::log_node_children( const std::string& ind, const node* n )
+void profiler::log_node_children( uint32 indent, const node* n )
 {
+	char buffer[128];
 	for ( const auto& pair : n->m_children )
 	{
@@ -119,13 +122,15 @@
 		if ( c->m_calls > 0 )
 		{
-			NV_LOG_STREAM( LOG_INFO, std::left << std::setw(24) << ind + c->m_tag 
-				<< std::setw(7) << std::setprecision(2) << std::fixed << ( (double)c->m_total_time_us / (double)c->m_parent->m_total_time_us ) * 100.0
-				<< std::setw(7) << c->m_calls 
-				<< std::setw(10) << std::setprecision(2) << std::fixed << c->m_total_time_us / 1000.f
-				<< std::setw(10) << std::setprecision(2) << std::fixed << ( (double)c->m_total_time_us / (double)c->m_calls ) / 1000.f
-				);
+			double pparent  = ( (double)c->m_total_time_us / (double)c->m_parent->m_total_time_us ) * 100.f;
+			int calls       = c->m_calls;
+			double total_ms = c->m_total_time_us / 1000.f;
+			double avg_ms   = ( (double)c->m_total_time_us / (double)c->m_calls ) / 1000.f;
+			if ( indent > 0 ) memset( buffer, '-', indent );
+			snprintf( buffer + indent, 128 - indent, "%*.*s %6.2f %6d %9.2f %6.2f", indent - 23, 23 - indent,
+				c->m_tag.c_str(), pparent, calls, total_ms, avg_ms );
+			NV_LOG_INFO( string_ref( buffer, strlen( buffer ) ) );
 			if ( c->m_children.size() > 0 )
 			{
-				log_node_children( ind + "-", c );
+				log_node_children( indent + 1, c );
 			}
 		}
