mirror of
https://github.com/tridactyl/tridactyl.git
synced 2026-09-10 07:16:33 -04:00
Add perf markers to hint filtering and fix perf commands
This commit is contained in:
parent
6162b13809
commit
bca9f63a81
|
|
@ -37,6 +37,7 @@ import { contentState } from "@src/content/state_content"
|
|||
import * as config from "@src/lib/config"
|
||||
import Logger from "@src/lib/logging"
|
||||
import * as R from "ramda"
|
||||
import * as Perf from "@src/perf"
|
||||
|
||||
/** @hidden */
|
||||
const logger = new Logger("hinting")
|
||||
|
|
@ -1043,6 +1044,7 @@ type HintFilter = (s: string) => void
|
|||
/** Show only hints prefixed by fstr. Focus first match
|
||||
@hidden */
|
||||
function filterHintsSimple(fstr) {
|
||||
const perfMarker = new Perf.Marker("Hinting", "filterHintsSimple").start()
|
||||
const active: Hint[] = []
|
||||
let foundMatch
|
||||
|
||||
|
|
@ -1069,6 +1071,7 @@ function filterHintsSimple(fstr) {
|
|||
if (active.length === 1 && config.get("hintautoselect") === "true") {
|
||||
selectFocusedHint()
|
||||
}
|
||||
perfMarker.end()
|
||||
}
|
||||
|
||||
/** Partition the filter string into hintchars and content filter strings.
|
||||
|
|
@ -1083,6 +1086,7 @@ function filterHintsSimple(fstr) {
|
|||
@hidden
|
||||
*/
|
||||
function filterHintsVimperator(query: string, reflow = false) {
|
||||
const perfMarker = new Perf.Marker("Hinting", "filterHintsVimperator").start()
|
||||
/** Partition a query into a tagged array of substrings */
|
||||
function partitionquery(
|
||||
query,
|
||||
|
|
@ -1162,6 +1166,7 @@ function filterHintsVimperator(query: string, reflow = false) {
|
|||
if (active.length === 1 && config.get("hintautoselect") === "true") {
|
||||
selectFocusedHint(true)
|
||||
}
|
||||
perfMarker.end()
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5790,8 +5790,11 @@ export function buildFilterConfigs(filters: string[]): Perf.StatsFilterConfig[]
|
|||
export async function perfdump(...filters: string[]) {
|
||||
const filterconfigs = buildFilterConfigs(filters)
|
||||
const entries = window.tri.statsLogger.getEntries(...filterconfigs)
|
||||
console.log(filterconfigs)
|
||||
return open("data:application/json;charset=UTF-8," + JSON.stringify(entries))
|
||||
console.log("Filter configs:", filterconfigs)
|
||||
console.log("Performance entries:", entries)
|
||||
const jsonStr = JSON.stringify(entries, null, 2)
|
||||
await clipboard("yank", jsonStr)
|
||||
return fillcmdline_tmp(3000, `perfdump: ${entries.length} samples copied to clipboard. Check browser console for details.`)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5811,8 +5814,9 @@ export async function perfhistogram(...filters: string[]) {
|
|||
return fillcmdline_tmp(3000, "perfhistogram: No samples found.")
|
||||
}
|
||||
const histogram = Perf.renderStatsHistogram(entries)
|
||||
console.log(histogram)
|
||||
return open("data:text/plain;charset=UTF-8;base64," + btoa(histogram))
|
||||
console.log("Histogram:\n" + histogram)
|
||||
await clipboard("yank", histogram)
|
||||
return fillcmdline_tmp(3000, `perfhistogram: ${entries.length} samples. Histogram copied to clipboard. Check browser console for details.`)
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
|
|
|||
|
|
@ -340,6 +340,7 @@ export class StatsFilter {
|
|||
|
||||
matches(entry: PerformanceEntry): boolean {
|
||||
const metricNameInfo = extractMetricName(entry.name)
|
||||
if (!metricNameInfo) return false
|
||||
return !(
|
||||
(this.config.kind === "functionName" && this.config.functionName !== metricNameInfo.functionName) ||
|
||||
(this.config.kind === "ownerName" && this.config.ownerName !== metricNameInfo.ownerName) ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue