ai_stats.h
Go to the documentation of this file.
1// Copyright 2025 Autodesk, Inc. All rights reserved.
2//
3// Use of this software is subject to the terms of the Autodesk license
4// agreement provided at the time of installation or download, or which
5// otherwise accompanies this software in either electronic or hard copy form.
6
12#pragma once
13#include "ai_api.h"
14#include "ai_string.h"
15#include "ai_universe.h"
16#include "ai_render.h"
17
18#include <stddef.h> // NULL
19#include <stdint.h>
20
32{
35};
36
37AI_API AI_DEPRECATED AtStatsMode AiStatsGetMode();
38AI_API AI_DEPRECATED void AiStatsSetMode(AtStatsMode mode);
39AI_API const char* AiStatsGetFileName();
40AI_API void AiStatsSetFileName(const char* filename);
41
42#ifdef AI_GPU_COMPILER
43// profiling does not work on GPU
44#define AiProfileBlock(...)
45#else
71#define AiProfileBlock(...) AiProfileBlockRAII Ai_profile_block(__VA_ARGS__)
72#endif
73
79AI_API void AiProfileSetFileName(const char* filename);
80
86
87/*\}*/
88
89AI_API void AiReportSetFileName(const char* filename);
91
92struct AtNode;
93
100AI_API void AiProfileUpdate(uint64_t start_counter, uint64_t end_counter,
101 const char* name, const AtNode* node);
102
109AI_API uint64_t AiProfileCounter();
110
117ARNOLD_FORCEINLINE void AiProfileEnd(uint64_t start_counter, const char* name, const AtNode* node=NULL)
118{
119 const uint64_t end_counter = AiProfileCounter();
120 if (Ai_unlikely(start_counter != end_counter))
121 AiProfileUpdate(start_counter, end_counter, name, node);
122}
123
125struct AiProfileBlockRAII
126{
127 AiProfileBlockRAII(const char* name, const AtNode* node=NULL) :
128 start_counter(AiProfileCounter()), name(name), node(node) { }
129
130 AiProfileBlockRAII(const AtNode* node) :
131 start_counter(AiProfileCounter()), name(NULL), node(node) { }
132
133 ~AiProfileBlockRAII()
134 {
135 AiProfileEnd(start_counter, name, node);
136 }
137
138private:
139 const uint64_t start_counter;
140 const char* const name;
141 const AtNode* const node;
142};
DLL export prefix for API functions (necessary for multi-platform development)
API for managing rendering sessions.
AtString class for fast comparisons.
Global entry point to the scene graph elements (options, camera, lights, etc)
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_API AI_FORCEINLINE uint64_t AiProfileCounter()
Get profile counter.
Definition: ai_stats.cpp:56
AI_API void AiProfileUpdate(uint64_t start_counter, uint64_t end_counter, const char *name, const AtNode *node)
Finalize profile entry.
Definition: ai_stats.cpp:61
AI_API void AiProfileSetFileName(const char *filename)
JSON file to which profiling traces should be written to.
Definition: ai_stats.cpp:67
AI_API const char * AiStatsGetFileName()
Get the filename of the structured stats output.
Definition: ai_stats.cpp:51
AtStatsMode
Output mode for structured statistics.
Definition: ai_stats.h:32
AI_API void AiReportSetFileName(const char *filename)
Set the report file that will contain render report HTML page.
Definition: ai_stats.cpp:83
AI_API AI_DEPRECATED void AiStatsSetMode(AtStatsMode mode)
Set the file mode for outputting structured statistics.
Definition: ai_stats.cpp:18
AI_API AtString AiProfileGetFileName()
Get the JSON filename to which profiling traces will be written to.
Definition: ai_stats.cpp:72
AI_API void AiStatsSetFileName(const char *filename)
Set the output file that will contain structured stats from this session's renders.
Definition: ai_stats.cpp:28
AI_API AtString AiReportGetFileName()
Get the filename of the render report output.
Definition: ai_stats.cpp:93
AI_API AI_DEPRECATED AtStatsMode AiStatsGetMode()
Get the mode for outputting structured statistics.
Definition: ai_stats.cpp:41
@ AI_STATS_MODE_OVERWRITE
Overwrite the file if it exists
Definition: ai_stats.h:33
@ AI_STATS_MODE_APPEND
Append data to existing statistics file.
Definition: ai_stats.h:34
This represents a node in Arnold.

© 2023 Autodesk, Inc. · All rights reserved · www.arnoldrenderer.com