@@ -37,6 +37,7 @@ use hyperlight_guest_bin::guest_function::register::register_function;
3737use hyperlight_guest_bin:: guest_logger:: log_message;
3838use hyperlight_guest_bin:: host_comm:: { call_host_function, print_output_with_host_print} ;
3939
40+ #[ hyperlight_guest_tracing:: trace_function]
4041fn send_message_to_host_method (
4142 method_name : & str ,
4243 guest_message : & str ,
@@ -52,6 +53,7 @@ fn send_message_to_host_method(
5253 Ok ( get_flatbuffer_result ( res) )
5354}
5455
56+ #[ hyperlight_guest_tracing:: trace_function]
5557fn guest_function ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
5658 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
5759 send_message_to_host_method ( "HostMethod" , "Hello from GuestFunction, " , message)
@@ -63,6 +65,7 @@ fn guest_function(function_call: &FunctionCall) -> Result<Vec<u8>> {
6365 }
6466}
6567
68+ #[ hyperlight_guest_tracing:: trace_function]
6669fn guest_function1 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
6770 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
6871 send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction1, " , message)
@@ -74,6 +77,7 @@ fn guest_function1(function_call: &FunctionCall) -> Result<Vec<u8>> {
7477 }
7578}
7679
80+ #[ hyperlight_guest_tracing:: trace_function]
7781fn guest_function2 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
7882 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
7983 send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction2, " , message)
@@ -85,6 +89,7 @@ fn guest_function2(function_call: &FunctionCall) -> Result<Vec<u8>> {
8589 }
8690}
8791
92+ #[ hyperlight_guest_tracing:: trace_function]
8893fn guest_function3 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
8994 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
9095 send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction3, " , message)
@@ -96,6 +101,7 @@ fn guest_function3(function_call: &FunctionCall) -> Result<Vec<u8>> {
96101 }
97102}
98103
104+ #[ hyperlight_guest_tracing:: trace_function]
99105fn guest_function4 ( _: & FunctionCall ) -> Result < Vec < u8 > > {
100106 call_host_function :: < ( ) > (
101107 "HostMethod4" ,
@@ -108,6 +114,7 @@ fn guest_function4(_: &FunctionCall) -> Result<Vec<u8>> {
108114 Ok ( get_flatbuffer_result ( ( ) ) )
109115}
110116
117+ #[ hyperlight_guest_tracing:: trace_function]
111118fn guest_log_message ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
112119 if let (
113120 ParameterValue :: String ( message) ,
@@ -141,6 +148,7 @@ fn guest_log_message(function_call: &FunctionCall) -> Result<Vec<u8>> {
141148 }
142149}
143150
151+ #[ hyperlight_guest_tracing:: trace_function]
144152fn call_error_method ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
145153 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
146154 send_message_to_host_method ( "ErrorMethod" , "Error From Host: " , message)
@@ -152,11 +160,13 @@ fn call_error_method(function_call: &FunctionCall) -> Result<Vec<u8>> {
152160 }
153161}
154162
163+ #[ hyperlight_guest_tracing:: trace_function]
155164fn call_host_spin ( _: & FunctionCall ) -> Result < Vec < u8 > > {
156165 call_host_function :: < ( ) > ( "Spin" , None , ReturnType :: Void ) ?;
157166 Ok ( get_flatbuffer_result ( ( ) ) )
158167}
159168
169+ #[ hyperlight_guest_tracing:: trace_function]
160170fn host_call_loop ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
161171 if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
162172 loop {
@@ -171,6 +181,7 @@ fn host_call_loop(function_call: &FunctionCall) -> Result<Vec<u8>> {
171181}
172182
173183#[ no_mangle]
184+ #[ hyperlight_guest_tracing:: trace_function]
174185pub extern "C" fn hyperlight_main ( ) {
175186 let print_output_def = GuestFunctionDefinition :: new (
176187 "PrintOutput" . to_string ( ) ,
@@ -258,6 +269,7 @@ pub extern "C" fn hyperlight_main() {
258269}
259270
260271#[ no_mangle]
272+ #[ hyperlight_guest_tracing:: trace_function]
261273pub fn guest_dispatch_function ( function_call : FunctionCall ) -> Result < Vec < u8 > > {
262274 Err ( HyperlightGuestError :: new (
263275 ErrorCode :: GuestFunctionNotFound ,
0 commit comments