Skip to content

Commit

Permalink
Merge pull request opensearch-project#342 from javierhonduco/run-clan…
Browse files Browse the repository at this point in the history
…g-format

Format our C code
  • Loading branch information
kakkoyun authored Apr 13, 2022
2 parents a02cbe2 + 527497c commit fa2861c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
goreleaser:
name: Goreleaer Dry
name: Goreleaser Dry
runs-on: ubuntu-latest
steps:
- name: Set up Go
Expand Down Expand Up @@ -68,6 +68,12 @@ jobs:
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest

- name: Install clang-format
run: sudo apt-get install clang-format

- name: Show clang-format version
run: clang-format --version

- name: Check out code into the Go module directory
uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ README.md: $(OUT_DIR)/help.txt deploy/manifests
$(CMD_EMBEDMD) -w README.md

.PHONY: format
format: go/fmt
format: go/fmt c/fmt

.PHONY: c/fmt
c/fmt:
Expand Down
14 changes: 7 additions & 7 deletions parca-agent.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
// Max depth of each stack trace to track
#define MAX_STACK_DEPTH 127

#define BPF_MAP(_name, _type, _key_type, _value_type, _max_entries) \
struct { \
__uint(type, _type); \
__uint(max_entries, _max_entries); \
__type(key, _key_type); \
__type(value, _value_type); \
#define BPF_MAP(_name, _type, _key_type, _value_type, _max_entries) \
struct { \
__uint(type, _type); \
__uint(max_entries, _max_entries); \
__type(key, _key_type); \
__type(value, _value_type); \
} _name SEC(".maps");

// Stack Traces are slightly different
// in that the value is 1 big byte array
// of the stack addresses
typedef __u64 stack_trace_type[MAX_STACK_DEPTH];
#define BPF_STACK_TRACE(_name, _max_entries) \
#define BPF_STACK_TRACE(_name, _max_entries) \
BPF_MAP(_name, BPF_MAP_TYPE_STACK_TRACE, u32, stack_trace_type, _max_entries);

#define BPF_HASH(_name, _key_type, _value_type) \
Expand Down

0 comments on commit fa2861c

Please sign in to comment.