Skip to content

Block counter events the hacky way

Code Style Turtle / Code Formatting Test failed Oct 17, 2023 in 4s

Clang-Format Checker

Completed code style check

Details

Some files are not formatted according to your code style.

Annotations

Check failure on line 76 in include/lo2s/monitor/bio_monitor.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/monitor/bio_monitor.hpp#L76

-        skel_ = std::unique_ptr<struct block_io_bpf, SkelDeleter>(block_io_bpf__block_io_and_load());
+        skel_ =
+            std::unique_ptr<struct block_io_bpf, SkelDeleter>(block_io_bpf__block_io_and_load());

Check failure on line 123 in include/lo2s/monitor/bio_monitor.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/monitor/bio_monitor.hpp#L123

-

Check failure on line 70 in include/lo2s/monitor/posix_monitor.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/monitor/posix_monitor.hpp#L70

-        
+

Check failure on line 76 in include/lo2s/monitor/posix_monitor.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/monitor/posix_monitor.hpp#L76

-        skel_ = std::unique_ptr<struct block_io_bpf, SkelDeleter>(block_io_bpf__block_io_and_load());
+        skel_ =
+            std::unique_ptr<struct block_io_bpf, SkelDeleter>(block_io_bpf__block_io_and_load());

Check failure on line 29 in include/lo2s/perf/bio/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/bio/common.h#L24-L29

-struct trace_entry {
-     short unsigned int type;
-     unsigned char flags;
-     unsigned char preempt_count;
-     int pid;
- };
+struct trace_entry
+{
+    short unsigned int type;
+    unsigned char flags;
+    unsigned char preempt_count;
+    int pid;
+};

Check failure on line 42 in include/lo2s/perf/bio/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/bio/common.h#L39-L42

-struct block_io_event {
-  unsigned long long int sector;
-  unsigned int dev;
-  unsigned int bytes;
+struct block_io_event
+{
+    unsigned long long int sector;
+    unsigned int dev;
+    unsigned int bytes;

Check failure on line 25 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L25

-  {
+{

Check failure on line 34 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L32-L34

-  };
-
-
+};

Check failure on line 43 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L38-L43

-  unsigned long __syscall_nr;
-  char padding[4];
-  unsigned long long dfd;
-  char* filename;
-  unsigned long long flags;
-  unsigned long long mode;
+    unsigned long __syscall_nr;
+    char padding[4];
+    unsigned long long dfd;
+    char* filename;
+    unsigned long long flags;
+    unsigned long long mode;

Check failure on line 50 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L48-L50

-  long __syscall_nr;
-  char padding[4];
-  long  ret;
+    long __syscall_nr;
+    char padding[4];
+    long ret;

Check failure on line 59 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L55-L59

-  long __syscall_nr;
-  char padding0 [4];
-  unsigned long long fd;
-  unsigned long long buf;
-  unsigned long long count;
+    long __syscall_nr;
+    char padding0[4];
+    unsigned long long fd;
+    unsigned long long buf;
+    unsigned long long count;

Check failure on line 66 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L64-L66

-  long __syscall_nr;
-  char padding0 [4];
-  unsigned long long fd;
+    long __syscall_nr;
+    char padding0[4];
+    unsigned long long fd;

Check failure on line 74 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L71-L74

-  int type;
-  unsigned long long time;
-  int pid;
-  int fd;
+    int type;
+    unsigned long long time;
+    int pid;
+    int fd;

Check failure on line 80 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L79-L80

-  struct posix_event_header header;
-  char filename[256];
+    struct posix_event_header header;
+    char filename[256];

Check failure on line 87 in include/lo2s/perf/posix_io/common.h

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/perf/posix_io/common.h#L85-L87

-  struct posix_event_header header;
-  uint64_t buf;
-  uint64_t count;
+    struct posix_event_header header;
+    uint64_t buf;
+    uint64_t count;

Check failure on line 88 in include/lo2s/trace/reg_keys.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/trace/reg_keys.hpp#L88

-

Check failure on line 93 in include/lo2s/trace/reg_keys.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/trace/reg_keys.hpp#L93

-  using ByBlockCounterDevice = SimpleKeyType<dev_t, ByBlockCounterDeviceTag>;
+using ByBlockCounterDevice = SimpleKeyType<dev_t, ByBlockCounterDeviceTag>;

Check failure on line 232 in include/lo2s/trace/reg_keys.hpp

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

include/lo2s/trace/reg_keys.hpp#L231-L232

-    using type = otf2::lookup_definition_holder<otf2::definition::location, ByExecutionScope,
-                                                ByMeasurementScope, ByBlockDevice, ByBlockCounterDevice>;
+    using type =
+        otf2::lookup_definition_holder<otf2::definition::location, ByExecutionScope,
+                                       ByMeasurementScope, ByBlockDevice, ByBlockCounterDevice>;

Check failure on line 3 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L3

-#include <linux/bpf.h>

Check failure on line 4 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L4

+#include <linux/bpf.h>

Check failure on line 12 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L10-L12

-struct {
-	__uint(type, BPF_MAP_TYPE_RINGBUF);
-	__uint(max_entries, 256 * 1024 /* 256 KB */);
+struct
+{
+    __uint(type, BPF_MAP_TYPE_RINGBUF);
+    __uint(max_entries, 256 * 1024 /* 256 KB */);

Check failure on line 19 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L19

-int handle_exec(struct trace_event_raw_sched_process_exec *ctx)
+int handle_exec(struct trace_event_raw_sched_process_exec* ctx)

Check failure on line 23 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L22-L23

-  counter = counter + 1;
-  bytes = bytes + ctx->bytes;
+    counter = counter + 1;
+    bytes = bytes + ctx->bytes;

Check failure on line 25 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L25

-  if(counter >= 200)
+    if (counter >= 200)

Check failure on line 32 in src/perf/bio/block.bpf.c

See this annotation in the file changed.

@code-style-turtle code-style-turtle / Code Formatting Test

src/perf/bio/block.bpf.c#L27-L32

-      struct block_io_event *e;
-
-	e = bpf_ringbuf_reserve(&rb, sizeof(*e), 0);
-	if (!e)
-    {
-		return 0;
+        struct block_io_event* e;
+
+        e = bpf_ringbuf_reserve(&rb, sizeof(*e), 0);
+        if (!e)
+        {
+            return 0;
+        }
+        e->dev = 0;
+        e->bytes = bytes;
+        bpf_ringbuf_submit(e, 0);