History

update OTF message output

Ge Wang committed 3 years ago

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

Showing the changes to src/core/chuck_vm.cpp (1 of 2 files). Show all

Unified · Split

src/core/chuck_vm.cpp+31−25
@@ -36,6 +36,7 @@ · 35 unmodified lines
36#include "chuck_dl.h"36#include "chuck_dl.h"
37#include "chuck_globals.h" // added 1.4.1.0 (jack)37#include "chuck_globals.h" // added 1.4.1.0 (jack)
38#include "chuck_errmsg.h"38#include "chuck_errmsg.h"
39#include "util_string.h"
39 40
40#ifndef __DISABLE_SERIAL__41#ifndef __DISABLE_SERIAL__
41#include "chuck_io.h"42#include "chuck_io.h"
@@ -752,7 +753,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 710 unmodified lines
752 Chuck_VM_Shred * out = m_shreduler->lookup( msg->param );753 Chuck_VM_Shred * out = m_shreduler->lookup( msg->param );
753 if( !out )754 if( !out )
754 {755 {
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...",
756 msg->param );757 msg->param );
757 retval = 0;758 retval = 0;
758 goto done;759 goto done;
@@ -785,7 +786,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 26 unmodified lines
785 // replace786 // replace
786 if( m_shreduler->remove( out ) && m_shreduler->shredule( shred ) )787 if( m_shreduler->remove( out ) && m_shreduler->shredule( shred ) )
787 {788 {
788 EM_error3( "[chuck](VM): replacing shred %i (%s) with %i (%s)...",789 EM_error3( "[chuck](VM): ---- replacing shred %i (%s) with %i (%s)...",
789 out->xid, mini(out->name.c_str()), shred->xid, mini(shred->name.c_str()) );790 out->xid, mini(out->name.c_str()), shred->xid, mini(shred->name.c_str()) );
790 this->free( out, TRUE, FALSE );791 this->free( out, TRUE, FALSE );
791 retval = shred->xid;792 retval = shred->xid;
@@ -797,7 +798,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 5 unmodified lines
797 }798 }
798 else799 else
799 {800 {
800 EM_error3( "[chuck](VM): shreduler ERROR replacing shred %i...",801 EM_error3( "[chuck](VM): ---- shreduler ERROR replacing shred %i...",
801 out->xid );802 out->xid );
802 shred->release();803 shred->release();
803 retval = 0;804 retval = 0;
@@ -810,7 +811,7 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 6 unmodified lines
810 {811 {
811 if( !this->m_num_shreds)812 if( !this->m_num_shreds)
812 {813 {
813 EM_error3( "[chuck](VM): no shreds to remove..." );814 EM_error3( "[chuck](VM): ---- no shreds to remove..." );
814 retval = 0;815 retval = 0;
815 goto done;816 goto done;
816 }817 }
@@ -821,14 +822,14 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 4 unmodified lines
821 xid--;822 xid--;
822 if( xid >= 0 )823 if( xid >= 0 )
823 {824 {
824 EM_error3( "[chuck](VM): removing recent shred: %i (%s)...",825 EM_error3( "[chuck](VM): ---- removing recent shred: %i (%s)...",
825 xid, mini(shred->name.c_str()) );826 xid, mini(shred->name.c_str()) );
826 this->free( shred, TRUE );827 this->free( shred, TRUE );
827 retval = xid;828 retval = xid;
828 }829 }
829 else830 else
830 {831 {
831 EM_error3( "[chuck](VM): no shreds removed..." );832 EM_error3( "[chuck](VM): ---- no shreds removed..." );
832 retval = 0;833 retval = 0;
833 goto done;834 goto done;
834 }835 }
@@ -838,19 +839,19 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 3 unmodified lines
838 Chuck_VM_Shred * shred = m_shreduler->lookup( msg->param );839 Chuck_VM_Shred * shred = m_shreduler->lookup( msg->param );
839 if( !shred )840 if( !shred )
840 {841 {
841 EM_error3( "[chuck](VM): cannot remove: no shred with id %i...",842 EM_error3( "[chuck](VM): ---- cannot remove: no shred with id %i...",
842 msg->param );843 msg->param );
843 retval = 0;844 retval = 0;
844 goto done;845 goto done;
845 }846 }
846 if( shred != m_shreduler->m_current_shred && !m_shreduler->remove( shred ) ) // was lookup847 if( shred != m_shreduler->m_current_shred && !m_shreduler->remove( shred ) ) // was lookup
847 {848 {
848 EM_error3( "[chuck](VM): shreduler: cannot remove shred %i...",849 EM_error3( "[chuck](VM): ---- shreduler: cannot remove shred %i...",
849 msg->param );850 msg->param );
850 retval = 0;851 retval = 0;
851 goto done;852 goto done;
852 }853 }
853 EM_error3( "[chuck](VM): removing shred: %i (%s)...",854 EM_error3( "[chuck](VM) ---- removing shred: %i (%s)...",
854 msg->param, mini(shred->name.c_str()) );855 msg->param, mini(shred->name.c_str()) );
855 this->free( shred, TRUE );856 this->free( shred, TRUE );
856 retval = msg->param;857 retval = msg->param;
@@ -859,14 +860,14 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 2 unmodified lines
859 else if( msg->type == MSG_REMOVEALL )860 else if( msg->type == MSG_REMOVEALL )
860 {861 {
861 // print862 // 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 );
863 // remove all shreds864 // remove all shreds
864 this->removeAll();865 this->removeAll();
865 }866 }
866 else if( msg->type == MSG_CLEARVM ) // added 1.3.2.0867 else if( msg->type == MSG_CLEARVM ) // added 1.3.2.0
867 {868 {
868 // print869 // 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" );
870 // first, remove all shreds871 // first, remove all shreds
871 this->removeAll();872 this->removeAll();
872 // next, clear user type system873 // next, clear user type system
@@ -889,20 +890,20 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 16 unmodified lines
889 if( msg->args ) shred->args = *(msg->args);890 if( msg->args ) shred->args = *(msg->args);
890 891
891 const char * s = ( msg->shred ? msg->shred->name.c_str() : msg->code->name.c_str() );892 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) );
893 retval = xid;894 retval = xid;
894 goto done;895 goto done;
895 }896 }
896 else if( msg->type == MSG_KILL )897 else if( msg->type == MSG_KILL )
897 {898 {
898 EM_error3( "[chuck](VM): KILL received...." );899 EM_error3( "[chuck](VM): ---- KILL received...." );
899 // close file handles and clean up900 // close file handles and clean up
900 // REFACTOR-2017: TODO all_detach function901 // REFACTOR-2017: TODO all_detach function
901 // all_detach();902 // all_detach();
902 // TODO: free more memory?903 // TODO: free more memory?
903 904
904 // log905 // log
905 EM_log( CK_LOG_INFO, "(VM): exiting..." );906 EM_log( CK_LOG_INFO, "(VM): ---- exiting..." );
906 // come again907 // come again
907 exit( 1 );908 exit( 1 );
908 }909 }
@@ -924,19 +925,19 @@ t_CKUINT Chuck_VM::process_msg( Chuck_Msg * msg ) · 15 unmodified lines
924 else if( msg->type == MSG_TIME )925 else if( msg->type == MSG_TIME )
925 {926 {
926 float srate = m_srate; // 1.3.5.3; was: (float)Digitalio::sampling_rate();927 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( "[chuck](VM): ---- duration since VM start (now):\n" );
928 CK_FPRINTF_STDERR( " now = %.6f (samp)\n", m_shreduler->now_system );929 CK_FPRINTF_STDERR( "%25.6f :: samp\n", m_shreduler->now_system );
929 CK_FPRINTF_STDERR( " = %.6f (second)\n", m_shreduler->now_system / srate );930 CK_FPRINTF_STDERR( "%25.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( "%25.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( "%25.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( "%25.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 );934 CK_FPRINTF_STDERR( "%25.6f :: week\n", m_shreduler->now_system / srate / 60.0f / 60.0f / 24.0f / 7.0f );
934 }935 }
935 else if( msg->type == MSG_RESET_ID )936 else if( msg->type == MSG_RESET_ID )
936 {937 {
937 t_CKUINT n = m_shreduler->highest();938 t_CKUINT n = m_shreduler->highest();
938 m_shred_id = n;939 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 );
940 }941 }
941 942
942done:943done:
@@ -2432,19 +2433,24 @@ void Chuck_VM_Shreduler::status() · 1489 unmodified lines
2432 t_CKUINT h = m_status.t_hour;2433 t_CKUINT h = m_status.t_hour;
2433 t_CKUINT m = m_status.t_minute;2434 t_CKUINT m = m_status.t_minute;
2434 t_CKUINT sec = m_status.t_second;2435 t_CKUINT sec = m_status.t_second;
2435 CK_FPRINTF_STDOUT( "[chuck](VM): status (now == %ldh%ldm%lds, %.1f samps) ...\n",2436 CK_FPRINTF_STDOUT( "[chuck](VM): ---- status | # of shreds in VM: %ld\n", m_status.list.size() );
2436 h, m, sec, m_status.now_system );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 );
2437 2441
2438 // print status2442 // print status
2443 if( m_status.list.size() ) CK_FPRINTF_STDOUT( " --------\n" );
2439 for( t_CKUINT i = 0; i < m_status.list.size(); i++ )2444 for( t_CKUINT i = 0; i < m_status.list.size(); i++ )
2440 {2445 {
2441 shred = m_status.list[i];2446 shred = m_status.list[i];
2442 CK_FPRINTF_STDOUT(2447 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",
2444 shred->xid, mini( shred->name.c_str() ),2449 shred->xid, mini( shred->name.c_str() ),
2445 (m_status.now_system - shred->start) / m_status.srate,2450 (m_status.now_system - shred->start) / m_status.srate,
2446 shred->has_event ? " (blocked)" : "" );2451 shred->has_event ? " (blocked)" : "" );
2447 }2452 }
2453 if( m_status.list.size() ) CK_FPRINTF_STDOUT( " --------\n" );
2448}2454}
2449 2455
2450 2456

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