History

update OTF message output

Ge Wang committed 3 years ago

Commit 67a6fc31 parent 712b3c52 files · +38 −28Browse files

Unified · Split

2 files
  1. src/core/chuck_compile.cpp +7 −3
  2. src/core/chuck_vm.cpp +31 −25
src/core/chuck_compile.cpp+7−3
@@ -448,16 +448,20 @@ t_CKBOOL Chuck_Compiler::do_normal_depend( const string & filename, FILE * fd, · 447 unmodified lines
448448 t_CKBOOL ret = TRUE;
449449 Chuck_Context * context = NULL;
450450
451+ // expand
452+ string theFilename = expand_filepath(filename);
453+ string theFullpath = expand_filepath(full_path);
454+
451455 // parse the code
452− if( !chuck_parse( filename.c_str(), fd, str_src ) )
456+ if( !chuck_parse( theFilename.c_str(), fd, str_src ) )
453457 return FALSE;
454458
455459 // make the context
456− context = type_engine_make_context( g_program, filename );
460+ context = type_engine_make_context( g_program, theFilename );
457461 if( !context ) return FALSE;
458462
459463 // remember full path (added 1.3.0.0)
460− context->full_path = full_path;
464+ context->full_path = theFullpath;
461465
462466 // reset the env
463467 env()->reset();
src/core/chuck_vm.cpp+31−25
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include "chuck_dl.h"
3737 #include "chuck_globals.h" // added 1.4.1.0 (jack)
3838 #include "chuck_errmsg.h"
39+#include "util_string.h"
3940
4041 #ifndef __DISABLE_SERIAL__
4142 #include "chuck_io.h"
@@ -752,7 +753,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 710 unmodified lines
752753 Chuck_VM_Shred * out = m_shreduler->lookup( msg->param );
753754 if( !out )
754755 {
755− EM_error3( "[chuck](VM): error replacing shred: no shred with id %i...",
756+ EM_error3( "[chuck](VM): ---- error replacing shred: no shred with id %i...",
756757 msg->param );
757758 retval = 0;
758759 goto done;
@@ -785,7 +786,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 26 unmodified lines
785786 // replace
786787 if( m_shreduler->remove( out ) && m_shreduler->shredule( shred ) )
787788 {
788− EM_error3( "[chuck](VM): replacing shred %i (%s) with %i (%s)...",
789+ EM_error3( "[chuck](VM): ---- replacing shred %i (%s) with %i (%s)...",
789790 out->xid, mini(out->name.c_str()), shred->xid, mini(shred->name.c_str()) );
790791 this->free( out, TRUE, FALSE );
791792 retval = shred->xid;
@@ -797,7 +798,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 5 unmodified lines
797798 }
798799 else
799800 {
800− EM_error3( "[chuck](VM): shreduler ERROR replacing shred %i...",
801+ EM_error3( "[chuck](VM): ---- shreduler ERROR replacing shred %i...",
801802 out->xid );
802803 shred->release();
803804 retval = 0;
@@ -810,7 +811,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 6 unmodified lines
810811 {
811812 if( !this->m_num_shreds)
812813 {
813− EM_error3( "[chuck](VM): no shreds to remove..." );
814+ EM_error3( "[chuck](VM): ---- no shreds to remove..." );
814815 retval = 0;
815816 goto done;
816817 }
@@ -821,14 +822,14 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 4 unmodified lines
821822 xid--;
822823 if( xid >= 0 )
823824 {
824− EM_error3( "[chuck](VM): removing recent shred: %i (%s)...",
825+ EM_error3( "[chuck](VM): ---- removing recent shred: %i (%s)...",
825826 xid, mini(shred->name.c_str()) );
826827 this->free( shred, TRUE );
827828 retval = xid;
828829 }
829830 else
830831 {
831− EM_error3( "[chuck](VM): no shreds removed..." );
832+ EM_error3( "[chuck](VM): ---- no shreds removed..." );
832833 retval = 0;
833834 goto done;
834835 }
@@ -838,19 +839,19 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 3 unmodified lines
838839 Chuck_VM_Shred * shred = m_shreduler->lookup( msg->param );
839840 if( !shred )
840841 {
841− EM_error3( "[chuck](VM): cannot remove: no shred with id %i...",
842+ EM_error3( "[chuck](VM): ---- cannot remove: no shred with id %i...",
842843 msg->param );
843844 retval = 0;
844845 goto done;
845846 }
846847 if( shred != m_shreduler->m_current_shred && !m_shreduler->remove( shred ) ) // was lookup
847848 {
848− EM_error3( "[chuck](VM): shreduler: cannot remove shred %i...",
849+ EM_error3( "[chuck](VM): ---- shreduler: cannot remove shred %i...",
849850 msg->param );
850851 retval = 0;
851852 goto done;
852853 }
853− EM_error3( "[chuck](VM): removing shred: %i (%s)...",
854+ EM_error3( "[chuck](VM) ---- removing shred: %i (%s)...",
854855 msg->param, mini(shred->name.c_str()) );
855856 this->free( shred, TRUE );
856857 retval = msg->param;
@@ -859,14 +860,14 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 2 unmodified lines
859860 else if( msg->type == MSG_REMOVEALL )
860861 {
861862 // print
862− EM_error3( "[chuck](VM): removing all (%i) shreds...", m_num_shreds );
863+ EM_error3( "[chuck](VM): ---- removing all (%i) shreds...", m_num_shreds );
863864 // remove all shreds
864865 this->removeAll();
865866 }
866867 else if( msg->type == MSG_CLEARVM ) // added 1.3.2.0
867868 {
868869 // print
869− EM_error3( "[chuck](VM): removing all shreds and resetting type system" );
870+ EM_error3( "[chuck](VM): ---- removing all shreds and resetting type system" );
870871 // first, remove all shreds
871872 this->removeAll();
872873 // next, clear user type system
@@ -889,20 +890,20 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 16 unmodified lines
889890 if( msg->args ) shred->args = *(msg->args);
890891
891892 const char * s = ( msg->shred ? msg->shred->name.c_str() : msg->code->name.c_str() );
892− EM_error3( "[chuck](VM): sporking incoming shred: %i (%s)...", xid, mini(s) );
893+ EM_error3( "[chuck](VM): ---- sporking incoming shred: %i (%s)...", xid, mini(s) );
893894 retval = xid;
894895 goto done;
895896 }
896897 else if( msg->type == MSG_KILL )
897898 {
898− EM_error3( "[chuck](VM): KILL received...." );
899+ EM_error3( "[chuck](VM): ---- KILL received...." );
899900 // close file handles and clean up
900901 // REFACTOR-2017: TODO all_detach function
901902 // all_detach();
902903 // TODO: free more memory?
903904
904905 // log
905− EM_log( CK_LOG_INFO, "(VM): exiting..." );
906+ EM_log( CK_LOG_INFO, "(VM): ---- exiting..." );
906907 // come again
907908 exit( 1 );
908909 }
@@ -924,19 +925,19 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 15 unmodified lines
924925 else if( msg->type == MSG_TIME )
925926 {
926927 float srate = m_srate; // 1.3.5.3; was: (float)Digitalio::sampling_rate();
927− CK_FPRINTF_STDERR( "[chuck](VM): the values of now:\n" );
928− CK_FPRINTF_STDERR( " now = %.6f (samp)\n", m_shreduler->now_system );
929− CK_FPRINTF_STDERR( " = %.6f (second)\n", m_shreduler->now_system / srate );
930− CK_FPRINTF_STDERR( " = %.6f (minute)\n", m_shreduler->now_system / srate / 60.0f );
931− CK_FPRINTF_STDERR( " = %.6f (hour)\n", m_shreduler->now_system / srate / 60.0f / 60.0f );
932− CK_FPRINTF_STDERR( " = %.6f (day)\n", m_shreduler->now_system / srate / 60.0f / 60.0f / 24.0f );
933− CK_FPRINTF_STDERR( " = %.6f (week)\n", m_shreduler->now_system / srate / 60.0f / 60.0f / 24.0f / 7.0f );
928+ CK_FPRINTF_STDERR( "[chuck](VM): ---- duration since VM start (now):\n" );
929+ CK_FPRINTF_STDERR( "%25.6f :: samp\n", m_shreduler->now_system );
930+ CK_FPRINTF_STDERR( "%25.6f :: second\n", m_shreduler->now_system / srate );
931+ CK_FPRINTF_STDERR( "%25.6f :: minute\n", m_shreduler->now_system / srate / 60.0f );
932+ CK_FPRINTF_STDERR( "%25.6f :: hour\n", m_shreduler->now_system / srate / 60.0f / 60.0f );
933+ CK_FPRINTF_STDERR( "%25.6f :: day\n", m_shreduler->now_system / srate / 60.0f / 60.0f / 24.0f );
934+ CK_FPRINTF_STDERR( "%25.6f :: week\n", m_shreduler->now_system / srate / 60.0f / 60.0f / 24.0f / 7.0f );
934935 }
935936 else if( msg->type == MSG_RESET_ID )
936937 {
937938 t_CKUINT n = m_shreduler->highest();
938939 m_shred_id = n;
939− CK_FPRINTF_STDERR( "[chuck](VM): resetting shred id to %lu...\n", m_shred_id + 1 );
940+ CK_FPRINTF_STDERR( "[chuck](VM): -- resetting shred id to %lu...\n", m_shred_id + 1 );
940941 }
941942
942943 done:
@@ -2432,19 +2433,24 @@ void Chuck_VM_Shreduler::status() · 1489 unmodified lines
24322433 t_CKUINT h = m_status.t_hour;
24332434 t_CKUINT m = m_status.t_minute;
24342435 t_CKUINT sec = m_status.t_second;
2435− CK_FPRINTF_STDOUT( "[chuck](VM): status (now == %ldh%ldm%lds, %.1f samps) ...\n",
2436− h, m, sec, m_status.now_system );
2436+ CK_FPRINTF_STDOUT( "[chuck](VM): ---- status | # of shreds in VM: %ld\n", m_status.list.size() );
2437+ CK_FPRINTF_STDOUT( " earth time: %s\n",
2438+ timestamp_formatted().c_str() );
2439+ CK_FPRINTF_STDOUT( " chuck time: %.0f::samp (%ldh%ldm%lds)\n",
2440+ m_status.now_system, h, m, sec );
24372441
24382442 // print status
2443+ if( m_status.list.size() ) CK_FPRINTF_STDOUT( " --------\n" );
24392444 for( t_CKUINT i = 0; i < m_status.list.size(); i++ )
24402445 {
24412446 shred = m_status.list[i];
24422447 CK_FPRINTF_STDOUT(
2443− " [shred id]: %ld [source]: %s [spork time]: %.2fs ago%s\n",
2448+ " [shred id]: %ld [source]: %s [spork time]: %.2fs ago%s\n",
24442449 shred->xid, mini( shred->name.c_str() ),
24452450 (m_status.now_system - shred->start) / m_status.srate,
24462451 shred->has_event ? " (blocked)" : "" );
24472452 }
2453+ if( m_status.list.size() ) CK_FPRINTF_STDOUT( " --------\n" );
24482454 }
24492455
24502456

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t