14#include "arcane/utils/PlatformUtils.h"
15#include "arcane/utils/String.h"
16#include "arcane/utils/StdHeader.h"
17#include "arcane/utils/StackTrace.h"
18#include "arcane/utils/IStackTraceService.h"
19#include "arcane/utils/IOnlineDebuggerService.h"
20#include "arcane/utils/Iostream.h"
21#include "arcane/utils/StringBuilder.h"
22#include "arcane/utils/NotSupportedException.h"
23#include "arcane/utils/Array.h"
24#include "arcane/utils/StringList.h"
26#include "arcane/utils/internal/MemoryUtilsInternal.h"
30#ifndef ARCANE_OS_WIN32
46#include <sys/resource.h>
56#if !defined(ARCANE_OS_CYGWIN) && !defined(ARCANE_OS_WIN32)
58#define ARCANE_HAS_I386_FPU_CONTROL_H
59#include <fpu_control.h>
63#ifndef ARCANE_OS_WIN32
74#if defined(ARCANE_OS_LINUX) && defined(__USE_GNU)
76# define ARCANE_GLIBC_FENV
96 bool global_has_color_console =
false;
105 return global_symbolizer_service;
115 global_symbolizer_service = service;
125 return global_online_debugger_service;
135 global_online_debugger_service = service;
145 return global_profiling_service;
155 global_profiling_service = service;
165 return global_dynamic_library_loader;
175 global_dynamic_library_loader =
idll;
185 return global_processor_affinity_service;
195 global_processor_affinity_service = service;
205 return global_performance_counter_service;
214 auto*
old_service = global_performance_counter_service;
215 global_performance_counter_service = service;
223getAcceleratorHostMemoryAllocator()
225 return MemoryUtils::getAcceleratorHostMemoryAllocator();
231extern "C++" ARCANE_UTILS_EXPORT IMemoryAllocator* platform::
232setAcceleratorHostMemoryAllocator(IMemoryAllocator* a)
258IMemoryRessourceMng* platform::
259getDataMemoryRessourceMng()
270 return Arccore::Concurrency::getThreadImplementation();
279 return Arccore::Concurrency::setThreadImplementation(service);
300 cout <<
"** ERROR in setitimer r=" <<
r <<
'\n';
327template<
typename ByteType>
bool
331 long unsigned int file_length = platform::getFileLength(filename);
337 ios::openmode mode = ios::in;
345 out_bytes.resize(file_length);
346 ifile.read((
char*)(out_bytes.data()), file_length);
355 size_t nb_read = ifile.gcount();
356 out_bytes.resize(nb_read);
383static bool global_has_dotnet_runtime =
false;
387 return global_has_dotnet_runtime;
393 global_has_dotnet_runtime = v;
403#if defined(ARCANE_OS_LINUX)
404 char* buf = ::realpath(
"/proc/self/exe",
nullptr);
409#elif defined(ARCANE_OS_WIN32)
416#error "platform::getExeFullPath() not implemented for this platform"
430#if defined(ARCANE_OS_LINUX)
432 std::ifstream
ifile(
"/proc/self/maps");
435 while (
ifile.good()){
438 if (
vb.size()>0 &&
vb[0]==
'/'){
447#elif defined(ARCANE_OS_WIN32)
468#if defined(ARCANE_OS_LINUX)
470 const int BUFSIZE = 1024;
471 char buffer[BUFSIZE + 1];
477 const char* filename =
"/proc/self/cmdline";
483 while ((
nb_read = read(
fd, buffer, BUFSIZE)) > 0) {
484 buffer[BUFSIZE] =
'\0';
490 int size = bytes.size();
491 const char*
ptr = bytes.data();
492 const char* end =
ptr + size;
495 while (*
ptr++ &&
ptr < end)
508 auto x = std::chrono::high_resolution_clock::now();
510 auto y = std::chrono::time_point_cast<std::chrono::nanoseconds>(x);
512 return static_cast<Int64>(y.time_since_epoch().count());
521#if defined(ARCCORE_OS_WIN32)
524 return si.dwPageSize;
525#elif defined(ARCANE_OS_LINUX)
528#warning "getPageSize() not implemented for your platform. Default is 4096"
543 sprintf(filename,
"errlog.%ld", pid);
558#if defined(ARCANE_OS_LINUX)
564 snprintf(cmd,
cmd_size,
"gdb --ex 'set debuginfod enabled off' --ex 'attach %ld' --ex 'info threads' --ex 'thread apply all bt full' --batch", pid);
577#if defined(ARCANE_OS_LINUX)
583 snprintf(cmd,
cmd_size,
"lldb -p %ld -o 'bt' -o 'bt all' -o 'clrthreads' -o 'clrstack' -o 'dumpstack' --batch", pid);
597extern "C" ARCANE_UTILS_EXPORT
void
598_ArcaneSetCallGarbageCollectorDelegate(
void(*f)())
600 global_garbage_collector_delegate = f;
607 (*global_garbage_collector_delegate)();
Fonctions de gestion mémoire et des allocateurs.
Tableau d'items de types quelconques.
Interface d'une chargeur dynamique de bibliothèque.
Gestion des ressources mémoire pour les CPU et accélérateurs.
Interface d'un service de debugger hybrid.
Interface d'un service de de trace des appels de fonctions.
Interface d'un service de profiling.
Interface d'un service de récupération des symboles du code source.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Interface d'un allocateur pour la mémoire.
Interface d'un service implémentant le support des threads.
Exception lorsqu'une opération n'est pas supportée.
Vue sur une chaîne de caractères UTF-8.
std::string_view toStdStringView() const ARCCORE_NOEXCEPT
Retourne une vue de la STL de la vue actuelle.
Chaîne de caractères unicode.
IMemoryRessourceMng * setDataMemoryResourceMng(IMemoryRessourceMng *mng)
Positionne le gestionnaire de ressource mémoire pour les données.
IMemoryRessourceMng * getDataMemoryResourceMng()
Gestionnaire de ressource mémoire pour les données.
IMemoryAllocator * setAcceleratorHostMemoryAllocator(IMemoryAllocator *a)
Positionne l'allocateur spécifique pour les accélérateurs.
IMemoryAllocator * getDefaultDataAllocator()
Allocateur par défaut pour les données.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-