Skip to content

Commit

Permalink
fix rust library bug
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Aug 21, 2024
1 parent d667b5b commit 3611964
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Binary file modified pyroscope/pprof-bin/pkg/pprof_bin_bg.wasm
Binary file not shown.
5 changes: 5 additions & 0 deletions pyroscope/pprof-bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use std::vec::Vec;
use wasm_bindgen::prelude::*;
use std::sync::Arc;

//TODO: REMOVE
use std::fs;

pub mod pprof_pb {

Expand Down Expand Up @@ -80,6 +82,9 @@ struct Tree {
impl Tree {
pub fn total(&self) -> i64 {
let mut total: i64 = 0;
if !self.nodes.contains_key(&0) {
return 0 as i64;
}
for c in 0..self.nodes.get(&0).unwrap().len() {
let _c = &self.nodes.get(&0).unwrap()[c];
total += _c.total[0];
Expand Down
3 changes: 0 additions & 3 deletions pyroscope/pprof.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,15 @@ const bfs = (t) => {
* @param {string} sampleType
*/
const createFlameGraph = (pprofBinaries, sampleType) => {
console.log(`got ${pprofBinaries.length} profiles`)
const tree = new Tree()
tree.sampleType = sampleType
let start = Date.now()
for (const p of pprofBinaries) {
const prof = messages.Profile.deserializeBinary(p)
tree.merge(prof)
}
console.log(`ds + merge took ${Date.now() - start} ms`)
start = Date.now()
const levels = bfs(tree)
console.log(`bfs took ${Date.now() - start} ms`)
return { levels: levels, names: tree.names, total: parseInt(tree.root.total), maxSelf: parseInt(tree.maxSelf) }
}

Expand Down
1 change: 0 additions & 1 deletion pyroscope/pyroscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ const analyzeQuery = async (req, res) => {
const toTimeSec = Math.floor(req.getEnd && req.getEnd()
? parseInt(req.getEnd()) / 1000
: Date.now() / 1000)
console.log(query)

const scope = new messages.QueryScope()
scope.setComponentType('store')
Expand Down
1 change: 0 additions & 1 deletion pyroscope/select_series.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ const selectSeriesImpl = async (fromTimeSec, toTimeSec, payload) => {

const resp = new messages.SelectSeriesResponse()
resp.setSeriesList(seriesList)
console.log(`Queried ${seriesList.length} series`)
return resp
}

Expand Down

0 comments on commit 3611964

Please sign in to comment.