zig/lib/std/os
Andrew Kelley 63f4778827 std: add Linux perf syscall bits
Example usage:

```zig
const std = @import("std");
const PERF = std.os.linux.PERF;
const assert = std.debug.assert;

test "perf" {
    var attr: std.os.linux.perf_event_attr = .{
        .type = PERF.TYPE.HARDWARE,
        .config = @enumToInt(PERF.COUNT.HW.INSTRUCTIONS),
        .flags = .{
            .disabled = true,
            .exclude_kernel = true,
            .exclude_hv = true,
        },
    };
    const fd = try std.os.perf_event_open(&attr, 0, -1, -1, PERF.FLAG.FD_CLOEXEC);
    defer std.os.close(fd);

    _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.RESET, 0);
    _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.ENABLE, 0);

    long();

    _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.DISABLE, 0);

    var result: usize = 0;
    assert((try std.os.read(fd, std.mem.asBytes(&result))) == @sizeOf(usize));

    std.debug.print("instruction count: {d}\n", .{result});
}

fn long() void {
    var i: usize = 0;
    while (i < 100000) : (i += 1) {}
}
```
2021-11-01 14:45:05 -07:00
..
linux std: Fix edge case in TLS tp calculation 2021-10-23 22:48:25 -04:00
uefi fix(uefi MemoryDescriptor): padding after memory type 2021-10-25 16:43:23 -04:00
windows migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
linux.zig std: add Linux perf syscall bits 2021-11-01 14:45:05 -07:00
test.zig Initial bringup of the Solaris/Illumos port 2021-09-24 14:06:16 -04:00
uefi.zig remove redundant license headers from zig standard library 2021-08-24 12:25:09 -07:00
wasi.zig std.os fixes to get the test suite passing again 2021-09-01 17:54:07 -07:00
windows.zig std.os.windows: Fix typo (#9951) 2021-10-15 14:44:05 +02:00