@@ -10,9 +10,10 @@ use bevy::time::common_conditions::on_timer;
10
10
use bevy_mod_reqwest:: { BevyReqwest , ReqwestErrorEvent , ReqwestResponseEvent } ;
11
11
use bevy_persistent:: Persistent ;
12
12
use serde_json:: { json, Value } ;
13
- use std:: env;
14
13
use std:: path:: Path ;
15
14
use std:: time:: Duration ;
15
+ use std:: { env, process} ;
16
+ use sysinfo:: Pid ;
16
17
use uuid:: Uuid ;
17
18
18
19
const TELEMETRY_URL : & str = "https://telemetry.phichain.rs/report" ;
@@ -145,17 +146,33 @@ fn handle_push_telemetry_event_system(
145
146
fps = value;
146
147
}
147
148
149
+ let mut system = sysinfo:: System :: new_all ( ) ;
150
+ system. refresh_all ( ) ;
151
+
152
+ let pid = process:: id ( ) ;
153
+ let process = system. process ( Pid :: from_u32 ( pid) ) . unwrap ( ) ;
154
+
155
+ let info = os_info:: get ( ) ;
156
+
148
157
let payload = json ! ( {
149
158
"timestamp" : chrono:: Utc :: now( ) . to_rfc3339( ) ,
150
159
"reporter" : "phichain-editor" ,
151
160
"uuid" : telemetry_manager. uuid,
152
161
"type" : event. event_type,
153
162
"system" : {
154
- "os" : system_info. os. trim( ) ,
163
+ "arch" : env:: consts:: ARCH ,
164
+ "os" : env:: consts:: OS ,
165
+ "name" : & info. os_type( ) . to_string( ) ,
166
+ "version" : & info. version( ) . to_string( ) ,
167
+ "family" : env:: consts:: FAMILY ,
168
+ "bitness" : info. bitness( ) . to_string( ) ,
155
169
"kernel" : system_info. kernel. trim( ) ,
156
- "cpu" : system_info. cpu. trim( ) ,
157
- "core_count" : system_info. core_count. trim( ) ,
158
- "memory" : system_info. memory. trim( ) ,
170
+ } ,
171
+ "hardware" : {
172
+ "cpu" : system. cpus( ) . first( ) . unwrap( ) . brand( ) ,
173
+ "core_count" : system. cpus( ) . len( ) ,
174
+ "memory" : system. total_memory( ) ,
175
+ "memory_formatted" : format!( "{:.1} GiB" , system. total_memory( ) as f64 / 1024.0 / 1024.0 / 1024.0 ) ,
159
176
} ,
160
177
"adapter" : & * * * adapter_info,
161
178
"environment" : {
@@ -171,8 +188,8 @@ fn handle_push_telemetry_event_system(
171
188
"performance" : {
172
189
"fps" : fps,
173
190
"entities" : entities. len( ) ,
174
- "cpu" : 0.5 , // TODO
175
- "memory" : 1024 , // TODO
191
+ "cpu" : process . cpu_usage ( ) ,
192
+ "memory" : process . memory ( ) ,
176
193
} ,
177
194
"config" : * * editor_settings,
178
195
"uptime" : time. elapsed( ) . as_secs_f32( ) ,
0 commit comments