git-svn-id: svn://db.shs.com.ru/pip@4 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2015-02-28 18:35:47 +00:00
parent 8e451c891d
commit 13336674eb
154 changed files with 44021 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
add_executable(pip_system_test "main.cpp")
target_link_libraries(pip_system_test pip)
if (DEFINED LIB)
install(TARGETS pip_system_test DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif ()

209
utils/system_test/Makefile Normal file
View File

@@ -0,0 +1,209 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/andrey/linux_build/libs
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/andrey/linux_build/libs
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
/usr/bin/cmake -i .
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /home/andrey/linux_build/libs && $(CMAKE_COMMAND) -E cmake_progress_start /home/andrey/linux_build/libs/CMakeFiles /home/andrey/linux_build/libs/pip/utils/system_test/CMakeFiles/progress.marks
cd /home/andrey/linux_build/libs && $(MAKE) -f CMakeFiles/Makefile2 pip/utils/system_test/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/andrey/linux_build/libs/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /home/andrey/linux_build/libs && $(MAKE) -f CMakeFiles/Makefile2 pip/utils/system_test/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /home/andrey/linux_build/libs && $(MAKE) -f CMakeFiles/Makefile2 pip/utils/system_test/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /home/andrey/linux_build/libs && $(MAKE) -f CMakeFiles/Makefile2 pip/utils/system_test/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /home/andrey/linux_build/libs && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
pip/utils/system_test/CMakeFiles/pip_system_test.dir/rule:
cd /home/andrey/linux_build/libs && $(MAKE) -f CMakeFiles/Makefile2 pip/utils/system_test/CMakeFiles/pip_system_test.dir/rule
.PHONY : pip/utils/system_test/CMakeFiles/pip_system_test.dir/rule
# Convenience name for target.
pip_system_test: pip/utils/system_test/CMakeFiles/pip_system_test.dir/rule
.PHONY : pip_system_test
# fast build rule for target.
pip_system_test/fast:
cd /home/andrey/linux_build/libs && $(MAKE) -f pip/utils/system_test/CMakeFiles/pip_system_test.dir/build.make pip/utils/system_test/CMakeFiles/pip_system_test.dir/build
.PHONY : pip_system_test/fast
main.o: main.cpp.o
.PHONY : main.o
# target to build an object file
main.cpp.o:
cd /home/andrey/linux_build/libs && $(MAKE) -f pip/utils/system_test/CMakeFiles/pip_system_test.dir/build.make pip/utils/system_test/CMakeFiles/pip_system_test.dir/main.cpp.o
.PHONY : main.cpp.o
main.i: main.cpp.i
.PHONY : main.i
# target to preprocess a source file
main.cpp.i:
cd /home/andrey/linux_build/libs && $(MAKE) -f pip/utils/system_test/CMakeFiles/pip_system_test.dir/build.make pip/utils/system_test/CMakeFiles/pip_system_test.dir/main.cpp.i
.PHONY : main.cpp.i
main.s: main.cpp.s
.PHONY : main.s
# target to generate assembly for a file
main.cpp.s:
cd /home/andrey/linux_build/libs && $(MAKE) -f pip/utils/system_test/CMakeFiles/pip_system_test.dir/build.make pip/utils/system_test/CMakeFiles/pip_system_test.dir/main.cpp.s
.PHONY : main.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... pip_system_test"
@echo "... rebuild_cache"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /home/andrey/linux_build/libs && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

View File

@@ -0,0 +1,60 @@
# Install script for directory: /home/andrey/linux_build/libs/pip/utils/system_test
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX "/usr")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
IF(BUILD_TYPE)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "Release")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
IF(COMPONENT)
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
ELSE(COMPONENT)
SET(CMAKE_INSTALL_COMPONENT)
ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
# Install shared libraries without execute permission?
IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
SET(CMAKE_INSTALL_SO_NO_EXE "1")
ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
IF(EXISTS "$ENV{DESTDIR}/usr/bin/pip_system_test" AND
NOT IS_SYMLINK "$ENV{DESTDIR}/usr/bin/pip_system_test")
FILE(RPATH_CHECK
FILE "$ENV{DESTDIR}/usr/bin/pip_system_test"
RPATH "")
ENDIF()
list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES
"/usr/bin/pip_system_test")
IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)
message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)
IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)
message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)
FILE(INSTALL DESTINATION "/usr/bin" TYPE EXECUTABLE FILES "/home/andrey/linux_build/libs/pip/utils/system_test/pip_system_test")
IF(EXISTS "$ENV{DESTDIR}/usr/bin/pip_system_test" AND
NOT IS_SYMLINK "$ENV{DESTDIR}/usr/bin/pip_system_test")
FILE(RPATH_REMOVE
FILE "$ENV{DESTDIR}/usr/bin/pip_system_test")
IF(CMAKE_INSTALL_DO_STRIP)
EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/usr/bin/pip_system_test")
ENDIF(CMAKE_INSTALL_DO_STRIP)
ENDIF()
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")

