MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / _report_usage_once

Method _report_usage_once

fastdeploy/usage/usage_lib.py:295–334  ·  view source on GitHub ↗
(self, fd_config: FDConfig, extra_kvs: dict[str, Any])

Source from the content-addressed store, hash-verified

293 self._report_continuous_usage()
294
295 def _report_usage_once(self, fd_config: FDConfig, extra_kvs: dict[str, Any]):
296 if current_platform.is_cuda_alike():
297 self.gpu_num = cuda_device_count()
298 self.gpu_type, self.gpu_memory_per_device = cuda_get_device_properties(0, ("name", "total_memory"))
299 if current_platform.is_xpu():
300 self.gpu_num = xpu_device_count()
301 self.gpu_type = get_xpu_model()
302 self.gpu_memory_per_device = paddle.device.xpu.memory_total()
303 if current_platform.is_cuda():
304 self.cuda_runtime = get_cuda_version()
305 self.provider = detect_cloud_provider()
306 self.architecture = platform.machine()
307 self.platform = platform.platform()
308 self.total_memory = psutil.virtual_memory().total
309
310 info = cpuinfo.get_cpu_info()
311 self.cpu_num = info.get("count", None)
312 self.cpu_type = info.get("brand_raw", "")
313 self.cpu_family_model_stepping = ",".join(
314 [
315 str(info.get("family", "")),
316 str(info.get("model", "")),
317 str(info.get("stepping", "")),
318 ]
319 )
320 self.env_var_json = json.dumps({env_var: getattr(envs, env_var) for env_var in _USAGE_ENV_VARS_TO_COLLECT})
321
322 self.model_architecture = fd_config.model_config.architectures[0]
323 from fastdeploy import __version__ as FD_VERSION
324
325 self.fd_version = FD_VERSION
326 self.log_time = get_current_timestamp_ns()
327 self.source = envs.FD_USAGE_SOURCE
328
329 self.config = json.dumps({k: simple_convert(v) for k, v in vars(fd_config).items()})
330 data = vars(self)
331 if extra_kvs:
332 data.update(extra_kvs)
333 self._write_to_file(data)
334 self._send_to_server(data)
335
336 def _send_to_server(self, data: dict[str, Any]) -> None:
337 try:

Calls 15

_write_to_fileMethod · 0.95
_send_to_serverMethod · 0.95
cuda_device_countFunction · 0.85
xpu_device_countFunction · 0.85
get_xpu_modelFunction · 0.85
detect_cloud_providerFunction · 0.85
get_current_timestamp_nsFunction · 0.85
simple_convertFunction · 0.85
is_cuda_alikeMethod · 0.80
joinMethod · 0.80
itemsMethod · 0.80