Arcane  v3.16.7.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
arcane/src/arcane/utils/PlatformUtils.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* PlatformUtils.cc (C) 2000-2025 */
9/* */
10/* Fonctions utilitaires dépendant de la plateforme. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
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/NotImplementedException.h"
24#include "arcane/utils/FatalErrorException.h"
25#include "arcane/utils/Array.h"
26#include "arcane/utils/StringList.h"
28#include "arcane/utils/CheckedConvert.h"
29#include "arcane/utils/internal/MemoryUtilsInternal.h"
30
32
33#include <chrono>
34
35#ifndef ARCANE_OS_WIN32
36#define ARCANE_OS_UNIX
37#endif
38
39#ifdef ARCANE_OS_WIN32
40#include <sys/types.h>
41#include <sys/timeb.h>
42#include <sys/stat.h>
43#include <direct.h>
44#include <process.h>
45#include <windows.h>
46#include <shlobj.h>
47#endif
48
49#ifdef ARCANE_OS_UNIX
50#include <unistd.h>
51#include <sys/resource.h>
52#include <time.h>
53#include <sys/types.h>
54#include <sys/stat.h>
55#include <sys/time.h>
56#include <fcntl.h>
57#endif
58
59#ifdef ARCANE_OS_MACOS
60#include <cstdlib>
61#include <mach-o/dyld.h>
62#include <crt_externs.h>
63#else
64#include <malloc.h>
65#endif
66
67
68#if !defined(ARCANE_OS_CYGWIN) && !defined(ARCANE_OS_WIN32)
69#if defined(__i386__)
70#define ARCANE_HAS_I386_FPU_CONTROL_H
71#include <fpu_control.h>
72#endif
73#endif
74
75#ifndef ARCANE_OS_WIN32
76#include <pwd.h>
77#include <sys/types.h>
78#include <unistd.h>
79#endif
80
81// Support pour gérer les exceptions flottantes:
82// - sous Linux avec la GlibC, cela se fait via les méthodes
83// feenableexcept(), fedisableexcept() et fegetexcept()
84// - sous Win32, cela se fait via la méthode _controlfp() mais pour
85// l'instant ce n'est pas utilisé dans Arcane.
86#if defined(ARCANE_OS_LINUX) && defined(__USE_GNU)
87# include <fenv.h>
88# define ARCANE_GLIBC_FENV
89#endif
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94namespace Arcane
95{
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
100namespace platform
101{
102 IOnlineDebuggerService* global_online_debugger_service = nullptr;
103 ISymbolizerService* global_symbolizer_service = nullptr;
104 IProfilingService* global_profiling_service = nullptr;
105 IProcessorAffinityService* global_processor_affinity_service = nullptr;
106 IDynamicLibraryLoader* global_dynamic_library_loader = nullptr;
107 IPerformanceCounterService* global_performance_counter_service = nullptr;
108 bool global_has_color_console = false;
109}
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114extern "C++" ARCANE_UTILS_EXPORT ISymbolizerService* platform::
116{
117 return global_symbolizer_service;
118}
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123extern "C++" ARCANE_UTILS_EXPORT ISymbolizerService* platform::
125{
126 ISymbolizerService* old_service = global_symbolizer_service;
127 global_symbolizer_service = service;
128 return old_service;
129}
130
131/*---------------------------------------------------------------------------*/
132/*---------------------------------------------------------------------------*/
133
134extern "C++" ARCANE_UTILS_EXPORT IOnlineDebuggerService* platform::
136{
137 return global_online_debugger_service;
138}
139
140/*---------------------------------------------------------------------------*/
141/*---------------------------------------------------------------------------*/
142
143extern "C++" ARCANE_UTILS_EXPORT IOnlineDebuggerService* platform::
145{
146 IOnlineDebuggerService* old_service = global_online_debugger_service;
147 global_online_debugger_service = service;
148 return old_service;
149}
150
151/*---------------------------------------------------------------------------*/
152/*---------------------------------------------------------------------------*/
153
154extern "C++" ARCANE_UTILS_EXPORT IProfilingService* platform::
156{
157 return global_profiling_service;
158}
159
160/*---------------------------------------------------------------------------*/
161/*---------------------------------------------------------------------------*/
162
163extern "C++" ARCANE_UTILS_EXPORT IProfilingService* platform::
165{
166 IProfilingService* old_service = global_profiling_service;
167 global_profiling_service = service;
168 return old_service;
169}
170
171/*---------------------------------------------------------------------------*/
172/*---------------------------------------------------------------------------*/
173
174extern "C++" ARCANE_UTILS_EXPORT IDynamicLibraryLoader* platform::
176{
177 return global_dynamic_library_loader;
178}
179
180/*---------------------------------------------------------------------------*/
181/*---------------------------------------------------------------------------*/
182
183extern "C++" ARCANE_UTILS_EXPORT IDynamicLibraryLoader* platform::
185{
186 IDynamicLibraryLoader* old_service = global_dynamic_library_loader;
187 global_dynamic_library_loader = idll;
188 return old_service;
189}
190
191/*---------------------------------------------------------------------------*/
192/*---------------------------------------------------------------------------*/
193
194extern "C++" ARCANE_UTILS_EXPORT IProcessorAffinityService* platform::
196{
197 return global_processor_affinity_service;
198}
199
200/*---------------------------------------------------------------------------*/
201/*---------------------------------------------------------------------------*/
202
203extern "C++" ARCANE_UTILS_EXPORT IProcessorAffinityService* platform::
205{
206 IProcessorAffinityService* old_service = global_processor_affinity_service;
207 global_processor_affinity_service = service;
208 return old_service;
209}
210
211/*---------------------------------------------------------------------------*/
212/*---------------------------------------------------------------------------*/
213
214extern "C++" ARCANE_UTILS_EXPORT IPerformanceCounterService* platform::
216{
217 return global_performance_counter_service;
218}
219
220/*---------------------------------------------------------------------------*/
221/*---------------------------------------------------------------------------*/
222
223extern "C++" ARCANE_UTILS_EXPORT IPerformanceCounterService* platform::
225{
226 auto* old_service = global_performance_counter_service;
227 global_performance_counter_service = service;
228 return old_service;
229}
230
231/*---------------------------------------------------------------------------*/
232/*---------------------------------------------------------------------------*/
233
239
240/*---------------------------------------------------------------------------*/
241/*---------------------------------------------------------------------------*/
242
248
249/*---------------------------------------------------------------------------*/
250/*---------------------------------------------------------------------------*/
251
257
258/*---------------------------------------------------------------------------*/
259/*---------------------------------------------------------------------------*/
260
261extern "C++" ARCANE_UTILS_EXPORT IMemoryRessourceMng* platform::
262setDataMemoryRessourceMng(IMemoryRessourceMng* mng)
263{
265}
266
267/*---------------------------------------------------------------------------*/
268/*---------------------------------------------------------------------------*/
269
270IMemoryRessourceMng* platform::
272{
274}
275
276/*---------------------------------------------------------------------------*/
277/*---------------------------------------------------------------------------*/
278
279extern "C++" ARCANE_UTILS_EXPORT IThreadImplementation* platform::
281{
282 return Arccore::Concurrency::getThreadImplementation();
283}
284
285/*---------------------------------------------------------------------------*/
286/*---------------------------------------------------------------------------*/
287
288extern "C++" ARCANE_UTILS_EXPORT IThreadImplementation* platform::
290{
291 return Arccore::Concurrency::setThreadImplementation(service);
292}
293
294/*---------------------------------------------------------------------------*/
295/*---------------------------------------------------------------------------*/
296
297extern "C++" ARCANE_UTILS_EXPORT void platform::
298resetAlarmTimer(Integer nb_second)
299{
300#ifdef ARCANE_OS_UNIX
301 struct itimerval time_val;
302 struct itimerval otime_val;
303 time_val.it_value.tv_sec = nb_second;
304 time_val.it_value.tv_usec = 0;
305 time_val.it_interval.tv_sec = 0;
306 time_val.it_interval.tv_usec = 0;
307 // Utilise le temps virtuel et pas le temps réel.
308 // Cela permet de suspendre temporairement un job (par exemple
309 // pour régler des problèmes systèmes) sans déclencher l'alarme.
310 int r = setitimer(ITIMER_VIRTUAL,&time_val,&otime_val);
311 if (r!=0)
312 cout << "** ERROR in setitimer r=" << r << '\n';
313#endif
314}
315
316/*---------------------------------------------------------------------------*/
317/*---------------------------------------------------------------------------*/
318
319extern "C++" ARCANE_UTILS_EXPORT void platform::
321{
323}
324
325/*---------------------------------------------------------------------------*/
326/*---------------------------------------------------------------------------*/
327
328extern "C++" ARCANE_UTILS_EXPORT void platform::
330{
332}
333
334/*---------------------------------------------------------------------------*/
335/*---------------------------------------------------------------------------*/
336
337namespace
338{
339template<typename ByteType> bool
340_readAllFile(StringView filename, bool is_binary, Array<ByteType>& out_bytes)
341{
342 using namespace std;
343 long unsigned int file_length = platform::getFileLength(filename);
344 if (file_length == 0) {
345 //cerr << "** FAIL LENGTH\n";
346 return true;
347 }
348 ifstream ifile;
349 ios::openmode mode = ios::in;
350 if (is_binary)
351 mode |= ios::binary;
352 ifile.open(filename.toStdStringView().data());
353 if (ifile.fail()) {
354 //cerr << "** FAIL OPEN\n";
355 return true;
356 }
357 out_bytes.resize(file_length);
358 ifile.read((char*)(out_bytes.data()), file_length);
359 if (ifile.bad()) {
360 // cerr << "** BAD READ\n";
361 return true;
362 }
363 // Il est possible que le nombre d'octets lus soit inférieur
364 // à la longueur du fichier, notamment sous Windows avec les fichiers
365 // texte et la conversion des retour-chariots. Il faut donc redimensionner
366 // \a bytes à la bonne longueur.
367 size_t nb_read = ifile.gcount();
368 out_bytes.resize(nb_read);
369 //cerr << "** READ " << file_length << " bytes " << (const char*)(bytes.begin()) << "\n";
370 return false;
371}
372}
373
374/*---------------------------------------------------------------------------*/
375/*---------------------------------------------------------------------------*/
376
378readAllFile(StringView filename, bool is_binary, ByteArray& out_bytes)
379{
380 return _readAllFile(filename,is_binary,out_bytes);
381}
382
383/*---------------------------------------------------------------------------*/
384/*---------------------------------------------------------------------------*/
385
387readAllFile(StringView filename, bool is_binary, Array<std::byte>& out_bytes)
388{
389 return _readAllFile(filename,is_binary,out_bytes);
390}
391
392/*---------------------------------------------------------------------------*/
393/*---------------------------------------------------------------------------*/
394
395static bool global_has_dotnet_runtime = false;
396extern "C++" bool platform::
398{
399 return global_has_dotnet_runtime;
400}
401
402extern "C++" void platform::
404{
405 global_has_dotnet_runtime = v;
406}
407
408/*---------------------------------------------------------------------------*/
409/*---------------------------------------------------------------------------*/
410
411extern "C++" String platform::
413{
414 String full_path;
415#if defined(ARCANE_OS_LINUX)
416 char* buf = ::realpath("/proc/self/exe",nullptr);
417 if (buf){
418 full_path = StringView(buf);
419 ::free(buf);
420 }
421#elif defined(ARCANE_OS_WIN32)
422 char buf[2048];
423 int r = GetModuleFileNameA(NULL,buf,2000);
424 if (r>0){
425 full_path = StringView(buf);
426 }
427#elif defined(ARCANE_OS_MACOS)
428 char buf[2048];
429 uint32_t bufSize = 2000;
430 int r = _NSGetExecutablePath(buf, &bufSize);
431 if (r==0) { // success returns 0
432 full_path = StringView(buf);
433 }
434#else
435#error "platform::getExeFullPath() not implemented for this platform"
436#endif
437 return full_path;
438}
439
440/*---------------------------------------------------------------------------*/
441/*---------------------------------------------------------------------------*/
442
443extern "C++" String platform::
445{
446 String full_path;
447 if (dll_name.null())
448 return full_path;
449#if defined(ARCANE_OS_LINUX)
450 {
451 std::ifstream ifile("/proc/self/maps");
452 String v;
453 String true_name = "lib" + dll_name + ".so";
454 while (ifile.good()){
455 ifile >> v;
456 Span<const Byte> vb = v.bytes();
457 if (vb.size()>0 && vb[0]=='/'){
458 if (v.endsWith(true_name)){
459 full_path = v;
460 //std::cout << "V='" << v << "'\n";
461 break;
462 }
463 }
464 }
465 }
466#elif defined(ARCANE_OS_WIN32)
467 HMODULE hModule = GetModuleHandleA(dll_name.localstr());
468 if (!hModule)
469 return full_path;
470 TCHAR dllPath[_MAX_PATH];
471 GetModuleFileName(hModule, dllPath, _MAX_PATH);
472 full_path = StringView(dllPath);
473#elif defined(ARCANE_OS_MACOS)
474 {
475 String true_name = "lib" + dll_name + ".dylib";
476 uint32_t count = _dyld_image_count();
477 for (uint32_t i = 0; i < count; i++) {
478 const char* image_name = _dyld_get_image_name(i);
479 if (image_name) {
480 String image_path(image_name);
481 if (image_path.endsWith(true_name)) {
482 full_path = image_path;
483 break;
484 }
485 }
486 }
487 }
488#else
489 throw NotSupportedException(A_FUNCINFO);
490//#error "platform::getSymbolFullPath() not implemented for this platform"
491#endif
492 return full_path;
493}
494
495/*---------------------------------------------------------------------------*/
496/*---------------------------------------------------------------------------*/
497
498extern "C++" void platform::
500{
501 arg_list.clear();
502#if defined(ARCANE_OS_LINUX)
503
504 const int BUFSIZE = 1024;
505 char buffer[BUFSIZE + 1];
506
507 UniqueArray<char> bytes;
508 bytes.reserve(1024);
509
510 {
511 const char* filename = "/proc/self/cmdline";
512 int fd = open(filename, O_RDONLY);
513 if (fd<0)
514 return;
515 ssize_t nb_read = 0;
516 // TODO: traiter les interruptions
517 while ((nb_read = read(fd, buffer, BUFSIZE)) > 0) {
518 buffer[BUFSIZE] = '\0';
519 bytes.addRange(Span<const char>(buffer, nb_read));
520 }
521 close(fd);
522 }
523
524 int size = bytes.size();
525 const char* ptr = bytes.data();
526 const char* end = ptr + size;
527 while (ptr < end) {
528 arg_list.add(StringView(ptr));
529 while (*ptr++ && ptr < end)
530 ;
531 }
532#elif defined(ARCANE_OS_WIN32)
533 LPWSTR* w_arg_list = nullptr;
534 int nb_arg = 0;
535
536 w_arg_list = ::CommandLineToArgvW(GetCommandLineW(), &nb_arg);
537 if (!w_arg_list)
538 ARCANE_FATAL("Can not get arguments from command line");
539
540 for (int i = 0; i < nb_arg; i++) {
541 std::wstring_view wstr_view(w_arg_list[i]);
543 arg_list.add(str);
544 }
545
546 ::LocalFree(w_arg_list);
547#elif defined(ARCANE_OS_MACOS)
548 int argc = *_NSGetArgc();
549 char** argv = *_NSGetArgv();
550 for (int i = 0; i < argc; i++) {
551 arg_list.add(StringView(argv[i]));
552 }
553#else
554 ARCANE_THROW(NotImplementedException, "not implemented for this platform");
555#endif
556}
557
558/*---------------------------------------------------------------------------*/
559/*---------------------------------------------------------------------------*/
560// TODO: mettre ensuite dans 'Arccore'
561
562extern "C++" ARCANE_UTILS_EXPORT Int64 platform::
564{
565 auto x = std::chrono::high_resolution_clock::now();
566 // Converti la valeur en nanosecondes.
567 auto y = std::chrono::time_point_cast<std::chrono::nanoseconds>(x);
568 // Retourne le temps en nano-secondes.
569 return static_cast<Int64>(y.time_since_epoch().count());
570}
571
572/*---------------------------------------------------------------------------*/
573/*---------------------------------------------------------------------------*/
574
575extern "C++" ARCANE_UTILS_EXPORT Int64 platform::
577{
578#if defined(ARCCORE_OS_WIN32)
579 SYSTEM_INFO si;
580 GetSystemInfo(&si);
581 return si.dwPageSize;
582#elif defined(ARCANE_OS_LINUX)
583 return ::sysconf(_SC_PAGESIZE);
584#else
585#warning "getPageSize() not implemented for your platform. Default is 4096"
586 Int64 page_size = 4096;
587 return page_size;
588#endif
589}
590
591/*---------------------------------------------------------------------------*/
592/*---------------------------------------------------------------------------*/
593
594namespace
595{
596 String _getDebuggerStack(const char* command)
597 {
598 char filename[4096];
599 long pid = (long)getpid();
600 sprintf(filename, "errlog.%ld", pid);
601 int ret_value = system(command);
602 if (ret_value != 0) {
603 UniqueArray<Byte> bytes;
604 if (!platform::readAllFile(filename, false, bytes))
605 return String(bytes);
606 }
607 return {};
608 }
609} // namespace
610
611extern "C++" ARCANE_UTILS_EXPORT String platform::
613{
614 String result;
615#if defined(ARCANE_OS_LINUX)
616 const size_t cmd_size = 4096;
617 char cmd[cmd_size + 1];
618 //sprintf (cmd, "gdb --ex 'attach %ld' --ex 'info threads' --ex 'thread apply all bt'", (long)getpid ());
619 //sprintf (cmd, "gdb --ex 'attach %ld' --ex 'info threads' --ex 'thread apply all bt' --batch", (long)getpid ());
620 long pid = (long)getpid();
621 snprintf(cmd, cmd_size, "gdb --ex 'set debuginfod enabled off' --ex 'attach %ld' --ex 'info threads' --ex 'thread apply all bt full' --batch", pid);
622 result = _getDebuggerStack(cmd);
623#endif
624 return result;
625}
626
627/*---------------------------------------------------------------------------*/
628/*---------------------------------------------------------------------------*/
629
630extern "C++" ARCANE_UTILS_EXPORT String platform::
632{
633 String result;
634#if defined(ARCANE_OS_LINUX)
635 const size_t cmd_size = 4096;
636 char cmd[cmd_size + 1];
637 long pid = (long)getpid();
638 // Les commandes 'clrthreads', 'clrstack' et 'dumpstack' nécessitent
639 // d'avoir installé 'dotnet-sos'.
640 snprintf(cmd, cmd_size, "lldb -p %ld -o 'bt' -o 'bt all' -o 'clrthreads' -o 'clrstack' -o 'dumpstack' --batch", pid);
641 result = _getDebuggerStack(cmd);
642#endif
643 return result;
644}
645
646/*---------------------------------------------------------------------------*/
647/*---------------------------------------------------------------------------*/
648
649namespace
650{
651void (*global_garbage_collector_delegate)() = nullptr;
652}
653
654extern "C" ARCANE_UTILS_EXPORT void
655_ArcaneSetCallGarbageCollectorDelegate(void(*f)())
656{
657 global_garbage_collector_delegate = f;
658}
659
660extern "C++" void platform::
662{
663 if (global_garbage_collector_delegate)
664 (*global_garbage_collector_delegate)();
665}
666
667/*---------------------------------------------------------------------------*/
668/*---------------------------------------------------------------------------*/
669
670} // End namespace Arcane
671
672/*---------------------------------------------------------------------------*/
673/*---------------------------------------------------------------------------*/
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Fonctions de gestion mémoire et des allocateurs.
Fonctions utilitaires sur les chaînes de caractères.
ARCCORE_BASE_EXPORT String convertToArcaneString(const std::wstring_view &wstr)
Convertie wstr en une String.
Definition String.cc:1305
Integer size() const
Nombre d'éléments du vecteur.
Tableau d'items de types quelconques.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
void reserve(Int64 new_capacity)
Réserve le mémoire pour new_capacity éléments.
const T * data() const
Accès à la racine du tableau hors toute protection.
void addRange(ConstReferenceType val, Int64 n)
Ajoute n élément de valeur val à la fin du tableau.
void clear()
Supprime tous les éléments de la collection.
Definition Collection.h:68
Interface d'une chargeur dynamique de bibliothèque.
Interface d'un service de debugger hybrid.
Interface d'un service d'accès aux compteurs de performance.
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.
Interface d'un service implémentant le support des threads.
Exception lorsqu'une fonction n'est pas implémentée.
Exception lorsqu'une opération n'est pas supportée.
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
Definition Span.h:212
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
Vue sur une chaîne de caractères UTF-8.
Definition StringView.h:47
std::string_view toStdStringView() const ARCCORE_NOEXCEPT
Retourne une vue de la STL de la vue actuelle.
Definition StringView.h:112
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
Definition String.cc:305
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
Definition String.cc:228
bool endsWith(const String &s) const
Indique si la chaîne se termine par les caractères de s.
Definition String.cc:1084
Vecteur 1D de données avec sémantique par valeur (style STL).
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.
IMemoryAllocator * getAcceleratorHostMemoryAllocator()
Allocateur spécifique pour les accélérateurs.
ARCCORE_BASE_EXPORT void platformTerminate()
Routines de fin de programme spécifiques à une platforme.
ARCCORE_BASE_EXPORT void platformInitialize()
Initialisations spécifiques à une platforme.
Espace de nom pour les fonctions dépendant de la plateforme.
IPerformanceCounterService * setPerformanceCounterService(IPerformanceCounterService *service)
Positionne le service utilisé pour gérer les compteurs interne du processeur.
void callDotNETGarbageCollector()
Appelle le Garbage Collector de '.Net' s'il est disponible.
String getLLDBStack()
Récupère la pile d'appel via lldb.
String getLoadedSharedLibraryFullPath(const String &dll_name)
Retourne le chemin complet d'une bibliothèque dynamique chargée.
ISymbolizerService * setSymbolizerService(ISymbolizerService *service)
Positionne le service pour obtenir des informations sur les symboles du code source.
IDynamicLibraryLoader * getDynamicLibraryLoader()
Service utilisé pour charger dynamiquement des bibliothèques.
void fillCommandLineArguments(StringList &arg_list)
Remplit arg_list avec les arguments de la ligne de commande.
IMemoryRessourceMng * setDataMemoryRessourceMng(IMemoryRessourceMng *mng)
Positionne le gestionnaire de ressource mémoire pour les données.
void platformInitialize()
Initialisations spécifiques à une platforme.
IOnlineDebuggerService * setOnlineDebuggerService(IOnlineDebuggerService *service)
Positionne le service a utiliser pour l'architecture en ligne de debug.
ISymbolizerService * getSymbolizerService()
Service utilisé pour obtenir des informations sur les symboles du code source.
IProfilingService * getProfilingService()
Service utilisé pour obtenir pour obtenir des informations de profiling.
IMemoryRessourceMng * getDataMemoryRessourceMng()
Gestionnaire de ressource mémoire pour les données.
void resetAlarmTimer(Integer nb_second)
Remet à timer d'alarme à nb_second.
void platformTerminate()
Routines de fin de programme spécifiques à une platforme.
ARCCORE_BASE_EXPORT long unsigned int getFileLength(const String &filename)
Longueur du fichier filename. Si le fichier n'est pas lisible ou n'existe pas, retourne 0.
IProfilingService * setProfilingService(IProfilingService *service)
Positionne le service utilisé pour obtenir des informations de profiling.
IMemoryAllocator * getAcceleratorHostMemoryAllocator()
Allocateur spécifique pour les accélérateurs.
IMemoryAllocator * getDefaultDataAllocator()
Allocateur par défaut pour les données.
Int64 getPageSize()
Taille des pages du système hôte en octets.
String getExeFullPath()
Retourne le nom complet avec le chemin de l'exécutable.
Int64 getRealTimeNS()
Temps horloge en nano-secondes.
bool readAllFile(StringView filename, bool is_binary, ByteArray &out_bytes)
Lit le contenu d'un fichier et le conserve dans out_bytes.
IProcessorAffinityService * setProcessorAffinityService(IProcessorAffinityService *service)
Positionne le service utilisé pour la gestion de l'affinité des processeurs.
void setHasDotNETRuntime(bool v)
Positionne si le code s'exécute avec le runtime .NET.
IProcessorAffinityService * getProcessorAffinityService()
Service utilisé pour la gestion de l'affinité des processeurs.
IMemoryAllocator * setAcceleratorHostMemoryAllocator(IMemoryAllocator *a)
Positionne l'allocateur spécifique pour les accélérateurs.
IThreadImplementation * getThreadImplementationService()
Service utilisé pour gérer les threads.
IDynamicLibraryLoader * setDynamicLibraryLoader(IDynamicLibraryLoader *idll)
Positionne le service utilisé pour charger dynamiquement des bibliothèques.
IPerformanceCounterService * getPerformanceCounterService()
Service utilisé pour obtenir pour obtenir les compteurs interne du processeur.
bool hasDotNETRuntime()
Vrai si le code s'exécute avec le runtime .NET.
String getGDBStack()
Récupère la pile d'appel via gdb.
IThreadImplementation * setThreadImplementationService(IThreadImplementation *service)
Positionne le service utilisé pour gérer les threads.
IOnlineDebuggerService * getOnlineDebuggerService()
Service utilisé pour obtenir la mise en place d'une architecture en ligne de debug.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
Array< Byte > ByteArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:208
List< String > StringList
Tableau de chaînes de caractères unicode.
Definition UtilsTypes.h:596