Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MemoryTracer.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MemoryTracer.h (C) 2000-2024 */
9/* */
10/* Utilitaires pour tracer les accès mémoire entre l'accélérateur et l'hôte. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ACCELERATOR_CORE_INTERNAL_MEMORYTRACER_H
13#define ARCANE_ACCELERATOR_CORE_INTERNAL_MEMORYTRACER_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include <tuple>
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane::Accelerator::impl
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
34class ARCANE_ACCELERATOR_CORE_EXPORT MemoryTracer
35{
36 public:
37
38 static void notifyMemoryAllocation(Span<const std::byte> bytes, const String& name, const String& stack_trace, Int64 timestamp);
39 static void notifyMemoryFree(void* ptr, const String& name, const String& stack_trace, Int64 timestamp);
40 static std::pair<String, String> findMemory(const void* ptr);
41};
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
49class ARCANE_ACCELERATOR_CORE_EXPORT MemoryTracerWrapper
50{
51 public:
52
53 MemoryTracerWrapper();
54
55 public:
56
57 bool isActive() const { return m_trace_level > 0; }
58 void traceDeallocate(const AllocatedMemoryInfo& mem_info, const MemoryAllocationArgs& args);
59 void traceAllocate(void* p, size_t new_size, MemoryAllocationArgs args);
60 void setTraceLevel(Int32 v) { m_trace_level = v; }
61
62 private:
63
64 Int32 m_trace_level = 0;
65};
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70} // namespace Arcane::Accelerator::impl
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75#endif
Classe utilitaire pour tracer les accès mémoire entre l'accélérateur et l'hôte.
Informations sur une zone mémoire allouée.
Classe contenant des informations pour spécialiser les allocations.
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
Chaîne de caractères unicode.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.