PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
Logging utilities and macros for PETSc-based applications. More...
#include <petsc.h>
#include <stdlib.h>
#include <string.h>
#include <petscsys.h>
#include <ctype.h>
#include "variables.h"
#include "AnalyticalSolution.h"
#include "Boundaries.h"
Go to the source code of this file.
Data Structures | |
struct | DualMonitorCtx |
Context for a dual-purpose KSP monitor. More... | |
Macros | |
#define | LOCAL 0 |
Logging scope definitions for controlling message output. | |
#define | GLOBAL 1 |
Scope for global logging across all processes. | |
#define | LOG(scope, level, fmt, ...) |
Logging macro for PETSc-based applications with scope control. | |
#define | LOG_DEFAULT(level, fmt, ...) |
Default logging macro for PETSc-based applications. | |
#define | LOG_SYNC(scope, level, fmt, ...) |
Logging macro for PETSc-based applications with scope control, using synchronized output across processes. | |
#define | LOG_SYNC_DEFAULT(level, fmt, ...) |
Default synchronized logging macro for PETSc-based applications. | |
#define | LOG_ALLOW(scope, level, fmt, ...) |
Logging macro that checks both the log level and whether the calling function is in the allowed-function list before printing. | |
#define | LOG_ALLOW_SYNC(scope, level, fmt, ...) |
----— DEBUG ---------------------------------------— #define LOG_ALLOW(scope, level, fmt, ...) \ do { \ MPI_Comm comm = (scope == LOCAL) ? MPI_COMM_SELF : MPI_COMM_WORLD; \ PetscInt current_level_val = get_log_level(); \ PetscBool __allowed_func_val = is_function_allowed(__func); \ Print BEFORE the check \ if (strcmp(func, "LocateAllParticlesInGrid") == 0) { \ printf("[DEBUG LOG_ALLOW in %s] Checking: level=%d, get_log_level() returned %d, func_allowed=%d\n", \ func, (int)level, (int)__current_level_val, (int)__allowed_func_val); \ } \ if ((int)(level) <= (int)__current_level_val && allowed_func_val) { \ Print AFTER passing the check // \ if (strcmp(__func, "LocateAllParticlesInGrid") == 0) { \ printf("[DEBUG LOG_ALLOW in %s] Check PASSED. Printing log.\n", func); \ } \ PetscPrintf(comm, "[%s] " fmt, func, ##__VA_ARGS__); \ } \ | |
#define | LOG_LOOP_ALLOW(scope, level, iterVar, interval, fmt, ...) |
Logs a message inside a loop, but only every interval iterations. | |
#define | LOG_LOOP_ALLOW_EXACT(scope, level, var, val, fmt, ...) |
Logs a custom message if a variable equals a specific value. | |
#define | LOG_ARRAY_ELEMENT_ALLOW(scope, level, arr, length, idx, fmt) |
Logs a single element of an array, given an index. | |
#define | LOG_ARRAY_SUBRANGE_ALLOW(scope, level, arr, length, start, end, fmt) |
Logs a consecutive subrange of an array. | |
#define | LOG_FUNC_TIMER_BEGIN_EVENT(eventID, scope) |
Begins timing a function by: | |
#define | LOG_FUNC_TIMER_END_EVENT(eventID, scope) |
Ends timing a function by: | |
#define | LOG_PROFILE_MSG(scope, fmt, ...) |
#define | PROFILE_FUNCTION_BEGIN _ProfilingStart(__FUNCT__) |
Marks the beginning of a profiled code block (typically a function). | |
#define | PROFILE_FUNCTION_END _ProfilingEnd(__FUNCT__) |
Marks the end of a profiled code block. | |
Enumerations | |
enum | LogLevel { LOG_ERROR = 0 , LOG_WARNING , LOG_PROFILE , LOG_INFO , LOG_DEBUG } |
Enumeration of logging levels. More... | |
Functions | |
LogLevel | get_log_level () |
Retrieves the current logging level from the environment variable LOG_LEVEL . | |
PetscErrorCode | print_log_level (void) |
Prints the current logging level to the console. | |
void | set_allowed_functions (const char **functionList, int count) |
Sets the global list of function names that are allowed to log. | |
PetscBool | is_function_allowed (const char *functionName) |
Checks if a given function is in the allow-list. | |
PetscErrorCode | LOG_CELL_VERTICES (const Cell *cell, PetscMPIInt rank) |
Prints the coordinates of a cell's vertices. | |
PetscErrorCode | LOG_FACE_DISTANCES (PetscReal *d) |
Prints the signed distances to each face of the cell. | |
PetscErrorCode | LOG_PARTICLE_FIELDS (UserCtx *user, PetscInt printInterval) |
Prints particle fields in a table that automatically adjusts its column widths. | |
PetscErrorCode | FreeAllowedFunctions (char **funcs, PetscInt n) |
Free an array previously returned by LoadAllowedFunctionsFromFile(). | |
PetscErrorCode | LoadAllowedFunctionsFromFile (const char filename[], char ***funcsOut, PetscInt *nOut) |
Load function names from a text file. | |
const char * | BCFaceToString (BCFace face) |
Helper function to convert BCFace enum to a string representation. | |
const char * | BCTypeToString (BCType type) |
Helper function to convert BCType enum to a string representation. | |
const char * | BCHandlerTypeToString (BCHandlerType handler_type) |
Converts a BCHandlerType enum to its string representation. | |
PetscErrorCode | DualKSPMonitor (KSP ksp, PetscInt it, PetscReal rnorm, void *ctx) |
A custom KSP monitor that logs to a file and optionally to the console. | |
PetscErrorCode | DualMonitorDestroy (void **ctx) |
Destroys the DualMonitorCtx. | |
PetscErrorCode | LOG_CONTINUITY_METRICS (UserCtx *user) |
Logs continuity metrics for a single block to a file. | |
const char * | ParticleLocationStatusToString (ParticleLocationStatus level) |
A function that outputs the name of the current level in the ParticleLocation enum. | |
PetscErrorCode | ProfilingInitialize (SimCtx *simCtx) |
Initializes the custom profiling system using configuration from SimCtx. | |
PetscErrorCode | ProfilingLogTimestepSummary (PetscInt step) |
Logs the performance summary for the current timestep and resets timers. | |
PetscErrorCode | ProfilingFinalize (void) |
Prints the final, cumulative performance summary and cleans up resources. | |
void | _ProfilingStart (const char *func_name) |
void | _ProfilingEnd (const char *func_name) |
Variables | |
PetscLogEvent | EVENT_Individualwalkingsearch |
PetscLogEvent | EVENT_walkingsearch |
PetscLogEvent | EVENT_GlobalParticleLocation |
PetscLogEvent | EVENT_IndividualLocation |
Logging utilities and macros for PETSc-based applications.
This header defines logging levels, scopes, and macros for consistent logging throughout the application. It provides functions to retrieve the current logging level and macros to simplify logging with scope control.
Definition in file logging.h.
struct DualMonitorCtx |
#define LOCAL 0 |
#define GLOBAL 1 |
#define LOG | ( | scope, | |
level, | |||
fmt, | |||
... | |||
) |
Logging macro for PETSc-based applications with scope control.
This macro provides a convenient way to log messages with different scopes (LOCAL or GLOBAL) and severity levels. It utilizes PETSc's PetscPrintf
function for message output.
scope | Specifies the logging scope:
|
level | The severity level of the message (e.g., LOG_INFO, LOG_ERROR). |
fmt | The format string for the message (similar to printf). |
... | Additional arguments for the format string (optional). |
Example usage: LOG(LOCAL, LOG_ERROR, "An error occurred at index %ld.\n", idx); LOG(GLOBAL, LOG_INFO, "Grid size: %ld x %ld x %ld.\n", nx, ny, nz);
Definition at line 91 of file logging.h.
#define LOG_DEFAULT | ( | level, | |
fmt, | |||
... | |||
) |
Default logging macro for PETSc-based applications.
This macro simplifies logging by defaulting the scope to GLOBAL (i.e., MPI_COMM_WORLD
) and providing a convenient interface for common logging needs.
level | The severity level of the message (e.g., LOG_ERROR, LOG_INFO). |
fmt | The format string for the log message (similar to printf). |
... | Additional arguments for the format string (optional). |
Example usage: LOG_DEFAULT(LOG_ERROR, "Error occurred at index %ld.\n", idx); LOG_DEFAULT(LOG_INFO, "Grid size: %ld x %ld x %ld.\n", nx, ny, nz);
MPI_COMM_WORLD
.LOG
macro.get_log_level()
. Definition at line 122 of file logging.h.
#define LOG_SYNC | ( | scope, | |
level, | |||
fmt, | |||
... | |||
) |
Logging macro for PETSc-based applications with scope control, using synchronized output across processes.
This macro uses PetscSynchronizedPrintf
and PetscSynchronizedFlush
to ensure messages from different ranks are printed in a synchronized (rank-by-rank) manner, preventing interleaved outputs.
scope | Specifies the logging scope:
|
level | The severity level of the message (e.g., LOG_INFO, LOG_ERROR). |
fmt | The format string for the message (similar to printf). |
... | Additional arguments for the format string (optional). |
Example usage: LOG_SYNC(LOCAL, LOG_ERROR, "An error occurred at index %ld.\n", idx); LOG_SYNC(GLOBAL, LOG_INFO, "Synchronized info: rank = %ld.\n", rank);
Definition at line 152 of file logging.h.
#define LOG_SYNC_DEFAULT | ( | level, | |
fmt, | |||
... | |||
) |
Default synchronized logging macro for PETSc-based applications.
This macro simplifies logging by defaulting the scope to GLOBAL (i.e., MPI_COMM_WORLD
) and provides synchronized output across all processes.
level | The severity level of the message (e.g., LOG_ERROR, LOG_INFO). |
fmt | The format string for the log message (similar to printf). |
... | Additional arguments for the format string (optional). |
Example usage: LOG_SYNC_DEFAULT(LOG_ERROR, "Error at index %ld.\n", idx); LOG_SYNC_DEFAULT(LOG_INFO, "Process rank: %ld.\n", rank);
MPI_COMM_WORLD
.LOG_SYNC
macro.get_log_level()
. Definition at line 185 of file logging.h.
#define LOG_ALLOW | ( | scope, | |
level, | |||
fmt, | |||
... | |||
) |
Logging macro that checks both the log level and whether the calling function is in the allowed-function list before printing.
Useful for selective, per-function logging.
scope | Specifies the logging scope (LOCAL or GLOBAL). |
level | The severity level of the message (e.g., LOG_INFO, LOG_ERROR). |
fmt | The format string for the message (similar to printf). |
... | Additional arguments for the format string (optional). |
Example usage: LOG_ALLOW(LOCAL, LOG_DEBUG, "Debugging info in function: %s\n", func);
Definition at line 207 of file logging.h.
#define LOG_ALLOW_SYNC | ( | scope, | |
level, | |||
fmt, | |||
... | |||
) |
----— DEBUG ---------------------------------------— #define LOG_ALLOW(scope, level, fmt, ...) \ do { \ MPI_Comm comm = (scope == LOCAL) ? MPI_COMM_SELF : MPI_COMM_WORLD; \ PetscInt current_level_val = get_log_level(); \ PetscBool __allowed_func_val = is_function_allowed(__func); \ Print BEFORE the check \ if (strcmp(func, "LocateAllParticlesInGrid") == 0) { \ printf("[DEBUG LOG_ALLOW in %s] Checking: level=%d, get_log_level() returned %d, func_allowed=%d\n", \ func, (int)level, (int)__current_level_val, (int)__allowed_func_val); \ } \ if ((int)(level) <= (int)__current_level_val && allowed_func_val) { \ Print AFTER passing the check // \ if (strcmp(__func, "LocateAllParticlesInGrid") == 0) { \ printf("[DEBUG LOG_ALLOW in %s] Check PASSED. Printing log.\n", func); \ } \ PetscPrintf(comm, "[%s] " fmt, func, ##__VA_ARGS__); \ } \
Synchronized logging macro that checks both the log level and whether the calling function is in the allow-list.
This macro uses PetscSynchronizedPrintf
and PetscSynchronizedFlush
to ensure messages from different ranks are printed in a rank-ordered fashion (i.e., to avoid interleaving). It also filters out messages if the current function is not in the allow-list (is_function_allowed(__func__)
) or the requested log level is higher than get_log_level()
.
scope | Either LOCAL (MPI_COMM_SELF) or GLOBAL (MPI_COMM_WORLD). |
level | One of LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG. |
fmt | A printf -style format string (e.g., "Message: %ld\n"). |
... | Variadic arguments to fill in fmt . |
Example usage:
Definition at line 274 of file logging.h.
#define LOG_LOOP_ALLOW | ( | scope, | |
level, | |||
iterVar, | |||
interval, | |||
fmt, | |||
... | |||
) |
Logs a message inside a loop, but only every interval
iterations.
scope | LOCAL or GLOBAL. |
level | LOG_* level. |
iterVar | The loop variable (e.g., i). |
interval | Only log when (iterVar % interval == 0). |
fmt | printf-style format string. |
... | Variadic arguments to include in the formatted message. |
Example: for (int i = 0; i < 100; i++) { LOG_LOOP_ALLOW(LOCAL, LOG_DEBUG, i, 10, "Value of i=%d\n", i); }
Definition at line 319 of file logging.h.
#define LOG_LOOP_ALLOW_EXACT | ( | scope, | |
level, | |||
var, | |||
val, | |||
fmt, | |||
... | |||
) |
Logs a custom message if a variable equals a specific value.
This is a variadic macro for logging a single event when a condition is met. It is extremely useful for printing debug information at a specific iteration of a loop or when a state variable reaches a certain value.
scope | Either LOCAL or GLOBAL. |
level | The logging level. |
var | The variable to check (e.g., a loop counter 'k'). |
val | The value that triggers the log (e.g., 6). The log prints if var == val. |
... | A printf-style format string and its corresponding arguments. |
Definition at line 355 of file logging.h.
#define LOG_ARRAY_ELEMENT_ALLOW | ( | scope, | |
level, | |||
arr, | |||
length, | |||
idx, | |||
fmt | |||
) |
Logs a single element of an array, given an index.
scope | Either LOCAL or GLOBAL. |
level | LOG_ERROR, LOG_WARNING, LOG_INFO, or LOG_DEBUG. |
arr | Pointer to the array to log from. |
length | The length of the array (to prevent out-of-bounds). |
idx | The index of the element to print. |
fmt | The printf-style format specifier (e.g. "%g", "%f", etc.). |
This macro only logs if: 1) The current function is in the allow-list (is_function_allowed(__func__)
). 2) The requested logging level
<= the current global get_log_level()
. 3) The index idx
is valid (0 <= idx < length).
Definition at line 384 of file logging.h.
#define LOG_ARRAY_SUBRANGE_ALLOW | ( | scope, | |
level, | |||
arr, | |||
length, | |||
start, | |||
end, | |||
fmt | |||
) |
Logs a consecutive subrange of an array.
scope | Either LOCAL or GLOBAL. |
level | LOG_ERROR, LOG_WARNING, LOG_INFO, or LOG_DEBUG. |
arr | Pointer to the array to log from. |
length | Total length of the array. |
start | Starting index of the subrange. |
end | Ending index of the subrange (inclusive). |
fmt | The printf-style format specifier (e.g., "%g", "%f"). |
This macro prints each element arr[i] for i in [start, end], bounded by [0, length-1].
Definition at line 408 of file logging.h.
#define LOG_FUNC_TIMER_BEGIN_EVENT | ( | eventID, | |
scope | |||
) |
Begins timing a function by:
eventID | A previously registered PetscLogEvent (e.g., EVENT_EvalPosition). |
scope | LOCAL or GLOBAL (for potential later usage in logging). |
level | LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG. |
Example usage:
Definition at line 436 of file logging.h.
#define LOG_FUNC_TIMER_END_EVENT | ( | eventID, | |
scope | |||
) |
Ends timing a function by:
eventID | The same PetscLogEvent handle passed to LOG_FUNC_TIMER_BEGIN_EVENT. |
scope | LOCAL or GLOBAL for possible MPI_Comm usage. |
level | The log level at which to print the timing message. |
The log message is only printed if the function is in the allow-list and the current log level is >= the requested level
.
Definition at line 462 of file logging.h.
#define LOG_PROFILE_MSG | ( | scope, | |
fmt, | |||
... | |||
) |
Definition at line 479 of file logging.h.
#define PROFILE_FUNCTION_BEGIN _ProfilingStart(__FUNCT__) |
#define PROFILE_FUNCTION_END _ProfilingEnd(__FUNCT__) |
enum LogLevel |
Enumeration of logging levels.
Defines various severity levels for logging messages.
Definition at line 28 of file logging.h.
LogLevel get_log_level | ( | ) |
Retrieves the current logging level from the environment variable LOG_LEVEL
.
The function checks the LOG_LEVEL
environment variable and sets the logging level accordingly. Supported levels are "DEBUG", "INFO", "WARNING", and defaults to "ERROR" if not set or unrecognized.
The function checks the LOG_LEVEL
environment variable and sets the logging level accordingly. Supported levels are "DEBUG", "INFO", "WARNING", and defaults to "ERROR" if not set or unrecognized. The log level is cached after the first call to avoid repeated environment variable checks.
Definition at line 49 of file logging.c.
PetscErrorCode print_log_level | ( | void | ) |
Prints the current logging level to the console.
This function retrieves the log level using get_log_level()
and prints the corresponding log level name. It helps verify the logging configuration at runtime.
The log levels supported are:
LOG_PROFILE
(0) : Logs performance profiling details.LOG_ERROR
(1) : Logs only critical errors.LOG_WARNING
(2) : Logs warnings and errors.LOG_INFO
(3) : Logs general information, warnings, and errors.LOG_DEBUG
(4) : Logs debugging information, info, warnings, and errors.LOG_LEVEL
environment variable. If LOG_LEVEL
is not set, it defaults to LOG_INFO
.This function retrieves the log level using get_log_level()
and prints the corresponding log level name. It helps verify the logging configuration at runtime.
LOG_LEVEL
environment variable. If LOG_LEVEL
is not set, it defaults to LOG_INFO
.Definition at line 86 of file logging.c.
void set_allowed_functions | ( | const char ** | functionList, |
int | count | ||
) |
Sets the global list of function names that are allowed to log.
You can replace the entire list of allowed function names at runtime.
functionList | An array of function name strings (e.g., {"foo", "bar"}). |
count | The number of entries in the array. |
The existing allow-list is cleared and replaced by the new one. If you pass an empty list (count = 0), then no function will be allowed unless you change it later.
Definition at line 124 of file logging.c.
PetscBool is_function_allowed | ( | const char * | functionName | ) |
Checks if a given function is in the allow-list.
This helper is used internally by the LOG_ALLOW macro.
Checks if a given function is in the allow-list.
functionName | The name of the function to check. |
If no functions are in the list, nothing is allowed by default. You can reverse this logic if you prefer to allow everything unless specified otherwise.
Definition at line 159 of file logging.c.
PetscErrorCode LOG_CELL_VERTICES | ( | const Cell * | cell, |
PetscMPIInt | rank | ||
) |
Prints the coordinates of a cell's vertices.
This function iterates through the eight vertices of a given cell and prints their coordinates. It is primarily used for debugging purposes to verify the correctness of cell vertex assignments.
[in] | cell | Pointer to a Cell structure representing the cell, containing its vertices. |
[in] | rank | MPI rank for identification (useful in parallel environments). |
cell
pointer is not NULL
before calling this function.. Definition at line 189 of file logging.c.
PetscErrorCode LOG_FACE_DISTANCES | ( | PetscReal * | d | ) |
Prints the signed distances to each face of the cell.
This function iterates through the six signed distances from a point to each face of a given cell and prints their values. It is primarily used for debugging purposes to verify the correctness of distance calculations.
[in] | d | An array of six PetscReal values representing the signed distances. The indices correspond to:
|
d
array is correctly populated with signed distances before calling this function. Definition at line 229 of file logging.c.
PetscErrorCode LOG_PARTICLE_FIELDS | ( | UserCtx * | user, |
PetscInt | printInterval | ||
) |
Prints particle fields in a table that automatically adjusts its column widths.
This function retrieves data from the particle swarm and prints a table where the width of each column is determined by the maximum width needed to display the data. Only every 'printInterval'-th particle is printed.
[in] | user | Pointer to the UserCtx structure. |
[in] | printInterval | Only every printInterval‑th particle is printed. |
Definition at line 402 of file logging.c.
PetscErrorCode FreeAllowedFunctions | ( | char ** | funcs, |
PetscInt | n | ||
) |
Free an array previously returned by LoadAllowedFunctionsFromFile().
[in,out] | funcs | Array of strings to release (may be NULL ). |
[in] | n | Number of entries in funcs . Ignored if funcs is NULL . |
Definition at line 627 of file logging.c.
PetscErrorCode LoadAllowedFunctionsFromFile | ( | const char | filename[], |
char *** | funcsOut, | ||
PetscInt * | nOut | ||
) |
Load function names from a text file.
The file is expected to contain one identifier per line. Blank lines and lines whose first non‑blank character is a #
are silently skipped so the file can include comments. Example:
The routine allocates memory as needed (growing an internal buffer with PetscRealloc()
) and returns the resulting array and its length to the caller. Use FreeAllowedFunctions() to clean up when done.
[in] | filename | Path of the configuration file to read. |
[out] | funcsOut | On success, points to a freshly‑allocated array of char* (size nOut ). |
[out] | nOut | Number of valid entries in funcsOut . |
Definition at line 568 of file logging.c.
const char * BCFaceToString | ( | BCFace | face | ) |
Helper function to convert BCFace enum to a string representation.
[in] | face | The BCFace enum value. |
Definition at line 645 of file logging.c.
const char * BCTypeToString | ( | BCType | type | ) |
Helper function to convert BCType enum to a string representation.
[in] | type | The BCType enum value. |
Definition at line 662 of file logging.c.
const char * BCHandlerTypeToString | ( | BCHandlerType | handler_type | ) |
Converts a BCHandlerType enum to its string representation.
Provides a descriptive string for a specific boundary condition implementation strategy. This is crucial for logging the exact behavior configured for a face.
handler_type | The BCHandlerType enum value (e.g., BC_HANDLER_WALL_NOSLIP). |
Definition at line 689 of file logging.c.
PetscErrorCode DualKSPMonitor | ( | KSP | ksp, |
PetscInt | it, | ||
PetscReal | rnorm, | ||
void * | ctx | ||
) |
A custom KSP monitor that logs to a file and optionally to the console.
This function unconditionally calls the standard true residual monitor to log to a file viewer provided in the context. It also checks a flag in the context and, if true, calls the monitor again to log to standard output.
ksp | The Krylov subspace context. |
it | The current iteration number. |
rnorm | The preconditioned residual norm. |
ctx | A pointer to the DualMonitorCtx structure. |
Definition at line 759 of file logging.c.
PetscErrorCode DualMonitorDestroy | ( | void ** | ctx | ) |
Destroys the DualMonitorCtx.
This function is passed to KSPMonitorSet to ensure the viewer is properly destroyed and the context memory is freed when the KSP is destroyed.
Ctx | a pointer to the context pointer to be destroyed |
Definition at line 727 of file logging.c.
PetscErrorCode LOG_CONTINUITY_METRICS | ( | UserCtx * | user | ) |
Logs continuity metrics for a single block to a file.
This function should be called for each block, once per timestep. It opens a central log file in append mode. To ensure the header is written only once, it checks if it is processing block 0 on the simulation's start step.
user | A pointer to the UserCtx for the specific block whose metrics are to be logged. The function accesses both global (SimCtx) and local (user->...) data. |
Definition at line 819 of file logging.c.
const char * ParticleLocationStatusToString | ( | ParticleLocationStatus | level | ) |
A function that outputs the name of the current level in the ParticleLocation enum.
level | The ParticleLocation enum value. |
Definition at line 878 of file logging.c.
PetscErrorCode ProfilingInitialize | ( | SimCtx * | simCtx | ) |
Initializes the custom profiling system using configuration from SimCtx.
This function sets up the internal data structures for tracking function performance. It reads the list of "critical functions" from the provided SimCtx and marks them for per-step logging at LOG_INFO level.
It should be called once at the beginning of the application, after CreateSimulationContext() but before the main time loop.
simCtx | The master simulation context, which contains the list of critical function names to always log. |
Definition at line 955 of file logging.c.
PetscErrorCode ProfilingLogTimestepSummary | ( | PetscInt | step | ) |
Logs the performance summary for the current timestep and resets timers.
Depending on the current log level, this function will print:
It must be called once per timestep, typically at the end of the main loop. After logging, it resets the per-step counters and timers.
step | The current simulation step number, for logging context. |
Definition at line 994 of file logging.c.
PetscErrorCode ProfilingFinalize | ( | void | ) |
Prints the final, cumulative performance summary and cleans up resources.
This should be called once at the end of the simulation, before PetscFinalize(). It prints a table with total time, call count, and average time per call for every function that was profiled. This summary is only printed if the log level is LOG_PROFILE.
Definition at line 1046 of file logging.c.
void _ProfilingStart | ( | const char * | func_name | ) |
Definition at line 972 of file logging.c.
void _ProfilingEnd | ( | const char * | func_name | ) |