X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c7edbf695cf8cae1e5bbca502b505d349510eebb..c4000f89d4644c3d7ff6187a62a0930c4d53e683:/src/instr/instr_paje_header.cpp diff --git a/src/instr/instr_paje_header.cpp b/src/instr/instr_paje_header.cpp index 4f49363a9b..9e4de83ac3 100644 --- a/src/instr/instr_paje_header.cpp +++ b/src/instr/instr_paje_header.cpp @@ -1,264 +1,263 @@ -/* Copyright (c) 2010, 2012-2015. The SimGrid Team. +/* Copyright (c) 2010-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "src/instr/instr_private.h" -#include "simgrid/sg_config.h" +#include "simgrid/sg_config.hpp" +#include "src/instr/instr_private.hpp" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_header, instr, "Paje tracing event system (header)"); +extern std::ofstream tracing_file; -extern FILE *tracing_file; - -static void TRACE_header_PajeDefineContainerType (int basic, int size) +static void TRACE_header_PajeDefineContainerType(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", simgrid::instr::PAJE_DefineContainerType); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineContainerType " << simgrid::instr::PAJE_DefineContainerType << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% ContainerType string\n"); + tracing_file << "% ContainerType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); + tracing_file << "% Type string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDefineVariableType (int basic, int size) +static void TRACE_header_PajeDefineVariableType(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", simgrid::instr::PAJE_DefineVariableType); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineVariableType " << simgrid::instr::PAJE_DefineVariableType << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% ContainerType string\n"); + tracing_file << "% ContainerType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); + tracing_file << "% Type string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%% Color color\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "% Color color" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDefineStateType (int basic, int size) +static void TRACE_header_PajeDefineStateType(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", simgrid::instr::PAJE_DefineStateType); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineStateType " << simgrid::instr::PAJE_DefineStateType << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% ContainerType string\n"); + tracing_file << "% ContainerType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); + tracing_file << "% Type string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDefineEventType (int basic, int size) +static void TRACE_header_PajeDefineEventType(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", simgrid::instr::PAJE_DefineEventType); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineEventType " << simgrid::instr::PAJE_DefineEventType << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% ContainerType string\n"); + tracing_file << "% ContainerType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); + tracing_file << "% Type string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDefineLinkType (int basic, int size) +static void TRACE_header_PajeDefineLinkType(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", simgrid::instr::PAJE_DefineLinkType); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineLinkType " << simgrid::instr::PAJE_DefineLinkType << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% ContainerType string\n"); - fprintf(tracing_file, "%% SourceContainerType string\n"); - fprintf(tracing_file, "%% DestContainerType string\n"); + tracing_file << "% ContainerType string" << std::endl; + tracing_file << "% SourceContainerType string" << std::endl; + tracing_file << "% DestContainerType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% StartContainerType string\n"); - fprintf(tracing_file, "%% EndContainerType string\n"); + tracing_file << "% Type string" << std::endl; + tracing_file << "% StartContainerType string" << std::endl; + tracing_file << "% EndContainerType string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDefineEntityValue (int basic, int size) +static void TRACE_header_PajeDefineEntityValue(bool basic) { - fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", simgrid::instr::PAJE_DefineEntityValue); - fprintf(tracing_file, "%% Alias string\n"); + tracing_file << "%EventDef PajeDefineEntityValue " << simgrid::instr::PAJE_DefineEntityValue << std::endl; + tracing_file << "% Alias string" << std::endl; if (basic){ - fprintf(tracing_file, "%% EntityType string\n"); + tracing_file << "% EntityType string" << std::endl; }else{ - fprintf(tracing_file, "%% Type string\n"); + tracing_file << "% Type string" << std::endl; } - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%% Color color\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Name string" << std::endl; + tracing_file << "% Color color" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeCreateContainer (int basic, int size) +static void TRACE_header_PajeCreateContainer() { - fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", simgrid::instr::PAJE_CreateContainer); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Alias string\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeCreateContainer " << simgrid::instr::PAJE_CreateContainer << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Alias string" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeDestroyContainer (int basic, int size) +static void TRACE_header_PajeDestroyContainer() { - fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", simgrid::instr::PAJE_DestroyContainer); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Name string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeDestroyContainer " << simgrid::instr::PAJE_DestroyContainer << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Name string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeSetVariable (int basic, int size) +static void TRACE_header_PajeSetVariable() { - fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", simgrid::instr::PAJE_SetVariable); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value double\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeSetVariable " << simgrid::instr::PAJE_SetVariable << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value double" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeAddVariable (int basic, int size) +static void TRACE_header_PajeAddVariable() { - fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", simgrid::instr::PAJE_AddVariable); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value double\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeAddVariable " << simgrid::instr::PAJE_AddVariable << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value double" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeSubVariable (int basic, int size) +static void TRACE_header_PajeSubVariable() { - fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", simgrid::instr::PAJE_SubVariable); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value double\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeSubVariable " << simgrid::instr::PAJE_SubVariable << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value double" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } - -static void TRACE_header_PajeSetState (int basic, int size) +static void TRACE_header_PajeSetState() { - fprintf(tracing_file, "%%EventDef PajeSetState %d\n", simgrid::instr::PAJE_SetState); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeSetState " << simgrid::instr::PAJE_SetState << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajePushState (int basic, int size) +static void TRACE_header_PajePushState(int size) { - fprintf(tracing_file, "%%EventDef PajePushState %d\n", simgrid::instr::PAJE_PushState); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value string\n"); - if (size) fprintf(tracing_file, "%% Size int\n"); + tracing_file << "%EventDef PajePushState " << simgrid::instr::PAJE_PushState << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value string" << std::endl; + if (size) + tracing_file << "% Size int" << std::endl; #if HAVE_SMPI - if (xbt_cfg_get_boolean("smpi/trace-call-location")) { + if (simgrid::config::get_value("smpi/trace-call-location")) { /** * paje currently (May 2016) uses "Filename" and "Linenumber" as * reserved words. We cannot use them... */ - fprintf(tracing_file, "%% Fname string\n"); - fprintf(tracing_file, "%% Lnumber int\n"); + tracing_file << "% Fname string" << std::endl; + tracing_file << "% Lnumber int" << std::endl; } #endif - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajePopState (int basic, int size) +static void TRACE_header_PajePopState() { - fprintf(tracing_file, "%%EventDef PajePopState %d\n", simgrid::instr::PAJE_PopState); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajePopState " << simgrid::instr::PAJE_PopState << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeResetState (int basic, int size) +static void TRACE_header_PajeResetState(bool basic) { - if (basic) return; + if (basic) + return; - fprintf(tracing_file, "%%EventDef PajeResetState %d\n", simgrid::instr::PAJE_ResetState); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeResetState " << simgrid::instr::PAJE_ResetState << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeStartLink (int basic, int size) +static void TRACE_header_PajeStartLink(bool basic, bool size) { - fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", simgrid::instr::PAJE_StartLink); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value string\n"); + tracing_file << "%EventDef PajeStartLink " << simgrid::instr::PAJE_StartLink << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value string" << std::endl; if (basic){ - fprintf(tracing_file, "%% SourceContainer string\n"); + tracing_file << "% SourceContainer string" << std::endl; }else{ - fprintf(tracing_file, "%% StartContainer string\n"); + tracing_file << "% StartContainer string" << std::endl; } - fprintf(tracing_file, "%% Key string\n"); - if (size) fprintf(tracing_file, "%% Size int\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Key string" << std::endl; + if (size) + tracing_file << "% Size int" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeEndLink (int basic, int size) +static void TRACE_header_PajeEndLink(bool basic) { - fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", simgrid::instr::PAJE_EndLink); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value string\n"); + tracing_file << "%EventDef PajeEndLink " << simgrid::instr::PAJE_EndLink << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value string" << std::endl; if (basic){ - fprintf(tracing_file, "%% DestContainer string\n"); + tracing_file << "% DestContainer string" << std::endl; }else{ - fprintf(tracing_file, "%% EndContainer string\n"); + tracing_file << "% EndContainer string" << std::endl; } - fprintf(tracing_file, "%% Key string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "% Key string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -static void TRACE_header_PajeNewEvent (int basic, int size) +static void TRACE_header_PajeNewEvent() { - fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", simgrid::instr::PAJE_NewEvent); - fprintf(tracing_file, "%% Time date\n"); - fprintf(tracing_file, "%% Type string\n"); - fprintf(tracing_file, "%% Container string\n"); - fprintf(tracing_file, "%% Value string\n"); - fprintf(tracing_file, "%%EndEventDef\n"); + tracing_file << "%EventDef PajeNewEvent " << simgrid::instr::PAJE_NewEvent << std::endl; + tracing_file << "% Time date" << std::endl; + tracing_file << "% Type string" << std::endl; + tracing_file << "% Container string" << std::endl; + tracing_file << "% Value string" << std::endl; + tracing_file << "%EndEventDef" << std::endl; } -void TRACE_header(int basic, int size) +void TRACE_header(bool basic, bool size) { - XBT_DEBUG ("Define paje header"); - TRACE_header_PajeDefineContainerType (basic, size); - TRACE_header_PajeDefineVariableType (basic, size); - TRACE_header_PajeDefineStateType (basic, size); - TRACE_header_PajeDefineEventType (basic, size); - TRACE_header_PajeDefineLinkType (basic, size); - TRACE_header_PajeDefineEntityValue (basic, size); - TRACE_header_PajeCreateContainer (basic, size); - TRACE_header_PajeDestroyContainer (basic, size); - TRACE_header_PajeSetVariable (basic, size); - TRACE_header_PajeAddVariable (basic, size); - TRACE_header_PajeSubVariable (basic, size); - TRACE_header_PajeSetState (basic, size); - TRACE_header_PajePushState (basic, size); - TRACE_header_PajePopState (basic, size); - TRACE_header_PajeResetState (basic, size); + TRACE_header_PajeDefineContainerType(basic); + TRACE_header_PajeDefineVariableType(basic); + TRACE_header_PajeDefineStateType(basic); + TRACE_header_PajeDefineEventType(basic); + TRACE_header_PajeDefineLinkType(basic); + TRACE_header_PajeDefineEntityValue(basic); + TRACE_header_PajeCreateContainer(); + TRACE_header_PajeDestroyContainer(); + TRACE_header_PajeSetVariable(); + TRACE_header_PajeAddVariable(); + TRACE_header_PajeSubVariable(); + TRACE_header_PajeSetState(); + TRACE_header_PajePushState(size); + TRACE_header_PajePopState(); + TRACE_header_PajeResetState(basic); TRACE_header_PajeStartLink (basic, size); - TRACE_header_PajeEndLink (basic, size); - TRACE_header_PajeNewEvent (basic, size); + TRACE_header_PajeEndLink(basic); + TRACE_header_PajeNewEvent(); }