diff --git a/src/App.tsx b/src/App.tsx index 89e39ba..1b88dcb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -99,6 +99,8 @@ function App() { const [stats, setStats] = useState(null); const [history, setHistory] = useState<{ time: string; cpu: number }[]>([]); const [report, setReport] = useState(null); + const [searchTerm, setSearchBar] = useState(""); + const [pinnedPid, setPinnedPid] = useState(null); // Initial report check useEffect(() => { @@ -162,7 +164,11 @@ function App() { setReport(reportData); setView('report'); } else { - await invoke('start_profiling'); + if (pinnedPid) { + await invoke('start_targeted_profiling', { pid: pinnedPid }); + } else { + await invoke('start_profiling'); + } } }; @@ -213,6 +219,11 @@ function App() { const avgCpu = stats.cpu_usage.reduce((a, b) => a + b, 0) / stats.cpu_usage.length; const memoryPercent = (stats.used_memory / stats.total_memory) * 100; + const filteredLiveProcs = stats.processes.filter(p => + p.name.toLowerCase().includes(searchTerm.toLowerCase()) || + p.pid.toString().includes(searchTerm) + ); + return (
@@ -239,7 +250,7 @@ function App() { onClick={toggleRecording} > {stats.is_recording ? : } - {stats.is_recording ? `STOP (${formatDuration(stats.recording_duration)})` : "START PROFILING"} + {stats.is_recording ? `STOP (${formatDuration(stats.recording_duration)})` : (pinnedPid ? "PROFILE TARGET" : "START GLOBAL")}
@@ -327,14 +338,25 @@ function App() {
-
+

Live Feed

-
-
- Real-time +
+
+ setSearchBar(e.target.value)} + className="bg-surface1/50 border border-surface2 rounded-xl px-4 py-2 text-xs font-bold text-text placeholder:text-overlay1 focus:outline-none focus:ring-2 focus:ring-blue/30 w-64 transition-all" + /> +
+
+
+ Real-time +
@@ -347,12 +369,19 @@ function App() {
- {stats.processes.map((proc) => ( -
+ {filteredLiveProcs.map((proc) => ( +
setPinnedPid(pinnedPid === proc.pid ? null : proc.pid)} + >
{proc.name}
@@ -361,14 +390,14 @@ function App() {
{formatBytes(proc.memory, 0)}