Skip to content

Commit

Permalink
autoparse correct vram total when available
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 26, 2024
1 parent 5ca346b commit fd6c11a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions components/UsageGraph.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';

const UsageGraph = ({ data, maxMemory }) => {
const parsedData = Object.entries(data).map(([time, mem]) => ({
time: parseFloat(time.split(' ')[0]),
mem: parseInt((mem as string).split(' ')[0])
})).sort((a, b) => a.time - b.time);
const UsageGraph = ({ data }) => {
const maxMemory = data["total"] ? parseInt(data["total"].split(' ')[0]) : undefined;

const parsedData = Object.entries(data)
.filter(([key]) => key !== "total")
.map(([time, mem]) => ({
time: parseFloat(time.split(' ')[0]),
mem: parseInt((mem as string).split(' ')[0])
}))
.sort((a, b) => a.time - b.time);

const maxYValue = maxMemory || Math.max(...parsedData.map(item => item.mem));

Expand Down
2 changes: 1 addition & 1 deletion pages/workflow/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function WorkflowResultDetail() {
VRAM Usage Over Time
</h5>
<div className="w-full">
<UsageGraph data={workflowResult?.machine_stats?.vram_time_series || {}} maxMemory={workflowResult?.peak_vram} />
<UsageGraph data={workflowResult?.machine_stats?.vram_time_series || {}} />
</div>
</Card>
</div>
Expand Down

0 comments on commit fd6c11a

Please sign in to comment.