14#include "arcane/utils/ValueConvert.h"
15#include "arcane/utils/NotImplementedException.h"
16#include "arcane/utils/PlatformUtils.h"
17#include "arcane/utils/FatalErrorException.h"
18#include "arcane/utils/TraceInfo.h"
20#include "arcane/FactoryService.h"
21#include "arcane/AbstractService.h"
23#include "arcane/utils/IProfilingService.h"
25#include "arcane/std/ProfilingInfo.h"
63 void switchEvent()
override;
68 void reset()
override;
73 bool m_is_initialized =
false;
81 ProfProfilingService);
86ProfPerformanceService::
87ProfPerformanceService(
const ServiceBuildInfo& sbi)
95ProfPerformanceService::
96~ProfPerformanceService()
104_setTimer(Integer usecond)
106 struct itimerval time_val;
107 struct itimerval otime_val;
108 time_val.it_value.tv_sec = 0;
109 time_val.it_value.tv_usec = usecond;
110 time_val.it_interval.tv_sec = 0;
111 time_val.it_interval.tv_usec = 0;
112 int r = setitimer(ITIMER_PROF,&time_val,&otime_val);
114 cout <<
"** ERROR in setitimer r=" << r <<
'\n';
124ProfInfos* global_infos =
nullptr;
125bool global_is_active =
false;
127int global_timer_period = 10000;
133 static bool is_in_handler =
false;
140 cout <<
"** WARNING: ProfHandler in pending exception\n";
144 cout <<
"** In handler\n";
147 is_in_handler =
true;
150 int overflow_event[MAX_COUNTER];
151 int nb_overflow_event = 1;
152 overflow_event[0] = 0;
154 unw_word_t func_ip = 0;
155 unw_word_t offset = 0;
160 unw_init_local(&cursor, &uc);
161 int current_func = 0;
167 while (unw_step(&cursor) > 0 && current_func<3) {
170 unw_get_reg(&cursor, UNW_REG_IP, &func_ip);
172 char func_name_buf[10000];
173 unw_get_proc_name(&cursor,func_name_buf,10000,&offset);
174 cout <<
"** I=" << current_func <<
" FUNC NAME=" << func_name_buf
175 <<
" ip=" << (
void*)func_ip <<
'\n';
181 global_infos->addEvent((
void*)(func_ip+offset),overflow_event,nb_overflow_event);
183 is_in_handler =
false;
190_arcaneProfilingSigFunc(
int signum)
195 if (global_is_active){
196 arcane_prof_handler();
200 _setTimer(global_timer_period);
205_arcaneProfilingSigactionFunc(
int val, siginfo_t*,
void*)
207 _arcaneProfilingSigFunc(val);
216 if (m_is_initialized)
218 m_is_initialized =
true;
238 sa.sa_sigaction = _arcaneProfilingSigactionFunc;
247void ProfPerformanceService::
297void ProfPerformanceService::
#define ARCANE_REGISTER_APPLICATION_FACTORY(aclass, ainterface, aname)
Enregistre un service de fabrique pour la classe aclass.
Classe de base d'un service.
Tableau d'items de types quelconques.
Interface d'un service de profiling.
Interface d'un gestionnaire de timer.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Structure contenant les informations pour créer un service.
static bool hasPendingException()
Indique si des exceptions sont en cours.
Exception lorsqu'une fonction n'est pas implémentée.
ITraceMng * traceMng() const
Gestionnaire de trace.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-