-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supports CPU flamegraphs and wait flamegraphs. Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
- Loading branch information
Showing
18 changed files
with
679 additions
and
13 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
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
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
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
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
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,64 @@ | ||
/* | ||
* Copyright (c) 2022 Pedro Falcato | ||
* This file is part of Onyx, and is released under the terms of the MIT License | ||
* check LICENSE at the root directory for more information | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#ifndef _ONYX_PERF_PROBE_H | ||
#define _ONYX_PERF_PROBE_H | ||
|
||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include <onyx/compiler.h> | ||
#include <onyx/public/perf_probe.h> | ||
|
||
struct registers; | ||
|
||
size_t stack_trace_get(unsigned long *stack, unsigned long *pcs, size_t nr_pcs); | ||
|
||
/** | ||
* @brief Check if CPU perf probing is enabled | ||
* | ||
* @return True if enabled, else false | ||
*/ | ||
bool perf_probe_is_enabled(); | ||
|
||
/** | ||
* @brief Do a CPU perf probe | ||
* | ||
* @param regs Registers | ||
*/ | ||
void perf_probe_do(struct registers *regs); | ||
|
||
/** | ||
* @brief Check is wait perf probing is enabled | ||
* | ||
* @return True if enabled, else false | ||
*/ | ||
bool perf_probe_is_enabled_wait(); | ||
|
||
/** | ||
* @brief Set up a wait probe. Called right before platform_yield() | ||
* | ||
* @param fge flame_graph_entry, stack allocated | ||
*/ | ||
void perf_probe_setup_wait(struct flame_graph_entry *fge); | ||
|
||
/** | ||
* @brief Commit the wait probe | ||
* | ||
* @param fge flame_graph_entry, stack allocated | ||
*/ | ||
void perf_probe_commit_wait(const struct flame_graph_entry *fge); | ||
|
||
/** | ||
* @brief Try to take a trace for the wait probe | ||
* | ||
* @param regs Registers | ||
*/ | ||
void perf_probe_try_wait_trace(struct registers *regs); | ||
|
||
#endif |
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,36 @@ | ||
/* | ||
* Copyright (c) 2022 Pedro Falcato | ||
* This file is part of Onyx, and is released under the terms of the MIT License | ||
* check LICENSE at the root directory for more information | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#ifndef _ONYX_PUBLIC_PERF_PROBE_H | ||
#define _ONYX_PUBLIC_PERF_PROBE_H | ||
|
||
#include <stdbool.h> | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#define FLAME_GRAPH_FRAMES 32 | ||
#define FLAME_GRAPH_NENTRIES 65536 | ||
|
||
struct flame_graph_entry | ||
{ | ||
unsigned long rips[FLAME_GRAPH_FRAMES]; | ||
}; | ||
|
||
struct flame_graph_pcpu | ||
{ | ||
uint32_t nentries; | ||
uint32_t windex; | ||
struct flame_graph_entry *fge; /* array of nentries */ | ||
int dummy[12]; | ||
}; | ||
|
||
#define PERF_PROBE_ENABLE_DISABLE_CPU 0 | ||
#define PERF_PROBE_GET_BUFFER_LENGTH 1 | ||
#define PERF_PROBE_READ_DATA 2 | ||
#define PERF_PROBE_ENABLE_DISABLE_WAIT 3 | ||
|
||
#endif |
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
Oops, something went wrong.