Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benpoulson committed Apr 25, 2024
1 parent 66dc3d9 commit 4a96721
Show file tree
Hide file tree
Showing 13 changed files with 2,086 additions and 1,500 deletions.
458 changes: 247 additions & 211 deletions backend/package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions backend/src/repositories/TraceRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class TraceRepository {
let WHERE = "";

if (search) {
WHERE += `(CONCAT(method, " ", url, " ", status_code, " ", server_name, " ", user_id, " ", ip) LIKE ?)`;
WHERE += `(CONCAT_WS(method, " ", url, " ", status_code, " ", server_name, " ", user_id, " ", ip) LIKE ?)`;
params.push(search);
}

Expand All @@ -79,13 +79,13 @@ export class TraceRepository {
}

return this.db.query<Trace[]>(`
SELECT id, uuid, url, method, status_code, server_name, ajax, pmu, wt, cpu, user_id, ip, created_at
FROM ${TraceRepository.getTableName()}
WHERE ${WHERE}
ORDER BY id DESC
LIMIT ${rowCount}
OFFSET ${(page-1)*rowCount}
`, params);
SELECT id, uuid, url, method, status_code, server_name, ajax, pmu, wt, cpu, user_id, ip, created_at
FROM ${TraceRepository.getTableName()}
WHERE ${WHERE}
ORDER BY id DESC
LIMIT ${rowCount}
OFFSET ${(page-1)*rowCount}
`, params);
}

public async getTracesCount() {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/BprofLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class BprofLib {
}

parseParentChild(parentChild: string): [string | null, string] {
const ret = parentChild.split('>>>');
const ret = parentChild.split(/==>|>>>/);
return ret.length === 2 ? [ret[0], ret[1]] : [null, ret[0]];
}

Expand Down
2,616 changes: 1,428 additions & 1,188 deletions frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/src/Components/Copyright.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Copyright() {
<>
<Box sx={{textAlign: "center"}}>
<Typography variant="subtitle1" component="div" sx={{mt: 3}}>
<Link href="https://github.com/nexelity/bprof-viewer/" target={"_blank"}>BPROF</Link> &copy; {new Date().getFullYear()} - v1.4 (abc238414 2023-01-01)
<Link href="https://github.com/nexelity/bprof-viewer/" target={"_blank"}>BPROF</Link> &copy; {new Date().getFullYear()} - v2.0
</Typography>
</Box>
</>
Expand Down
37 changes: 37 additions & 0 deletions frontend/src/Interfaces/IState.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {Trace} from "../Services/Bprof";

export type TableRows = (object | string[] | number[])[] | any;

export interface IState {
id: string;
tableRows: TableRows,
trace: Trace | null,
totals: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
} | null,
symbols: {
[key: string]: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
callers: number;
callerMap: { [key: string]: boolean };
excl_ct: number;
excl_wt: number;
}
} | null,
mysqlQueries: number;
search: string;
}
20 changes: 20 additions & 0 deletions frontend/src/Interfaces/StatsResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export interface StatsResponse {
total: {
count: number;
}
last_24h: {
count: number;
}
stats: {
count: number;
avg: number;
max: number;
}
stats_by_day: Array<{
day: string;
total_rows: number;
min_wt: number;
avg_wt: number;
max_wt: number;
}>
}
4 changes: 4 additions & 0 deletions frontend/src/Interfaces/TracePaginatedResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import {Trace} from "../Services/Bprof";

export interface TracePaginatedResponse extends Array<Trace> {
}
31 changes: 31 additions & 0 deletions frontend/src/Interfaces/TraceResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {Trace} from "../Services/Bprof";

export interface TraceResponse {
trace: Trace,
totals: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
},
symbols: {
[key: string]: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
callers: number;
callerMap: { [key: string]: boolean };
excl_ct: number;
excl_wt: number;
}
}
}
40 changes: 3 additions & 37 deletions frontend/src/Pages/SingleTrace.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,19 @@
import * as React from 'react';
import {useEffect, useState} from 'react';
import TableContainer from '@mui/material/TableContainer';
import InfoIcon from '@mui/icons-material/Info';
import Paper from '@mui/material/Paper';
import Box from '@mui/material/Box';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import Link from "@mui/material/Link";
import {Trace} from "../Services/Bprof";
import {TraceRepositoryClient} from "../Repository/TraceRepositoryClient";
import {useEffect, useState} from "react";
import MUIDataTable, {MUIDataTableColumn, MUIDataTableColumnOptions, MUIDataTableOptions} from "mui-datatables";
import MUIDataTable, {MUIDataTableColumn, MUIDataTableOptions} from "mui-datatables";
import {useParams} from "react-router-dom";
import Tooltip from '@mui/material/Tooltip';
import {IconButton, Skeleton} from "@mui/material";
import {sortNumeric, toFixedDown} from "../Services/Utils";

interface IState {
id: string;
tableRows: (object | string[] | number[])[] | any,
trace: Trace | null,
totals: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
} | null,
symbols: {
[key: string]: {
ct: number;
wt: number;
ut: number;
st: number;
cpu: number;
mu: number;
pmu: number;
samples: number;
callers: number;
callerMap: {[key: string]: boolean};
excl_ct: number;
excl_wt: number;
}
} | null,
mysqlQueries: number;
search: string;
}
import {IState} from "../Interfaces/IState";

export default function SingleTrace() {

Expand Down
Loading

0 comments on commit 4a96721

Please sign in to comment.