-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* port cachegrind.h to zig * import cachegrind.zig in valgrind.zig * Avoid Redundant Names in Fully-Qualified Namespaces
- Loading branch information
1 parent
ab69482
commit 9374725
Showing
4 changed files
with
67 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const std = @import("../std.zig"); | ||
const valgrind = std.valgrind; | ||
|
||
pub const ClientRequest = enum(usize) { | ||
StartInstrumentation = valgrind.ToolBase("CG".*), | ||
StopInstrumentation, | ||
}; | ||
|
||
fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | ||
return valgrind.doClientRequest(default, @as(usize, @intCast(@intFromEnum(request))), a1, a2, a3, a4, a5); | ||
} | ||
|
||
fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | ||
_ = doClientRequestExpr(0, request, a1, a2, a3, a4, a5); | ||
} | ||
|
||
/// Start Cachegrind instrumentation if not already enabled. Use this in | ||
/// combination with `std.valgrind.cachegrind.stopInstrumentation` and | ||
/// `--instr-at-start` to measure only part of a client program's execution. | ||
pub fn startInstrumentation() void { | ||
doClientRequestStmt(.StartInstrumentation, 0, 0, 0, 0, 0); | ||
} | ||
|
||
/// Stop Cachegrind instrumentation if not already disabled. Use this in | ||
/// combination with `std.valgrind.cachegrind.startInstrumentation` and | ||
/// `--instr-at-start` to measure only part of a client program's execution. | ||
pub fn stopInstrumentation() void { | ||
doClientRequestStmt(.StopInstrumentation, 0, 0, 0, 0, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters