MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / performance_process

Function performance_process

packages/server/src/performance.rs:567–609  ·  view source on GitHub ↗
(
    ps: PsProcess,
    foreground: Option<&ForegroundProcess>,
)

Source from the content-addressed store, hash-verified

565}
566
567fn performance_process(
568 ps: PsProcess,
569 foreground: Option<&ForegroundProcess>,
570) -> PerformanceProcess {
571 let app_path = app_bundle_path_from_command(&ps.command);
572 let metadata = app_path.as_deref().and_then(app_metadata);
573 let fallback_name = process_name_from_command(&ps.command);
574 let is_foreground =
575 foreground.is_some_and(|process| process.process_identifier as i32 == ps.pid);
576 PerformanceProcess {
577 pid: ps.pid,
578 parent_pid: ps.parent_pid,
579 process: metadata
580 .as_ref()
581 .and_then(|metadata| metadata.app_name.clone())
582 .or_else(|| {
583 foreground
584 .filter(|foreground| foreground.process_identifier as i32 == ps.pid)
585 .and_then(|foreground| foreground.app_name.clone())
586 })
587 .unwrap_or(fallback_name),
588 role: process_role(&ps.command),
589 state: ps.state,
590 app_name: metadata
591 .as_ref()
592 .and_then(|metadata| metadata.app_name.clone())
593 .or_else(|| {
594 foreground
595 .filter(|foreground| foreground.process_identifier as i32 == ps.pid)
596 .and_then(|foreground| foreground.app_name.clone())
597 }),
598 bundle_identifier: metadata
599 .as_ref()
600 .and_then(|metadata| metadata.bundle_identifier.clone())
601 .or_else(|| {
602 foreground
603 .filter(|foreground| foreground.process_identifier as i32 == ps.pid)
604 .and_then(|foreground| foreground.bundle_identifier.clone())
605 }),
606 command: ps.command,
607 is_foreground,
608 }
609}
610
611fn is_relevant_app_process(command: &str) -> bool {
612 command.contains(".app/") || command.contains(".appex/") || command.contains("WebContent")

Callers 2

app_processes_from_psFunction · 0.85

Calls 4

process_roleFunction · 0.85
cloneMethod · 0.65

Tested by

no test coverage detected