106
utils/system_test/main.cpp Executable file
View File

@@ -0,0 +1,106 @@
/*
PIP - Platform Independent Primitives
System tests program
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pip.h"
#include "pisystemtests.h"
int main(int argc, char * argv[]) {
#ifdef WINDOWS
cout << "This program is useless for Windows" << endl;
return 0;
#else
if (getuid() != 0) {
cout << "You should run this program as root!" << endl;
return 0;
}
PIConfig conf(
#ifndef WINDOWS
"/etc/pip.conf"
#else
"pip.conf"
#endif
);
PITimeMeasurer timer, tm;
timespec ts;
long stc = 0;
double st;
llong sts = 0;
clock_getres(CLOCK_REALTIME, &ts);
stc = long(ts.tv_sec) * 1000000000l + long(ts.tv_nsec);
conf.setValue("time_resolution_ns", stc);
cout << "Timer resolution is " << stc << " ns" << endl;
cout << "\"PITimer.elapsed_*\" test ... " << flush;
stc = 0;
ts.tv_sec = 0;
ts.tv_nsec = 1000;
PIVector<double> times;
times.resize(8192);
tm.reset();
PISystemTests::time_elapsed_ns = 0;
while (tm.elapsed_s() < 3.) {
for (int i = 0; i < times.size_s(); ++i) {
timer.reset();
times[i] = timer.elapsed_m();
times[i] = timer.elapsed_s();
times[i] = timer.elapsed_u();
}
st = 0;
for (int i = 0; i < times.size_s(); ++i)
st += times[i];
//cout << times[0] << endl;
//cout << st / times.size_s() / 3. * 1000. << endl;
sts += piRoundd(st / times.size_s() / 3. * 1000.);
//cout << sts << endl;
stc++;
}
sts /= stc;
conf.setValue("time_elapsed_ns", long(sts));
cout << "ok, cost " << sts << " ns, average in " << stc << " series (" << (stc * 3 * times.size_s()) << " executes)" << endl;
cout << "\"usleep\" offset test ... " << flush;
PISystemTests::time_elapsed_ns = sts;
tm.reset();
stc = 0;
sts = 0;
times.resize(128);
while (tm.elapsed_s() < 3.) {
for (int i = 0; i < times.size_s(); ++i) {
timer.reset();
usleep(1000);
times[i] = timer.elapsed_u();
}
st = 0;
for (int i = 0; i < times.size_s(); ++i)
st += times[i] - 1000;
//cout << times[0] << endl;
//cout << st / times.size_s() / 3. * 1000. << endl;
sts += piRoundd(st / times.size_s());
//cout << sts << endl;
stc++;
}
sts /= stc;
conf.setValue("usleep_offset_us", long(sts));
cout << "ok, " << sts << " us, average in " << stc << " series (" << (stc * times.size_s()) << " executes)" << endl;
//WAIT_FOR_EXIT
return 0;
#endif
};

BIN
utils/system_test/pip_system_test Executable file

Binary file not shown.

Binary file not shown.