mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
Ability to capture a V8 heap profile and a heap snapshot
This commit is contained in:
@@ -51,7 +51,7 @@ pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
|
||||
// defer {
|
||||
// if (page.js.stopCpuProfiler()) |profile| {
|
||||
// std.fs.cwd().writeFile(.{
|
||||
// .sub_path = "v8/profile.json",
|
||||
// .sub_path = ".lp-cache/cpu_profile.json",
|
||||
// .data = profile,
|
||||
// }) catch |err| {
|
||||
// log.err(.app, "profile write error", .{ .err = err });
|
||||
@@ -61,6 +61,27 @@ pub fn fetch(app: *App, url: [:0]const u8, opts: FetchOpts) !void {
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Comment this out to get a heap V8 heap profil
|
||||
// page.js.startHeapProfiler();
|
||||
// defer {
|
||||
// if (page.js.stopHeapProfiler()) |profile| {
|
||||
// std.fs.cwd().writeFile(.{
|
||||
// .sub_path = ".lp-cache/allocating.heapprofile",
|
||||
// .data = profile.@"0",
|
||||
// }) catch |err| {
|
||||
// log.err(.app, "allocating write error", .{ .err = err });
|
||||
// };
|
||||
// std.fs.cwd().writeFile(.{
|
||||
// .sub_path = ".lp-cache/snapshot.heapsnapshot",
|
||||
// .data = profile.@"1",
|
||||
// }) catch |err| {
|
||||
// log.err(.app, "heapsnapshot write error", .{ .err = err });
|
||||
// };
|
||||
// } else |err| {
|
||||
// log.err(.app, "profile error", .{ .err = err });
|
||||
// }
|
||||
// }
|
||||
|
||||
_ = try page.navigate(url, .{
|
||||
.reason = .address_bar,
|
||||
.kind = .{ .push = null },
|
||||
|
||||
Reference in New Issue
Block a user