@@ -37,6 +37,7 @@ use hyperlight_guest_bin::guest_function::register::register_function;
37
37
use hyperlight_guest_bin:: guest_logger:: log_message;
38
38
use hyperlight_guest_bin:: host_comm:: { call_host_function, print_output_with_host_print} ;
39
39
40
+ #[ hyperlight_guest_tracing:: trace_function]
40
41
fn send_message_to_host_method (
41
42
method_name : & str ,
42
43
guest_message : & str ,
@@ -52,6 +53,7 @@ fn send_message_to_host_method(
52
53
Ok ( get_flatbuffer_result ( res) )
53
54
}
54
55
56
+ #[ hyperlight_guest_tracing:: trace_function]
55
57
fn guest_function ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
56
58
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
57
59
send_message_to_host_method ( "HostMethod" , "Hello from GuestFunction, " , message)
@@ -63,6 +65,7 @@ fn guest_function(function_call: &FunctionCall) -> Result<Vec<u8>> {
63
65
}
64
66
}
65
67
68
+ #[ hyperlight_guest_tracing:: trace_function]
66
69
fn guest_function1 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
67
70
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
68
71
send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction1, " , message)
@@ -74,6 +77,7 @@ fn guest_function1(function_call: &FunctionCall) -> Result<Vec<u8>> {
74
77
}
75
78
}
76
79
80
+ #[ hyperlight_guest_tracing:: trace_function]
77
81
fn guest_function2 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
78
82
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
79
83
send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction2, " , message)
@@ -85,6 +89,7 @@ fn guest_function2(function_call: &FunctionCall) -> Result<Vec<u8>> {
85
89
}
86
90
}
87
91
92
+ #[ hyperlight_guest_tracing:: trace_function]
88
93
fn guest_function3 ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
89
94
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
90
95
send_message_to_host_method ( "HostMethod1" , "Hello from GuestFunction3, " , message)
@@ -96,6 +101,7 @@ fn guest_function3(function_call: &FunctionCall) -> Result<Vec<u8>> {
96
101
}
97
102
}
98
103
104
+ #[ hyperlight_guest_tracing:: trace_function]
99
105
fn guest_function4 ( _: & FunctionCall ) -> Result < Vec < u8 > > {
100
106
call_host_function :: < ( ) > (
101
107
"HostMethod4" ,
@@ -108,6 +114,7 @@ fn guest_function4(_: &FunctionCall) -> Result<Vec<u8>> {
108
114
Ok ( get_flatbuffer_result ( ( ) ) )
109
115
}
110
116
117
+ #[ hyperlight_guest_tracing:: trace_function]
111
118
fn guest_log_message ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
112
119
if let (
113
120
ParameterValue :: String ( message) ,
@@ -141,6 +148,7 @@ fn guest_log_message(function_call: &FunctionCall) -> Result<Vec<u8>> {
141
148
}
142
149
}
143
150
151
+ #[ hyperlight_guest_tracing:: trace_function]
144
152
fn call_error_method ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
145
153
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
146
154
send_message_to_host_method ( "ErrorMethod" , "Error From Host: " , message)
@@ -152,11 +160,13 @@ fn call_error_method(function_call: &FunctionCall) -> Result<Vec<u8>> {
152
160
}
153
161
}
154
162
163
+ #[ hyperlight_guest_tracing:: trace_function]
155
164
fn call_host_spin ( _: & FunctionCall ) -> Result < Vec < u8 > > {
156
165
call_host_function :: < ( ) > ( "Spin" , None , ReturnType :: Void ) ?;
157
166
Ok ( get_flatbuffer_result ( ( ) ) )
158
167
}
159
168
169
+ #[ hyperlight_guest_tracing:: trace_function]
160
170
fn host_call_loop ( function_call : & FunctionCall ) -> Result < Vec < u8 > > {
161
171
if let ParameterValue :: String ( message) = & function_call. parameters . as_ref ( ) . unwrap ( ) [ 0 ] {
162
172
loop {
@@ -171,6 +181,7 @@ fn host_call_loop(function_call: &FunctionCall) -> Result<Vec<u8>> {
171
181
}
172
182
173
183
#[ no_mangle]
184
+ #[ hyperlight_guest_tracing:: trace_function]
174
185
pub extern "C" fn hyperlight_main ( ) {
175
186
let print_output_def = GuestFunctionDefinition :: new (
176
187
"PrintOutput" . to_string ( ) ,
@@ -258,6 +269,7 @@ pub extern "C" fn hyperlight_main() {
258
269
}
259
270
260
271
#[ no_mangle]
272
+ #[ hyperlight_guest_tracing:: trace_function]
261
273
pub fn guest_dispatch_function ( function_call : FunctionCall ) -> Result < Vec < u8 > > {
262
274
Err ( HyperlightGuestError :: new (
263
275
ErrorCode :: GuestFunctionNotFound ,
0 commit comments