Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_stats.h
| Show All 11 Lines | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef __UTIL_STATS_H__ | #ifndef __UTIL_STATS_H__ | ||||
| #define __UTIL_STATS_H__ | #define __UTIL_STATS_H__ | ||||
| #include "util/util_api.h" | |||||
| #include "util/util_atomic.h" | #include "util/util_atomic.h" | ||||
| #include "util/util_profiling.h" | #include "util/util_profiling.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| class Stats { | class Stats { | ||||
| public: | public: | ||||
| enum static_init_t { static_init = 0 }; | enum static_init_t { static_init = 0 }; | ||||
| Show All 12 Lines | public: | ||||
| } | } | ||||
| void mem_free(size_t size) | void mem_free(size_t size) | ||||
| { | { | ||||
| assert(mem_used >= size); | assert(mem_used >= size); | ||||
| atomic_sub_and_fetch_z(&mem_used, size); | atomic_sub_and_fetch_z(&mem_used, size); | ||||
| } | } | ||||
| size_t mem_used; | GET_SET(size_t, mem_used) | ||||
| size_t mem_peak; | GET_SET(size_t, mem_peak) | ||||
| }; | }; | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif /* __UTIL_STATS_H__ */ | #endif /* __UTIL_STATS_H__ */ | ||||