added dvm/tools/
This commit is contained in:
1
dvm/tools/pppa/trunk/CMakeLists.txt
Normal file
1
dvm/tools/pppa/trunk/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
add_subdirectory(src)
|
||||
27
dvm/tools/pppa/trunk/makefile.uni
Normal file
27
dvm/tools/pppa/trunk/makefile.uni
Normal file
@@ -0,0 +1,27 @@
|
||||
#######################################################################
|
||||
## Copyright (C) 1999 ##
|
||||
## Keldysh Institute of Appllied Mathematics ##
|
||||
#######################################################################
|
||||
|
||||
# dvm/tools/pppa/makefile.uni
|
||||
#
|
||||
# This makefile recursively calls MAKE in each subdirectory
|
||||
#
|
||||
|
||||
# What to compile
|
||||
SUBDIR=src
|
||||
|
||||
all:
|
||||
@echo "****** RECURSIVELY MAKING SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
cd src; $(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" all
|
||||
@echo "****** DONE MAKING SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
|
||||
clean:
|
||||
@echo "****** RECURSIVELY CLEAN SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
cd src; ($(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" clean)
|
||||
@echo "****** DONE CLEAN SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
|
||||
cleanall:
|
||||
@echo "****** RECURSIVELY CLEANALL SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
cd src; ($(MAKE) "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" cleanall)
|
||||
@echo "****** DONE CLEANALL SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
40
dvm/tools/pppa/trunk/makefile.win
Normal file
40
dvm/tools/pppa/trunk/makefile.win
Normal file
@@ -0,0 +1,40 @@
|
||||
#######################################################################
|
||||
## Copyright (C) 1999 ##
|
||||
## Keldysh Institute of Appllied Mathematics ##
|
||||
#######################################################################
|
||||
|
||||
|
||||
# dvm/tools/pppa/makefile.win
|
||||
|
||||
# Valentin Emelianov (4/01/99)
|
||||
|
||||
#
|
||||
# This makefile recursively calls MAKE in each subdirectory
|
||||
#
|
||||
|
||||
# What to compile
|
||||
SUBDIR=src
|
||||
|
||||
all:
|
||||
@echo "****** RECURSIVELY MAKING SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
@cd src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" all
|
||||
@cd ..
|
||||
@echo "****** DONE MAKING SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
|
||||
clean:
|
||||
@echo "****** RECURSIVELY CLEAN SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
@cd src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" clean
|
||||
@cd ..
|
||||
@del /q .\obj\*.*
|
||||
@echo "****** DONE CLEAN SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
|
||||
cleanall:
|
||||
@echo "****** RECURSIVELY CLEANALL SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
@cd src
|
||||
@$(MAKE) /nologo -f makefile.win "MAKE=$(MAKE)" "CC=$(CC)" "CXX=$(CXX)" "LINKER=$(LINKER)" cleanall
|
||||
@cd ..
|
||||
@del /q .\bin\*.*
|
||||
@del /q .\obj\*.*
|
||||
@echo "****** DONE CLEANALL SUBDIRECTORIES dvm/tools/pppa/: $(SUBDIR) ******"
|
||||
20
dvm/tools/pppa/trunk/src/CMakeLists.txt
Normal file
20
dvm/tools/pppa/trunk/src/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
configure_file(dvmvers.h.in dvmvers.h)
|
||||
|
||||
set(PPPA_SOURCES inter.cpp potensyn.cpp statfile.cpp statread.cpp treeinter.cpp
|
||||
statprintf.cpp)
|
||||
|
||||
if(MSVC_IDE)
|
||||
file(GLOB_RECURSE PPPA_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
|
||||
endif()
|
||||
|
||||
add_executable(dvmstf ${PPPA_SOURCES} ${PPPA_HEADERS})
|
||||
|
||||
add_dependencies(dvmstf zlib)
|
||||
target_link_libraries(dvmstf zlib)
|
||||
target_include_directories(dvmstf PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(dvmstf PROPERTIES
|
||||
FOLDER "${DVM_TOOL_FOLDER}"
|
||||
RUNTIME_OUTPUT_DIRECTORY ${DVM_BIN_DIR}
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
|
||||
PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
|
||||
)
|
||||
50
dvm/tools/pppa/trunk/src/LibraryImport.cpp
Normal file
50
dvm/tools/pppa/trunk/src/LibraryImport.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Created by Пенёк on 14.09.2020.
|
||||
//
|
||||
|
||||
#include <jni.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "LibraryImport.h"
|
||||
#include "statlist.h"
|
||||
|
||||
void _stat_to_char(CStat &stat, char * &res){
|
||||
json j;
|
||||
// std::cout << std::endl << std::endl;
|
||||
// auto cur = stat.inter_tree;
|
||||
// while (cur != NULL){
|
||||
// for (int i = 0; i < cur->id.nlev; ++i)
|
||||
// std::cout << " ";
|
||||
// std::cout << cur->id.nlev << " " << ((cur->id.t == SEQ) ? "SEQ" : ((cur->id.t == PAR) ? "PAR" : "USER"));
|
||||
// std::cout << " " << ((cur->id.t == USER) ? cur->id.expr : NULL) << " " << cur->id.nline << std::endl;
|
||||
// cur = cur->next;
|
||||
// }
|
||||
stat.to_json(j);
|
||||
std::string str = j.dump();
|
||||
res = (char*) malloc(sizeof(char) * (str.size() + 1));
|
||||
for (int i = 0; i < str.size(); ++i){
|
||||
res[i] = str[i];
|
||||
}
|
||||
res[str.size()] = '\0';
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_LibraryImport_readStat(JNIEnv * env, jobject obj, jstring s)
|
||||
{
|
||||
// printf("Hello, Java! I am C++!!! Hm\n");
|
||||
jboolean isCopy;
|
||||
char *path = (char *) (env)->GetStringUTFChars(s, &isCopy);
|
||||
// std::string string = std::string(path, strlen(path));
|
||||
// std::cout << string << "\n";
|
||||
// char msg[60] = "Puk puk";
|
||||
// std::string str = "Std::string";
|
||||
// jstring result = (env)->NewStringUTF(msg);
|
||||
|
||||
CStat stat;
|
||||
stat.init(path);
|
||||
if (!stat.isinitialized)
|
||||
return NULL;
|
||||
char *res;
|
||||
_stat_to_char(stat, res);
|
||||
return (env)->NewStringUTF(res);
|
||||
}
|
||||
21
dvm/tools/pppa/trunk/src/LibraryImport.h
Normal file
21
dvm/tools/pppa/trunk/src/LibraryImport.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class LibraryImport */
|
||||
|
||||
#ifndef _Included_LibraryImport
|
||||
#define _Included_LibraryImport
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: LibraryImport
|
||||
* Method: readStat
|
||||
* Signature: (Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_LibraryImport_readStat
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
37
dvm/tools/pppa/trunk/src/PPPA/PPPA.sln
Normal file
37
dvm/tools/pppa/trunk/src/PPPA/PPPA.sln
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPPA", "PPPA\PPPA.vcxproj", "{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release_lib|x64 = Release_lib|x64
|
||||
Release_lib|x86 = Release_lib|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Debug|x64.Build.0 = Debug|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release_lib|x64.ActiveCfg = Release_lib|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release_lib|x64.Build.0 = Release_lib|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release_lib|x86.ActiveCfg = Release_lib|Win32
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release_lib|x86.Build.0 = Release_lib|Win32
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release|x64.ActiveCfg = Release|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release|x64.Build.0 = Release|x64
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F2863E8C-6FDC-4067-92B3-8E638CD846FA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
231
dvm/tools/pppa/trunk/src/PPPA/PPPA/PPPA.vcxproj
Normal file
231
dvm/tools/pppa/trunk/src/PPPA/PPPA/PPPA.vcxproj
Normal file
@@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_lib|Win32">
|
||||
<Configuration>Release_lib</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release_lib|x64">
|
||||
<Configuration>Release_lib</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{F3A2EEA7-8650-4D07-A526-AEDB0109ECB8}</ProjectGuid>
|
||||
<RootNamespace>PPPA</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\..\..\..\branches\dvm4.07\src;..\..\..\..\..\Zlib\Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\..\..\..\branches\dvm4.07\src;..\..\..\..\..\Zlib\Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'">
|
||||
<IncludePath>C:\Program Files\Java\jdk1.8.0_231\include\win32;C:\Program Files\Java\jdk1.8.0_231\include;..\..\..\..\branches\dvm4.07\src;..\..\..\..\..\Zlib\Include\;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_lib|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/wd4996 %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\adler32.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\compress.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\crc32.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\deflate.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\gzio.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infblock.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infcodes.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inffast.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inflate.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inftrees.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infutil.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\trees.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\uncompr.c" />
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\zutil.c" />
|
||||
<ClCompile Include="..\..\inter.cpp" />
|
||||
<ClCompile Include="..\..\LibraryImport.cpp" />
|
||||
<ClCompile Include="..\..\potensyn.cpp" />
|
||||
<ClCompile Include="..\..\stat.cpp" />
|
||||
<ClCompile Include="..\..\statfile.cpp" />
|
||||
<ClCompile Include="..\..\statinter.cpp" />
|
||||
<ClCompile Include="..\..\statlist.cpp" />
|
||||
<ClCompile Include="..\..\statprintf.cpp" />
|
||||
<ClCompile Include="..\..\statread.cpp" />
|
||||
<ClCompile Include="..\..\treeinter.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\bool.h" />
|
||||
<ClInclude Include="..\..\dvmh_stat.h" />
|
||||
<ClInclude Include="..\..\inter.h" />
|
||||
<ClInclude Include="..\..\LibraryImport.h" />
|
||||
<ClInclude Include="..\..\potensyn.h" />
|
||||
<ClInclude Include="..\..\statist.h" />
|
||||
<ClInclude Include="..\..\statlist.h" />
|
||||
<ClInclude Include="..\..\statprintf.h" />
|
||||
<ClInclude Include="..\..\statread.h" />
|
||||
<ClInclude Include="..\..\strall.h" />
|
||||
<ClInclude Include="..\..\sysstat.h" />
|
||||
<ClInclude Include="..\..\treeinter.h" />
|
||||
<ClInclude Include="..\..\ver.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
141
dvm/tools/pppa/trunk/src/PPPA/PPPA/PPPA.vcxproj.filters
Normal file
141
dvm/tools/pppa/trunk/src/PPPA/PPPA/PPPA.vcxproj.filters
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Исходные файлы\pppa">
|
||||
<UniqueIdentifier>{53f9375c-8c47-45fe-b189-8fba76eb91b8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков\pppa">
|
||||
<UniqueIdentifier>{53f30301-90df-4d39-ad4f-c3587eb4450f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Исходные файлы\Zlib">
|
||||
<UniqueIdentifier>{e95620dc-95c6-438c-a5f7-2322880aa280}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\inter.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\potensyn.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\statfile.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\statprintf.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\statread.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\treeinter.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\adler32.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\compress.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\crc32.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\deflate.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\gzio.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infblock.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infcodes.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inffast.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inflate.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\inftrees.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\infutil.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\trees.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\uncompr.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\..\Zlib\src\zutil.c">
|
||||
<Filter>Исходные файлы\Zlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\LibraryImport.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\statlist.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\stat.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\statinter.cpp">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\bool.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\dvmh_stat.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\inter.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\potensyn.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\statist.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\statprintf.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\statread.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\strall.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\sysstat.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\treeinter.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\ver.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\LibraryImport.h">
|
||||
<Filter>Исходные файлы\pppa</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\statlist.h">
|
||||
<Filter>Файлы заголовков\pppa</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
7
dvm/tools/pppa/trunk/src/bool.h
Normal file
7
dvm/tools/pppa/trunk/src/bool.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _BOOL_H
|
||||
#define _BOOL_H
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
typedef int BOOL;
|
||||
#endif
|
||||
|
||||
202
dvm/tools/pppa/trunk/src/dvmh_stat.h
Normal file
202
dvm/tools/pppa/trunk/src/dvmh_stat.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
* Файл содержит типы и функции для сбора статистики DVMH
|
||||
* <b> Файл не полностью совпадает с файлом из RTS! Соотвествующие места помечены как (+) </b>
|
||||
* @author Aleksei Shubert <alexei@shubert.ru>
|
||||
*/
|
||||
|
||||
#ifndef DVM_SYS_DVMH_STAT_H
|
||||
#define DVM_SYS_DVMH_STAT_H
|
||||
|
||||
#if defined(_WIN64)
|
||||
#define __LLP64__ 1
|
||||
#endif
|
||||
|
||||
#if defined(__LLP64__)
|
||||
typedef long long DvmType;
|
||||
typedef unsigned long long UDvmType;
|
||||
#else
|
||||
typedef long DvmType;
|
||||
typedef unsigned long UDvmType;
|
||||
#endif
|
||||
|
||||
#define DVMH_EXTENDED_STAT 0 /**< разбор расширенной статистики */
|
||||
|
||||
// -- Forward declarations ---------------------------------------------------------------------------------------------
|
||||
|
||||
struct _dvmh_stat_header_st;
|
||||
struct _dvmh_stat_header_gpu_info_st;
|
||||
struct _dvmh_stat_interval_st;
|
||||
struct _dvmh_stat_interval_gpu_st;
|
||||
struct _dvmh_stat_interval_gpu_metric_st;
|
||||
struct _dvmh_stat_interval_thread_st;
|
||||
|
||||
// -- Типы связанные с заголовком статистики
|
||||
typedef struct _dvmh_stat_header_st dvmh_stat_header;
|
||||
typedef struct _dvmh_stat_header_gpu_info_st dvmh_stat_header_gpu_info;
|
||||
|
||||
// -- Типы связанные с интервальной статистикой
|
||||
typedef struct _dvmh_stat_interval_st dvmh_stat_interval;
|
||||
typedef struct _dvmh_stat_interval_gpu_st dvmh_stat_interval_gpu;
|
||||
typedef struct _dvmh_stat_interval_gpu_metric_st dvmh_stat_interval_gpu_metric;
|
||||
typedef struct _dvmh_stat_interval_thread_st dvmh_stat_interval_thread;
|
||||
|
||||
// -- Constants --------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Названия метрик
|
||||
typedef enum {
|
||||
DVMH_STAT_METRIC_KERNEL_EXEC,
|
||||
/* DVMH-CUDA memcpy */
|
||||
DVMH_STAT_METRIC_CPY_DTOH,
|
||||
DVMH_STAT_METRIC_CPY_HTOD,
|
||||
DVMH_STAT_METRIC_CPY_DTOD,
|
||||
/* DVMH memcpy */
|
||||
DVMH_STAT_METRIC_CPY_SHADOW_DTOH,
|
||||
DVMH_STAT_METRIC_CPY_SHADOW_HTOD,
|
||||
DVMH_STAT_METRIC_CPY_SHADOW_DTOD,
|
||||
DVMH_STAT_METRIC_CPY_REMOTE_DTOH,
|
||||
DVMH_STAT_METRIC_CPY_REMOTE_HTOD,
|
||||
DVMH_STAT_METRIC_CPY_REMOTE_DTOD,
|
||||
DVMH_STAT_METRIC_CPY_REDIST_DTOH,
|
||||
DVMH_STAT_METRIC_CPY_REDIST_HTOD,
|
||||
DVMH_STAT_METRIC_CPY_REDIST_DTOD,
|
||||
DVMH_STAT_METRIC_CPY_IN_REG_DTOH,
|
||||
DVMH_STAT_METRIC_CPY_IN_REG_HTOD,
|
||||
DVMH_STAT_METRIC_CPY_IN_REG_DTOD,
|
||||
DVMH_STAT_METRIC_CPY_GET_ACTUAL,
|
||||
/* DVMH loop events */
|
||||
DVMH_STAT_METRIC_LOOP_PORTION_TIME,
|
||||
/* DVMH utility functions events */
|
||||
DVMH_STAT_METRIC_UTIL_ARRAY_TRANSFORMATION,
|
||||
DVMH_STAT_METRIC_UTIL_ARRAY_REDUCTION,
|
||||
DVMH_STAT_METRIC_UTIL_RTC_COMPILATION,
|
||||
DVMH_STAT_METRIC_UTIL_PAGE_LOCK_HOST_MEM,
|
||||
// --
|
||||
DVMH_STAT_METRIC_FORCE_INT
|
||||
} dvmh_stat_metric_names;
|
||||
|
||||
#define DVMH_STAT_SIZE_STR 64
|
||||
#define DVMH_STAT_METRIC_CNT DVMH_STAT_METRIC_FORCE_INT
|
||||
#define DVMH_STAT_MAX_GPU_CNT 8
|
||||
#define DVMH_STAT_GPU_UNKNOWN "Unknown"
|
||||
|
||||
// -- Global variables -------------------------------------------------------------------------------------------------
|
||||
|
||||
static const char *dvmhStatMetricsTitles[DVMH_STAT_METRIC_FORCE_INT] = {
|
||||
"Kernel executions",
|
||||
"Copy GPU to CPU",
|
||||
"Copy CPU to GPU",
|
||||
"Copy GPU to GPU",
|
||||
"[Shadow] Copy GPU to CPU",
|
||||
"[Shadow] Copy CPU to GPU",
|
||||
"[Shadow] Copy GPU to GPU",
|
||||
"[Remote] Copy GPU to CPU",
|
||||
"[Remote] Copy CPU to GPU",
|
||||
"[Remote] Copy GPU to GPU",
|
||||
"[Redistribution] Copy GPU to CPU",
|
||||
"[Redistribution] Copy CPU to GPU",
|
||||
"[Redistribution] Copy GPU to GPU",
|
||||
"[Region IN] Copy GPU to CPU",
|
||||
"[Region IN] Copy CPU to GPU",
|
||||
"[Region IN] Copy GPU to GPU",
|
||||
"GET_ACTUAL",
|
||||
"Loop execution",
|
||||
"Data reorganization",
|
||||
"Reduction",
|
||||
"GPU Runtime compilation",
|
||||
"Page lock host memory"
|
||||
};
|
||||
|
||||
static short dvmhDebug = 0;
|
||||
|
||||
// -- Data types -------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Описатель GPU в заголовке статистики
|
||||
*/
|
||||
struct _dvmh_stat_header_gpu_info_st {
|
||||
unsigned long id; /**< идентификатор GPU */
|
||||
unsigned char name[DVMH_STAT_SIZE_STR + 1]; /**< текстовое описание GPU */
|
||||
};
|
||||
|
||||
/**
|
||||
* Заголовок DVMH статистики
|
||||
*/
|
||||
struct _dvmh_stat_header_st {
|
||||
unsigned long sizeHeader;
|
||||
unsigned long sizeIntervalConstPart;
|
||||
unsigned long threadsAmount;
|
||||
dvmh_stat_header_gpu_info gpu[DVMH_STAT_MAX_GPU_CNT]; /**< ссылка на массив описателей GPU */
|
||||
};
|
||||
|
||||
/**
|
||||
* Характеристика/метрика DVMH
|
||||
*
|
||||
* Поле `values` не выгружется в файл. Это ведет к избыточному использованию памяти, но упрощает поддержку.
|
||||
*/
|
||||
struct _dvmh_stat_interval_gpu_metric_st {
|
||||
short hasOwnMeasures; /**< если собственные измерения */
|
||||
short isReduced; /**< значения метрики редуцированы */
|
||||
|
||||
#if DVMH_EXTENDED_STAT == 1
|
||||
dvmh_stat_interval_gpu_metric_value *values; /**< ссылка на массив значений */
|
||||
#endif
|
||||
|
||||
UDvmType countMeasures; /**< количество измерений характеристики */
|
||||
double timeProductive; /**< полезное время */
|
||||
double timeLost; /**< потерянное время */
|
||||
|
||||
// -- Агрегированные значения (для box-диаграммы)
|
||||
double min; /**< минимальное значение */
|
||||
double mean; /**< среднее */
|
||||
double max; /**< максимальное значение */
|
||||
double sum; /**< сумма значений */
|
||||
|
||||
#if DVMH_EXTENDED_STAT == 1
|
||||
double q1; /**< Q1 квантиль */
|
||||
double median; /**< медиана */
|
||||
double q3; /**< Q3 квантиль */
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Интервальное хранилище статистики для одного GPU
|
||||
*
|
||||
* Необходим, для автоматического позиционирования в памяти, а не ручному просчету.
|
||||
* Ведет к некоторому избыточному использованию памяти, ввиду возможного выравнивания компилятором,
|
||||
* но упрощает поддерживаемость кода.
|
||||
*
|
||||
* Структура избыточна, но введена с целью упрощения понимания кода.
|
||||
*/
|
||||
struct _dvmh_stat_interval_gpu_st {
|
||||
dvmh_stat_interval_gpu_metric metrics[DVMH_STAT_METRIC_FORCE_INT]; /** статистические метрики */
|
||||
// --
|
||||
double timeProductive; /**< (+) полезное время */
|
||||
double timeLost; /**< (+) потерянное время */
|
||||
};
|
||||
|
||||
/**
|
||||
* Структура для нитей
|
||||
*/
|
||||
struct _dvmh_stat_interval_thread_st {
|
||||
double user_time;
|
||||
double system_time;
|
||||
};
|
||||
|
||||
/**
|
||||
* Интервальное хранилище статистики по GPU и нитям
|
||||
*/
|
||||
struct _dvmh_stat_interval_st {
|
||||
unsigned long mask; /**< маска GPU (если GPU задействован, устанавливаем бит в 1 с соотвествующим номером **/
|
||||
bool threadsUsed;
|
||||
|
||||
dvmh_stat_interval_gpu gpu[DVMH_STAT_MAX_GPU_CNT]; /** хранилище метрик для каждого GPU */
|
||||
dvmh_stat_interval_thread* threads;
|
||||
// --
|
||||
double allGPUTimeProductive; /**< (+) полезное время */
|
||||
double allGPUTimeLost; /**< (+) потерянное время */
|
||||
|
||||
double allThreadsUserTime; /**< (+) полезное время нитей */
|
||||
double allThreadsSystemTime; /**< (+) потерянное время нитей */
|
||||
};
|
||||
|
||||
#endif //DVM_SYS_DVMH_STAT_H
|
||||
2
dvm/tools/pppa/trunk/src/dvmvers.h.in
Normal file
2
dvm/tools/pppa/trunk/src/dvmvers.h.in
Normal file
@@ -0,0 +1,2 @@
|
||||
#define VERS "@DVM_VERSION@"
|
||||
#define PLATFORM "@DVM_PLATFORM_STRING@"
|
||||
409
dvm/tools/pppa/trunk/src/inter.cpp
Normal file
409
dvm/tools/pppa/trunk/src/inter.cpp
Normal file
@@ -0,0 +1,409 @@
|
||||
#define _STATFILE_
|
||||
#include "inter.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CLEAR(A) memset(A, 0, sizeof A);
|
||||
|
||||
typedef s_GRPTIMES (*matrix) [StatGrpCount];
|
||||
|
||||
CInter::CInter(
|
||||
matrix pt,
|
||||
s_SendRecvTimes ps,
|
||||
ident id,
|
||||
unsigned long nint,
|
||||
int iIM,
|
||||
int jIM,
|
||||
short sore,
|
||||
dvmh_stat_interval *dvmhStatInterval
|
||||
) { int i, j;
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// -- Store DVMH statistics for the interval
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
// store prepared DVMH statistics
|
||||
this->dvmhStatInterval = dvmhStatInterval;
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// -- Store general information about the interval
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// set interval name (name of DVM programm)
|
||||
if (id.pname) {
|
||||
idint.pname = new char[strlen(id.pname) + 1];
|
||||
if (idint.pname == NULL)
|
||||
throw("Internal error: out of memory at %s, line %d \n", __FILE__, __LINE__);
|
||||
strcpy(idint.pname, id.pname);
|
||||
}
|
||||
else idint.pname = NULL;
|
||||
|
||||
idint.nline = id.nline; // number of DVM-programm line
|
||||
idint.nline_end = id.nline_end; // number of end of DVM-programm line
|
||||
idint.nenter = id.nenter; // number of enters into the interval
|
||||
idint.expr = id.expr; // conditional expession
|
||||
idint.nlev = id.nlev; // number of interval level
|
||||
idint.t = id.t; // type of interval
|
||||
idint.proc = id.proc; // number of processors§
|
||||
ninter = nint; // inteval number
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// -- Clean statistics storages
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
CLEAR(mgen)
|
||||
CLEAR(mcom)
|
||||
CLEAR(mrcom)
|
||||
CLEAR(msyn)
|
||||
CLEAR(mvar)
|
||||
CLEAR(mcall)
|
||||
CLEAR(moverlap)
|
||||
CLEAR(lost)
|
||||
CLEAR(calls)
|
||||
CLEAR(prod)
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// -- Aggregate statistics information
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
// Execution characteristics on each processor
|
||||
for (i = 0; i < StatGrpCount; i++) {
|
||||
mgen[SUMCOM] += pt[i][MsgPasGrp].LostTime;
|
||||
mgen[SUMRCOM] += pt[i][MsgPasGrp].ProductTime;
|
||||
|
||||
// mgen[CPUUSR] += pt[i][UserGrp].ProductTime;
|
||||
// mgen[INSUFUSR] += pt[i][UserGrp].LostTime;
|
||||
// mgen[IOTIME] += pt[i][IOGrp].ProductTime;
|
||||
|
||||
for (j = 0; j < StatGrpCount; j++) {
|
||||
|
||||
if (i == UserGrp) mgen[CPUUSR] += pt[UserGrp][j].ProductTime;
|
||||
if (i == UserGrp) mgen[INSUFUSR] += pt[UserGrp][j].LostTime;
|
||||
if (i == IOGrp) mgen[IOTIME] += pt[IOGrp][j].ProductTime;
|
||||
|
||||
mgen[CPU] += pt[i][j].ProductTime;
|
||||
mgen[EXEC] += pt[i][j].ProductTime + pt[i][j].LostTime;
|
||||
mgen[INSUF] += pt[i][j].LostTime;
|
||||
}
|
||||
}
|
||||
|
||||
mgen[EXEC] = mgen[EXEC] - mgen[SUMRCOM];
|
||||
mgen[CPU] = mgen[CPU] - mgen[CPUUSR] - mgen[SUMRCOM] - mgen[IOTIME];
|
||||
mgen[INSUF] = mgen[INSUF] - mgen[INSUFUSR] - mgen[SUMCOM];
|
||||
|
||||
if (mgen[CPU] < 0) mgen[CPU] = 0.0;
|
||||
|
||||
//real synchronization,number of calls, communication
|
||||
// reduction
|
||||
mcom[RD] = pt[WaitRedGrp][MsgPasGrp].LostTime + pt[StartRedGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RD] = pt[WaitRedGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RD] = pt[UserGrp][WaitRedGrp].CallCount;
|
||||
|
||||
// shadow
|
||||
mcom[SH] = pt[WaitShdGrp][MsgPasGrp].LostTime + pt[DoPLGrp][MsgPasGrp].LostTime + pt[StartShdGrp][MsgPasGrp].LostTime;
|
||||
mrcom[SH] = pt[WaitShdGrp][MsgPasGrp].ProductTime + pt[DoPLGrp][MsgPasGrp].ProductTime;
|
||||
mcall[SH] = pt[UserGrp][WaitShdGrp].CallCount;
|
||||
|
||||
// remote access
|
||||
mcom[RA] = pt[RemAccessGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RA] = pt[RemAccessGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RA] = pt[UserGrp][RemAccessGrp].CallCount;
|
||||
|
||||
// redistribute
|
||||
mcom[RED] = pt[ReDistrGrp][MsgPasGrp].LostTime;
|
||||
mrcom[RED] = pt[ReDistrGrp][MsgPasGrp].ProductTime;
|
||||
mcall[RED] = pt[UserGrp][ReDistrGrp].CallCount;
|
||||
|
||||
// input/output
|
||||
mcom[IO] = pt[IOGrp][MsgPasGrp].LostTime;
|
||||
mrcom[IO] = pt[IOGrp][MsgPasGrp].ProductTime;
|
||||
mcall[IO] = pt[UserGrp][IOGrp].CallCount;
|
||||
|
||||
// add information
|
||||
SendCallTime = ps.SendCallTime;
|
||||
MinSendCallTime = ps.MinSendCallTime;
|
||||
MaxSendCallTime = ps.MaxSendCallTime;
|
||||
SendCallCount = ps.SendCallCount;
|
||||
RecvCallTime = ps.RecvCallTime;
|
||||
MinRecvCallTime = ps.MinRecvCallTime;
|
||||
MaxRecvCallTime = ps.MaxRecvCallTime;
|
||||
RecvCallCount = ps.RecvCallCount;
|
||||
mgen[START] = SendCallTime + RecvCallTime;
|
||||
|
||||
// -- FOR DEBUG !!!
|
||||
if (iIM != 0) {
|
||||
for (i = 0; i < StatGrpCount; i++) {
|
||||
if (sore == 1) {//sum
|
||||
for (j = 0; j < StatGrpCount; j++) {
|
||||
//mgen[j] = mgen[j] + pt[i][k].ProductTime;
|
||||
lost[i] = lost[i] + pt[i][j].LostTime;
|
||||
prod[i] = prod[i] + pt[i][j].ProductTime;
|
||||
calls[i] = calls[i] + pt[i][j].CallCount;
|
||||
}
|
||||
} else {
|
||||
//mgen[j]=pt[iIM-1][i].ProductTime;
|
||||
lost[i] = pt[iIM-1][i].LostTime;
|
||||
prod[i] = pt[iIM-1][i].ProductTime;
|
||||
calls[i] = pt[iIM-1][i].CallCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jIM != 0) {
|
||||
for (i = 0; i < StatGrpCount; i++) {
|
||||
if (sore == 1) {
|
||||
for (j = 0; j < StatGrpCount; j++) {
|
||||
//mgen[j] = mgen[j] + pt[k][i].ProductTime;
|
||||
prod[i] = prod[i] + pt[j][i].ProductTime;
|
||||
lost[i] = lost[i] + pt[j][i].LostTime;
|
||||
calls[i] = calls[i] + pt[j][i].CallCount;
|
||||
}
|
||||
} else {
|
||||
//mgen[j] = pt[i][jIM-1].ProductTime;
|
||||
prod[i] = pt[i][jIM-1].ProductTime;
|
||||
lost[i] = pt[i][jIM-1].LostTime;
|
||||
calls[i] = pt[i][jIM-1].CallCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// deallocate memory for name of DVM-program
|
||||
CInter::~CInter()
|
||||
{
|
||||
if (idint.pname!=NULL) delete []idint.pname;
|
||||
delete[] this->dvmhStatInterval->threads;
|
||||
delete this->dvmhStatInterval;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// addition execution time characteristics
|
||||
void CInter::AddTime(typetime t2,double val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - additional value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter AddTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (t2 == DVMH_GPU_TIME_PRODUCTIVE)
|
||||
this->dvmhStatInterval->allGPUTimeProductive += val;
|
||||
else if (t2 == DVMH_GPU_TIME_LOST)
|
||||
this->dvmhStatInterval->allGPUTimeLost += val;
|
||||
else if (t2 == DVMH_THREADS_USER_TIME)
|
||||
this->dvmhStatInterval->allThreadsUserTime += val;
|
||||
else if (t2 == DVMH_THREADS_SYSTEM_TIME)
|
||||
this->dvmhStatInterval->allThreadsSystemTime += val;
|
||||
else
|
||||
mgen[t2] = mgen[t2] + val;
|
||||
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//write new execution time characteristics
|
||||
void CInter::WriteTime(typetime t2,double val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - new value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter WriteTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (t2 == DVMH_GPU_TIME_PRODUCTIVE)
|
||||
this->dvmhStatInterval->allGPUTimeProductive = val;
|
||||
else if (t2 == DVMH_GPU_TIME_LOST)
|
||||
this->dvmhStatInterval->allGPUTimeLost = val;
|
||||
else if (t2 == DVMH_THREADS_USER_TIME)
|
||||
this->dvmhStatInterval->allThreadsUserTime = val;
|
||||
else if (t2 == DVMH_THREADS_SYSTEM_TIME)
|
||||
this->dvmhStatInterval->allThreadsSystemTime = val;
|
||||
else
|
||||
mgen[t2] = val;
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// read execution time characteristics
|
||||
void CInter::ReadTime(typetime t2,double &val)
|
||||
//t2 - type of execution characteristics
|
||||
// val - answer
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>ITER) {
|
||||
printf("CInter ReadTime incorrect typetime %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (t2 == DVMH_GPU_TIME_PRODUCTIVE)
|
||||
val = this->dvmhStatInterval->allGPUTimeProductive;
|
||||
else if (t2 == DVMH_GPU_TIME_LOST)
|
||||
val = this->dvmhStatInterval->allGPUTimeLost;
|
||||
else if (t2 == DVMH_THREADS_USER_TIME)
|
||||
val = this->dvmhStatInterval->allThreadsUserTime;
|
||||
else if (t2 == DVMH_THREADS_SYSTEM_TIME)
|
||||
val = this->dvmhStatInterval->allThreadsSystemTime;
|
||||
else
|
||||
val = mgen[t2];
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// addition times of collective operations
|
||||
void CInter::AddTime(typegrp t1,typecom t2,double val)
|
||||
//t1 - type of communication operation
|
||||
//t2 - type of collective operation
|
||||
//val - additional value
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>RED) {
|
||||
printf("CInter AddTime incorrect typecom %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case COM:
|
||||
mcom[t2]=mcom[t2]+val;
|
||||
break;
|
||||
case RCOM:
|
||||
mrcom[t2]=mrcom[t2]+val;
|
||||
break;
|
||||
case SYN :
|
||||
msyn[t2]=msyn[t2]+val;
|
||||
break;
|
||||
case VAR:
|
||||
mvar[t2]=mvar[t2]+val;
|
||||
break;
|
||||
case CALL:
|
||||
mcall[t2]=mcall[t2]+val;
|
||||
break;
|
||||
case OVERLAP:
|
||||
moverlap[t2]=moverlap[t2]+val;
|
||||
break;
|
||||
default:
|
||||
printf("CInter WriteCom incorrect typegrp\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------
|
||||
// read communication collective operations time
|
||||
void CInter::ReadTime(typegrp t1,typecom t2,double &val)
|
||||
//t1 - type of communication operation
|
||||
//t2 - type of collective operation
|
||||
//val - answer
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>RED) {
|
||||
printf("CInter ReadTime incorrect typecom %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case COM:
|
||||
val=mcom[t2];
|
||||
break;
|
||||
case RCOM:
|
||||
val=mrcom[t2];
|
||||
break;
|
||||
case SYN :
|
||||
val=msyn[t2];
|
||||
break;
|
||||
case VAR:
|
||||
val=mvar[t2];
|
||||
break;
|
||||
case CALL:
|
||||
val=mcall[t2];
|
||||
break;
|
||||
case OVERLAP:
|
||||
val=moverlap[t2];
|
||||
break;
|
||||
default:
|
||||
printf("CInter ReadTime incorrect typegrp\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------
|
||||
// read time from interval matrix
|
||||
void CInter::ReadTime(typetimeim t1,int t2,double &val)
|
||||
//t1 - type of time (lost/number of calls)
|
||||
//t2 - index
|
||||
//val - answer
|
||||
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (t2<0 || t2>=StatGrpCount) {
|
||||
printf("CInter ReadTime incorrect 2 parameter %d\n",t2);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
switch (t1) {
|
||||
case CALLSMT:
|
||||
val=calls[t2];
|
||||
break;
|
||||
case LOSTMT:
|
||||
val=lost[t2];
|
||||
break;
|
||||
case PRODMT:
|
||||
val=prod[t2];
|
||||
break;
|
||||
default:
|
||||
printf("CInter ReadTime incorrect type of im time\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// compare identifier information on other processors
|
||||
int CInter::CompIdent(ident *p)
|
||||
//p - pointer identifire information
|
||||
{
|
||||
if ((idint.pname==NULL || (strcmp(p->pname,idint.pname)==0)) && (p->nline==idint.nline) &&
|
||||
(p->nlev==idint.nlev) && (p->expr==idint.expr) && (p->t==idint.t)) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//------------------------------------------------------
|
||||
// read identifier information
|
||||
void CInter::ReadIdent(ident **p)
|
||||
{
|
||||
*p=&idint;
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// sum times characteristics upon levels
|
||||
void CInter::SumInter(CInter *p)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<=RED;i++) {
|
||||
mgen[SUMSYN]=mgen[SUMSYN]+msyn[i];
|
||||
mgen[SUMVAR]=mgen[SUMVAR]+mvar[i];
|
||||
mgen[SUMOVERLAP]=mgen[SUMOVERLAP]+moverlap[i];
|
||||
}
|
||||
mgen[PROC]=(double)idint.proc;
|
||||
if (idint.proc!=0) {
|
||||
mgen[LOST]=mgen[INSUF]+mgen[INSUFUSR]+mgen[IDLE]+mgen[SUMCOM];
|
||||
}
|
||||
if (p==NULL) return;
|
||||
for (i=0;i<=ITER;i++) {
|
||||
if (i<SUMSYN || i>SUMOVERLAP) p->mgen[i]=p->mgen[i]+mgen[i];
|
||||
}
|
||||
for (i=0;i<StatGrpCount;i++) {
|
||||
p->lost[i]=p->lost[i]+lost[i];
|
||||
p->prod[i]=p->prod[i]+prod[i];
|
||||
p->calls[i]=p->calls[i]+calls[i];
|
||||
}
|
||||
// add information
|
||||
p->SendCallTime=p->SendCallTime+SendCallTime;
|
||||
p->MinSendCallTime=p->MinSendCallTime+MinSendCallTime;
|
||||
p->MaxSendCallTime=p->MaxSendCallTime+MaxSendCallTime;
|
||||
p->SendCallCount=p->SendCallCount+SendCallCount;
|
||||
p->RecvCallTime=p->RecvCallTime+RecvCallTime;
|
||||
p->MinRecvCallTime=p->MinRecvCallTime+MinRecvCallTime;
|
||||
p->MaxRecvCallTime=p->MaxRecvCallTime+MaxRecvCallTime;
|
||||
p->RecvCallCount=p->RecvCallCount+RecvCallCount;
|
||||
|
||||
// sum communication information
|
||||
for (i=0;i<=RED;i++) {
|
||||
p->mcom[i]=p->mcom[i]+mcom[i];
|
||||
p->mrcom[i]=p->mrcom[i]+mrcom[i];
|
||||
p->msyn[i]=p->msyn[i]+msyn[i];
|
||||
p->mvar[i]=p->mvar[i]+mvar[i];
|
||||
p->moverlap[i]=p->moverlap[i]+moverlap[i];
|
||||
p->mcall[i]=p->mcall[i]+mcall[i];
|
||||
}
|
||||
}
|
||||
178
dvm/tools/pppa/trunk/src/inter.h
Normal file
178
dvm/tools/pppa/trunk/src/inter.h
Normal file
@@ -0,0 +1,178 @@
|
||||
#ifndef _INTER_H
|
||||
#define _INTER_H
|
||||
|
||||
#include "sysstat.h"
|
||||
#include "strall.h"
|
||||
#include "dvmh_stat.h"
|
||||
|
||||
enum typegrp {
|
||||
COM,
|
||||
RCOM,
|
||||
SYN,
|
||||
VAR,
|
||||
OVERLAP,
|
||||
CALL
|
||||
};
|
||||
|
||||
enum typetimeim {
|
||||
CALLSMT,
|
||||
LOSTMT,
|
||||
PRODMT
|
||||
};
|
||||
|
||||
enum typetime {
|
||||
LOST,
|
||||
INSUFUSR,
|
||||
INSUF,
|
||||
IDLE,
|
||||
SUMCOM,
|
||||
SUMRCOM,
|
||||
SUMSYN,
|
||||
SUMVAR,
|
||||
SUMOVERLAP,
|
||||
IMB,
|
||||
EXEC,
|
||||
CPUUSR,
|
||||
CPU,
|
||||
IOTIME,
|
||||
START,
|
||||
DVMH_THREADS_USER_TIME,
|
||||
DVMH_THREADS_SYSTEM_TIME,
|
||||
DVMH_GPU_TIME_PRODUCTIVE,
|
||||
DVMH_GPU_TIME_LOST,
|
||||
PROC,
|
||||
ITER
|
||||
};
|
||||
|
||||
enum typecom {
|
||||
IO,
|
||||
RD,
|
||||
SH,
|
||||
RA,
|
||||
RED
|
||||
};
|
||||
//5 collective operation. new operation insert before RED
|
||||
//if insert new time don't forget insert text in the statread.h
|
||||
//don't insert new time between SUMCOM...SUMOVERLAP
|
||||
|
||||
|
||||
/** Описатель интервала */
|
||||
typedef struct tident {
|
||||
typefrag t; // тип интервала
|
||||
short nlev; // номер уровня, вложенности
|
||||
char *pname; // имя исходного файла, где задан интервал
|
||||
long expr; // значение выражения.
|
||||
unsigned long nline; // номер строки исходного файла
|
||||
unsigned long nline_end; // ???
|
||||
unsigned long proc; // количество процессоров, на которых выполнялся интервал
|
||||
double nenter; // число вхождений в интервал
|
||||
} ident;
|
||||
|
||||
|
||||
typedef struct {
|
||||
double SendCallTime;
|
||||
double MinSendCallTime;
|
||||
double MaxSendCallTime;
|
||||
long SendCallCount;
|
||||
double RecvCallTime;
|
||||
double MinRecvCallTime;
|
||||
double MaxRecvCallTime;
|
||||
long RecvCallCount;
|
||||
} s_SendRecvTimes;
|
||||
|
||||
|
||||
class CInter {
|
||||
public:
|
||||
/**
|
||||
* Конструктор интервала
|
||||
*
|
||||
* @param pt указатель на массив времен, переписанный из файла
|
||||
* @param ps ???
|
||||
* @param id индентификатор интервала
|
||||
* @param nint номер интервала
|
||||
* @param iIM ??? (для отладки)
|
||||
* @param jIM ??? (для отладки)
|
||||
* @param sore ??? (для отладки)
|
||||
* @param dvmhStatInterval указатель на DVMH-статистику по интервалу
|
||||
*/
|
||||
CInter(
|
||||
s_GRPTIMES (*pt)[StatGrpCount],
|
||||
s_SendRecvTimes ps,
|
||||
ident id,
|
||||
unsigned long nint,
|
||||
int iIM,
|
||||
int jIM,
|
||||
short sore,
|
||||
dvmh_stat_interval *dvmhStatInterval
|
||||
);
|
||||
|
||||
~CInter(void);
|
||||
|
||||
/**
|
||||
* Эти функции-члены добавляют к ранее посчитанным или записывают новые значения временных
|
||||
* характеристик. Первая функция AddTime и WriteTime предназначены для работы с массивом mgen,
|
||||
* первый параметр - это номер индекса, а второй само значение. Вторая функция AddTime
|
||||
* предназначена для работы с остальными массивами, параметр t1 служит для выбора массива,
|
||||
* параметр t2 – значение индекса массива, а val - значение.
|
||||
*/
|
||||
void AddTime(typetime t2, double val);
|
||||
void WriteTime(typetime t2, double val);
|
||||
void AddTime(typegrp t1, typecom t2, double val);
|
||||
|
||||
/**
|
||||
* Эти функции-члены читают значения временных характеристик, значения их параметров такие же,
|
||||
* как и для записи, только последний параметр передается ссылкой.
|
||||
*/
|
||||
void ReadTime(typetime t2,double &val);
|
||||
void ReadTime(typegrp t1,typecom t2,double &val);
|
||||
void ReadTime(typetimeim t1,int t2,double &val);
|
||||
|
||||
/**
|
||||
* Сравнивает идентификатор интервала с другого процессора с идентификатором текущего интервала,
|
||||
* параметр р - указатель на идентификатор интервала. В случае совпадения идентификаторов по всем
|
||||
* элементам структуры возвращает 1, в противном случае – 0.
|
||||
*/
|
||||
int CompIdent(ident *p);
|
||||
|
||||
/**
|
||||
* Устанавливает указатель равным адресу идентификатора интервала.
|
||||
*/
|
||||
void ReadIdent(ident **p);
|
||||
|
||||
/**
|
||||
* Эта функция-член суммирует значения временных характеристик интервала со значениями интервала
|
||||
* более высокого уровня. Параметр р – указатель на интервал более высокого уровня.
|
||||
*/
|
||||
void SumInter(CInter *p);
|
||||
|
||||
// -- Открытые параметры
|
||||
unsigned long ninter; // номер интервала
|
||||
dvmh_stat_interval *dvmhStatInterval; // DVMH статитстика
|
||||
|
||||
private:
|
||||
ident idint; // описатель интервала
|
||||
|
||||
double mgen [ITER + 1]; // массив времен, для выдачи характеристик по процессорам
|
||||
|
||||
double mcom [RED + 1]; // массив времен передачи сообщений в коллективных операциях
|
||||
double mrcom [RED + 1]; // массив времен реальной рассинхронизации
|
||||
double msyn [RED + 1]; // массив времен рассинхронизации
|
||||
double mvar [RED + 1]; // массив разброса времен
|
||||
double moverlap[RED + 1]; // массив времен перекрытия операций
|
||||
double mcall [RED + 1]; // количество вызовов коллективных операций
|
||||
|
||||
double lost[StatGrpCount];
|
||||
double prod[StatGrpCount];
|
||||
double calls[StatGrpCount];
|
||||
|
||||
double SendCallTime;
|
||||
double MinSendCallTime;
|
||||
double MaxSendCallTime;
|
||||
long SendCallCount;
|
||||
double RecvCallTime;
|
||||
double MinRecvCallTime;
|
||||
double MaxRecvCallTime;
|
||||
long RecvCallCount;
|
||||
};
|
||||
|
||||
#endif
|
||||
22828
dvm/tools/pppa/trunk/src/json.hpp
Normal file
22828
dvm/tools/pppa/trunk/src/json.hpp
Normal file
File diff suppressed because it is too large
Load Diff
38
dvm/tools/pppa/trunk/src/makefile.uni
Normal file
38
dvm/tools/pppa/trunk/src/makefile.uni
Normal file
@@ -0,0 +1,38 @@
|
||||
BINDIR=../../../bin
|
||||
|
||||
EXECUTABLES = dvmstf
|
||||
COPT=-c -I../../Zlib/include
|
||||
ZLIB = zlib
|
||||
ZLIBDIR = ../../Zlib/Release
|
||||
|
||||
OBJS=\
|
||||
inter.o \
|
||||
potensyn.o \
|
||||
statfile.o \
|
||||
statread.o \
|
||||
treeinter.o \
|
||||
statprintf.o
|
||||
|
||||
$(BINDIR)/$(EXECUTABLES): $(OBJS)
|
||||
$(LINKER) -o $@ $(OBJS) -L$(ZLIBDIR) -l$(ZLIB)
|
||||
|
||||
all: $(BINDIR)/$(EXECUTABLES)
|
||||
@echo "*** COMPILING EXECUTABLE $(EXECUTABLES) DONE"
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
cleanall:
|
||||
rm -f $(OBJS)
|
||||
|
||||
potensyn.o:
|
||||
$(CXX) $(COPT) potensyn.cpp
|
||||
inter.o:
|
||||
$(CXX) $(COPT) inter.cpp
|
||||
statfile.o:
|
||||
$(CXX) $(COPT) statfile.cpp
|
||||
statread.o:
|
||||
$(CXX) $(COPT) statread.cpp
|
||||
treeinter.o:
|
||||
$(CXX) $(COPT) treeinter.cpp
|
||||
statprintf.o:
|
||||
$(CXX) $(COPT) statprintf.cpp
|
||||
44
dvm/tools/pppa/trunk/src/makefile.win
Normal file
44
dvm/tools/pppa/trunk/src/makefile.win
Normal file
@@ -0,0 +1,44 @@
|
||||
######################################
|
||||
### Automated created makefile.win ###
|
||||
######################################
|
||||
|
||||
OUTDIR=..\obj
|
||||
BINDIR=..\..\..\bin
|
||||
ZLIB=zlib.lib
|
||||
ZLIBDIR=..\..\Zlib\Release
|
||||
|
||||
EXECUTABLES = dvmstf
|
||||
|
||||
LINK_FLAGS=/nologo /subsystem:console /incremental:no\
|
||||
/pdb:"$(OUTDIR)\$(EXECUTABLES).pdb" /out:"$(BINDIR)\$(EXECUTABLES).exe"
|
||||
|
||||
#COPT=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
# /I "../../Zlib/Include"\
|
||||
# /Fp"$(OUTDIR)\tools.pch" /YX /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /c
|
||||
COPT=/nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/I "../../Zlib/Include"\
|
||||
/Fp"$(OUTDIR)\tools.pch" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" /c
|
||||
|
||||
.cpp{$(OUTDIR)/}.obj:
|
||||
$(CXX) $(COPT) $<
|
||||
|
||||
OBJS=\
|
||||
$(OUTDIR)\potensyn.obj \
|
||||
$(OUTDIR)\inter.obj \
|
||||
$(OUTDIR)\statfile.obj \
|
||||
$(OUTDIR)\statread.obj \
|
||||
$(OUTDIR)\treeinter.obj \
|
||||
$(OUTDIR)\statprintf.obj
|
||||
|
||||
$(BINDIR)/$(EXECUTABLES).exe: $(OBJS)
|
||||
$(LINKER) @<<
|
||||
$(LINK_FLAGS) $(OBJS) $(ZLIBDIR)\$(ZLIB)
|
||||
<<
|
||||
|
||||
all: $(BINDIR)/$(EXECUTABLES).exe
|
||||
@echo "*** COMPILING EXECUTABLE $(EXECUTABLES) DONE"
|
||||
|
||||
clean:
|
||||
|
||||
cleanall:
|
||||
|
||||
49
dvm/tools/pppa/trunk/src/makefileJnilib
Normal file
49
dvm/tools/pppa/trunk/src/makefileJnilib
Normal file
@@ -0,0 +1,49 @@
|
||||
CXX=clang++ -g -O2
|
||||
COPT=-c -I../../Zlib/include -g
|
||||
ZLIB = zlib
|
||||
ZLIBDIR = ../../Zlib/Release
|
||||
|
||||
OBJS=\
|
||||
inter.o \
|
||||
potensyn.o \
|
||||
statread.o \
|
||||
treeinter.o \
|
||||
statprintf.o \
|
||||
statlist.o \
|
||||
statinter.o \
|
||||
interface.o \
|
||||
stat.o \
|
||||
LibraryImport.o \
|
||||
libLibraryImport.jnilib \
|
||||
|
||||
#$(BINDIR)/$(EXECUTABLES): $(OBJS)
|
||||
# clang++ -o $@ $(OBJS) -L$(ZLIBDIR) -l$(ZLIB)
|
||||
|
||||
all: libLibraryImport.jnilib
|
||||
@echo "*** COMPILING EXECUTABLE $(EXECUTABLES) DONE"
|
||||
|
||||
clean:
|
||||
rm -f libLibraryImport.jnilib LibraryImport.o
|
||||
cleanall:
|
||||
rm -f $(OBJS)
|
||||
|
||||
libLibraryImport.jnilib: potensyn.o inter.o statread.o treeinter.o statinter.o statlist.o interface.o stat.o
|
||||
clang++ -shared -fPIC -I /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/include potensyn.o inter.o statread.o treeinter.o statinter.o statlist.o interface.o stat.o ../../Zlib/*.o LibraryImport.cpp -o libLibraryImport.jnilib
|
||||
potensyn.o:
|
||||
$(CXX) $(COPT) potensyn.cpp
|
||||
inter.o:
|
||||
$(CXX) $(COPT) inter.cpp
|
||||
statread.o:
|
||||
$(CXX) $(COPT) statread.cpp
|
||||
treeinter.o:
|
||||
$(CXX) $(COPT) treeinter.cpp
|
||||
statinter.o:
|
||||
$(CXX) $(COPT) -std=c++11 statinter.cpp
|
||||
statlist.o:
|
||||
$(CXX) $(COPT) -std=c++11 statlist.cpp
|
||||
interface.o:
|
||||
$(CXX) $(COPT) -std=c++11 interface.cpp -fdeclspec
|
||||
stat.o:
|
||||
$(CXX) $(COPT) -std=c++11 stat.cpp
|
||||
#LibraryImport.o:
|
||||
# gcc LibraryImport.c -I /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -fdeclspec
|
||||
175
dvm/tools/pppa/trunk/src/potensyn.cpp
Normal file
175
dvm/tools/pppa/trunk/src/potensyn.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
#define _STATFILE_
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "strall.h"
|
||||
#include "potensyn.h"
|
||||
short reverse,szsh,szd,szv,szl,torightto,torightfrom;
|
||||
// Dynamically allocate array of synchronization times
|
||||
CSynchro::CSynchro(gzFile stream,unsigned long lsyn,unsigned char *pbuff)
|
||||
// stream - pointer to the file written during DVM-program execution
|
||||
// lsyn - length of written information
|
||||
{
|
||||
valid=TRUE;
|
||||
ps=NULL;
|
||||
pbuff_read=NULL;
|
||||
// dynamically allocate array of char from file (strall.h tsyn_ch)
|
||||
unsigned char *buffer;
|
||||
if (pbuff==NULL) {
|
||||
buffer=new unsigned char[lsyn];
|
||||
if (buffer==NULL) throw("Out of memory\n");
|
||||
pbuff_read=buffer;
|
||||
long l=gztell(stream);
|
||||
// read from file to the allocated buffer
|
||||
int s=gzread(stream,buffer,lsyn);
|
||||
if ((unsigned long)s!=lsyn) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read synchronization times from file addr=%ld,length=%ld\n",
|
||||
l,lsyn);
|
||||
if (pbuff_read!=NULL) {
|
||||
delete []pbuff_read;
|
||||
pbuff_read=NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}else buffer=pbuff;
|
||||
// calculate size of struct tsyn_ch
|
||||
unsigned long lsynone=QSYN_SHORT*szsh+QSYN_LONG*szl+QSYN_VOID*szv+
|
||||
QSYN_DOUBLE*szd;
|
||||
//set pointer to the first synchronization time
|
||||
unsigned char *p=buffer+lsyn-lsynone;
|
||||
// number of synchronization times
|
||||
qsyn=lsyn/lsynone;
|
||||
// allocate array of struct tsyn
|
||||
ps=new psyn[qsyn];
|
||||
if (ps==NULL) throw("Out of memory\n");
|
||||
psyn *psl=ps;
|
||||
unsigned long i;
|
||||
// copy values from struct of char to struct tsyn
|
||||
for (i=0;i<qsyn;i++) {
|
||||
psl->sh.nitem=0; psl->l.ninter=0; psl->v.ppgrp=NULL; psl->d.time=0.0;
|
||||
CPYMEM(psl->sh.nitem,p+MAKESHORT(ps,nitem,nitem),szsh);
|
||||
CPYMEM(psl->l.ninter,p+MAKELONG(ps,ninter,ninter,QSYN_SHORT),szl);
|
||||
// ppgrp -reference to group, used only for compare values
|
||||
CPYMEM(psl->v.ppgrp,p+MAKEVOID(ps,ppgrp,ppgrp,QSYN_SHORT,QSYN_LONG),szv);
|
||||
CPYMEM(psl->d.time,p+MAKEDOUBLE(ps,time,time,QSYN_SHORT,QSYN_LONG,QSYN_VOID),szd);
|
||||
p=p-lsynone;
|
||||
psl++;
|
||||
}
|
||||
if (pbuff_read!=NULL) {
|
||||
delete []pbuff_read;
|
||||
pbuff_read=NULL;
|
||||
}
|
||||
}
|
||||
//------------------------------------------
|
||||
// deallocate struct tsyn and memory of group references
|
||||
CSynchro::~CSynchro()
|
||||
{
|
||||
if (ps==0) return;
|
||||
if (pbuff_read!=NULL) delete []pbuff_read;
|
||||
delete []ps;
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
//return result of constructor execution
|
||||
int CSynchro::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
//error message
|
||||
void CSynchro::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
//-----------------------------------------------
|
||||
// calculate number of times different types
|
||||
BOOL CSynchro::Count(unsigned long n,short waserr )
|
||||
// n - number of interval
|
||||
// waserr - sign of error during accumulating times
|
||||
{
|
||||
if (n==0) return(0);
|
||||
//qoper - array of number of times
|
||||
for (int j=0;j<QCOLLECT+QCOLLECT;j++) {
|
||||
qoper[j]=0;
|
||||
}
|
||||
ncurr=0;
|
||||
// set current ninter
|
||||
ninter=n;
|
||||
psyn *pp=ps;
|
||||
// calculate number of times, nitem - type of time
|
||||
for (unsigned long i=0;i<qsyn;i++) {
|
||||
if (pp->l.ninter==n) {
|
||||
qoper[pp->sh.nitem-1]++;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
// veryfy number of calls and number of returns
|
||||
if (waserr!=0) return(0);
|
||||
for (int ak=0;ak<QCOLLECT;ak=ak+4) {
|
||||
// number of start calls and number of wait calls
|
||||
if (qoper[ak]!=qoper[ak+QCOLLECT] || qoper[ak+2]!=qoper[ak+2+QCOLLECT]) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Number of calls !=number of returns interval=%ld\n",n);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// return number of synchronization time, function call after Count()
|
||||
int CSynchro::GetCount(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
{
|
||||
short nitem=(short)nitem1;
|
||||
ncurr=0;
|
||||
first=1; // the first Find
|
||||
return (qoper[nitem-1]);
|
||||
}
|
||||
//--------------------------------------------
|
||||
//return next synchronyzation time,call after Count()
|
||||
double CSynchro::Find(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
{
|
||||
short nitem=(short)nitem1;
|
||||
if (first!=1) ncurr++;
|
||||
first++;
|
||||
psyn *psl=ps+ncurr;
|
||||
// ninter set Count()
|
||||
for (unsigned long i=ncurr;i<qsyn;i++) {
|
||||
if (psl->sh.nitem==nitem && psl->l.ninter==ninter) {
|
||||
ncurr=i; // set current synchronization time
|
||||
return(psl->d.time);
|
||||
}
|
||||
psl++;
|
||||
}
|
||||
ncurr=0;
|
||||
return(0.0);
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
// return current synchronyzation time, call after Find()
|
||||
double CSynchro::GetCurr(void)
|
||||
{
|
||||
// ncurr set find
|
||||
if (ncurr>=qsyn) return(0.0);
|
||||
psyn *psl=ps+ncurr;
|
||||
return(psl->d.time);
|
||||
}
|
||||
//--------------------------------------------------------
|
||||
//return nearest time from current
|
||||
double CSynchro::FindNearest(typecollect nitem1)
|
||||
// nitem1 - type of synchronyzation time
|
||||
// for overlap, for call_wait_operation find ret_start_operation
|
||||
{
|
||||
if (ncurr>=qsyn ) return(0.0);
|
||||
short nitem=(short)nitem1;
|
||||
psyn *psl=ps+ncurr;
|
||||
psyn *psl_curr=psl;
|
||||
for (unsigned long i=ncurr;;i--) {
|
||||
if (psl->sh.nitem==nitem) {
|
||||
if (psl->v.ppgrp==psl_curr->v.ppgrp) {
|
||||
return(psl->d.time);
|
||||
}
|
||||
}
|
||||
psl--;
|
||||
if (i==0) return(0.0);
|
||||
}
|
||||
}
|
||||
52
dvm/tools/pppa/trunk/src/potensyn.h
Normal file
52
dvm/tools/pppa/trunk/src/potensyn.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#if !defined( _POTENSYN_H )
|
||||
#define _POTENSYN_H
|
||||
#include "zlib.h"
|
||||
#include "bool.h"
|
||||
#include "inter.h"
|
||||
#include "treeinter.h"
|
||||
struct syn_short{
|
||||
short nitem;
|
||||
};
|
||||
struct syn_long{
|
||||
unsigned long ninter;
|
||||
};
|
||||
struct syn_void{
|
||||
void* ppgrp;
|
||||
};
|
||||
struct syn_double{
|
||||
double time;
|
||||
};
|
||||
#define QSYN_SHORT sizeof(syn_short)/SZSH
|
||||
#define QSYN_LONG sizeof(syn_long)/SZL
|
||||
#define QSYN_VOID sizeof(syn_void)/SZV
|
||||
#define QSYN_DOUBLE sizeof(syn_double)/SZD
|
||||
typedef struct tsyn {
|
||||
syn_double d;
|
||||
syn_void v;
|
||||
syn_long l;
|
||||
syn_short sh;
|
||||
}psyn;
|
||||
class CSynchro {
|
||||
public:
|
||||
CSynchro(gzFile stream,unsigned long l,unsigned char *pbuff);
|
||||
~CSynchro();
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
BOOL Count(unsigned long nin,short waserr);
|
||||
int GetCount(typecollect nitem);
|
||||
double Find(typecollect nitem);
|
||||
double GetCurr(void);
|
||||
double FindNearest(typecollect nitem);
|
||||
private:
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
psyn *ps;
|
||||
unsigned long qsyn;
|
||||
unsigned long ninter;
|
||||
unsigned char *pbuff_read;
|
||||
int qoper[QCOLLECT+QCOLLECT];
|
||||
unsigned long ncurr;
|
||||
short first;
|
||||
int err;
|
||||
};
|
||||
#endif
|
||||
239
dvm/tools/pppa/trunk/src/stat.cpp
Normal file
239
dvm/tools/pppa/trunk/src/stat.cpp
Normal file
@@ -0,0 +1,239 @@
|
||||
#include "statlist.h"
|
||||
#include <iostream>
|
||||
|
||||
void CStat::to_string(std::string & result) {
|
||||
CStatInter * cur=inter_tree;
|
||||
if (cur == NULL||!isinitialized) return;
|
||||
result = "";
|
||||
result += patch::to_string(iscomp) + ' ' + patch::to_string(nproc) + '\n';
|
||||
for (unsigned int i = 0; i < nproc; i++) {
|
||||
result += '@'+std::string(proc_info[i].node_name)+'@' + ' ';
|
||||
result += patch::to_string(proc_info[i].test_time)+'\n';
|
||||
}
|
||||
while (cur != NULL)
|
||||
{
|
||||
cur->to_string(result);
|
||||
cur = cur->next;
|
||||
if (cur) {
|
||||
result += ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CStat::to_json(json &result){
|
||||
CStatInter * cur=inter_tree;
|
||||
if (cur == NULL||!isinitialized) return;
|
||||
json proc, inter, temp;
|
||||
for (unsigned int i = 0; i < nproc; i++) {
|
||||
proc.push_back({{"node_name", std::string(proc_info[i].node_name)},
|
||||
{"test_time", (proc_info[i].test_time) ? proc_info[i].test_time : 0.0}});
|
||||
}
|
||||
while (cur != NULL)
|
||||
{
|
||||
cur->to_json(temp);
|
||||
inter.push_back(temp);
|
||||
cur = cur->next;
|
||||
}
|
||||
result = {{"iscomp", iscomp}, {"nproc", nproc}, {"p_heading", std::string(p_heading)}, {"proc", proc}, {"inter", inter}};
|
||||
}
|
||||
|
||||
CStat::CStat(json source){
|
||||
isjson = true;
|
||||
stat = NULL;
|
||||
iscomp = source["iscomp"];
|
||||
nproc = source["nproc"];
|
||||
const char *tmp = (source["p_heading"].dump()).c_str();
|
||||
std::cout << ">> p_heading = " << source["p_heading"] << " " << strlen(tmp) << " " << tmp << std::endl;
|
||||
for (int i = 0; i < strlen(tmp); ++i)
|
||||
p_heading[i] = tmp[i];
|
||||
proc_info = new CProcInfo[nproc];
|
||||
int i = 0;
|
||||
for (json::iterator it = source["proc"].begin(); it != source["proc"].end() && i < nproc; ++it, ++i){
|
||||
const char * str = ((*it)["node_name"].dump()).c_str();
|
||||
proc_info[i].node_name = new char[strlen(str)];
|
||||
strcpy(proc_info[i].node_name, str);
|
||||
proc_info[i].test_time = (*it)["test_time"];
|
||||
}
|
||||
CStatInter *inter_temp = NULL;
|
||||
inter_tree = NULL;
|
||||
for (json::reverse_iterator it = source["inter"].rbegin(); it != source["inter"].rend(); ++it){
|
||||
inter_temp = inter_tree;
|
||||
inter_tree = new CStatInter((json)(*it));
|
||||
// if(inter_temp)
|
||||
inter_tree->next = inter_temp;
|
||||
}
|
||||
isinitialized = true;
|
||||
}
|
||||
|
||||
CStat::~CStat() {
|
||||
// printf("Destructor: ~Stat()\n");
|
||||
// if (inter_tree) {
|
||||
// inter_tree->delete_tail();
|
||||
// inter_tree->clear();
|
||||
// delete inter_tree;
|
||||
// }
|
||||
//for (unsigned long i = 0; i < nproc; i++)
|
||||
// delete [] proc_info[i].node_name;
|
||||
// if (proc_info){
|
||||
// delete [] proc_info;
|
||||
// }
|
||||
// if (stat){
|
||||
// delete stat;
|
||||
// }
|
||||
}
|
||||
|
||||
void CStat::clear() {
|
||||
if (inter_tree) {
|
||||
inter_tree->delete_tail();
|
||||
inter_tree->clear();
|
||||
delete inter_tree;
|
||||
}
|
||||
// for (unsigned long i = 0; i < nproc; i++)
|
||||
// delete[] proc_info[i].node_name;
|
||||
if (proc_info)
|
||||
delete[] proc_info;
|
||||
if (spath) {
|
||||
delete[] spath;
|
||||
}
|
||||
if (stat)
|
||||
delete stat;
|
||||
}
|
||||
|
||||
CStat::CStat() {
|
||||
isjson = false;
|
||||
stat = NULL;
|
||||
isinitialized = false;
|
||||
nproc = 0;
|
||||
inter_tree = NULL;
|
||||
iscomp = false;
|
||||
proc_info = NULL;
|
||||
spath = NULL;
|
||||
};
|
||||
|
||||
void CStat::init(const char* path) {
|
||||
isjson = false;
|
||||
if (isinitialized) {
|
||||
err = true;
|
||||
return;
|
||||
}
|
||||
stat = new CStatRead(path, 0, 0, 0);
|
||||
int warn;
|
||||
if (stat->Valid(&warn) != TRUE) {
|
||||
err = true;
|
||||
return;
|
||||
}
|
||||
nproc = stat->QProc();
|
||||
if (nproc == 0) {
|
||||
err = true;
|
||||
return;
|
||||
}
|
||||
stat->VMSSize(p_heading);
|
||||
unsigned long n = stat->BeginTreeWalk();
|
||||
if (n != 0) inter_tree = new CStatInter(stat, n);
|
||||
proc_info = new struct CProcInfo[nproc];
|
||||
for (unsigned long i = 0; i<nproc; i++) {
|
||||
stat->NameTimeProc(i, &proc_info[i].node_name, &proc_info[i].test_time);
|
||||
}
|
||||
isinitialized = true;
|
||||
spath = new char[strlen(path) + 1];
|
||||
strcpy(spath, path);
|
||||
}
|
||||
|
||||
CStatInter * find_inter(short type, long expr, short nlev, CStatInter * cur) {
|
||||
while (cur != NULL) {
|
||||
if (cur->id.t == type && cur->id.nlev == nlev)
|
||||
switch (type){
|
||||
case USER:
|
||||
if (cur->id.expr == expr)
|
||||
return cur;
|
||||
break;
|
||||
default:
|
||||
return cur;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
CStatInter * next_inter(short nlev, CStatInter * cur) {
|
||||
if (cur == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
cur = cur->next;
|
||||
while (cur != NULL && cur->id.nlev != nlev)
|
||||
{
|
||||
if (cur->id.nlev < nlev)
|
||||
return NULL;
|
||||
cur = cur->next;
|
||||
}
|
||||
return cur;
|
||||
};
|
||||
|
||||
int copy_for_compare(const CStat &s, CStat &r){
|
||||
if (!s.isinitialized)
|
||||
return 1;
|
||||
if (!s.isjson) {
|
||||
r.spath = new char[(strlen(s.spath)) + 1];
|
||||
strcpy(r.spath, s.spath);
|
||||
}
|
||||
r.nproc = s.nproc;
|
||||
strcpy(r.p_heading, s.p_heading);
|
||||
r.proc_info = new CProcInfo[r.nproc];
|
||||
for (int i = 0; i < r.nproc; ++i){
|
||||
r.proc_info[i].node_name = new char[strlen(s.proc_info[i].node_name)];
|
||||
strcpy(r.proc_info[i].node_name, s.proc_info[i].node_name);
|
||||
r.proc_info->test_time = s.proc_info->test_time;
|
||||
}
|
||||
r.isinitialized = true;
|
||||
r.iscomp = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void stat_intersect(const CStat &s1, const CStat &s2, CStat & r1, CStat & r2) {
|
||||
if (copy_for_compare(s1, r1) || copy_for_compare(s2, r2))
|
||||
return;
|
||||
inter_tree_intersect(s1.inter_tree, s2.inter_tree, &r1.inter_tree, &r2.inter_tree);
|
||||
};
|
||||
|
||||
void skip_to_end(CStatInter ***i){
|
||||
while ((**i)->next != NULL)
|
||||
*i = &(**i)->next;
|
||||
}
|
||||
|
||||
void inter_tree_intersect(CStatInter *i1, CStatInter *i2, CStatInter **r1, CStatInter **r2) {
|
||||
std::cout << "In inter_tree_intersect\n";
|
||||
CStatInter *cur;
|
||||
if (!i1 || !i2)
|
||||
return;
|
||||
short cur_lev = i1->id.nlev;
|
||||
while (i1 != NULL && i2 != NULL) {
|
||||
std::cout << "Going to find_inter: " << i1->id.expr << " " << cur_lev << " " << i1->id.t << " " << i1->id.nline << std::endl;
|
||||
if (cur = find_inter(i1->id.t, i1->id.expr, cur_lev, i2)) {
|
||||
std::cout << "Find_inter: " << cur->id.expr << " " << cur->id.nlev << " " << cur->id.nline << std::endl;
|
||||
*r1 = new CStatInter(*i1);
|
||||
*r2 = new CStatInter(*cur);
|
||||
r1 = &(*r1)->next;
|
||||
r2 = &(*r2)->next;
|
||||
if (i1->next != NULL && cur->next != NULL && i1->next->id.nlev > cur_lev && cur->next->id.nlev > cur_lev) {
|
||||
inter_tree_intersect(i1->next, cur->next, r1, r2);
|
||||
if (*r1 != NULL && *r2 != NULL){
|
||||
skip_to_end(&r1);
|
||||
skip_to_end(&r2);
|
||||
r1 = &(*r1)->next;
|
||||
r2 = &(*r2)->next;
|
||||
}
|
||||
}
|
||||
i2 = next_inter(cur_lev, cur);
|
||||
}
|
||||
i1 = next_inter(cur_lev, i1);
|
||||
// json j;
|
||||
//
|
||||
// if (i1 != NULL){
|
||||
// i1->to_json(j);
|
||||
// std::cout << ">> next_inter: " << i1->id.nlev << "\n\n" << j << "\n\n";
|
||||
// }
|
||||
// else
|
||||
// std::cout << ">> next_inter: " << i1 << "\n\n" << j << "\n\n";
|
||||
}
|
||||
// std::cout << "inter_tree_intersect OK " << cur_lev << std::endl;
|
||||
}
|
||||
1093
dvm/tools/pppa/trunk/src/statfile.cpp
Normal file
1093
dvm/tools/pppa/trunk/src/statfile.cpp
Normal file
File diff suppressed because it is too large
Load Diff
704
dvm/tools/pppa/trunk/src/statinter.cpp
Normal file
704
dvm/tools/pppa/trunk/src/statinter.cpp
Normal file
@@ -0,0 +1,704 @@
|
||||
#include "statlist.h"
|
||||
#include <iostream>
|
||||
|
||||
//--- Not relevant ‣ Use to_json ---//
|
||||
void CStatInter::to_string(std::string &result) {
|
||||
result += "@interval@ ";
|
||||
result += patch::to_string(id.nlev) + ' '; //уровень вложенности
|
||||
result += patch::to_string(id.t) + ' '; //тип интервала
|
||||
result += patch::to_string(id.expr) + ' '; //значение выражения
|
||||
result += patch::to_string(id.nline) + ' '; //номер строки начала
|
||||
result += patch::to_string(id.nline_end) + ' '; //номер строки конца
|
||||
result += patch::to_string(id.nenter) + ' '; //число вхождений в интервал
|
||||
result += std::string(id.pname) + ' ';
|
||||
result += "\n@times@ ";
|
||||
result += patch::to_string(prod_cpu)+' ';
|
||||
result += patch::to_string(prod_sys) + ' ';
|
||||
result += patch::to_string(prod_io) + ' ';
|
||||
result += patch::to_string(exec_time) + ' ';
|
||||
result += patch::to_string(sys_time) + ' ';
|
||||
result += patch::to_string(real_comm) + ' ';
|
||||
result += patch::to_string(efficiency) + ' ';
|
||||
result += patch::to_string(lost_time) + ' ';
|
||||
result += patch::to_string(insuf_user) + ' ';
|
||||
result += patch::to_string(insuf_sys) + ' ';
|
||||
result += patch::to_string(comm) + ' ';
|
||||
result += patch::to_string(real_comm) + ' ';
|
||||
result += patch::to_string(comm_start) + ' ';
|
||||
result += patch::to_string(idle) + ' ';
|
||||
result += patch::to_string(load_imb) + ' ';
|
||||
result += patch::to_string(synch) + ' ';
|
||||
result += patch::to_string(time_var) + ' ';
|
||||
result += patch::to_string(overlap) + ' ';
|
||||
result += patch::to_string(thr_user_time) + ' ';
|
||||
result += patch::to_string(thr_sys_time) + ' ';
|
||||
result += patch::to_string(gpu_time_prod) + ' ';
|
||||
result += patch::to_string(gpu_time_lost) + ' ';
|
||||
result += patch::to_string(nproc)+' ';
|
||||
result += patch::to_string(threadsOfAllProcs)+' ';
|
||||
result += "@end_times@\n";
|
||||
for (unsigned int i = 0; i < RED; i++) {
|
||||
result+= patch::to_string(col_op[i].ncall)+' ';
|
||||
result += patch::to_string(col_op[i].comm) + ' ';
|
||||
result += patch::to_string(col_op[i].synch) + ' ';
|
||||
result += patch::to_string(col_op[i].real_comm) + ' ';
|
||||
result += patch::to_string(col_op[i].time_var) + ' ';
|
||||
result += patch::to_string(col_op[i].overlap) + ' ';
|
||||
}
|
||||
if (!isjson){
|
||||
for (unsigned int j = 0; j < nproc; j++) {
|
||||
for (int i = 0; i <= StatGrpCount; i++) {
|
||||
result += patch::to_string(op_group[j][i].calls) + ' ';
|
||||
result += patch::to_string(op_group[j][i].prod) + ' ';
|
||||
result += patch::to_string(op_group[j][i].lost_time) + ' ';
|
||||
}
|
||||
}
|
||||
result += "\n@proc@\n";
|
||||
result += patch::to_string(id.proc) + '\n'; //кол-во процессов
|
||||
for (unsigned int i = 0; i < nproc; i++) {
|
||||
result += "@proc" + patch::to_string(i) + "@ ";
|
||||
result += patch::to_string(proc_times[i].prod_cpu) + ' ';
|
||||
result += patch::to_string(proc_times[i].prod_sys) + ' ';
|
||||
result += patch::to_string(proc_times[i].prod_io) + ' ';
|
||||
result += patch::to_string(proc_times[i].exec_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].sys_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].real_comm) + ' ';
|
||||
result += patch::to_string(proc_times[i].lost_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].insuf_user) + ' ';
|
||||
result += patch::to_string(proc_times[i].insuf_sys) + ' ';
|
||||
result += patch::to_string(proc_times[i].comm) + ' ';
|
||||
result += patch::to_string(proc_times[i].idle) + ' ';
|
||||
result += patch::to_string(proc_times[i].load_imb) + ' ';
|
||||
result += patch::to_string(proc_times[i].synch) + ' ';
|
||||
result += patch::to_string(proc_times[i].time_var) + ' ';
|
||||
result += patch::to_string(proc_times[i].overlap) + ' ';
|
||||
result += patch::to_string(proc_times[i].thr_user_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].thr_sys_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].gpu_time_prod) + ' ';
|
||||
result += patch::to_string(proc_times[i].gpu_time_lost) + ' ';
|
||||
result += "\n@treads@\n";
|
||||
result += patch::to_string(proc_times[i].num_threads) + ' ';
|
||||
for (unsigned int j = 0; j < proc_times[i].num_threads;j++) {
|
||||
result += "@tread" + patch::to_string(j) + "@ ";
|
||||
result += patch::to_string(proc_times[i].th_times[j].sys_time) + ' ';
|
||||
result += patch::to_string(proc_times[i].th_times[j].user_time) + ' ';
|
||||
result += "@end_tread" + patch::to_string(j) + "@ ";
|
||||
}
|
||||
result += "\n@end_treads@\n";
|
||||
result += "@gpu@\n";
|
||||
result += patch::to_string(proc_times[i].num_gpu) + ' ';
|
||||
for (unsigned int j = 0; j < proc_times[i].num_gpu; j++) {
|
||||
result +="@gpu"+ patch::to_string(j) + "_"
|
||||
+ std::string(proc_times[i].gpu_times[j].gpu_name) + '@' + ' ';
|
||||
result += patch::to_string(proc_times[i].gpu_times[j].prod_time)+' ';
|
||||
result += patch::to_string(proc_times[i].gpu_times[j].lost_time) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].kernel_exec) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].loop_exec) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].get_actual) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].data_reorg) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].reduction) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].gpu_runtime_compilation) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].gpu_to_cpu) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].cpu_to_gpu) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].gpu_to_gpu)+ ' ';
|
||||
// for (unsigned int k = 0; k < GNUMOP; k++) {
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].op_times[k].cpu_to_gpu) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].op_times[k].gpu_to_gpu) + ' ';
|
||||
// result += patch::to_string(proc_times[i].gpu_times[j].op_times[k].gpu_to_cpu) + ' ';
|
||||
// }
|
||||
result += "@end_gpu" + patch::to_string(j) + "@";
|
||||
}
|
||||
result += "\n@end_gpu@\n";
|
||||
|
||||
// Col_op
|
||||
// for (int i = 0; i < 4; i++) {
|
||||
// result += patch::to_string(col_op[i].comm) + ' ';
|
||||
// result += patch::to_string(col_op[i].ncall) + ' ';
|
||||
// result += patch::to_string(col_op[i].overlap) + ' ';
|
||||
// result += patch::to_string(col_op[i].real_comm) + ' ';
|
||||
// result += patch::to_string(col_op[i].synch) + ' ';
|
||||
// result += patch::to_string(col_op[i].time_var) + ' ';
|
||||
// }
|
||||
result += "@end_proc" + patch::to_string(i) + "@\n";
|
||||
}
|
||||
result += "@end_proc@\n";
|
||||
}
|
||||
result += "@end_interval@\n";
|
||||
}
|
||||
|
||||
void CStatInter::to_json(json & result){
|
||||
json col_op_json, proc_times_json;
|
||||
for (int i = 0; i < RED; i++) {
|
||||
col_op_json.push_back(
|
||||
{
|
||||
{"ncall", col_op[i].ncall},
|
||||
{"comm", col_op[i].comm},
|
||||
{"real_comm", col_op[i].real_comm},
|
||||
{"synch", col_op[i].synch},
|
||||
{"time_var", col_op[i].time_var},
|
||||
{"overlap", col_op[i].overlap}
|
||||
});
|
||||
}
|
||||
for (unsigned int i = 0; i < nproc; i++) {
|
||||
json th_times_json, gpu_times_json;
|
||||
// --- treads ---
|
||||
// std::cout << ">> th_times_json\n";
|
||||
for (unsigned int j = 0; j < proc_times[i].num_threads; ++j){
|
||||
th_times_json.push_back(
|
||||
{
|
||||
{"sys_time", proc_times[i].th_times[j].sys_time},
|
||||
{"user_time", proc_times[i].th_times[j].user_time}
|
||||
});
|
||||
}
|
||||
// --- GPU ---
|
||||
for (unsigned int j = 0; j < proc_times[i].num_gpu; j++) {
|
||||
json metrics_json;
|
||||
// std::cout << ">> metrics_json\n";
|
||||
for (unsigned int k = 0; k < DVMH_STAT_METRIC_CNT; ++k) {
|
||||
metrics_json.push_back(
|
||||
{
|
||||
{"countMeasures", proc_times[i].gpu_times[j].metrics[k].countMeasures},
|
||||
{"timeProductive", proc_times[i].gpu_times[j].metrics[k].timeProductive},
|
||||
{"timeLost", proc_times[i].gpu_times[j].metrics[k].timeLost},
|
||||
{"min", proc_times[i].gpu_times[j].metrics[k].min},
|
||||
{"mean", proc_times[i].gpu_times[j].metrics[k].mean},
|
||||
{"max", proc_times[i].gpu_times[j].metrics[k].max},
|
||||
{"sum", proc_times[i].gpu_times[j].metrics[k].sum}
|
||||
});
|
||||
}
|
||||
// std::cout << ">> gpu_times_json\n";
|
||||
gpu_times_json.push_back(
|
||||
{
|
||||
{"gpu_name", proc_times[i].gpu_times[j].gpu_name},
|
||||
{"prod_time", proc_times[i].gpu_times[j].prod_time},
|
||||
{"lost_time", proc_times[i].gpu_times[j].lost_time},
|
||||
{"metrics", metrics_json}
|
||||
});
|
||||
}
|
||||
// --- processors ---
|
||||
// std::cout << ">> proc_times_json\n";
|
||||
proc_times_json.push_back(
|
||||
{
|
||||
{"prod_cpu", proc_times[i].prod_cpu},
|
||||
{"prod_sys", proc_times[i].prod_sys},
|
||||
{"prod_io", proc_times[i].prod_io},
|
||||
{"exec_time", proc_times[i].exec_time},
|
||||
{"sys_time", proc_times[i].sys_time},
|
||||
{"real_comm", proc_times[i].real_comm},
|
||||
{"lost_time", proc_times[i].lost_time},
|
||||
{"insuf_user", proc_times[i].insuf_user},
|
||||
{"insuf_sys", proc_times[i].insuf_sys},
|
||||
{"comm", proc_times[i].comm},
|
||||
{"idle", proc_times[i].idle},
|
||||
{"load_imb", proc_times[i].load_imb},
|
||||
{"synch", proc_times[i].synch},
|
||||
{"time_var", proc_times[i].time_var},
|
||||
{"overlap", proc_times[i].overlap},
|
||||
{"thr_user_time", proc_times[i].thr_user_time},
|
||||
{"thr_sys_time", proc_times[i].thr_sys_time},
|
||||
{"gpu_time_prod", proc_times[i].gpu_time_prod},
|
||||
{"gpu_time_lost", proc_times[i].gpu_time_lost},
|
||||
{"num_threads", proc_times[i].num_threads},
|
||||
{"num_gpu", proc_times[i].num_gpu},
|
||||
{"th_times", th_times_json},
|
||||
{"gpu_times", gpu_times_json}
|
||||
});
|
||||
}
|
||||
// std::cout << ">> New JSON OK\n";
|
||||
|
||||
result = {
|
||||
{"id",
|
||||
{
|
||||
{"nlev", id.nlev},
|
||||
{"t", id.t},
|
||||
{"expr", id.expr},
|
||||
{"nline", id.nline},
|
||||
{"nline_end", id.nline_end},
|
||||
{"nenter", id.nenter},
|
||||
{"pname", id.pname}
|
||||
}
|
||||
},
|
||||
{"times",
|
||||
{
|
||||
{"prod_cpu", prod_cpu},
|
||||
{"prod_sys", prod_sys},
|
||||
{"prod_io", prod_io},
|
||||
{"exec_time", exec_time},
|
||||
{"sys_time", sys_time},
|
||||
{"efficiency", efficiency},
|
||||
{"lost_time", lost_time},
|
||||
{"insuf", insuf},
|
||||
{"insuf_user", insuf_user},
|
||||
{"insuf_sys", insuf_sys},
|
||||
{"comm", comm},
|
||||
{"real_comm", real_comm},
|
||||
{"comm_start", comm_start},
|
||||
{"idle", idle},
|
||||
{"load_imb", load_imb},
|
||||
{"synch", synch},
|
||||
{"time_var", time_var},
|
||||
{"overlap", overlap},
|
||||
{"thr_user_time", thr_user_time},
|
||||
{"thr_sys_time", thr_sys_time},
|
||||
{"gpu_time_prod", gpu_time_prod},
|
||||
{"gpu_time_lost", gpu_time_lost},
|
||||
{"nproc", nproc},
|
||||
{"threadsOfAllProcs", threadsOfAllProcs}
|
||||
}
|
||||
},
|
||||
{"col_op", col_op_json},
|
||||
{"proc_times", proc_times_json}
|
||||
};
|
||||
}
|
||||
|
||||
CStatInter::CStatInter(json source){
|
||||
isjson = true;
|
||||
// ----- id -----
|
||||
json j_id = source["id"];
|
||||
id.nenter = j_id["nenter"];
|
||||
id.nline_end = j_id["nline_end"];
|
||||
id.nline = j_id["nline"];
|
||||
id.expr = j_id["expr"];
|
||||
id.nlev = j_id["nlev"];
|
||||
id.t = j_id["t"];
|
||||
std::string tmp = (j_id["pname"]).dump();
|
||||
id.pname = new char[tmp.length() + 1];
|
||||
for (int i = 0; i < tmp.length(); ++i)
|
||||
id.pname[i] = tmp[i];
|
||||
id.pname[tmp.length()] = '\0';
|
||||
|
||||
// ----- times -----
|
||||
json j_times = source["times"];
|
||||
prod_cpu = j_times["prod_cpu"];
|
||||
prod_sys = j_times["prod_sys"];
|
||||
prod_io = j_times["prod_io"];
|
||||
exec_time = j_times["exec_time"];
|
||||
sys_time = j_times["sys_time"];
|
||||
efficiency = j_times["efficiency"];
|
||||
lost_time = j_times["lost_time"];
|
||||
insuf = j_times["insuf"];
|
||||
insuf_user = j_times["insuf_user"];
|
||||
insuf_sys = j_times["insuf_sys"];
|
||||
comm = j_times["comm"];
|
||||
real_comm = j_times["real_comm"];
|
||||
comm_start = j_times["comm_start"];
|
||||
idle = j_times["idle"];
|
||||
load_imb = j_times["load_imb"];
|
||||
synch = j_times["synch"];
|
||||
time_var = j_times["time_var"];
|
||||
overlap = j_times["overlap"];
|
||||
thr_user_time = j_times["thr_user_time"];
|
||||
thr_sys_time = j_times["thr_sys_time"];
|
||||
gpu_time_prod = j_times["gpu_time_prod"];
|
||||
gpu_time_lost = j_times["gpu_time_lost"];
|
||||
nproc = j_times["nproc"];
|
||||
threadsOfAllProcs = j_times["threadsOfAllProcs"];
|
||||
|
||||
// ----- col_op -----
|
||||
if (source.contains("col_op")) {
|
||||
json j_col_op = source["col_op"];
|
||||
for (int i = 0; i < RED; ++i) {
|
||||
col_op[i].ncall = j_col_op[i]["ncall"];
|
||||
col_op[i].comm = j_col_op[i]["comm"];
|
||||
col_op[i].real_comm = j_col_op[i]["real_comm"];
|
||||
col_op[i].synch = j_col_op[i]["synch"];
|
||||
col_op[i].time_var = j_col_op[i]["time_var"];
|
||||
col_op[i].overlap = j_col_op[i]["overlap"];
|
||||
}
|
||||
}
|
||||
// std::cout << ">> Going to proc_times\n";
|
||||
// ----- proc_times -----
|
||||
if (source.contains("proc_times")){
|
||||
proc_times = new struct ProcTimes[nproc];
|
||||
json proc_times_json = source["proc_times"];
|
||||
for (int i = 0; i < nproc; ++i){
|
||||
json th_times_json = proc_times_json[i]["th_times"],
|
||||
gpu_times_json = proc_times_json[i]["gpu_times"];
|
||||
proc_times[i].prod_cpu = proc_times_json[i]["prod_cpu"];
|
||||
proc_times[i].prod_sys = proc_times_json[i]["prod_sys"];
|
||||
proc_times[i].prod_io = proc_times_json[i]["prod_io"];
|
||||
proc_times[i].exec_time = proc_times_json[i]["exec_time"];
|
||||
proc_times[i].sys_time = proc_times_json[i]["sys_time"];
|
||||
proc_times[i].real_comm = proc_times_json[i]["real_comm"];
|
||||
proc_times[i].lost_time = proc_times_json[i]["lost_time"];
|
||||
proc_times[i].insuf_user = proc_times_json[i]["insuf_user"];
|
||||
proc_times[i].insuf_sys = proc_times_json[i]["insuf_sys"];
|
||||
proc_times[i].comm = proc_times_json[i]["comm"];
|
||||
proc_times[i].idle = proc_times_json[i]["idle"];
|
||||
proc_times[i].load_imb = proc_times_json[i]["load_imb"];
|
||||
proc_times[i].synch = proc_times_json[i]["synch"];
|
||||
proc_times[i].time_var = proc_times_json[i]["time_var"];
|
||||
proc_times[i].overlap = proc_times_json[i]["overlap"];
|
||||
proc_times[i].thr_user_time = proc_times_json[i]["thr_user_time"];
|
||||
proc_times[i].thr_sys_time = proc_times_json[i]["thr_sys_time"];
|
||||
proc_times[i].gpu_time_prod = proc_times_json[i]["gpu_time_prod"];
|
||||
proc_times[i].gpu_time_lost = proc_times_json[i]["gpu_time_lost"];
|
||||
proc_times[i].num_threads = proc_times_json[i]["num_threads"];
|
||||
proc_times[i].num_gpu = proc_times_json[i]["num_gpu"];
|
||||
// std::cout << ">> NumGPU - " << proc_times[i].num_gpu << std::endl;
|
||||
proc_times[i].th_times = new struct ThreadTime[proc_times[i].num_threads];
|
||||
for (int j = 0; j < proc_times[i].num_threads; ++j){
|
||||
proc_times[i].th_times[j].user_time = th_times_json[j]["user_time"];
|
||||
proc_times[i].th_times[j].sys_time = th_times_json[j]["sys_time"];
|
||||
}
|
||||
proc_times[i].gpu_times = new struct GpuTime[proc_times[i].num_gpu];
|
||||
for (int j = 0; j < proc_times[i].num_gpu; ++j){
|
||||
tmp = gpu_times_json[j]["gpu_name"].dump();
|
||||
proc_times[i].gpu_times[j].gpu_name = new char[tmp.length() + 1];
|
||||
for (int k = 0; k < tmp.length(); ++k)
|
||||
proc_times[i].gpu_times[j].gpu_name[k] = tmp[k];
|
||||
proc_times[i].gpu_times[j].gpu_name[tmp.length()] = '\0';
|
||||
proc_times[i].gpu_times[j].prod_time = gpu_times_json[j]["prod_time"];
|
||||
proc_times[i].gpu_times[j].lost_time = gpu_times_json[j]["lost_time"];
|
||||
|
||||
// std::cout << ">> Odl times OK\n";
|
||||
|
||||
json metrics_json = gpu_times_json[j]["metrics"];
|
||||
|
||||
// std::cout << ">> metrics_json = " << metrics_json << std::endl;
|
||||
|
||||
for (int m = 0; m < DVMH_STAT_METRIC_CNT; ++m){
|
||||
proc_times[i].gpu_times[j].metrics[m].countMeasures = metrics_json[m]["countMeasures"];
|
||||
proc_times[i].gpu_times[j].metrics[m].timeProductive = metrics_json[m]["timeProductive"];
|
||||
proc_times[i].gpu_times[j].metrics[m].timeLost = metrics_json[m]["timeLost"];
|
||||
proc_times[i].gpu_times[j].metrics[m].min = metrics_json[m]["min"];
|
||||
proc_times[i].gpu_times[j].metrics[m].mean = metrics_json[m]["mean"];
|
||||
proc_times[i].gpu_times[j].metrics[m].max = metrics_json[m]["max"];
|
||||
proc_times[i].gpu_times[j].metrics[m].sum = metrics_json[m]["sum"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
CStatInter::CStatInter(const CStatInter & si) {
|
||||
std::cout << ">> In CStatInter(si)\n";
|
||||
isjson = si.isjson;
|
||||
id.t = si.id.t;
|
||||
id.nlev = si.id.nlev;
|
||||
id.expr = si.id.expr;
|
||||
id.nline = si.id.nline;
|
||||
id.nline_end = si.id.nline_end;
|
||||
id.proc = si.id.proc;
|
||||
id.nenter = si.id.nenter;
|
||||
if (si.id.pname) {
|
||||
id.pname = new char[strlen(si.id.pname) + 1];
|
||||
strcpy(id.pname, si.id.pname);
|
||||
}
|
||||
else {
|
||||
id.pname = new char [2];
|
||||
id.pname[0] = '0';
|
||||
id.pname[1] = '\0';
|
||||
}
|
||||
prod_cpu=si.prod_cpu;
|
||||
prod_sys = si.prod_sys;
|
||||
prod_io= si.prod_io;
|
||||
prod = si.prod;
|
||||
exec_time=si.exec_time;
|
||||
sys_time=si.sys_time;
|
||||
efficiency=si.efficiency;
|
||||
lost_time=si.lost_time;
|
||||
insuf=si.insuf;
|
||||
insuf_user=si.insuf_user;
|
||||
insuf_sys=si.insuf_sys;
|
||||
comm=si.comm;
|
||||
real_comm=si.real_comm;
|
||||
comm_start=si.comm_start;
|
||||
idle=si.idle;
|
||||
load_imb=si.load_imb;
|
||||
synch=si.synch;
|
||||
time_var=si.time_var;
|
||||
overlap=si.overlap;
|
||||
thr_user_time=si.thr_user_time;
|
||||
thr_sys_time=si.thr_sys_time;
|
||||
gpu_time_prod=si.gpu_time_prod;
|
||||
gpu_time_lost=si.gpu_time_lost;
|
||||
nproc=si.nproc;
|
||||
threadsOfAllProcs=si.threadsOfAllProcs;
|
||||
for (int i = 0; i < RED; i++) {
|
||||
col_op[i] = si.col_op[i];
|
||||
}
|
||||
// std::cout << ">> Prev OK\n";
|
||||
if (!isjson) {
|
||||
op_group = new OpGrp[nproc][StatGrpCount];
|
||||
// for (int i = 0; i < nproc; ++i)
|
||||
// op_group[i] = new OpGrp[StatGrpCount];
|
||||
|
||||
for (unsigned long j = 0; j < nproc; j++) {
|
||||
for (int i = 0; i < StatGrpCount; i++) {
|
||||
op_group[j][i].calls = si.op_group[j][i].calls;
|
||||
op_group[j][i].prod = si.op_group[j][i].prod;
|
||||
op_group[j][i].lost_time = op_group[j][i].lost_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
// std::cout << ">> Going to ProcTimes - nproc = " << nproc << std::endl;
|
||||
|
||||
proc_times = new struct ProcTimes[nproc];
|
||||
for (unsigned long i = 0; i < nproc; ++i) {
|
||||
proc_times[i].prod_cpu = si.proc_times[i].prod_cpu;
|
||||
proc_times[i].prod_sys = si.proc_times[i].prod_sys;
|
||||
proc_times[i].prod_io = si.proc_times[i].prod_io;
|
||||
proc_times[i].exec_time = si.proc_times[i].exec_time;
|
||||
proc_times[i].sys_time = si.proc_times[i].sys_time;
|
||||
proc_times[i].real_comm = si.proc_times[i].real_comm;
|
||||
proc_times[i].lost_time = si.proc_times[i].lost_time;
|
||||
proc_times[i].insuf_user = si.proc_times[i].insuf_user;
|
||||
proc_times[i].insuf_sys = si.proc_times[i].insuf_sys;
|
||||
proc_times[i].comm = si.proc_times[i].comm;
|
||||
proc_times[i].idle = si.proc_times[i].idle;
|
||||
proc_times[i].load_imb = si.proc_times[i].load_imb;
|
||||
proc_times[i].synch = si.proc_times[i].synch;
|
||||
proc_times[i].time_var = si.proc_times[i].time_var;
|
||||
proc_times[i].overlap = si.proc_times[i].overlap;
|
||||
proc_times[i].thr_user_time = si.proc_times[i].thr_user_time;
|
||||
proc_times[i].thr_sys_time = si.proc_times[i].thr_sys_time;
|
||||
proc_times[i].gpu_time_prod = si.proc_times[i].gpu_time_prod;
|
||||
proc_times[i].gpu_time_lost = si.proc_times[i].gpu_time_lost;
|
||||
proc_times[i].num_threads = si.proc_times[i].num_threads;
|
||||
std::cout << ">> Going to ThreadTime\n";
|
||||
proc_times[i].th_times = new struct ThreadTime[proc_times[i].num_threads];
|
||||
for (unsigned long j = 0; j < proc_times[i].num_threads; j++) {
|
||||
proc_times[i].th_times[j].user_time = si.proc_times[i].th_times[j].user_time;
|
||||
proc_times[i].th_times[j].sys_time = si.proc_times[i].th_times[j].sys_time;
|
||||
}
|
||||
proc_times[i].num_gpu = si.proc_times[i].num_gpu;
|
||||
// std::cout << ">> Going to GpuTime - num_gpu = " << proc_times[i].num_gpu << std::endl;
|
||||
proc_times[i].gpu_times = new struct GpuTime[proc_times[i].num_gpu];
|
||||
for (unsigned int j = 0; j < proc_times[i].num_gpu; j++) {
|
||||
// std::cout << ">> Name = " << si.proc_times[i].gpu_times[j].gpu_name << std::endl;
|
||||
if (si.proc_times[i].gpu_times[j].gpu_name) {
|
||||
proc_times[i].gpu_times[j].gpu_name = new char[strlen(si.proc_times[i].gpu_times[j].gpu_name) + 1];
|
||||
strcpy(proc_times[i].gpu_times[j].gpu_name, si.proc_times[i].gpu_times[j].gpu_name);
|
||||
} else {
|
||||
proc_times[i].gpu_times[j].gpu_name = new char[2];
|
||||
proc_times[i].gpu_times[j].gpu_name[0] = '0';
|
||||
proc_times[i].gpu_times[j].gpu_name[1] = '\0';
|
||||
}
|
||||
// std::cout << ">> Name OK\n";
|
||||
proc_times[i].gpu_times[j].prod_time = si.proc_times[i].gpu_times[j].prod_time;
|
||||
proc_times[i].gpu_times[j].lost_time = si.proc_times[i].gpu_times[j].lost_time;
|
||||
for (int m = 0; m < DVMH_STAT_METRIC_CNT; ++m) {
|
||||
proc_times[i].gpu_times[j].metrics[m] = si.proc_times[i].gpu_times[j].metrics[m];
|
||||
}
|
||||
}
|
||||
}
|
||||
next = NULL;
|
||||
std::cout << ">> CStatInter(si) OK\n";
|
||||
}
|
||||
|
||||
void CStatInter::clear() {
|
||||
if (!isjson){
|
||||
delete [] op_group;
|
||||
for (unsigned int i = 0; i < nproc; i++) {
|
||||
if (proc_times[i].num_threads)
|
||||
delete [] proc_times[i].th_times;
|
||||
for (unsigned int j = 0; j < proc_times[i].num_gpu; j++)
|
||||
if (proc_times[i].gpu_times[j].gpu_name)
|
||||
delete [] proc_times[i].gpu_times[j].gpu_name;
|
||||
if (proc_times[i].num_gpu)
|
||||
delete [] proc_times[i].gpu_times;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CStatInter::delete_tail() {
|
||||
if (next != NULL) {
|
||||
next->delete_tail();
|
||||
clear();
|
||||
delete next;
|
||||
}
|
||||
}
|
||||
|
||||
CStatInter::~CStatInter() {
|
||||
printf("Destructor: ~CStatInter()\n");
|
||||
//delete_tail();
|
||||
//clear();
|
||||
}
|
||||
|
||||
//--- Copy dvmhStatMetric to metric in CStatInter ---//
|
||||
void init_gpu_metric(GpuMetric &metric, dvmh_stat_interval_gpu_metric *dvmhStatMetric){
|
||||
metric.countMeasures = dvmhStatMetric->countMeasures;
|
||||
metric.max = dvmhStatMetric->max;
|
||||
metric.mean = dvmhStatMetric->mean;
|
||||
metric.min = dvmhStatMetric->min;
|
||||
metric.sum = dvmhStatMetric->sum;
|
||||
metric.timeLost = dvmhStatMetric->timeLost;
|
||||
metric.timeProductive = dvmhStatMetric->timeProductive;
|
||||
}
|
||||
|
||||
CStatInter::CStatInter(CStatRead * stat, int n)
|
||||
{
|
||||
isjson = false;
|
||||
//printf("begin init %d\n", n);
|
||||
qproc = stat->QProc();
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stat->ReadIdent(&id);
|
||||
// string for processor characteristics - max
|
||||
double min[ITER + 1];
|
||||
double max[ITER + 1];
|
||||
double sum[ITER + 1];
|
||||
// communication
|
||||
double minc[RED + 1];
|
||||
double maxc[RED + 1];
|
||||
double sumc[RED + 1];
|
||||
// real communication
|
||||
double minrc[RED + 1];
|
||||
double maxrc[RED + 1];
|
||||
double sumrc[RED + 1];
|
||||
// synchronization
|
||||
double mins[RED + 1];
|
||||
double maxs[RED + 1];
|
||||
double sums[RED + 1];
|
||||
// variation
|
||||
double minv[RED + 1];
|
||||
double maxv[RED + 1];
|
||||
double sumv[RED + 1];
|
||||
// overlap
|
||||
double minov[RED + 1];
|
||||
double maxov[RED + 1];
|
||||
double sumov[RED + 1];
|
||||
// number of processor
|
||||
unsigned long nprocmin[ITER + 1], nprocmax[ITER + 1];
|
||||
unsigned long nprocminc[RED + 1], nprocmaxc[RED + 1];
|
||||
unsigned long nprocminrc[RED + 1], nprocmaxrc[RED + 1];
|
||||
unsigned long nprocmins[RED + 1], nprocmaxs[RED + 1];
|
||||
unsigned long nprocminv[RED + 1], nprocmaxv[RED + 1];
|
||||
unsigned long nprocminov[RED + 1], nprocmaxov[RED + 1];
|
||||
stat->MinMaxSum(PRGEN, min, nprocmin, max, nprocmax, sum);
|
||||
stat->MinMaxSum(PRCOM, minc, nprocminc, maxc, nprocmaxc, sumc);
|
||||
stat->MinMaxSum(PRRCOM, minrc, nprocminrc, maxrc, nprocmaxrc, sumrc);
|
||||
stat->MinMaxSum(PRSYN, mins, nprocmins, maxs, nprocmaxs, sums);
|
||||
stat->MinMaxSum(PRVAR, minv, nprocminv, maxv, nprocmaxv, sumv);
|
||||
stat->MinMaxSum(PROVER, minov, nprocminov, maxov, nprocmaxov, sumov);
|
||||
//printf("main charecteristics\n");
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
nproc = n;
|
||||
prod_cpu = sum[CPUUSR];
|
||||
prod_sys = sum[CPU];
|
||||
prod_io = sum[IOTIME];
|
||||
prod = prod_cpu + prod_sys + prod_io;
|
||||
exec_time = max[EXEC];
|
||||
sys_time = nproc * max[EXEC];
|
||||
efficiency = sys_time ? prod / sys_time : 0.0;
|
||||
threadsOfAllProcs = 0;
|
||||
for (unsigned int not_i = 1; not_i <= nproc; ++not_i)
|
||||
threadsOfAllProcs += stat->getThreadsAmountByProcess(not_i);
|
||||
lost_time = sum[LOST];
|
||||
insuf = sum[INSUFUSR] + sum[INSUF];
|
||||
insuf_user = sum[INSUFUSR];
|
||||
insuf_sys = sum[INSUF];
|
||||
comm = sum[SUMCOM];
|
||||
real_comm = sum[SUMRCOM];
|
||||
comm_start = sum[START];
|
||||
idle = sum[IDLE];
|
||||
load_imb = sum[IMB];
|
||||
synch = sum[SUMSYN];
|
||||
time_var = sum[SUMVAR];
|
||||
overlap = sum[SUMOVERLAP];
|
||||
thr_user_time = sum[DVMH_THREADS_USER_TIME];
|
||||
thr_sys_time = sum[DVMH_THREADS_SYSTEM_TIME];
|
||||
gpu_time_prod = sum[DVMH_GPU_TIME_PRODUCTIVE];
|
||||
gpu_time_lost = sum[DVMH_GPU_TIME_LOST];
|
||||
for (int i = 0; i < RED; i++) {
|
||||
col_op[i].ncall = stat->ReadCall(typecom(i));
|
||||
col_op[i].comm = sumc[i];
|
||||
col_op[i].real_comm = sumrc[i];
|
||||
col_op[i].synch = sums[i];
|
||||
col_op[i].time_var = sumv[i];
|
||||
col_op[i].overlap = sumov[i];
|
||||
}
|
||||
//return;
|
||||
|
||||
op_group = new OpGrp[qproc][StatGrpCount];
|
||||
// for (int i = 0; i < qproc; ++i)
|
||||
// op_group[i] = new OpGrp[StatGrpCount];
|
||||
//printf("group\n");
|
||||
for (unsigned long j = 0; j < qproc; j++) {
|
||||
double prod[StatGrpCount], lost[StatGrpCount], sumprod = 0.0, sumlost = 0.0;
|
||||
double calls[StatGrpCount], sumcalls = 0.0;
|
||||
//printf("stat call\n");
|
||||
stat->GrpTimes(prod, lost, calls, j + 1);
|
||||
//printf("begin loop\n");
|
||||
for (int i = 0; i < StatGrpCount - 1; i++) {
|
||||
sumprod = sumprod + prod[i];
|
||||
sumlost = sumlost + lost[i];
|
||||
sumcalls = sumcalls + calls[i];
|
||||
op_group[j][i].calls = calls[i];
|
||||
op_group[j][i].prod = prod[i];
|
||||
op_group[j][i].lost_time = lost[i];
|
||||
}
|
||||
op_group[j][StatGrpCount - 1].calls = sumcalls;
|
||||
op_group[j][StatGrpCount - 1].prod = sumprod;
|
||||
op_group[j][StatGrpCount - 1].lost_time = sumlost;
|
||||
}
|
||||
//printf("proc %d\n", qproc);
|
||||
proc_times = new struct ProcTimes[qproc];
|
||||
//printf("struct\n");
|
||||
stat->ReadProcS(proc_times);
|
||||
//printf("procs call\n");
|
||||
for (unsigned long np = 1; np <= qproc; ++np)
|
||||
{
|
||||
proc_times[np-1].num_threads = 0;
|
||||
proc_times[np - 1].th_times = NULL;
|
||||
dvmh_stat_interval *dvmhStatInterval = stat->getDvmhStatIntervalByProcess(np);
|
||||
if (!dvmhStatInterval) {
|
||||
continue;
|
||||
}
|
||||
if (!dvmhStatInterval->threadsUsed)
|
||||
continue;
|
||||
proc_times[np - 1].num_threads = stat->getThreadsAmountByProcess(np);
|
||||
proc_times[np - 1].th_times = new struct ThreadTime[proc_times[np - 1].num_threads];
|
||||
for (unsigned long i = 0; i < proc_times[np - 1].num_threads; ++i)
|
||||
{
|
||||
proc_times[np - 1].th_times[i].user_time = dvmhStatInterval->threads[i].user_time;
|
||||
proc_times[np - 1].th_times[i].sys_time = dvmhStatInterval->threads[i].system_time;
|
||||
}
|
||||
}
|
||||
//printf("gpu\n");
|
||||
for (unsigned long np = 1; np <= qproc; ++np)
|
||||
{
|
||||
dvmh_stat_interval *dvmhStatInterval = stat->getDvmhStatIntervalByProcess(np);
|
||||
dvmh_stat_header_gpu_info *dvmhStatGpuInfo;
|
||||
if (!dvmhStatInterval) {
|
||||
continue;
|
||||
}
|
||||
proc_times[np - 1].gpu_times = new struct GpuTime[DVMH_STAT_MAX_GPU_CNT];
|
||||
proc_times[np - 1].num_gpu = 0;
|
||||
for (int gpu = 0; gpu < DVMH_STAT_MAX_GPU_CNT; ++gpu) {
|
||||
if (((dvmhStatInterval->mask >> gpu) & 1) == 0) continue;
|
||||
proc_times[np - 1].num_gpu++;
|
||||
dvmhStatGpuInfo = stat->getDvmhStatGpuInfoByProcess(np, gpu);
|
||||
dvmh_stat_interval_gpu *dvmhStatGpu = &dvmhStatInterval->gpu[gpu];
|
||||
if ((char *)dvmhStatGpuInfo->name) {
|
||||
int lenName = strlen((char *)dvmhStatGpuInfo->name);
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].gpu_name = new char[lenName + 1];
|
||||
strcpy(proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].gpu_name, (char *)dvmhStatGpuInfo->name);
|
||||
}
|
||||
else {
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].gpu_name = new char[2];
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].gpu_name[0]='0';
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].gpu_name[1] = '\0';
|
||||
}
|
||||
//--- Init times ---//
|
||||
dvmh_stat_interval_gpu_metric *dvmhStatMetric;
|
||||
for (int m = 0; m < DVMH_STAT_METRIC_CNT; ++m)
|
||||
init_gpu_metric(proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].metrics[m], &dvmhStatGpu->metrics[m]);
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].prod_time = dvmhStatGpu->timeProductive;
|
||||
proc_times[np - 1].gpu_times[proc_times[np - 1].num_gpu - 1].lost_time = dvmhStatGpu->timeLost;
|
||||
//if (dvmhStatMetric->countMeasures <= 0) ????;
|
||||
}
|
||||
}
|
||||
//printf("next\n");
|
||||
n = stat->TreeWalk();
|
||||
//printf("next %d\n", n);
|
||||
if (n != 0)
|
||||
{
|
||||
next = new CStatInter(stat, n);
|
||||
}
|
||||
else
|
||||
next = NULL;
|
||||
//printf("end inter\n");
|
||||
}
|
||||
93
dvm/tools/pppa/trunk/src/statinter.h
Normal file
93
dvm/tools/pppa/trunk/src/statinter.h
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
enum {
|
||||
GSHADOW,
|
||||
GREMOTE,
|
||||
GREDISTRIBUTION,
|
||||
GREGIONIN,
|
||||
GNUMOP
|
||||
};
|
||||
|
||||
struct GpuOpTime { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> gpu
|
||||
double gpu_to_cpu;
|
||||
double cpu_to_gpu;
|
||||
double gpu_to_gpu;
|
||||
};
|
||||
|
||||
struct ThreadTime { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
double user_time;
|
||||
double sys_time;
|
||||
};
|
||||
|
||||
struct GpuMetric {
|
||||
unsigned int countMeasures; /**< количество измерений характеристики */
|
||||
double timeProductive; /**< полезное время */
|
||||
double timeLost; /**< потерянное время */
|
||||
|
||||
// -- Агрегированные значения (для box-диаграммы)
|
||||
double min; /**< минимальное значение */
|
||||
double mean; /**< среднее */
|
||||
double max; /**< максимальное значение */
|
||||
double sum; /**< сумма значений */
|
||||
};
|
||||
|
||||
struct GpuTime { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gpu
|
||||
char * gpu_name;
|
||||
double prod_time;
|
||||
double lost_time;
|
||||
// double kernel_exec;
|
||||
// double loop_exec;
|
||||
// double get_actual;
|
||||
// double data_reorg;
|
||||
// double reduction;
|
||||
// double gpu_runtime_compilation;
|
||||
// double gpu_to_cpu;
|
||||
// double cpu_to_gpu;
|
||||
// double gpu_to_gpu;
|
||||
// struct GpuOpTime op_times[GNUMOP];
|
||||
struct GpuMetric metrics[DVMH_STAT_METRIC_FORCE_INT];
|
||||
};
|
||||
|
||||
struct ColOp { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long ncall;
|
||||
double comm;
|
||||
double synch;
|
||||
double real_comm;
|
||||
double time_var;
|
||||
double overlap;
|
||||
};
|
||||
|
||||
struct OpGrp {
|
||||
double calls;
|
||||
double lost_time;
|
||||
double prod;
|
||||
};
|
||||
|
||||
struct ProcTimes {
|
||||
double prod_cpu;
|
||||
double prod_sys;
|
||||
double prod_io;
|
||||
double exec_time;
|
||||
double sys_time;
|
||||
double real_comm;
|
||||
double lost_time;
|
||||
double insuf_user;
|
||||
double insuf_sys;
|
||||
double comm;
|
||||
double idle;
|
||||
double load_imb;
|
||||
double synch;
|
||||
double time_var;
|
||||
double overlap;
|
||||
double thr_user_time;
|
||||
double thr_sys_time;
|
||||
double gpu_time_prod;
|
||||
double gpu_time_lost;
|
||||
unsigned long num_threads;
|
||||
struct ThreadTime * th_times;
|
||||
unsigned long num_gpu;
|
||||
struct GpuTime *gpu_times;
|
||||
struct ColOp col_op[4];//4~RED
|
||||
};
|
||||
|
||||
typedef struct OpGrp OpGrp;
|
||||
typedef struct ProcTimes ProcTimes;
|
||||
7
dvm/tools/pppa/trunk/src/statist.h
Normal file
7
dvm/tools/pppa/trunk/src/statist.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#if !defined( __STATIST_H )
|
||||
#define __STATIST_H
|
||||
void CreateInter(int typef,long val);
|
||||
int FindInter(int typef,long val);
|
||||
void EndInter(long nline);
|
||||
void FreeInter(void);
|
||||
#endif
|
||||
361
dvm/tools/pppa/trunk/src/statlist.cpp
Normal file
361
dvm/tools/pppa/trunk/src/statlist.cpp
Normal file
@@ -0,0 +1,361 @@
|
||||
#include "statlist.h"
|
||||
|
||||
CStatList::CStatList(char * path) {
|
||||
err = false;
|
||||
length = 0;
|
||||
lname = NULL; //???
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
char buf[100];
|
||||
std::ifstream fin;
|
||||
fin.open(path);
|
||||
fin.getline(buf, 100);
|
||||
if (!fin.eof()) {
|
||||
stat_list = new struct CStatNode;
|
||||
}
|
||||
else {
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
}
|
||||
CStatNode * cur = stat_list, * prev = NULL;
|
||||
while (!fin.eof()) {
|
||||
cur->stat.init(buf);
|
||||
if (cur->stat.err) {
|
||||
err = true;
|
||||
clear_stat_list(stat_list);
|
||||
delete stat_list;
|
||||
return;
|
||||
}
|
||||
fin.getline(buf, 100);
|
||||
if (!fin.eof()) {
|
||||
cur->next = new struct CStatNode;
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
else {
|
||||
cur->next = NULL;
|
||||
}
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CStatList::CStatList(int n, char** paths) {
|
||||
length = n;
|
||||
lname = NULL; //???
|
||||
if (n > 0) {
|
||||
stat_list = new struct CStatNode;
|
||||
CStatNode * cur = stat_list, * prev = NULL;
|
||||
for (; n > 0; n--) {
|
||||
cur->stat.init(paths[n - 1]);
|
||||
if (cur->stat.err) {
|
||||
err = true;
|
||||
clear_stat_list(stat_list);
|
||||
delete stat_list;
|
||||
return;
|
||||
}
|
||||
if (n - 1 > 0) {
|
||||
cur->next = new struct CStatNode;
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
else
|
||||
cur->next = NULL;
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
}
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
};
|
||||
|
||||
CStatList::CStatList() {
|
||||
err = false;
|
||||
length = 0;
|
||||
lname = NULL; //???
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
};
|
||||
|
||||
CStatList::CStatList(const CStatList & sl) {
|
||||
length = sl.length;
|
||||
lname = NULL; //???
|
||||
int n = length;
|
||||
if (n > 0) {
|
||||
stat_list = new struct CStatNode;
|
||||
CStatNode * cur_new = stat_list, *prev = NULL, *cur_old = sl.stat_list;
|
||||
for (; n > 0; n--) {
|
||||
cur_new->stat.init(sl.stat_list->stat.spath);
|
||||
if (cur_new->stat.err) {
|
||||
err = true;
|
||||
clear_stat_list(stat_list);
|
||||
delete stat_list;
|
||||
return;
|
||||
}
|
||||
if (n - 1 > 0) {
|
||||
cur_new->next = new struct CStatNode;
|
||||
prev = cur_new;
|
||||
cur_new = cur_new->next;
|
||||
cur_old = cur_old->next;
|
||||
}
|
||||
else
|
||||
cur_new->next = NULL;
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
}
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
};
|
||||
|
||||
CStatList::~CStatList() {
|
||||
clear_stat_list(stat_list);
|
||||
delete stat_list;
|
||||
};
|
||||
|
||||
CStatList & CStatList::operator= (const CStatList & sl) {
|
||||
clear_list();
|
||||
length = sl.length;
|
||||
lname = NULL; //???
|
||||
int n = length;
|
||||
if (n > 0) {
|
||||
stat_list = new struct CStatNode;
|
||||
CStatNode * cur_new = stat_list, *prev = NULL, *cur_old = sl.stat_list;
|
||||
for (; n > 0; n--) {
|
||||
cur_new->stat.init(sl.stat_list->stat.spath);
|
||||
if (n - 1 > 0) {
|
||||
cur_new->next = new struct CStatNode;
|
||||
prev = cur_new;
|
||||
cur_new = cur_new->next;
|
||||
cur_old = cur_old->next;
|
||||
}
|
||||
else
|
||||
cur_new->next = NULL;
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
stat_list = NULL;
|
||||
last = NULL;
|
||||
}
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
return *this;
|
||||
};
|
||||
|
||||
CStatList & CStatList::operator+ (const CStatList & sl) {
|
||||
length += sl.length;
|
||||
int n = sl.length;
|
||||
if (n > 0) {
|
||||
CStatNode * cur_new, *prev = NULL, *cur_old = sl.stat_list;
|
||||
if (last) {
|
||||
(*last)->next = new struct CStatNode;
|
||||
prev = *last;
|
||||
cur_new = (*last)->next;
|
||||
}
|
||||
else {
|
||||
if (stat_list) {
|
||||
(stat_list)->next = new struct CStatNode;
|
||||
cur_new = (stat_list)->next;
|
||||
prev = stat_list;
|
||||
}
|
||||
else {
|
||||
stat_list = new struct CStatNode;
|
||||
cur_new = stat_list;
|
||||
}
|
||||
}
|
||||
for (; n > 0; n--) {
|
||||
cur_new->stat.init(sl.stat_list->stat.spath);
|
||||
if (n - 1 > 0) {
|
||||
cur_new->next = new struct CStatNode;
|
||||
prev = cur_new;
|
||||
cur_new = cur_new->next;
|
||||
cur_old = cur_old->next;
|
||||
}
|
||||
else
|
||||
cur_new->next = NULL;
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
|
||||
void CStatList::add_nodes(int n, char ** paths) {
|
||||
if (n > 0) {
|
||||
CStatNode * cur, *prev = NULL;
|
||||
length += n;
|
||||
if (last) {
|
||||
(*last)->next = new struct CStatNode;
|
||||
prev = *last;
|
||||
cur = (*last)->next;
|
||||
}
|
||||
else {
|
||||
if (stat_list) {
|
||||
(stat_list)->next = new struct CStatNode;
|
||||
cur = (stat_list)->next;
|
||||
prev = stat_list;
|
||||
}
|
||||
else {
|
||||
stat_list = new struct CStatNode;
|
||||
cur = stat_list;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<n; i++) {
|
||||
cur->stat.init(paths[i]);
|
||||
if (i+1<n) {
|
||||
cur->next = new struct CStatNode;
|
||||
prev = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
else
|
||||
cur->next = NULL;
|
||||
}
|
||||
if (prev) {
|
||||
last = &prev->next;
|
||||
}
|
||||
else {
|
||||
last = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void CStatList::clear_list() {
|
||||
clear_stat_list(stat_list);
|
||||
clear_stat_list(comp_stat1);
|
||||
clear_stat_list(comp_stat2);
|
||||
stat_list = NULL;
|
||||
comp_stat1 = NULL;
|
||||
comp_stat2 = NULL;
|
||||
last = NULL;
|
||||
delete [] lname;
|
||||
lname = NULL;
|
||||
length = 0;
|
||||
}
|
||||
|
||||
void CStatList::rename_list(char * new_lname) {
|
||||
if (lname) {
|
||||
delete[] lname;
|
||||
}
|
||||
lname = new char[strlen(new_lname) + 1];
|
||||
strcpy(lname, new_lname);
|
||||
};
|
||||
|
||||
void CStatList::del_node(char * path) {
|
||||
struct CStatNode * cur = stat_list, *prev = NULL;
|
||||
while (cur != NULL) {
|
||||
if (!strcmp(path, cur->stat.spath)) {
|
||||
if (prev) {
|
||||
prev->next = cur->next;
|
||||
}
|
||||
else {
|
||||
stat_list = cur->next;
|
||||
}
|
||||
cur->stat.clear();
|
||||
}
|
||||
cur = cur->next;
|
||||
prev = cur;
|
||||
}
|
||||
};
|
||||
|
||||
//void change_nparam (char * path, ???);
|
||||
|
||||
|
||||
struct CStatNode * CStatList::get_stat_node(char * path) {
|
||||
struct CStatNode * cur = stat_list;
|
||||
while (cur != NULL) {
|
||||
if (!strcmp(path, cur->stat.spath)) {
|
||||
return cur;
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
CStat * CStatList::get_stat(char * path) {
|
||||
struct CStatNode * np = get_stat_node(path);
|
||||
return &np->stat;
|
||||
};
|
||||
|
||||
void CStatList::save_list(char * path) {
|
||||
std::ofstream fout;
|
||||
fout.open(path);
|
||||
struct CStatNode * cur = stat_list;
|
||||
while (cur) {
|
||||
fout << (cur->stat.spath) << std::endl;
|
||||
cur = cur->next;
|
||||
}
|
||||
fout.close();
|
||||
};
|
||||
|
||||
|
||||
void CStatList::compare(struct CStatNode * n1, struct CStatNode * n2) {
|
||||
if (comp_stat1) {
|
||||
comp_stat1->stat.clear();
|
||||
}
|
||||
else {
|
||||
comp_stat1 = new CStatNode;
|
||||
}
|
||||
if (comp_stat2) {
|
||||
comp_stat2->stat.clear();
|
||||
}
|
||||
else {
|
||||
comp_stat2 = new CStatNode;
|
||||
}
|
||||
comp_stat2->next = NULL;
|
||||
comp_stat1->next = NULL;
|
||||
comp_stat1->param = n1->param;
|
||||
comp_stat2->param = n2->param;
|
||||
stat_intersect(n1->stat, n2->stat, comp_stat1->stat, comp_stat2->stat);
|
||||
};
|
||||
|
||||
|
||||
void CStatList::clear_stat_list(CStatNode * sl) {
|
||||
if (sl->next) {
|
||||
clear_stat_list(sl->next);
|
||||
delete sl->next;
|
||||
}
|
||||
else {
|
||||
sl->stat.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
167
dvm/tools/pppa/trunk/src/statlist.h
Normal file
167
dvm/tools/pppa/trunk/src/statlist.h
Normal file
@@ -0,0 +1,167 @@
|
||||
#include "json.hpp"
|
||||
#include <ctime>
|
||||
#define _STATFILE_
|
||||
#include "statread.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fstream>
|
||||
#include <float.h>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
#include <stdbool.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace patch
|
||||
{
|
||||
template < typename T > std::string to_string(const T& n)
|
||||
{
|
||||
std::ostringstream stm;
|
||||
stm << n;
|
||||
return stm.str();
|
||||
}
|
||||
}
|
||||
|
||||
class CStatInter {
|
||||
public:
|
||||
CStatInter( const CStatInter& si);
|
||||
CStatInter(CStatRead * stat_read, int n);
|
||||
CStatInter(json source);
|
||||
~CStatInter();
|
||||
void delete_tail();
|
||||
void clear();
|
||||
void to_string(std::string & result);
|
||||
void to_json(json & result);
|
||||
|
||||
ident id;
|
||||
//main characteristics
|
||||
double prod_cpu;
|
||||
double prod_sys;
|
||||
double prod_io;
|
||||
double prod;
|
||||
double exec_time;
|
||||
double sys_time;
|
||||
double efficiency;
|
||||
double lost_time;
|
||||
double insuf;
|
||||
double insuf_user;
|
||||
double insuf_sys;
|
||||
double comm;
|
||||
double real_comm;
|
||||
double comm_start;
|
||||
double idle;
|
||||
double load_imb;
|
||||
double synch;
|
||||
double time_var;
|
||||
double overlap;
|
||||
double thr_user_time;
|
||||
double thr_sys_time;
|
||||
double gpu_time_prod;
|
||||
double gpu_time_lost;
|
||||
unsigned long nproc;
|
||||
unsigned long threadsOfAllProcs;
|
||||
struct ColOp col_op[RED];
|
||||
OpGrp (* op_group)[StatGrpCount];
|
||||
unsigned long qproc;
|
||||
bool isjson;
|
||||
//comparative characteristics
|
||||
//struct ProcTimes comp_proc_times[3];
|
||||
//characteristics by processes
|
||||
struct ProcTimes * proc_times;
|
||||
CStatInter * next;
|
||||
};
|
||||
|
||||
struct CProcInfo {
|
||||
char * node_name;
|
||||
double test_time;
|
||||
};
|
||||
|
||||
class CStat { //копирование и присваивание запрещены
|
||||
private:
|
||||
CStat operator=(const CStat&);
|
||||
CStat( const CStat& );
|
||||
public:
|
||||
CStat();
|
||||
CStat(json source);
|
||||
void init(const char* path) ;
|
||||
void clear();
|
||||
~CStat() ;
|
||||
CStatInter * inter_tree; //"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned long nproc; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char p_heading[80];
|
||||
CProcInfo * proc_info; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>)
|
||||
CStatRead * stat;
|
||||
char * spath;
|
||||
bool iscomp;
|
||||
bool isinitialized;
|
||||
void to_string(std::string & result);
|
||||
void to_json(json &result);
|
||||
bool err;
|
||||
bool isjson;
|
||||
};
|
||||
|
||||
struct CStatParam {
|
||||
//????????????? //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
struct CStatNode { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CStat stat;
|
||||
struct CStatNode * next;
|
||||
struct CStatParam param;
|
||||
};
|
||||
|
||||
class CStatList {
|
||||
public:
|
||||
CStatList(int n, char** paths) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CStatList(char * path) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CStatList(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CStatList(const CStatList & stat_list);
|
||||
~CStatList();
|
||||
CStatList & operator= (const CStatList & stat_list);
|
||||
CStatList & operator+ (const CStatList & stat_list);
|
||||
void add_nodes(int n, char ** paths) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void clear_list() ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void rename_list(char * new_lname); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void del_node(char * path) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
struct CStatNode * get_stat_node(char * path) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
CStat * get_stat(char * path) ;
|
||||
void save_list(char * path); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
void compare(struct CStatNode * n1, struct CStatNode * n2);
|
||||
void clear_stat_list(CStatNode * sl) ;
|
||||
struct CStatNode* stat_list, **last, *comp_stat1, *comp_stat2;
|
||||
int length;
|
||||
char * lname;
|
||||
bool err;
|
||||
};
|
||||
|
||||
void inter_tree_intersect(CStatInter *i1, CStatInter *i2, CStatInter **r1, CStatInter **r2);
|
||||
void stat_intersect(const CStat &s1, const CStat &s2, CStat & r1, CStat & r2);
|
||||
CStatInter * find_inter(long expr, short nlev, CStatInter * cur);
|
||||
CStatInter * next_inter(short nlev, CStatInter * cur);
|
||||
/*
|
||||
struct CStatListNode {
|
||||
char * nname;
|
||||
CStatList sl;
|
||||
CStatListNode * next;
|
||||
};
|
||||
|
||||
CStatListNode * stat_set, **last; //stat_set - list of CStatList
|
||||
|
||||
void create_stat_list(char * name) {
|
||||
if (stat_set) {
|
||||
(*last)->next = new CStatListNode;
|
||||
last = &(*last)->next;
|
||||
(*last)->next = NULL;
|
||||
(*last)->nname = new char[strlen(name) + 1];
|
||||
strcpy((*last)->nname, name);
|
||||
}
|
||||
else {
|
||||
stat_set = new CStatListNode;
|
||||
stat_set->next = NULL;
|
||||
stat_set->nname = new char[strlen(name) + 1];
|
||||
strcpy(stat_set->nname, name);
|
||||
last = &stat_set;
|
||||
}
|
||||
}*/
|
||||
83
dvm/tools/pppa/trunk/src/statprintf.cpp
Normal file
83
dvm/tools/pppa/trunk/src/statprintf.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "statprintf.h"
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
CStatPrintf::CStatPrintf(char *name,int lstr,char *mode)
|
||||
//name -file name
|
||||
//lstr - string length for sprintf,used only for compressed file
|
||||
// mode -file mode,"wb0"- not compress out file
|
||||
{
|
||||
valid=TRUE;
|
||||
ff=NULL;
|
||||
lenstr=lstr;
|
||||
pstr=new char[lstr];
|
||||
if (pstr==NULL) throw("Out of memory\n");
|
||||
if (strcmp(mode,"wb0")!=0) {// compress file
|
||||
char *pname=new char[strlen(name)+4];
|
||||
if (pname==NULL) throw("Out of memory\n");
|
||||
strcpy(pname,name);
|
||||
strcat(pname,".gz");
|
||||
ffgz=gzopen(pname,mode);
|
||||
if (ffgz==NULL) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't open file %s\n",name);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ff=fopen(name,"w");
|
||||
if (ff==NULL) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't open file %s\n",name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
//-------------------------------------------------
|
||||
//return result of constructor execution
|
||||
BOOL CStatPrintf::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// error message
|
||||
void CStatPrintf::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
//------------------------------------------------
|
||||
// change length of string, if it > lenstr
|
||||
void CStatPrintf::ChangeLenStr(int lstr)
|
||||
{
|
||||
if (lstr<=lenstr) return;
|
||||
char * ppstr=new char[lstr];
|
||||
if (ppstr==NULL) throw("Out of memory\n");
|
||||
delete []pstr;
|
||||
pstr=ppstr;
|
||||
lenstr=lstr;
|
||||
return;
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
int CStatPrintf::StatPrintf(const char *format,...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist,format);
|
||||
if (ff==NULL) { // compress file
|
||||
int len=vsprintf(pstr,format,arglist);
|
||||
if (len<=0) return 1;
|
||||
int ans=gzwrite(ffgz,pstr,unsigned(len));
|
||||
if (ans!=len) return 1;
|
||||
} else {
|
||||
vfprintf(ff,format,arglist);
|
||||
}
|
||||
va_end(arglist);
|
||||
return 0;
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
CStatPrintf::~CStatPrintf()
|
||||
{
|
||||
if (ff==NULL) {
|
||||
delete []pstr;
|
||||
gzclose(ffgz);
|
||||
} else fclose (ff);
|
||||
return;
|
||||
}
|
||||
23
dvm/tools/pppa/trunk/src/statprintf.h
Normal file
23
dvm/tools/pppa/trunk/src/statprintf.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _STATPRINTF_H
|
||||
#define _STATPRINTF_H
|
||||
#include "bool.h"
|
||||
#include "zlib.h"
|
||||
#include "stdio.h"
|
||||
class CStatPrintf {
|
||||
public:
|
||||
CStatPrintf(char * name,int lstr,char *mode);
|
||||
~CStatPrintf();
|
||||
void ChangeLenStr(int lstr);
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
int StatPrintf(const char *format,...);
|
||||
private:
|
||||
int lll;
|
||||
char *pstr;
|
||||
int lenstr;
|
||||
FILE * ff;
|
||||
gzFile ffgz;
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
};
|
||||
#endif
|
||||
1242
dvm/tools/pppa/trunk/src/statread.cpp
Normal file
1242
dvm/tools/pppa/trunk/src/statread.cpp
Normal file
File diff suppressed because it is too large
Load Diff
194
dvm/tools/pppa/trunk/src/statread.h
Normal file
194
dvm/tools/pppa/trunk/src/statread.h
Normal file
@@ -0,0 +1,194 @@
|
||||
#if !defined( _STATREAD_H )
|
||||
#define _STATREAD_H
|
||||
#include "potensyn.h"
|
||||
#include "inter.h"
|
||||
#include "treeinter.h"
|
||||
#include "statinter.h"
|
||||
#define Fic_index 2000000000 //interval.h
|
||||
#define PREC 4
|
||||
#define DIGTIME 6+PREC
|
||||
// sizeof(nameOper[i])=DIGTIME
|
||||
#define DIGSTAT 5
|
||||
|
||||
enum typeprint {PRGEN,PRCOM,PRRCOM,PRSYN,PRVAR,PROVER,PRCALL,PRCALLS,PRLOST};
|
||||
static const char *nameGen[ITER+1]={
|
||||
"Lost time ",
|
||||
"User insufficient par. ",
|
||||
"Sys.insufficient par. ",
|
||||
"Idle time ",
|
||||
"Communication ",
|
||||
"Real synchronization ",
|
||||
"Synchronization ",
|
||||
"Variation ",
|
||||
"Overlap ",
|
||||
"Load imbalance ",
|
||||
"Execution time ",
|
||||
"User CPU time ",
|
||||
"Sys. CPU time ",
|
||||
"I/O time ",
|
||||
"Start operation ",
|
||||
"Threads user time ",
|
||||
"Threads system time ",
|
||||
"Productive time GPU ",
|
||||
"Lost time GPU ",
|
||||
"Processors "
|
||||
};
|
||||
|
||||
|
||||
static const char *nameGenMT[StatGrpCount]={
|
||||
"UserGrp ",
|
||||
"MsgPasGrp ",
|
||||
"StartRedGrp ",
|
||||
"WaitRedGrp ",
|
||||
"RedGrp ",
|
||||
"StartShdGrp ",
|
||||
"WaitShdGrp ",
|
||||
"ShdGrp ",
|
||||
"DistrGrp ",
|
||||
"ReDistrGrp ",
|
||||
"MapPLGrp ", //10
|
||||
"DoPLGrp ",
|
||||
"ProgBlockGrp ",
|
||||
"IOGrp ",
|
||||
"RemAccessGrp ",
|
||||
"UserDebGrp ",
|
||||
"StatistGrp ",
|
||||
"DvmhCpyHtoDTime", //17
|
||||
"DvmhCpyHtoDBytes",
|
||||
"DvmhCpyDtoHTime",
|
||||
"DvmhCpyDtoHBytes",
|
||||
"DvmhCpyDtoDTime",
|
||||
"DvmhCpyDtoDBytes",
|
||||
"DvmhCyclePortionTime",
|
||||
"DvmhArrayTransformTime",
|
||||
"DvmhArrayTransformBytes",
|
||||
"DvmhArrayReductionTime",
|
||||
"SystemGrp "
|
||||
};
|
||||
static const char *nameCom[RED+1]={
|
||||
"I/O ",
|
||||
"Reduction ",
|
||||
"Shadow ",
|
||||
"Remote access ",
|
||||
"Redistribution "
|
||||
};
|
||||
static const char *nameOper[SUMOVERLAP-SUMCOM+1]={
|
||||
" Communic",
|
||||
" Real_sync",
|
||||
" Synchro",
|
||||
" Variation",
|
||||
" Overlap"
|
||||
};
|
||||
enum tmps {EMP,GNS,ROU,MPI,PVM};
|
||||
struct vms_const {
|
||||
short reverse,szsh,szl,
|
||||
szv,szd;
|
||||
};
|
||||
struct vms_short {
|
||||
short rank,maxnlev,
|
||||
smallbuff,lvers;
|
||||
};
|
||||
struct vms_long{
|
||||
long proccount,mpstype,ioproc,
|
||||
qfrag,lbuf,linter,lsynchro;
|
||||
};
|
||||
struct vms_void{
|
||||
void *pbuffer;
|
||||
};
|
||||
struct vms_double{
|
||||
double proctime;
|
||||
};
|
||||
typedef struct tvms{
|
||||
vms_double d;
|
||||
vms_void v;
|
||||
vms_long l;
|
||||
vms_short sh;
|
||||
vms_const chc;
|
||||
} pvms;
|
||||
#define QV_CONST sizeof(vms_const)/SZSH
|
||||
#define QV_SHORT sizeof(vms_short)/SZSH
|
||||
#define QV_LONG sizeof(vms_long)/SZL
|
||||
#define QV_VOID sizeof(vms_void)/SZV
|
||||
#define QV_DOUBLE sizeof(vms_double)/SZD
|
||||
class CStatRead {
|
||||
public:
|
||||
CStatRead(const char * name,int i,int j,short sore);
|
||||
~CStatRead(void);
|
||||
unsigned long QProc(void);
|
||||
unsigned long BeginTreeWalk(void);
|
||||
unsigned long TreeWalk(void);
|
||||
BOOL Valid(int *warn);
|
||||
void TextErr(char *t);
|
||||
short ReadTitle(char * p);
|
||||
void ReadIdent(ident *idp);
|
||||
void ReadProcS(struct ProcTimes * pt);
|
||||
BOOL ReadProc(typeprint t,unsigned long *pnumb,int qnumb,short fmt,double sum,char *str);
|
||||
void MinMaxSum(typeprint t,double *min,unsigned long *nprocmin,
|
||||
double*max,unsigned long *nprocmax,
|
||||
double *sum);
|
||||
void GrpTimes(double *arrprod,double *arrlost,double *arrcalls,int nproc);
|
||||
|
||||
/**
|
||||
* Получить DVMH интервальную статистику по процессу
|
||||
*
|
||||
* @param nProc номер процесса
|
||||
*
|
||||
* @return интервальная DVMH статистики
|
||||
*/
|
||||
dvmh_stat_interval * getDvmhStatIntervalByProcess(unsigned long nProc);
|
||||
|
||||
|
||||
/**
|
||||
* Получить DVMH описатель GPU по процессу
|
||||
*
|
||||
* @param nProc номер процесса
|
||||
* @param nGpu номер GPU
|
||||
*
|
||||
* @return описатель GPU
|
||||
*/
|
||||
dvmh_stat_header_gpu_info * getDvmhStatGpuInfoByProcess(unsigned long nProc, int nGpu);
|
||||
|
||||
/**
|
||||
* Получить количество нитей по процессу
|
||||
*
|
||||
* @param nProc номер процесса
|
||||
*
|
||||
*/
|
||||
unsigned long getThreadsAmountByProcess(unsigned long nProc);
|
||||
/*
|
||||
*
|
||||
* Получить max min для нитей на процессоре
|
||||
* @param maxs массив максисумов
|
||||
* @param mins массив минимумов
|
||||
* @param meds массив средних
|
||||
* @param nProc номер процесса
|
||||
*/
|
||||
void getMaxsAndMins(double* maxs, double* mins, double* meds, unsigned long* n, unsigned long nProc);
|
||||
|
||||
void VMSSize(char *p);
|
||||
void WasErrAccum(char *p);
|
||||
long ReadCall(typecom t);
|
||||
char *ReadVers(void);
|
||||
char *ReadPlatform(void);
|
||||
void NameTimeProc(unsigned long n,char **name,double *time);
|
||||
|
||||
private:
|
||||
unsigned long proccount,curnproc;
|
||||
BOOL valid,valid_synchro;
|
||||
short rank;
|
||||
unsigned char *pch_vmssize,*pch_vms;
|
||||
short maxnlevel;
|
||||
char texterr[80];
|
||||
char textwarning[3][80];
|
||||
int valid_warning;
|
||||
CTreeInter **pclfrag;
|
||||
CSynchro **pclsyn;
|
||||
short smallbuff;
|
||||
CInter **pic;
|
||||
int nf,curntime;
|
||||
char *pvers;
|
||||
unsigned char *pbufcompr,*pbufuncompr;
|
||||
short gzplus; // sign of file gz/ gz+
|
||||
BOOL Synchro(void);
|
||||
};
|
||||
#endif
|
||||
178
dvm/tools/pppa/trunk/src/strall.h
Normal file
178
dvm/tools/pppa/trunk/src/strall.h
Normal file
@@ -0,0 +1,178 @@
|
||||
#if !defined( __STRALL_H )
|
||||
#define __STRALL_H
|
||||
#if defined (_STATFILE_)
|
||||
#include "sysstat.h"
|
||||
#endif
|
||||
#define SZSH sizeof(short)
|
||||
#define SZL sizeof(long)
|
||||
#define SZINT sizeof(int)
|
||||
#define SZD sizeof(double)
|
||||
#define SZV sizeof(void*)
|
||||
enum typecollect {INOUT=1,SINOUT,WINOUT,NINOUT,REDUC,SREDUC,WREDUC,NREDUC,
|
||||
SHAD,SSHAD,WSHAD,NSHAD,RACC,SRACC,WRACC,NRACC,REDISTR,SREDISTR,WREDISTR,
|
||||
NREDISTR}; /* new operation insert before REDISTR */
|
||||
#define QCOLLECT NREDISTR /* 4 type for 5 collective operation */
|
||||
|
||||
enum typefrag {PREFIX=QCOLLECT,SEQ,PAR,USER};
|
||||
#if !defined (_STATFILE_)
|
||||
struct vms_const {
|
||||
unsigned char reverse[2],szsh[2],szl[2],
|
||||
szv[2],szd[2];
|
||||
};
|
||||
struct vms_short {
|
||||
unsigned char rank[SZSH],maxnlev[SZSH],
|
||||
smallbuff[SZSH],lvers[SZSH];
|
||||
};
|
||||
struct vms_long{
|
||||
unsigned char proccount[SZL],mpstype[SZL],ioproc[SZL],
|
||||
qfrag[SZL],lbuf[SZL],linter[SZL],lsynchro[SZL];
|
||||
};
|
||||
struct vms_void{
|
||||
unsigned char pbuffer[SZV];
|
||||
};
|
||||
struct vms_double{
|
||||
unsigned char proctime[SZD];
|
||||
};
|
||||
/* if change here chahge statread.h */
|
||||
typedef struct tvms_ch {
|
||||
struct vms_const shc;
|
||||
struct vms_short sh;
|
||||
struct vms_long l;
|
||||
struct vms_void v;
|
||||
struct vms_double d;
|
||||
} *pvms_ch;
|
||||
|
||||
// -- Статистические интервалы -----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Группа характеристик описания статистического интервала
|
||||
*
|
||||
* @see pinter_ch
|
||||
*/
|
||||
struct inter_short {
|
||||
unsigned char nlev[SZSH]; /**< номер уровня вложенности */
|
||||
unsigned char type[SZSH]; /**< тип интервала */
|
||||
};
|
||||
|
||||
/**
|
||||
* Группа характеристик описания статистического интервала
|
||||
*
|
||||
* @see pinter_ch
|
||||
*/
|
||||
struct inter_long {
|
||||
unsigned char nline [SZL]; /**< начало фрагмента (номер строки пользовательской программы) */
|
||||
unsigned char nline_end [SZL]; /**< конец фрагмента (номер строки пользовательской программы) */
|
||||
unsigned char valvar [SZL]; /**< пользовательский идентификатор интервала */
|
||||
unsigned char qproc [SZL]; /**< количество процессоров, на которых выполнялся интервал */
|
||||
unsigned char ninter [SZL]; /**< порядковый номер интервала */
|
||||
unsigned char SendCallCount[SZL]; /**< */
|
||||
unsigned char RecvCallCount[SZL]; /**< */
|
||||
};
|
||||
|
||||
/**
|
||||
* Группа характеристик описания статистического интервала
|
||||
*
|
||||
* @see pinter_ch
|
||||
*/
|
||||
struct inter_void{
|
||||
unsigned char up [SZV]; /**< ссылка на родительский интервал */
|
||||
unsigned char next [SZV]; /**< ссылка на следующего соседа по уровню */
|
||||
unsigned char down [SZV]; /**< ссылка на первый дочерний интервал */
|
||||
unsigned char ptimes [SZV]; /**< ссылка на массив времен */
|
||||
};
|
||||
|
||||
/**
|
||||
* Группа характеристик описания статистического интервала
|
||||
*
|
||||
* @see pinter_ch
|
||||
*/
|
||||
struct inter_double{
|
||||
unsigned char nenter [SZD]; /**< число вхождений в интервал */
|
||||
unsigned char SendCallTime [SZD]; /**< */
|
||||
unsigned char MinSendCallTime[SZD]; /**< */
|
||||
unsigned char MaxSendCallTime[SZD]; /**< */
|
||||
unsigned char RecvCallTime [SZD]; /**< */
|
||||
unsigned char MinRecvCallTime[SZD]; /**< */
|
||||
unsigned char MaxRecvCallTime[SZD]; /**< */
|
||||
unsigned char times [STM][SZD]; /**< матрица времен */
|
||||
};
|
||||
|
||||
/**
|
||||
* Структура описывающая статистические интервалы
|
||||
*
|
||||
* Элемсенты разделены по подгруппам разделенные по типу.
|
||||
* If change here change treeinter.h
|
||||
*/
|
||||
typedef struct tinter_ch {
|
||||
struct inter_short sh; /**< группа параметров типа short */
|
||||
struct inter_long l; /**< группа параметров типа long */
|
||||
struct inter_void v; /**< группа параметров типа void* */
|
||||
struct inter_double d; /**< группа параметров типа double */
|
||||
// --
|
||||
unsigned char dvmhStat[DVMH_STAT_INTERVAL_SIZE]; /**< статистика dvmh */
|
||||
} *pinter_ch;
|
||||
|
||||
struct syn_short{
|
||||
unsigned char nitem[SZSH];
|
||||
};
|
||||
struct syn_long{
|
||||
unsigned char ninter[SZL];
|
||||
};
|
||||
struct syn_void{
|
||||
unsigned char pgrp[SZV];
|
||||
};
|
||||
struct syn_double{
|
||||
unsigned char time[SZD];
|
||||
};
|
||||
/* if change here change potensyn.h*/
|
||||
typedef struct tsyn_ch {
|
||||
struct syn_short sh;
|
||||
struct syn_long l;
|
||||
struct syn_void v;
|
||||
struct syn_double d;
|
||||
}*psyn_ch;
|
||||
#define CPYMEM(to,from)\
|
||||
memcpy(&(to),&(from),sizeof(to));
|
||||
#define CPYMEMC(to,from)\
|
||||
smfrom=0;\
|
||||
stcond = sizeof(from)>sizeof(to);\
|
||||
if (stcond && toright==1) smfrom=sizeof(from)-sizeof(to);\
|
||||
memcpy(&(to),(unsigned char *)(&(from))+smfrom,sizeof(to));
|
||||
#else
|
||||
#define min_(a,b) (((a) <(b)) ? (a):(b))
|
||||
#define MAKESHORT(p,nm,nmfirst)\
|
||||
(&(p->sh.nm)-&(p->sh.nmfirst))*szsh
|
||||
#define MAKELONG(p,nm,nmfirst,q_short)\
|
||||
q_short*szsh+(&(p->l.nm)-&(p->l.nmfirst))*szl
|
||||
#define MAKEVOID(p,nm,nmfirst,q_short,q_long)\
|
||||
q_short*szsh+q_long*szl+(&(p->v.nm)-&(p->v.nmfirst))*szv
|
||||
#define MAKEDOUBLE(p,nm,nmfirst,q_short,q_long,q_void)\
|
||||
q_short*szsh+q_long*szl+q_void*szv+(&(p->d.nm)-&(p->d.nmfirst))*szd
|
||||
#define MAKEDOUBLEA(p,nm,nmfirst,q_short,q_long,q_void,a)\
|
||||
a=q_short*szsh+q_long*szl+q_void*szv+(&(p->d.nm)-&(p->d.nmfirst))*szd;
|
||||
|
||||
#define CPYMEM(to,pfrom,sz_var)\
|
||||
{\
|
||||
int sz_to;\
|
||||
int smfrom=0,smto=0,mmin;\
|
||||
sz_to=sizeof(to);\
|
||||
mmin=min_(sz_to,sz_var);\
|
||||
if (sz_to!=sz_var) {\
|
||||
if (sz_to>sz_var) {\
|
||||
if (torightto==1) smto=sz_to-sz_var;\
|
||||
} else {\
|
||||
if (torightfrom==1) smfrom=sz_var-sz_to;\
|
||||
}\
|
||||
}\
|
||||
if (reverse!=1) {\
|
||||
memcpy((unsigned char *)(&(to))+smto,pfrom+smfrom,mmin);\
|
||||
} else {\
|
||||
int imcpy;\
|
||||
for (imcpy=mmin-1;imcpy>=0;imcpy--) {\
|
||||
*((unsigned char*)(&(to))+imcpy+smto)=\
|
||||
*(pfrom+smfrom+mmin-1-imcpy);\
|
||||
}\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
31
dvm/tools/pppa/trunk/src/sysstat.h
Normal file
31
dvm/tools/pppa/trunk/src/sysstat.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _SYSSTAT_H
|
||||
#define _SYSSTAT_H
|
||||
typedef struct {
|
||||
double CallCount;
|
||||
double ProductTime;
|
||||
double LostTime;
|
||||
}s_GRPTIMES;
|
||||
|
||||
#define StatGrpCount 28 /* number of operation groups */
|
||||
#define UserGrp 0 /* execution of user program */
|
||||
#define MsgPasGrp 1 /* operation group of message exchange */
|
||||
#define StartRedGrp 2 /* start reduction */
|
||||
#define WaitRedGrp 3 /* waiting for the end of reduction */
|
||||
#define RedGrp 4 /* other reduction operations */
|
||||
#define StartShdGrp 5 /* start edges exchange */
|
||||
#define WaitShdGrp 6 /* waiting for the end of edges exchange */
|
||||
#define ShdGrp 7 /* other operations of edges exchange */
|
||||
#define DistrGrp 8 /* data distribution */
|
||||
#define ReDistrGrp 9 /* data redistribution */
|
||||
#define MapPLGrp 10 /* parallel loop distribution operations */
|
||||
#define DoPLGrp 11 /* function dopl_ */
|
||||
#define ProgBlockGrp 12 /* program block operations */
|
||||
#define IOGrp 13 /* input/output operations */
|
||||
#define RemAccessGrp 14 /* remote access operations */
|
||||
#define UserDebGrp 15 /* dynamic control operations
|
||||
and operations for user program trace */
|
||||
#define StatistGrp 16 /* user program interval operations
|
||||
for performance analysis */
|
||||
#define SystemGrp 27 /* system work */
|
||||
|
||||
#endif
|
||||
473
dvm/tools/pppa/trunk/src/treeinter.cpp
Normal file
473
dvm/tools/pppa/trunk/src/treeinter.cpp
Normal file
@@ -0,0 +1,473 @@
|
||||
#define _STATFILE_
|
||||
#include "treeinter.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "dvmh_stat.h"
|
||||
|
||||
// @todo! ПРОВЕРИТЬ БЕЗ GZ+
|
||||
|
||||
extern short reverse,szsh,szd,szv,szl,torightto,torightfrom;
|
||||
// list of intervals for each processor
|
||||
CTreeInter::CTreeInter(gzFile stream,unsigned long lint,char *pbuff,
|
||||
unsigned int n,unsigned long qint,short maxn,
|
||||
char * ppn,double proct,
|
||||
int iIM,int jIM,short sore,
|
||||
unsigned char *pbuffer,
|
||||
dvmh_stat_header *dvmhStatHeader)
|
||||
// stream-file descriptor pointer,
|
||||
//lint- information length in bytes,
|
||||
// pbuff - beginning of the buffer at the collection stage,
|
||||
//n - processor number,
|
||||
//qint - number of intervals
|
||||
//maxn - maximal nesting level
|
||||
// ppn - processor name
|
||||
// proct - processor time
|
||||
//iIm- 0/1 sign of summing on index i
|
||||
//jIM-0/1 sign of summing on index j
|
||||
//sore - sign of summing or elements print
|
||||
//pbuffer - file gz+,data have been read
|
||||
{
|
||||
valid=TRUE;
|
||||
nproc=n;
|
||||
qinter=qint;
|
||||
maxnlev=maxn;
|
||||
curninter=1;
|
||||
pt=NULL;
|
||||
pprocname=NULL;
|
||||
sign_buffer=NULL;
|
||||
unsigned char *buffer;
|
||||
|
||||
// -- dvmh
|
||||
this->dvmhStatHeader = dvmhStatHeader;
|
||||
// --
|
||||
|
||||
if (ppn!=NULL) {// processor name
|
||||
if (dvmhDebug) { printf(" Process name: %s\n", ppn); fflush(stdout); }
|
||||
pprocname=new char[strlen(ppn)+1];
|
||||
if (pprocname==NULL) throw("Out of memory\n");
|
||||
strcpy(pprocname,ppn);
|
||||
}
|
||||
|
||||
proctime=proct;
|
||||
// dynamically allocate memory for intervals of struct tinter_ch
|
||||
if (pbuffer==NULL) { //data had not been read
|
||||
buffer=new unsigned char[lint];
|
||||
if (buffer==NULL) throw("Out of memory\n");
|
||||
sign_buffer=buffer;
|
||||
long l=gztell(stream);
|
||||
// read interval information from file
|
||||
int s=gzread(stream,buffer,lint);
|
||||
if ((unsigned long)s!=lint) {
|
||||
valid=FALSE;
|
||||
sprintf(texterr,"Can't read intervals from file, addr=%ld, length=%ld\n",
|
||||
l,lint);
|
||||
delete []sign_buffer;
|
||||
sign_buffer=NULL;
|
||||
return;
|
||||
}
|
||||
} else buffer=pbuffer;
|
||||
|
||||
unsigned char *pch=buffer;
|
||||
pinter *pi=NULL;
|
||||
|
||||
// allocate memory for intervals of struct ttree
|
||||
pt=new ptree[qinter];
|
||||
if (pt==NULL) throw("Out of memory\n");
|
||||
ident id;
|
||||
// calculate size of interval without name of DVM-programm
|
||||
|
||||
unsigned long offsetDvmhStat = QI_SHORT*szsh+QI_LONG*szl+QI_VOID*szv+QI_DOUBLE*szd; // -- dvmh
|
||||
// int lintone = QI_SHORT*szsh+QI_LONG*szl+QI_VOID*szv+QI_DOUBLE*szd + this->dvmhStatHeader->sizeIntervalConstPart; // -- dvmh
|
||||
int commonLengthForInterval=QI_SHORT*szsh+QI_LONG*szl+QI_VOID*szv+QI_DOUBLE*szd + this->dvmhStatHeader->sizeIntervalConstPart; // -- dvmh
|
||||
int extraLengthForThreads = 0;
|
||||
|
||||
s_GRPTIMES times[StatGrpCount][StatGrpCount];
|
||||
int a=MAKEDOUBLE(pi,times[0],nenter,QI_SHORT,QI_LONG,QI_VOID);
|
||||
a=MAKELONG(pi,nline,nline,QI_SHORT);
|
||||
|
||||
for (unsigned long ll=0;ll<qinter;ll++) {
|
||||
int lt=0;
|
||||
// copy time characteristics from file
|
||||
for (int i=0;i<StatGrpCount;i++) {
|
||||
for (int j=0;j<StatGrpCount;j++) {
|
||||
times[i][j].CallCount=0.0; times[i][j].ProductTime=0.0; times[i][j].LostTime=0.0;
|
||||
CPYMEM(times[i][j].CallCount,
|
||||
pch+MAKEDOUBLE(pi,times[lt],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(times[i][j].ProductTime,
|
||||
pch+MAKEDOUBLE(pi,times[lt+1],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(times[i][j].LostTime,
|
||||
pch+MAKEDOUBLE(pi,times[lt+2],nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
lt=lt+3;
|
||||
}
|
||||
}
|
||||
// add information to interval matrix
|
||||
s_SendRecvTimes addinfo;
|
||||
addinfo.SendCallTime=0.0;
|
||||
addinfo.MinSendCallTime=0.0;
|
||||
addinfo.MaxSendCallTime=0.0;
|
||||
addinfo.SendCallCount=0;
|
||||
addinfo.RecvCallTime=0.0;
|
||||
addinfo.MinRecvCallTime=0.0;
|
||||
addinfo.MaxRecvCallTime=0.0;
|
||||
addinfo.RecvCallCount=0;
|
||||
CPYMEM(addinfo.SendCallTime,pch+MAKEDOUBLE(pi,SendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MinSendCallTime,pch+MAKEDOUBLE(pi,MinSendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MaxSendCallTime,pch+MAKEDOUBLE(pi,MaxSendCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.SendCallCount,pch+MAKELONG(pi,SendCallCount,nline,QI_SHORT),szl);
|
||||
CPYMEM(addinfo.RecvCallTime,pch+MAKEDOUBLE(pi,RecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MinRecvCallTime,pch+MAKEDOUBLE(pi,MinRecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.MaxRecvCallTime,pch+MAKEDOUBLE(pi,MaxRecvCallTime,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
CPYMEM(addinfo.RecvCallCount,pch+MAKELONG(pi,RecvCallCount,nline,QI_SHORT),szl);
|
||||
|
||||
// -- dvmh
|
||||
dvmh_stat_interval *dvmhStatInterval = this->readDvmhStat(pch + offsetDvmhStat);
|
||||
extraLengthForThreads = dvmhStatHeader->threadsAmount * sizeof(dvmh_stat_interval_thread);
|
||||
// --
|
||||
int allLengthForInterval = commonLengthForInterval + extraLengthForThreads;
|
||||
|
||||
|
||||
// id.pname=(char *)(pch + lintone);
|
||||
id.pname=(char *)(pch + allLengthForInterval);
|
||||
// copy identifier information
|
||||
id.nline=0; id.nline_end=0; id.proc=0;id.nenter=0; id.expr=0;id.nlev=0;
|
||||
CPYMEM(id.nline,pch+MAKELONG(pi,nline,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nline_end,pch+MAKELONG(pi,nline_end,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.proc,pch+MAKELONG(pi,qproc,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nlev,pch+MAKESHORT(pi,nlev,nlev),szsh);
|
||||
CPYMEM(id.expr,pch+MAKELONG(pi,expr,nline,QI_SHORT),szl);
|
||||
CPYMEM(id.nenter,pch+MAKEDOUBLE(pi,nenter,nenter,QI_SHORT,QI_LONG,QI_VOID),szd);
|
||||
short sh=0;
|
||||
CPYMEM(sh,pch+MAKESHORT(pi,type,nlev),szsh);
|
||||
id.t=(typefrag)sh;
|
||||
unsigned char *pptr=NULL;
|
||||
unsigned long l0=0;
|
||||
// copy referenses on up, down and next intervals
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,up,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {
|
||||
memcpy(&pt[ll].up,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char*)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].up=0;
|
||||
CPYMEM(pt[ll].up,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
pptr=NULL;
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,down,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {memcpy(&pt[ll].down,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char*)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].down=0;
|
||||
CPYMEM(pt[ll].down,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
pptr=NULL;
|
||||
CPYMEM(pptr,pch+MAKEVOID(pi,next,up,QI_SHORT,QI_LONG),szv);
|
||||
if (pptr==NULL) {memcpy(&pt[ll].next,&l0,sizeof(l0));
|
||||
} else {
|
||||
long l=(char *)pptr-pbuff;
|
||||
pptr=buffer+l;
|
||||
pt[ll].next=0;
|
||||
CPYMEM(pt[ll].next,pptr+MAKELONG(pi,ninter,nline,QI_SHORT),szl);
|
||||
}
|
||||
// time characteristics for each interval
|
||||
pt[ll].pint=new CInter(times,addinfo,id,ll+1,iIM,jIM,sore, dvmhStatInterval);
|
||||
if (pt[ll].pint==NULL) throw("Out of memory\n");
|
||||
|
||||
// pch = pch + lintone + 1 + strlen((char*)(pch + lintone));
|
||||
pch = pch + allLengthForInterval + 1 + strlen((char*)(pch + allLengthForInterval));
|
||||
}
|
||||
if (sign_buffer!=NULL) {delete []sign_buffer; sign_buffer=NULL;}
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned long CTreeInter::memAlign(unsigned long pointer, const unsigned short align, const unsigned long size) {
|
||||
unsigned long p = pointer;
|
||||
if (align - p % align < size)
|
||||
while (p % align) p++;
|
||||
//printf(" memAlign %u -> %u (%u) rest %u\n", pointer, p, size, align - p % align);
|
||||
return p;
|
||||
}
|
||||
|
||||
dvmh_stat_interval *CTreeInter::readDvmhStat(unsigned char * const buffer) {
|
||||
dvmh_stat_interval *dvmhStatInterval;
|
||||
dvmh_stat_interval_gpu *dvmhStatGpu;
|
||||
dvmh_stat_interval_gpu_metric *dvmhStatMetric;
|
||||
|
||||
|
||||
unsigned long dvmhStatShift = 0;
|
||||
unsigned long t, t2; /*@todo del */
|
||||
int dvmh_i, dvmh_j;
|
||||
|
||||
dvmhStatInterval = new dvmh_stat_interval();
|
||||
if (!dvmhStatInterval) throw("Out of memory\n");
|
||||
|
||||
// Инициализируем аккумулируемые времена
|
||||
dvmhStatInterval->allGPUTimeProductive = 0.0f;
|
||||
dvmhStatInterval->allGPUTimeLost = 0.0f;
|
||||
dvmhStatInterval->allThreadsUserTime = 0.0f;
|
||||
dvmhStatInterval->allThreadsSystemTime = 0.0f;
|
||||
|
||||
CPYMEM(dvmhStatInterval->mask, buffer + dvmhStatShift, szl);
|
||||
if (dvmhDebug) { printf("Mask: %lu (%u)\n", dvmhStatInterval->mask, dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szl;
|
||||
|
||||
dvmhStatInterval->threads = new dvmh_stat_interval_thread[dvmhStatHeader->threadsAmount];
|
||||
if(!(dvmhStatInterval->threads)) throw ("Out of memory\n");
|
||||
|
||||
// Читаем информацию по каждому GPU
|
||||
for (dvmh_i = 0; dvmh_i < DVMH_STAT_MAX_GPU_CNT; ++dvmh_i) {
|
||||
dvmhStatGpu = & (dvmhStatInterval->gpu[dvmh_i]);
|
||||
if (dvmhDebug) { printf(" GPU: %lu (%u)\n", dvmh_i, dvmhStatShift); fflush(stdout); }
|
||||
t2 = dvmhStatShift;
|
||||
|
||||
// Инициализируем аккумулируемые времена GPU
|
||||
dvmhStatGpu->timeProductive = 0.0f;
|
||||
dvmhStatGpu->timeLost = 0.0f;
|
||||
|
||||
if (dvmhDebug) { printf(" gpuTimeProductive: %.4f\n", dvmhStatGpu->timeProductive); fflush(stdout); }
|
||||
if (dvmhDebug) { printf(" gpuTimeLost : %.4f\n", dvmhStatGpu->timeLost); fflush(stdout); }
|
||||
|
||||
// Copy metrics
|
||||
for (dvmh_j = 0; dvmh_j < DVMH_STAT_METRIC_CNT; ++dvmh_j) {
|
||||
t = dvmhStatShift;
|
||||
dvmhStatMetric = & (dvmhStatGpu->metrics[dvmh_j]);
|
||||
if (dvmhDebug) { printf(" Metric: %d (%u)\n", dvmh_j, dvmhStatShift); fflush(stdout); }
|
||||
|
||||
CPYMEM(dvmhStatMetric->isReduced, buffer+dvmhStatShift, szsh);
|
||||
if (dvmhDebug) { printf(" isReduced : %d (%u)\n", dvmhStatMetric->isReduced,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szsh;
|
||||
|
||||
CPYMEM(dvmhStatMetric->hasOwnMeasures, buffer+dvmhStatShift, szsh);
|
||||
if (dvmhDebug) { printf(" hasOwnMeasures: %d (%u)\n", dvmhStatMetric->hasOwnMeasures,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szsh;
|
||||
|
||||
CPYMEM(dvmhStatMetric->countMeasures, buffer+dvmhStatShift, szl);
|
||||
if (dvmhDebug) { printf(" countMeasures : %d (%u)\n", dvmhStatMetric->countMeasures,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szl;
|
||||
|
||||
CPYMEM(dvmhStatMetric->timeProductive, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" timeProductive: %.4f (%u)\n", dvmhStatMetric->timeProductive,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->timeLost, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" timeLost : %.4f (%u)\n", dvmhStatMetric->timeLost,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->min, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" min : %.4f (%u)\n", dvmhStatMetric->min,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->mean, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" mean : %.4f (%u)\n", dvmhStatMetric->mean,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->max, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" max : %.4f (%u)\n", dvmhStatMetric->max,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->sum, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" sum : %.4f (%u)\n", dvmhStatMetric->sum,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
#if DVMH_EXTENDED_STAT == 1
|
||||
CPYMEM(dvmhStatMetric->q1, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" q1 : %.4f (%u)\n", dvmhStatMetric->q1,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->median, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" median : %.4f (%u)\n", dvmhStatMetric->median,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
CPYMEM(dvmhStatMetric->q3, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" q3 : %.4f (%u)\n", dvmhStatMetric->q3,dvmhStatShift); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
#endif
|
||||
|
||||
if (dvmhDebug) { printf(" size : %u\n", dvmhStatShift-t); fflush(stdout); }
|
||||
|
||||
dvmhStatGpu->timeProductive += dvmhStatMetric->timeProductive > 0 ? dvmhStatMetric->timeProductive : 0.0;
|
||||
dvmhStatGpu->timeLost += dvmhStatMetric->timeLost > 0 ? dvmhStatMetric->timeLost : 0.0;
|
||||
}
|
||||
|
||||
if (dvmhDebug) { printf(" timeProductive: %.4f\n", dvmhStatGpu->timeProductive); fflush(stdout); }
|
||||
if (dvmhDebug) { printf(" timeLost : %.4f\n", dvmhStatGpu->timeLost); fflush(stdout); }
|
||||
if (dvmhDebug) { printf(" size : %d\n", dvmhStatShift-t2); fflush(stdout); }
|
||||
|
||||
dvmhStatInterval->allGPUTimeProductive += dvmhStatGpu->timeProductive > 0 ? dvmhStatGpu->timeProductive : 0.0;
|
||||
dvmhStatInterval->allGPUTimeLost += dvmhStatGpu->timeLost > 0 ? dvmhStatGpu->timeLost : 0.0;
|
||||
}
|
||||
|
||||
if (dvmhDebug) { printf("allGPUTimeProductive: %.4f\n", dvmhStatInterval->allGPUTimeProductive); fflush(stdout); }
|
||||
if (dvmhDebug) { printf("allGPUTimeLost : %.4f\n", dvmhStatInterval->allGPUTimeLost); fflush(stdout); }
|
||||
|
||||
dvmhStatInterval->threadsUsed = false;
|
||||
if (dvmhDebug) { printf("Threads:\n"); fflush(stdout); }
|
||||
for(unsigned long i = 0; i < dvmhStatHeader->threadsAmount; ++i)
|
||||
{
|
||||
dvmh_stat_interval_thread* dvmhStatThread = &(dvmhStatInterval->threads[i]);
|
||||
CPYMEM(dvmhStatThread->user_time, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" [%d] User time : %.8f\n", i, dvmhStatThread->user_time); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
CPYMEM(dvmhStatThread->system_time, buffer+dvmhStatShift, szd);
|
||||
if (dvmhDebug) { printf(" [%d] System time : %.8f\n", i, dvmhStatThread->system_time); fflush(stdout); }
|
||||
dvmhStatShift += szd;
|
||||
|
||||
dvmhStatInterval->allThreadsUserTime += dvmhStatThread->user_time > 0 ? dvmhStatThread->user_time : 0.0;
|
||||
dvmhStatInterval->allThreadsSystemTime += dvmhStatThread->system_time > 0 ? dvmhStatThread->system_time : 0.0;
|
||||
}
|
||||
if (dvmhDebug) { printf("allThreadsUserTime : %.4f\n", dvmhStatInterval->allThreadsUserTime); fflush(stdout); }
|
||||
if (dvmhDebug) { printf("allThreadsSystemTime: %.4f\n", dvmhStatInterval->allThreadsSystemTime); fflush(stdout); }
|
||||
|
||||
if(dvmhStatInterval->allThreadsUserTime > 0 || dvmhStatInterval->allThreadsSystemTime > 0)
|
||||
dvmhStatInterval->threadsUsed = true;
|
||||
|
||||
return dvmhStatInterval;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
//return result of constructor execution
|
||||
BOOL CTreeInter::Valid()
|
||||
{
|
||||
return(valid);
|
||||
}
|
||||
//-------------------------------------------
|
||||
// error message
|
||||
void CTreeInter::TextErr(char *p)
|
||||
{
|
||||
strcpy(p,texterr);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
//set current interval at the first interval
|
||||
void CTreeInter::BeginInter(void)
|
||||
{
|
||||
for (unsigned long i=0;i<qinter;i++) {
|
||||
pt[i].sign=0;
|
||||
}
|
||||
curninter=1;
|
||||
return;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//read identifier information of current interval
|
||||
void CTreeInter::NextInter(ident **id)
|
||||
{
|
||||
*id=NULL;
|
||||
for (unsigned long i=curninter;i<=qinter;i++) {
|
||||
if (pt[i-1].sign==0) {
|
||||
pt[i-1].sign=1;
|
||||
curninter=i;
|
||||
CInter *p=pt[i-1].pint;
|
||||
p->ReadIdent(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
//------------------------------------------------
|
||||
// return pointer to interval with the same identifier information
|
||||
// set current interval
|
||||
CInter *CTreeInter::FindInter(ident *id)
|
||||
//id - identifier information
|
||||
{
|
||||
unsigned long n;
|
||||
ident *idcur;
|
||||
pt[curninter-1].pint->ReadIdent(&idcur);
|
||||
if (id==idcur) return(pt[curninter-1].pint); //the same processor
|
||||
if (id->nlev==idcur->nlev) { // the same level
|
||||
n=pt[curninter-1].up;
|
||||
if (n>0) n=pt[n-1].down;
|
||||
else n=curninter;// first interval
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
// need level > current level
|
||||
n=curninter;
|
||||
if (id->nlev>idcur->nlev) {
|
||||
// find need down level
|
||||
while (id->nlev>idcur->nlev) {
|
||||
n=pt[n-1].down;
|
||||
if (n==0) return(NULL);
|
||||
pt[n-1].pint->ReadIdent(&idcur);
|
||||
}
|
||||
// find need interval on finded level
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
return(NULL);
|
||||
} else {
|
||||
// find need up level
|
||||
while (id->nlev<idcur->nlev) {
|
||||
n=pt[n-1].up;
|
||||
if (n==0) return(NULL);
|
||||
pt[n-1].pint->ReadIdent(&idcur);
|
||||
}
|
||||
unsigned long n1=n;
|
||||
n=pt[n-1].up;
|
||||
if (n>0) n=pt[n-1].down;else n=n1;
|
||||
while(n>0) {
|
||||
if (pt[n-1].sign==0 && pt[n-1].pint->CompIdent(id)==1) {
|
||||
pt[n-1].sign=1;
|
||||
curninter=n;
|
||||
return(pt[n-1].pint);
|
||||
}
|
||||
n=pt[n-1].next;
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
//--------------------------------------------------
|
||||
//sum time characteristics
|
||||
void CTreeInter::SumLevel(void)
|
||||
{
|
||||
for (short i=maxnlev;i>0;i--) {
|
||||
for (unsigned long j=0;j<qinter;j++) {
|
||||
ident *id;
|
||||
pt[j].pint->ReadIdent(&id);
|
||||
if (id->nlev==i) {
|
||||
// psum - up level
|
||||
unsigned long up=pt[j].up;
|
||||
CInter *psum=pt[up-1].pint;
|
||||
pt[j].pint->SumInter(psum);
|
||||
}
|
||||
}
|
||||
}
|
||||
pt[0].pint->SumInter(NULL);
|
||||
}
|
||||
//---------------------------------------------------
|
||||
//processor time
|
||||
void CTreeInter::ReadProcTime(double &time)
|
||||
{
|
||||
time=proctime;
|
||||
}
|
||||
//---------------------------------------------------
|
||||
//processor name
|
||||
void CTreeInter::ReadProcName(char **name)
|
||||
{
|
||||
*name=pprocname;
|
||||
}
|
||||
//--------------------------------------------------
|
||||
// deallocate memory for tree interval
|
||||
CTreeInter::~CTreeInter()
|
||||
{
|
||||
if (pprocname!=NULL) delete []pprocname;
|
||||
if (sign_buffer!=NULL) delete []sign_buffer;
|
||||
if (pt==NULL) return;
|
||||
for (unsigned long i=0;i<qinter;i++) {
|
||||
if (pt[i].pint!=NULL) pt[i].pint->~CInter();
|
||||
pt[i].pint=NULL;
|
||||
}
|
||||
delete []pt;
|
||||
}
|
||||
86
dvm/tools/pppa/trunk/src/treeinter.h
Normal file
86
dvm/tools/pppa/trunk/src/treeinter.h
Normal file
@@ -0,0 +1,86 @@
|
||||
#ifndef _TREEINTER_H
|
||||
#define _TREEINTER_H
|
||||
#include "zlib.h"
|
||||
#include "inter.h"
|
||||
#include "strall.h"
|
||||
#include "stdio.h"
|
||||
#include "bool.h"
|
||||
typedef struct ttree{
|
||||
unsigned long up,next,down;
|
||||
int sign;
|
||||
CInter *pint;
|
||||
} ptree;
|
||||
struct inter_short{
|
||||
short nlev,type;
|
||||
};
|
||||
struct inter_long{
|
||||
unsigned long nline,nline_end,expr,qproc,ninter,SendCallCount,RecvCallCount;
|
||||
};
|
||||
struct inter_void{
|
||||
void *up,*next,*down,*ptimes;
|
||||
};
|
||||
struct inter_double{
|
||||
double nenter,SendCallTime,MinSendCallTime,
|
||||
MaxSendCallTime,RecvCallTime,MinRecvCallTime,
|
||||
MaxRecvCallTime,
|
||||
times[3*StatGrpCount*StatGrpCount];
|
||||
};
|
||||
typedef struct tinter {
|
||||
inter_double d;
|
||||
inter_void v;
|
||||
inter_long l;
|
||||
inter_short sh;
|
||||
}pinter;
|
||||
#define QI_SHORT sizeof(inter_short)/SZSH
|
||||
#define QI_LONG sizeof(inter_long)/SZL
|
||||
#define QI_VOID sizeof(inter_void)/SZV
|
||||
#define QI_DOUBLE sizeof(inter_double)/SZD
|
||||
class CTreeInter {
|
||||
public:
|
||||
CTreeInter(gzFile stream,unsigned long lint,char* pbuf,unsigned int n,
|
||||
unsigned long qfrag,short maxn,char * ppn,double proct,int i,int j,short sore,unsigned char *pbuffer,
|
||||
dvmh_stat_header *dvmhStatHeader);
|
||||
~CTreeInter();
|
||||
/**
|
||||
* Прочитать DVMH статистику из буфера
|
||||
*
|
||||
* @param buffer указатель на буфер
|
||||
* @param size размер статистики в байтах
|
||||
*
|
||||
* @return заголовок DVMH статистики
|
||||
*/
|
||||
dvmh_stat_interval *readDvmhStat(unsigned char * const buffer);
|
||||
dvmh_stat_header *dvmhStatHeader;
|
||||
// --
|
||||
BOOL Valid();
|
||||
void TextErr(char *t);
|
||||
void BeginInter(void);
|
||||
void NextInter(ident **p);
|
||||
CInter *FindInter(ident *id);
|
||||
void SumLevel(void);
|
||||
void ReadProcTime(double &time);
|
||||
void ReadProcName(char **name);
|
||||
ptree (*pt);
|
||||
protected:
|
||||
unsigned int nproc;
|
||||
unsigned long qinter;
|
||||
unsigned long curninter;
|
||||
short maxnlev;
|
||||
BOOL valid;
|
||||
char texterr[80];
|
||||
char *pprocname;
|
||||
unsigned char * sign_buffer;
|
||||
double proctime;
|
||||
/**
|
||||
* Выравнивание памяти
|
||||
*
|
||||
* @param pointer указатель который необходимо выровнять
|
||||
* @param align размер выравнивания
|
||||
* @param size размер переменной которая будет размещаться по указателю
|
||||
*
|
||||
* @param выровненный указатель
|
||||
*/
|
||||
unsigned long memAlign(unsigned long pointer, const unsigned short align, const unsigned long size);
|
||||
//void CTreeInter::memAlign(unsigned long &pointer, short align);
|
||||
};
|
||||
#endif
|
||||
8
dvm/tools/pppa/trunk/src/ver.h
Normal file
8
dvm/tools/pppa/trunk/src/ver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef VER_H
|
||||
#define VER_H
|
||||
|
||||
#define VER_PPPA "2.6 (02.02.2010)"
|
||||
#define RTS_VERSION "RTS VERSION = 2871"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user