Enable -fno-strict-overflow flag only for GCC versions 4.2 and greater.

The -fstrict-overflow flag was introduced in GCC version 4.2.
It is on by default when optimizations (-O2) are enabled.
It allows the compiler to assume that integer sums will not overflow.
We use -fno-strict-overflow currently, because the index and endpoint
calculations in range traversal (rangeBase.these) is expected to overflow when
traversing a maximal range.  See r22290.

[tested with hello.chpl on darwin and linux64]

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@22293 3a8e244f-b0f2-452b-bcba-4c88e055c3ca

#
# settings for gnu-compatible platforms
#

#
# Tools
#
CXX = g++
CC = gcc

RANLIB = ranlib

#
# General Flags
#

DEBUG_CFLAGS = -g
DEPEND_CFLAGS = -MMD -MP
OPT_CFLAGS = -O3
PROFILE_CFLAGS = -pg
PROFILE_LFLAGS = -pg

ifdef CHPL_GCOV
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs
endif

#
# Flags for compiler, runtime, and generated code
#
COMP_CFLAGS = $(CFLAGS)
COMP_CFLAGS_NONCHPL = -Wno-error
RUNTIME_CFLAGS = -std=c99 $(CFLAGS)
RUNTIME_GEN_CFLAGS = $(RUNTIME_CFLAGS)
RUNTIME_CXXFLAGS = $(CFLAGS)
RUNTIME_GEN_CXXFLAGS = $(RUNTIME_CXXFLAGS)
GEN_CFLAGS = -std=c99
GEN_STATIC_FLAG = -static
GEN_DYNAMIC_FLAG =
LIB_STATIC_FLAG =
LIB_DYNAMIC_FLAG = -shared
SHARED_LIB_CFLAGS = -fPIC

ifeq ($(CHPL_MAKE_PLATFORM), darwin)
# build 64-bit binaries when on a 64-bit capable PowerPC
ARCH := $(shell test -x /usr/bin/machine -a `/usr/bin/machine` = ppc970 && echo -arch ppc64)
RUNTIME_CFLAGS += $(ARCH)
RUNTIME_CXXFLAGS += $(ARCH)
# the -D_POSIX_C_SOURCE flag prevents nonstandard functions from polluting the global name space
GEN_CFLAGS += -D_POSIX_C_SOURCE $(ARCH)
GEN_LFLAGS += $(ARCH)
endif

#ensure that 64 bit binaries are made on AIX
ifeq ($(CHPL_MAKE_PLATFORM), aix)
GEN_CFLAGS += -maix64
RUNTIME_CFLAGS += -maix64
RUNTIME_GEN_CFLAGS += -maix64
GEN_CFLAGS += -maix64
COMP_GEN_LFLAGS += -maix64
endif

#
# a hacky flag necessary currently due to our use of setenv in the runtime code
#
SUPPORT_SETENV_CFLAGS = -std=gnu89

#
# query gcc version
#
ifndef GNU_GPP_MAJOR_VERSION
export GNU_GPP_MAJOR_VERSION = $(shell $(CXX) -dumpversion | awk '{split($$1,a,"."); printf("%s", a[1]);}')
endif
ifndef GNU_GPP_MINOR_VERSION
export GNU_GPP_MINOR_VERSION = $(shell $(CXX) -dumpversion | awk '{split($$1,a,"."); printf("%s", a[2]);}')
endif
ifndef GNU_GPP_SUPPORTS_MISSING_DECLS
export GNU_GPP_SUPPORTS_MISSING_DECLS = $(shell test $(GNU_GPP_MAJOR_VERSION) -lt 4 || (test $(GNU_GPP_MAJOR_VERSION) -eq 4 && test $(GNU_GPP_MINOR_VERSION) -le 2); echo "$$?")
endif
ifndef GNU_GPP_SUPPORTS_STRICT_OVERFLOW
export GNU_GPP_SUPPORTS_STRICT_OVERFLOW = $(shell test $(GNU_GPP_MAJOR_VERSION) -lt 4 || (test $(GNU_GPP_MAJOR_VERSION) -eq 4 && test $(GNU_GPP_MINOR_VERSION) -le 2); echo "$$?")
endif

#
# Flags for turning on warnings for C++/C code
#
WARN_CXXFLAGS = -Wall -Werror -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing
# decl-after-stmt for non c99 compilers. See commit message 21665
WARN_CFLAGS = $(WARN_CXXFLAGS) -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wdeclaration-after-statement -Wmissing-format-attribute
WARN_GEN_CFLAGS = $(WARN_CFLAGS) -Wno-unused -Wno-uninitialized

ifeq ($(GNU_GPP_SUPPORTS_MISSING_DECLS),1)
WARN_CXXFLAGS += -Wmissing-declarations
else
WARN_CFLAGS += -Wmissing-declarations
endif

ifeq ($(GNU_GPP_SUPPORTS_STRICT_OVERFLOW),1)
# -fno-strict-overflow is needed only because the way we code range iteration
# (ChapelRangeBase.chpl:793) generates code which can overflow.
GEN_CFLAGS += -fno-strict-overflow
# -fstrict-overflow was introduced in GCC 4.2 and is on by default.  When on,
# it allows the compiler to assume that integer sums will not overflow.
endif

#
# developer settings
#
ifdef CHPL_DEVELOPER
COMP_CFLAGS += $(WARN_CXXFLAGS)
RUNTIME_CFLAGS += $(WARN_CFLAGS) -Wno-char-subscripts
RUNTIME_CXXFLAGS += $(WARN_CXXFLAGS)
RUNTIME_CXXFLAGS += $(WARN_CXXFLAGS)
RUNTIME_GEN_CFLAGS += -Wno-unused
RUNTIME_GEN_CXXFLAGS += -Wno-unused
#WARN_GEN_CFLAGS += -Wunreachable-code
# GEN_CFLAGS gets warnings added via WARN_GEN_CFLAGS in comp-generated Makefile

#
# When compiling GASNet...
#
# -Wno-missing-prototypes must be used because
# gasneti_linkconfig_idiotcheck isn't prototyped before it's used (boo)
# and is static, so we can't prototype it for them (awwww).
#
# -Wno-strict-prototypes has to be used because most GASNet prototypes
# aren't strict.
#
# -Wno-unused has to be used due to _dummy_checkalign variables in
# -gasnet_atomicops.h
#
CHPL_GASNET_MORE_CFLAGS = -Wno-strict-prototypes -Wno-missing-prototypes
ifndef CHPL_COMM_DEBUG
CHPL_GASNET_MORE_CFLAGS += -Wno-unused
endif
endif
ifdef CHPL_COMM_DEBUG
CHPL_GASNET_MORE_CFLAGS += -O0
CHPL_GASNET_MORE_GEN_CFLAGS += -Wno-uninitialized
endif

#
# settings for gnu-compatible platforms
#

#
# Tools
#
CXX = g++
CC = gcc

RANLIB = ranlib

#
# General Flags
#

DEBUG_CFLAGS = -g
DEPEND_CFLAGS = -MMD -MP
OPT_CFLAGS = -O3
PROFILE_CFLAGS = -pg
PROFILE_LFLAGS = -pg

ifdef CHPL_GCOV
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs
endif

#
# Flags for compiler, runtime, and generated code
#
COMP_CFLAGS = $(CFLAGS)
COMP_CFLAGS_NONCHPL = -Wno-error
RUNTIME_CFLAGS = -std=c99 $(CFLAGS)
RUNTIME_GEN_CFLAGS = $(RUNTIME_CFLAGS)
RUNTIME_CXXFLAGS = $(CFLAGS)
RUNTIME_GEN_CXXFLAGS = $(RUNTIME_CXXFLAGS)
GEN_CFLAGS = -std=c99

# -fno-strict-overflow is needed only because the way we code range iteration
# (ChapelRangeBase.chpl:793) generates code which can overflow.
GEN_CFLAGS += -fno-strict-overflow

GEN_STATIC_FLAG = -static
GEN_DYNAMIC_FLAG =
LIB_STATIC_FLAG =
LIB_DYNAMIC_FLAG = -shared
SHARED_LIB_CFLAGS = -fPIC

ifeq ($(CHPL_MAKE_PLATFORM), darwin)
# build 64-bit binaries when on a 64-bit capable PowerPC
ARCH := $(shell test -x /usr/bin/machine -a `/usr/bin/machine` = ppc970 && echo -arch ppc64)
RUNTIME_CFLAGS += $(ARCH)
RUNTIME_CXXFLAGS += $(ARCH)
# the -D_POSIX_C_SOURCE flag prevents nonstandard functions from polluting the global name space
GEN_CFLAGS += -D_POSIX_C_SOURCE $(ARCH)
GEN_LFLAGS += $(ARCH)
endif

#ensure that 64 bit binaries are made on AIX
ifeq ($(CHPL_MAKE_PLATFORM), aix)
GEN_CFLAGS += -maix64
RUNTIME_CFLAGS += -maix64
RUNTIME_GEN_CFLAGS += -maix64
GEN_CFLAGS += -maix64
COMP_GEN_LFLAGS += -maix64
endif

#
# a hacky flag necessary currently due to our use of setenv in the runtime code
#
SUPPORT_SETENV_CFLAGS = -std=gnu89

#
# query gcc version
#
ifndef GNU_GPP_MAJOR_VERSION
export GNU_GPP_MAJOR_VERSION = $(shell $(CXX) -dumpversion | awk '{split($$1,a,"."); printf("%s", a[1]);}')
endif
ifndef GNU_GPP_MINOR_VERSION
export GNU_GPP_MINOR_VERSION = $(shell $(CXX) -dumpversion | awk '{split($$1,a,"."); printf("%s", a[2]);}')
endif
ifndef GNU_GPP_SUPPORTS_MISSING_DECLS
export GNU_GPP_SUPPORTS_MISSING_DECLS = $(shell test $(GNU_GPP_MAJOR_VERSION) -lt 4 || (test $(GNU_GPP_MAJOR_VERSION) -eq 4 && test $(GNU_GPP_MINOR_VERSION) -le 2); echo "$$?")
endif

#
# Flags for turning on warnings for C++/C code
#
WARN_CXXFLAGS = -Wall -Werror -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing
# decl-after-stmt for non c99 compilers. See commit message 21665
WARN_CFLAGS = $(WARN_CXXFLAGS) -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wdeclaration-after-statement -Wmissing-format-attribute
WARN_GEN_CFLAGS = $(WARN_CFLAGS) -Wno-unused -Wno-uninitialized

ifeq ($(GNU_GPP_SUPPORTS_MISSING_DECLS),1)
WARN_CXXFLAGS += -Wmissing-declarations
else
WARN_CFLAGS += -Wmissing-declarations
endif

#
# developer settings
#
ifdef CHPL_DEVELOPER
COMP_CFLAGS += $(WARN_CXXFLAGS)
RUNTIME_CFLAGS += $(WARN_CFLAGS) -Wno-char-subscripts
RUNTIME_CXXFLAGS += $(WARN_CXXFLAGS)
RUNTIME_CXXFLAGS += $(WARN_CXXFLAGS)
RUNTIME_GEN_CFLAGS += -Wno-unused
RUNTIME_GEN_CXXFLAGS += -Wno-unused
#WARN_GEN_CFLAGS += -Wunreachable-code
# GEN_CFLAGS gets warnings added via WARN_GEN_CFLAGS in comp-generated Makefile

#
# When compiling GASNet...
#
# -Wno-missing-prototypes must be used because
# gasneti_linkconfig_idiotcheck isn't prototyped before it's used (boo)
# and is static, so we can't prototype it for them (awwww).
#
# -Wno-strict-prototypes has to be used because most GASNet prototypes
# aren't strict.
#
# -Wno-unused has to be used due to _dummy_checkalign variables in
# -gasnet_atomicops.h
#
CHPL_GASNET_MORE_CFLAGS = -Wno-strict-prototypes -Wno-missing-prototypes
ifndef CHPL_COMM_DEBUG
CHPL_GASNET_MORE_CFLAGS += -Wno-unused
endif
endif
ifdef CHPL_COMM_DEBUG
CHPL_GASNET_MORE_CFLAGS += -O0
CHPL_GASNET_MORE_GEN_CFLAGS += -Wno-uninitialized
endif


add support for mcstl from libstdc++ branch

git-svn-id: 69a08f0be502e23ba71eb4e212ee2948ff83149c@355 4e380d45-d1fd-0310-85a7-d18ec86df0ad

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

BOOST_INCLUDE	?= /usr/include/boost-1_33

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

STXXL_SPECIFIC	+= \
	-DSORT_OPT_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT)) \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME) -lpthread

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -D__MCSTL__ -I$(MCSTL_ROOT)/c++
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/bits/stl_algo.h)))
# not from libstdc++ branch, need to find the correct original symlink

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))

ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= -I$(MCSTL_ORIGINALS)

endif # not from libstdc++ branch

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	-I$(strip $(BOOST_INCLUDE)) \
	-pthread

BOOST_LINKER_OPTIONS	 = \
	-lboost_thread-gcc-mt \
	-lboost_date_time-gcc-mt \
	-lboost_iostreams-gcc-mt \
	-lboost_filesystem-gcc-mt

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

%.$o: %.cpp ../make.settings
	@$(RM) $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

BOOST_INCLUDE	?= /usr/include/boost-1_33

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

STXXL_SPECIFIC	+= \
	-DSORT_OPT_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT)) \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME) -lpthread

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))
MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -I$(MCSTL_ROOT)/c++ -I$(MCSTL_ORIGINALS) -D__MCSTL__
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	-I$(strip $(BOOST_INCLUDE)) \
	-pthread

BOOST_LINKER_OPTIONS	 = \
	-lboost_thread-gcc-mt \
	-lboost_date_time-gcc-mt \
	-lboost_iostreams-gcc-mt \
	-lboost_filesystem-gcc-mt

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

%.$o: %.cpp ../make.settings
	@$(RM) $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make


Added curve to timings plot.

Added curve to timings plot.

#!/usr/bin/gnuplot

set terminal postscript color
set output 'timing.ps'

set title 'Futures based multiply'

set logscale xy

set xlabel '# cores'
set ylabel 'walltime [s]'

full_2048_128_t1  = 40.368775
full_1024_64_t1   = 22.848918
full_1024_64_t2   = 3.197707
charm_1024_64_t1  = 0.371398
charm_2048_128_t1 = 1.320883

set datafile missing '-'

set xrange [1:48]
set xtics ( "1" 1, "2" 2, "4" 4, "8" 8, "16" 16, "32" 32, "48" 48 )

plot for [COL=2:3] 'timing.dat' using 1:COL with linespoints title columnheader, \
  '' using 1:($2-$3) with linespoints title 'work', \
  '' using 1:(full_2048_128_t1/$1) with lines linecolor 0 notitle, \
  '' using 1:(charm_2048_128_t1/$1) with lines linecolor 0 notitle

  #'' using 1:(full_1024_64_t1/$1) with lines title 'ideal - 1024x64', \
  #'' using 1:(full_1024_64_t2/$1) with lines title 'ideal cpuaffinity - 1024x64'
  #'' using 1:(charm_1024_64_t1/$1) with lines title 'charm - 1024x64'

#!/usr/bin/gnuplot

set terminal postscript color
set output 'timing.ps'

set title 'Futures based multiply'

set logscale xy

set xlabel '# cores'
set ylabel 'walltime [s]'

full_2048_128_t1  = 40.368775
full_1024_64_t1   = 22.848918
full_1024_64_t2   = 3.197707
charm_1024_64_t1  = 0.371398
charm_2048_128_t1 = 1.320883

set datafile missing '-'

set xrange [1:48]
set xtics ( "1" 1, "2" 2, "4" 4, "8" 8, "16" 16, "32" 32, "48" 48 )

plot for [COL=2:3] 'timing.dat' using 1:COL with linespoints title columnheader, \
  '' using 1:(full_2048_128_t1/$1) with lines linecolor 0 notitle, \
  '' using 1:(charm_2048_128_t1/$1) with lines linecolor 0 notitle

  #'' using 1:(full_1024_64_t1/$1) with lines title 'ideal - 1024x64', \
  #'' using 1:(full_1024_64_t2/$1) with lines title 'ideal cpuaffinity - 1024x64'
  #'' using 1:(charm_1024_64_t1/$1) with lines title 'charm - 1024x64'


Tidied up the chart style to make it easier to read.

#Expects data to be in data.csv
# Unfortunately, we can't read from the pipe becuase we need to read from the file twice :-(
set datafile separator ","

set logscale y

#0 is a special column that starts from 0 and increments by 1 for each row.
plot 'data.csv' using 0:3title "Markov Difficulties" with lines, \
'data.csv' using 0:2 title "Official Difficulties" axes x1y2 with lines

#Expects data to be in data.csv
# Unfortunately, we can't read from the pipe becuase we need to read from the file twice :-(
set datafile separator ","

set logscale y

#0 is a special column that starts from 0 and increments by 1 for each row.
plot 'data.csv' using 0:3title "Markov Difficulties" with boxes, \
'data.csv' using 0:2 title "QQWing Difficulties" axes x1y2 with lines


reduce yrange maximum from 1600

reduce yrange maximum from 1600


minor update

minor update

# Tested with gnuplot 4.6 patchlevel 6

# Tablet created/deleted events
FN_IN_CD = system("echo $FN_IN_CD")
# Tablet access counts
FN_IN_AC = system("echo $FN_IN_AC")
FN_OUT = system("echo $FN_OUT")
DESC = system("echo $DESC")

load "../conf/colorscheme.gnuplot"

# Get the plot range
set terminal unknown
set xdata time
set timefmt "%y%m%d-%H%M%S"
plot \
FN_IN_CD u 2:7:2:5:7:($7+$6) w boxxyerrorbars
X_MIN=GPVAL_DATA_X_MIN
X_MAX=GPVAL_DATA_X_MAX
Y_MIN=GPVAL_DATA_Y_MIN
Y_MAX=GPVAL_DATA_Y_MAX

# Get AC_MAX, access count max
set terminal unknown
plot \
FN_IN_AC u 3:6 w points
AC_MAX=GPVAL_DATA_Y_MAX
set print "-"
print sprintf("Max access count of all tablets: %d", AC_MAX)

set terminal pdfcairo enhanced rounded size 6, 3in
set output FN_OUT

set border (1) front lc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,(365.25*24*3600)
unset ytics

set format x "'%y"

# Give some margin on the left and at the bottom
x0=X_MIN-(365.25/12*1.3*24*3600)
x1=X_MAX+(365.25/12*0.5*24*3600)
y0=Y_MIN-(5*1024*1024)
y1=Y_MAX

set xrange [x0:x1]
set yrange [y0:y1]

set key top left

x1p = (X_MAX - X_MIN) / 100
y1p = (Y_MAX - Y_MIN) / 100

# Desc
x0 = X_MIN
y0 = Y_MAX - 3*y1p
set label DESC at x0, y0 left tc rgb "black" font ",7"

TRANSP0=0.06

# Legend
x1 = X_MIN + 11.5*x1p
x2 = x1 + 7*x1p
y2 = y0 - 15*y1p
y1 = y2 - 10*y1p
set object rect from x1, y1 to x2, y2 fc rgb "black" fs transparent solid TRANSP0 noborder
set arrow from x1, y1 to x1, y2 lc rgb "black" nohead

y3 = (y2 + y1) / 2
y4 = y3 + 1.5*y1p
set label "sst\ngen" at x1, y4 right offset -0.5, 0 tc rgb "black" font ",8"

x3 = x1 - 5*x1p
set arrow from x3, y1 to x3, y2 lc rgb "black" nohead

set arrow from x3 - 0.2*x1p, y2 to x3 + 0.2*x1p, y2 lc rgb "black" nohead
set arrow from x3 - 0.2*x1p, y1 to x3 + 0.2*x1p, y1 lc rgb "black" nohead

set label (sprintf("%.1f MB", (y2 - y1)/1024/1024)) at x3, y2 right offset -0.5, 0 tc rgb "black" font ",8"
set label "0"                                     at x3, y1 right offset -0.5, 0 tc rgb "black" font ",8"

x4 = x3 - 7*x1p
set label "Tablet size" at x4, y3 center rotate by 90 tc rgb "black" font ",8"

y4 = y1 - 4*y1p
set arrow from x1, y1 to x1, y4 lt 0 lc rgb "black" nohead
set arrow from x2, y1 to x2, y4 lt 0 lc rgb "black" nohead

y5 = y4 - 2*y1p
set label "created" at x1, y5 center tc rgb "black" font ",8"
set label "deleted" at x2, y5 center tc rgb "black" font ",8"

legendAccesses(x) = (x1 < x) && (x < x2) && (sin(x / (x2 - x1) * pi * 150) > 0) ? \
										y1 + (y2 - y1) * cos((x - x1) / (x2 - x1) * pi / 2) + sin(x / (x2 - x1) * pi * 20) * 0.5*y1p \
										: 1 / 0

x5 = x1 + 5.5*x1p
x6 = x2 + 2*x1p
set arrow from x5, y3 to x6, y3 lt 0 lc rgb "black" nohead

x7 = x6 + x1p
y6 = y3 + 2*y1p
set label "# of accesses\nper day" at x7, y6 left tc rgb "black" font ",8"

# Log scale
#   value range
#     x              : [0, AC_MAX]
#     +1             : [1, AC_MAX+1]
#     log(above)     : [0(=log(1)), log(AC_MAX+1)]
#     / log(AC_MAX+1) : [0, 1]
AccessCountHeight(x) = x == 0 ? \
											 1/0 \
											 : (log(x+1)/log(AC_MAX+1))*10000000

x8 = x7 + 11*x1p
y7 = y3 - AccessCountHeight(AC_MAX) / 2.0
y8 = y3 + AccessCountHeight(AC_MAX) / 2.0
set arrow from x8, y7 to x8, y8 lc rgb "black" nohead
set arrow from x8 - 0.2*x1p, y7 to x8 + 0.2*x1p, y7 lc rgb "black" nohead
set arrow from x8 - 0.2*x1p, y8 to x8 + 0.2*x1p, y8 lc rgb "black" nohead
set label (sprintf("%d", AC_MAX)) at x8, y8 left offset 0.4, 0.1 tc rgb "black" font ",7"
set label "0"                     at x8, y7 left offset 0.4,-0.1 tc rgb "black" font ",7"

set samples 5000

# gnuplot doesn't have a mod function
#   http://www.macs.hw.ac.uk/~ml355/lore/gnuplot.htm
mod(a, b) = a - floor(a/b) * b

color(a) = mod(a, 6)

set style fill solid TRANSP0 noborder

# x  y  xlow  xhigh  ylow  yhigh
plot \
FN_IN_CD u 2:7:2:5:7:($7+$6):(color($1)) w boxxyerrorbars lc variable not, \
FN_IN_AC u 3:($2 + AccessCountHeight($6)):(color($1)) w points pointsize 0.01 lc variable not, \
FN_IN_CD u 2:7:(0):6:(color($1)) w vectors nohead      lt 1 lc variable not, \
FN_IN_CD u 2:($7+$6/2.0):1:(color($1)) w labels right offset -0.5,0 font ",8" tc variable not, \
legendAccesses(x) w lines lc rgb "black" not

# dotted line doesn't work with lc variable
#FN_IN_CD u 4:7:(0):6:(color($1)) w vectors nohead lw 2 lt 0 lc variable not, \

# steps doesn't work with lc variable
#FN_IN_AC u 3:($2 + AccessCountHeight($6)):(color($1)) w steps lc variable not, \
#FN_IN_AC u 3:2:($2 + AccessCountHeight($6)):(color($1)) w filledcurves lc variable not, \

# This doesn't fill the exact same area as the steps, but was the closest thing
# that I can find.
#FN_IN_AC u 3:2:($2 + AccessCountHeight($6)) w filledcurves lc rgb "red" not, \

#FN_IN_AC u 3:($2 + AccessCountHeight($6)) w linespoints pt 7 pointsize 0.1 lc rgb "black" not, \

# no base y option, like y0
#FN_IN_AC u 3:($2 + AccessCountHeight($6)) w fillsteps lc rgb "red" not, \

# Tested with gnuplot 4.6 patchlevel 6

# Tablet created/deleted events
FN_IN_CD = system("echo $FN_IN_CD")
# Tablet access counts
FN_IN_AC = system("echo $FN_IN_AC")
FN_OUT = system("echo $FN_OUT")
DESC = system("echo $DESC")

load "../conf/colorscheme.gnuplot"

# Get the plot range
set terminal unknown
set xdata time
set timefmt "%y%m%d-%H%M%S"
plot \
FN_IN_CD u 2:7:2:5:7:($7+$6) w boxxyerrorbars
X_MIN=GPVAL_DATA_X_MIN
X_MAX=GPVAL_DATA_X_MAX
Y_MIN=GPVAL_DATA_Y_MIN
Y_MAX=GPVAL_DATA_Y_MAX

# Get AC_MAX, access count max
set terminal unknown
plot \
FN_IN_AC u 3:6 w points
AC_MAX=GPVAL_DATA_Y_MAX
set print "-"
print sprintf("Max access count of all tablets: %d", AC_MAX)

set terminal pdfcairo enhanced rounded size 6, 3in
set output FN_OUT

set border (1) front lc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,(365.25*24*3600)
unset ytics

set format x "'%y"

# Give some margin on the left and at the bottom
x0=X_MIN-(365.25/12*1.3*24*3600)
x1=X_MAX+(365.25/12*0.5*24*3600)
y0=Y_MIN-(5*1024*1024)
y1=Y_MAX

set xrange [x0:x1]
set yrange [y0:y1]

set key top left

x1p = (X_MAX - X_MIN) / 100
y1p = (Y_MAX - Y_MIN) / 100

# Desc
x0 = X_MIN
y0 = Y_MAX - 3*y1p
set label DESC at x0, y0 left tc rgb "black" font ",7"

TRANSP0=0.06

# Legend
x1 = X_MIN + 11.5*x1p
x2 = x1 + 7*x1p
y2 = y0 - 15*y1p
y1 = y2 - 10*y1p
set object rect from x1, y1 to x2, y2 fc rgb "black" fs transparent solid TRANSP0 noborder
set arrow from x1, y1 to x1, y2 lc rgb "black" nohead

y3 = (y2 + y1) / 2
y4 = y3 + 1.5*y1p
set label "sst\ngen" at x1, y4 right offset -0.5, 0 tc rgb "black" font ",8"

x3 = x1 - 5*x1p
set arrow from x3, y1 to x3, y2 lc rgb "black" nohead

set arrow from x3 - 0.2*x1p, y2 to x3 + 0.2*x1p, y2 lc rgb "black" nohead
set arrow from x3 - 0.2*x1p, y1 to x3 + 0.2*x1p, y1 lc rgb "black" nohead

set label (sprintf("%d MB", (y2 - y1)/1024/1024)) at x3, y2 right offset -0.5, 0 tc rgb "black" font ",8"
set label "0"                                     at x3, y1 right offset -0.5, 0 tc rgb "black" font ",8"

x4 = x3 - 6.5*x1p
set label "Tablet size" at x4, y3 center rotate by 90 tc rgb "black" font ",8"

y4 = y1 - 4*y1p
set arrow from x1, y1 to x1, y4 lt 0 lc rgb "black" nohead
set arrow from x2, y1 to x2, y4 lt 0 lc rgb "black" nohead

y5 = y4 - 2*y1p
set label "created" at x1, y5 center tc rgb "black" font ",8"
set label "deleted" at x2, y5 center tc rgb "black" font ",8"

legendAccesses(x) = (x1 < x) && (x < x2) && (sin(x / (x2 - x1) * pi * 150) > 0) ? \
										y1 + (y2 - y1) * cos((x - x1) / (x2 - x1) * pi / 2) + sin(x / (x2 - x1) * pi * 20) * 0.5*y1p \
										: 1 / 0

x5 = x1 + 5.5*x1p
x6 = x2 + 2*x1p
set arrow from x5, y3 to x6, y3 lt 0 lc rgb "black" nohead

x7 = x6 + x1p
y6 = y3 + 2*y1p
set label "# of accesses\nper day" at x7, y6 left tc rgb "black" font ",8"

# Log scale
#   value range
#     x              : [0, AC_MAX]
#     +1             : [1, AC_MAX+1]
#     log(above)     : [0(=log(1)), log(AC_MAX+1)]
#     / log(AC_MAX+1) : [0, 1]
AccessCountHeight(x) = x == 0 ? \
											 1/0 \
											 : (log(x+1)/log(AC_MAX+1))*10000000

x8 = x7 + 11*x1p
y7 = y3 - AccessCountHeight(AC_MAX) / 2.0
y8 = y3 + AccessCountHeight(AC_MAX) / 2.0
set arrow from x8, y7 to x8, y8 lc rgb "black" nohead
set arrow from x8 - 0.2*x1p, y7 to x8 + 0.2*x1p, y7 lc rgb "black" nohead
set arrow from x8 - 0.2*x1p, y8 to x8 + 0.2*x1p, y8 lc rgb "black" nohead
set label (sprintf("%d", AC_MAX)) at x8, y8 left offset 0.4, 0.1 tc rgb "black" font ",7"
set label "0"                     at x8, y7 left offset 0.4,-0.1 tc rgb "black" font ",7"

set samples 5000

# gnuplot doesn't have a mod function
#   http://www.macs.hw.ac.uk/~ml355/lore/gnuplot.htm
mod(a, b) = a - floor(a/b) * b

color(a) = mod(a, 6)

set style fill solid TRANSP0 noborder

# x  y  xlow  xhigh  ylow  yhigh
plot \
FN_IN_CD u 2:7:2:5:7:($7+$6):(color($1)) w boxxyerrorbars lc variable not, \
FN_IN_AC u 3:($2 + AccessCountHeight($6)):(color($1)) w points pointsize 0.01 lc variable not, \
FN_IN_CD u 2:7:(0):6:(color($1)) w vectors nohead      lt 1 lc variable not, \
FN_IN_CD u 2:($7+$6/2.0):1:(color($1)) w labels right offset -0.5,0 font ",8" tc variable not, \
legendAccesses(x) w lines lc rgb "black" not

# dotted line doesn't work with lc variable
#FN_IN_CD u 4:7:(0):6:(color($1)) w vectors nohead lw 2 lt 0 lc variable not, \

# steps doesn't work with lc variable
#FN_IN_AC u 3:($2 + AccessCountHeight($6)):(color($1)) w steps lc variable not, \
#FN_IN_AC u 3:2:($2 + AccessCountHeight($6)):(color($1)) w filledcurves lc variable not, \

# This doesn't fill the exact same area as the steps, but was the closest thing
# that I can find.
#FN_IN_AC u 3:2:($2 + AccessCountHeight($6)) w filledcurves lc rgb "red" not, \

#FN_IN_AC u 3:($2 + AccessCountHeight($6)) w linespoints pt 7 pointsize 0.1 lc rgb "black" not, \

# no base y option, like y0
#FN_IN_AC u 3:($2 + AccessCountHeight($6)) w fillsteps lc rgb "red" not, \


Cleanup.

Cleanup.

####################################################################################
# Gnuplot 4.6 script for plotting multiple groups of 3 bars in a barchart.
####################################################################################

### plot setup
#set terminal pngcairo transparent enhanced font "inconsolata,10" fontscale 1.0 size 500, 350
set terminal pngcairo size 800,600 enhanced font 'Liberation Mono,10' background "#002b36"
set output 'test.png'
COLORS = "red green gray"
STARTCOL=2
ENDCOL=4
GAPSIZE=5

NCOL=ENDCOL-STARTCOL+1
BOXWIDTH=1./(GAPSIZE+NCOL)

### legend
set key bmargin center horizontal Left reverse noenhanced autotitles columnhead nobox

### barchart layout - axis + grid
#set border 3 front linetype -1 linewidth 1.000
set boxwidth BOXWIDTH absolute
set style fill solid 1.00 border lt -1
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
 nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault linetype 0 linewidth 1.000,  linetype 0 linewidth 1.000
set xzeroaxis linetype 0 linewidth 1.000
set yzeroaxis linetype 0 linewidth 1.000
set zzeroaxis linetype 0 linewidth 1.000

### Set tics and histograms
set style histogram clustered gap 4 title  offset character 2, 0.25, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45  offset character 0, 0, 0 autojustify
set xtics  norangelimit font ",8"
set xtics ()
set ytics border in scale 0,0 mirror norotate  offset character 0, 0, 0 autojustify
set ztics border in scale 0,0 nomirror norotate  offset character 0, 0, 0 autojustify
set cbtics border in scale 0,0 mirror norotate  offset character 0, 0, 0 autojustify
set rtics axis in scale 0,0 nomirror norotate  offset character 0, 0, 0 autojustify

### titles and labels
set title "income\_vs\_expenses\n(Extra info here?)"
#set xlabel "(Note: )"
set xlabel  offset character 0, -2, 0 font "" textcolor lt -1 norotate
set ylabel "Value (EUR)"

#x = 0.0
#i = 23
### plotting
plot for [COL=STARTCOL:ENDCOL] 'test.dat' u COL:xtic(1) w histogram title columnheader(COL) lc rgb word(COLORS, COL), \
    for [COL=STARTCOL:ENDCOL] 'test.dat' u (column(0)+BOXWIDTH*(COL-STARTCOL+GAPSIZE/2+1)-0.5):COL:COL notitle w labels

### TODO: 2014_income_vs_expenses.dat -> 2014 / income_vs_expenses = year for a group of
### histograms / plottitle
### plot setup
#set terminal pngcairo transparent enhanced font "inconsolata,10" fontscale 1.0 size 500, 350
set terminal pngcairo size 800,600 enhanced font 'Liberation Mono,10' background "#002b36"
set output 'test.png'

STARTCOL=2
ENDCOL=4
GAPSIZE=5
NCOL=ENDCOL-STARTCOL+1
BOXWIDTH=1./(GAPSIZE+NCOL)
COLORS = "red green gray"

#set border 3 front linetype -1 linewidth 1.000
set boxwidth BOXWIDTH absolute
set style fill solid 1.00 border lt -1
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
 nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault linetype 0 linewidth 1.000,  linetype 0 linewidth 1.000
set xzeroaxis linetype 0 linewidth 1.000
set yzeroaxis linetype 0 linewidth 1.000
set zzeroaxis linetype 0 linewidth 1.000

### legend
set key bmargin center horizontal Left reverse noenhanced autotitles columnhead nobox

### Set tics and histograms
set style histogram clustered gap 4 title  offset character 2, 0.25, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror rotate by -45  offset character 0, 0, 0 autojustify
set xtics  norangelimit font ",8"
set xtics   ()
set ytics border in scale 0,0 mirror norotate  offset character 0, 0, 0 autojustify
set ztics border in scale 0,0 nomirror norotate  offset character 0, 0, 0 autojustify
set cbtics border in scale 0,0 mirror norotate  offset character 0, 0, 0 autojustify
set rtics axis in scale 0,0 nomirror norotate  offset character 0, 0, 0 autojustify

# TODO: the below text is variable
set title "income\_vs\_expenses\n(Extra info here?)"
# TODO: the below text is variable
#set xlabel "(Note: )"
set xlabel  offset character 0, -2, 0 font "" textcolor lt -1 norotate
# TODO: the below text is variable
set ylabel "Value (EUR)"
x = 0.0
i = 23
### the plot
## Last datafile plotted: "data.dat"
#plot newhistogram "Northern Europe", 'data.dat' using "Sweden":xtic(1) t col, '' u "Denmark" t col, '' u "Norway" t col, newhistogram "Southern Europe", '' u "Greece":xtic(1) t col, '' u "Romania" t col, '' u "Yugoslavia" t col, newhistogram "British Isles", '' u "Ireland":xtic(1) t col, '' u "United_Kingdom" t col
# TODO: the below texts and colors are variable
#plot 'test.dat' using "income":xtic(1) t col lc "#586e75", '' u "expenses" t col lc "#cb4b16", '' u "difference" t col lc "#93a1a1"
#plot 'test.dat' using "income":xtic(1) t col lc "green", '' u "expenses" t col lc "red", '' u "difference" t col lc "gray"
#plot for [COL=STARTCOL:ENDCOL] 'test.dat' using COL:xtic(1) t col lc "green", '' u  t col lc "red", '' u "difference" t col lc "gray"
plot for [COL=STARTCOL:ENDCOL] 'test.dat' u COL:xtic(1) w histogram title columnheader(COL) lc rgb word(COLORS, COL), \
    for [COL=STARTCOL:ENDCOL] 'test.dat' u (column(0)+BOXWIDTH*(COL-STARTCOL+GAPSIZE/2+1)-0.5):COL:COL notitle w labels


plot cleanup

plot cleanup

set terminal png size 900,400 font ',10'
set bmargin 10
set output "demo.png"
set nokey
set style data histogram
unset border
set xtics rotate
set xtics axis

plot 'time.log' using 2:xtic(1) with boxes

set terminal png size 900,400 font ',10'
set bmargin 10
set output "demo.png"
#set yrange [0:]
set nokey
set style data histogram
unset border
# unset xtics
# set xtics format ""
set xtics rotate
# set xtics offset 0, graph 0.5
set xtics axis

# plot 'time.log' using 1:xtic(2), \
# 'time.log' using 3 with boxes

plot 'time.log' using 2:xtic(1) with boxes

# reset
# set terminal png size "1000x1000"
# set output "test.png"
# set key at graph 0.24, 0.85 horizontal samplen 0.1
# set style data histogram
# set style histogram cluster gap 1
# set style fill solid border -1
# set boxwidth 0.8
# set xtic rotate by 90 scale 0
# unset ytics
# set y2tics rotate by 90
# set yrange [0:0.35]; set xrange [-0.5:6.5]
# set y2label 'Output' offset -2.5
# set xlabel ' '
# set size 0.6, 1
# set label 1 'Year' at graph 0.5, -0.1 centre rotate by 180
# set label 2 'Nowhere' at graph 0.09, 0.85 left rotate by 90
# set label 3 'Everywhere' at graph 0.2, 0.85 left rotate by 90
# p 'foo.log' u 2 title ' ', '' u ($2/2.0+rand(0)/10.0) title ' ', '' u 0:(0):xticlabel(1) w l title ''


update

update

# Tested with gnuplot 4.6 patchlevel 6

FN_IN = system("echo $FN_IN")
FN_OUT = system("echo $FN_OUT")

# Get min and max values
set terminal unknown
set xdata time
set timefmt "%y%m%d-%H%M%S"
set format x "'%y"

plot FN_IN u 1:($2/1000000) w fsteps, \
FN_IN u 1:($4+$5) w lines axes x1y2

X_MIN=GPVAL_DATA_X_MIN
X_MAX=GPVAL_DATA_X_MAX
Y_MIN=GPVAL_DATA_Y_MIN
Y_MAX=GPVAL_DATA_Y_MAX
Y2_MIN=GPVAL_DATA_Y2_MIN
Y2_MAX=GPVAL_DATA_Y2_MAX

#set print "-"
#print (sprintf("Y_MAX: %f", Y_MAX))
#print (sprintf("Y2_MAX: %f", Y2_MAX))

set terminal pdfcairo enhanced size 3in, 2in
set output FN_OUT

#set tmargin at screen 0.975
#set bmargin at screen 0.152
#set lmargin at screen 0.185
#set rmargin at screen 0.940

set xlabel "Time" offset 0,0.3
set ylabel "Storage size (MB)" offset 1.3,0
set y2label "Storage cost ($)"

set border (1 + 2 + 8) back lc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080" #autofreq 0,(365.25*24*3600)

# Not sure if this is what I wanted. Not important.
x1(a)=(10**floor(log10(a)))
x2(a)=floor(a/x1(a)/2)*x1(a)*2
yTicsStep(a, b)=x2(a/b)

#print (sprintf("yTicsStep(Y_MAX, 2)=%f", yTicsStep(Y_MAX, 2)))
#print (sprintf("yTicsStep(Y2_MAX, 2)=%f", yTicsStep(Y2_MAX, 2)))
set ytics  nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,yTicsStep(Y_MAX, 2)
set y2tics nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,yTicsStep(Y2_MAX, 2)
set tics front

set xrange [X_MIN:X_MAX]
set yrange [Y_MIN:Y_MAX]
set y2range [Y2_MIN:Y2_MAX]

set key top left

set pointsize 0.1

plot \
FN_IN u 1:($2/1000000) w steps lc rgb "red" t "Hot", \
FN_IN u 1:($3/1000000) w steps lc rgb "blue" t "Cold", \
FN_IN u 1:4 w linespoints axes x1y2 pt 7 lc rgb "red" not, \
FN_IN u 1:5 w linespoints axes x1y2 pt 7 lc rgb "blue" not, \
FN_IN u 1:($4+$5) w linespoints axes x1y2 pt 7 lc rgb "black" not

#FN_IN u 1:($2/1000000) w fillsteps fs solid 0.15 noborder not, \

# Tested with gnuplot 4.6 patchlevel 6

FN_IN = system("echo $FN_IN")
FN_OUT = system("echo $FN_OUT")

# Get min and max values
set terminal unknown
set xdata time
set timefmt "%y%m%d-%H%M%S"
set format x "'%y"

plot FN_IN u 1:($2/1000000) w fsteps, \
FN_IN u 1:($4+$5) w lines axes x1y2

X_MIN=GPVAL_DATA_X_MIN
X_MAX=GPVAL_DATA_X_MAX
Y_MIN=GPVAL_DATA_Y_MIN
Y_MAX=GPVAL_DATA_Y_MAX
Y2_MIN=GPVAL_DATA_Y2_MIN
Y2_MAX=GPVAL_DATA_Y2_MAX

set terminal pdfcairo enhanced size 3in, 2in
set output FN_OUT

#set tmargin at screen 0.975
#set bmargin at screen 0.152
#set lmargin at screen 0.185
#set rmargin at screen 0.940

set xlabel "Time" offset 0,0.3
set ylabel "Storage size (MB)" offset 1.3,0
set y2label "Storage cost ($)"

set border (1 + 2 + 8) back lc rgb "#808080"
set xtics nomirror scale 0.5,0 tc rgb "#808080" #autofreq 0,(365.25*24*3600)

OneMagSmaller(x)=10**floor(log10(x))
yTicsStep(a, b)=floor(floor(a / b) / OneMagSmaller(a)) * OneMagSmaller(a)
set ytics  nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,yTicsStep(Y_MAX, 2)
set y2tics nomirror scale 0.5,0 tc rgb "#808080" autofreq 0,yTicsStep(Y2_MAX, 2)
set tics front

set xrange [X_MIN:X_MAX]
set yrange [Y_MIN:Y_MAX]
set y2range [Y2_MIN:Y2_MAX]

set key top left

set pointsize 0.1

plot \
FN_IN u 1:($2/1000000) w steps lc rgb "red" t "Hot", \
FN_IN u 1:($3/1000000) w steps lc rgb "blue" t "Cold", \
FN_IN u 1:4 w linespoints axes x1y2 pt 7 lc rgb "red" not, \
FN_IN u 1:5 w linespoints axes x1y2 pt 7 lc rgb "blue" not, \
FN_IN u 1:($4+$5) w linespoints axes x1y2 pt 7 lc rgb "black" not

#FN_IN u 1:($2/1000000) w fillsteps fs solid 0.15 noborder not, \


Uses a new color scheme for graphs.

Uses a new color scheme for graphs.

;set term svg enhanced font 'arial,10' size 800,800
;bext = ".svg"
set terminal png nocrop enhanced font arial 10 size 800,800
bext = ".png"
set xtics nomirror rotate by -45 font "arial,8"
set key below
set style data linespoints
set datafile missing "0"
set xlabel "Number of elements in logarithmic scale"
set ylabel "Time for element in nanosecond in logarithmic scale\nLower is better"
set xrange [1000:100000000]
set yrange [6:1000]
set logscale y
set logscale x
set format y "%.0fns"
set format x "%.0s%c"
bdir = "data/"

# for some colors see: http://www.uni-hamburg.de/Wiss/FB/15/Sustainability/schneider/gnuplot/colors.htm
set style line 1 lc 1 lt 1 # hashtable
set style line 2 lc 2 lt 2 # hashdyn
set style line 3 lc 3 lt 3 # hashlin
set style line 4 lc 4 lt 4 # trie
set style line 5 lc 5 lt 5 # trie-inplace
set style line 6 lc 6 lt 6 # rbtre
set style line 7 lc 7 lt 7 # nedtrie
set style line 8 lc 8 lt 8 # khash
set style line 9 lc 9 lt 8 # uthash
set style line 10 lc 10 lt 10 # judy
set style line 11 lc 11 lt 11 # judyarray
set style line 12 lc 12 lt 12 # googledensehash
set style line 13 lc rgb "#FF69B4" lt 13 # googlebtree
set style line 14 lc 14 lt 14 # stxbtree
set style line 15 lc 15 lt 15 # c++unorderedmap
set style line 16 lc 16 lt 16 # c++map
set style line 17 lc 17 lt 17 # tesseract
set style line 18 lc rgb "#FF69B4" lt 18 # googlelibchash
set style line 19 lc rgb "#1E90FF" lt 19 # concurrencykit

;set term svg enhanced font 'arial,10' size 800,800
;bext = ".svg"
set terminal png nocrop enhanced font arial 10 size 800,800
bext = ".png"
set xtics nomirror rotate by -45 font "arial,8"
set key below
set style data linespoints
set datafile missing "0"
set xlabel "Number of elements in logarithmic scale"
set ylabel "Time for element in nanosecond in logarithmic scale\nLower is better"
set xrange [1000:100000000]
set yrange [6:1000]
set logscale y
set logscale x
set format y "%.0fns"
set format x "%.0s%c"
bdir = "data/"

# for some colors see: http://www.uni-hamburg.de/Wiss/FB/15/Sustainability/schneider/gnuplot/colors.htm
set style line 1 lc 1 lt 1
set style line 2 lc 2 lt 2
set style line 3 lc 3 lt 3
set style line 4 lc 4 lt 4
set style line 5 lc 5 lt 5
set style line 6 lc 6 lt 6
set style line 7 lc 7 lt 7
set style line 8 lc 8 lt 8
set style line 9 lc 9 lt 9
set style line 10 lc 10 lt 10
set style line 11 lc 11 lt 11
set style line 12 lc 12 lt 12
set style line 13 lc 13 lt 13
set style line 14 lc 14 lt 14
set style line 15 lc 15 lt 15
set style line 16 lc rgb "#DC143C" lt 16
set style line 17 lc 17 lt 17
set style line 18 lc rgb "brown" lt 18
set style line 19 lc rgb "#DAA520" lt 19
set style line 20 lc 20 lt 20


line style update

line style update

#!/usr/bin/env gnuplot

# graph of network usage

# datafile
ifname = "/tmp/sql13.csv"
ofname = "/tmp/lnxdiagd/site/img/day13.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 640,304
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
set output ofname

# ************************************************************* Functions ******
# determine delta data
delta(x) = ( xD = x - old_x, old_x = x, xD <= 0 ? 0.1 : xD)
# lg(x)    = ( xL = x, xL == NaN ? NaN : log(xL) )
old_x = NaN

# ************************************************************* Statistics *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifname using 2 name "X" nooutput
X_min = X_min + utc_offset - 946684800
X_max = X_max + utc_offset - 946684800

# stats to be calculated here of column 6 (Download bytes per minute)
stats ifname using (delta($6)) name "Ydn" nooutput
Ydn_min = 1024 * 8 / 60.
Ydn_max = (Ydn_max * 1.1) * 8 / 60.

# stats to be calculated here of column 6 (Download bytes per minute)
stats ifname using (delta($7)) name "Yup" nooutput
Yup_min = 1024 * 8 / 60.
Yup_max = (Yup_max * 1.1) * 8 / 60.

# ***************************************************************** Legend *****
set key inside top left nobox
set key samplen .5
set key reverse Left

set multiplot layout 2,1 title "Network Usage (eth0)"

################################################################################
################################### TOP PLOT ###################################
################################################################################

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""
set xtics rotate by 40 right
set xrange [ X_min : X_max ]

# ***************************************************************** Y-axis *****
set ylabel "Speed [bits/sec]"
set format y "%3.0s %c"
#set logscale y 10
set yrange [ Yup_min : Yup_max ]
set bmargin 0

# ***************************************************************** Output *****
set object 1 rect from screen 0,0 to screen 1,1 behind
set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
set object 2 rect from graph 0,0 to graph 1,1 behind
set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

##set style data boxes
##set style fill solid noborder

plot ifname \
      using ($2+utc_offset):(delta($7)*8/60) title "Upload   (eth0)" with lines lc rgb "#0000bb" lw 1\

unset object 1

################################################################################
################################## BOTTOM PLOT #################################
################################################################################

# ******************************************************* General settings *****
set timestamp 'created: %Y-%m-%d %H:%M' bottom font "Vera,6"

# ***************************************************************** X-axis *****
set xlabel "Date/Time"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xtics rotate by 40 right
set xrange [ X_min : X_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
#set logscale y 10
set yrange [ Ydn_min : Ydn_max ] reverse
set tmargin 0
unset bmargin

# ***************************************************************** Output *****
##set object 1 rect from screen 0,0 to screen 1,1 behind
##set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
set object 2 rect from graph 0,0 to graph 1,1 behind
set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

# ***** PLOT *****
##set style data boxes
##set style fill solid noborder

plot ifname \
      using ($2+utc_offset):(delta($6)*8/60) title "Download (eth0)" with lines lc rgb "#bb0000" lw 1 \

unset object 2
unset multiplot

#!/usr/bin/env gnuplot

# graph of network usage

# datafile
ifname = "/tmp/sql13.csv"
ofname = "/tmp/lnxdiagd/site/img/day13.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 640,304
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
set output ofname

# ************************************************************* Functions ******
# determine delta data
delta(x) = ( xD = x - old_x, old_x = x, xD <= 0 ? 0.1 : xD)
# lg(x)    = ( xL = x, xL == NaN ? NaN : log(xL) )
old_x = NaN

# ************************************************************* Statistics *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifname using 2 name "X" nooutput
X_min = X_min + utc_offset - 946684800
X_max = X_max + utc_offset - 946684800

# stats to be calculated here of column 6 (Download bytes per minute)
stats ifname using (delta($6)) name "Ydn" nooutput
Ydn_min = 1024 * 8 / 60.
Ydn_max = (Ydn_max * 1.1) * 8 / 60.

# stats to be calculated here of column 6 (Download bytes per minute)
stats ifname using (delta($7)) name "Yup" nooutput
Yup_min = 1024 * 8 / 60.
Yup_max = (Yup_max * 1.1) * 8 / 60.

# ***************************************************************** Legend *****
set key inside top left nobox
set key samplen .5
set key reverse Left

set multiplot layout 2,1 title "Network Usage (eth0)"

################################################################################
################################### TOP PLOT ###################################
################################################################################

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""
set xtics rotate by 40 right
set xrange [ X_min : X_max ]

# ***************************************************************** Y-axis *****
set ylabel "Speed [bits/sec]"
set format y "%3.0s %c"
#set logscale y 10
set yrange [ Yup_min : Yup_max ]
set bmargin 0

# ***************************************************************** Output *****
set object 1 rect from screen 0,0 to screen 1,1 behind
set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
set object 2 rect from graph 0,0 to graph 1,1 behind
set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

##set style data boxes
##set style fill solid noborder

plot ifname \
      using ($2+utc_offset):(delta($7)*8/60) title "Upload   (eth0)" fc rgb "#0000bb" with lines lw 1\

unset object 1

################################################################################
################################## BOTTOM PLOT #################################
################################################################################

# ******************************************************* General settings *****
set timestamp 'created: %Y-%m-%d %H:%M' bottom font "Vera,6"

# ***************************************************************** X-axis *****
set xlabel "Date/Time"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xtics rotate by 40 right
set xrange [ X_min : X_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
#set logscale y 10
set yrange [ Ydn_min : Ydn_max ] reverse
set tmargin 0
unset bmargin

# ***************************************************************** Output *****
##set object 1 rect from screen 0,0 to screen 1,1 behind
##set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
set object 2 rect from graph 0,0 to graph 1,1 behind
set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

# ***** PLOT *****
##set style data boxes
##set style fill solid noborder

plot ifname \
      using ($2+utc_offset):(delta($6)*8/60) title "Download (eth0)" fc rgb "#bb0000"  with lines lw 1 \

unset object 2
unset multiplot


always add the -pthread option

always add the -pthread option

git-svn-id: 4e7379b20b57f8e3dde5a0b7363f233184647162@495 4e380d45-d1fd-0310-85a7-d18ec86df0ad

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
ICPC_MCSTL_CPPFLAGS	?= -gcc-version=420 -cxxlib=$(FAKEGCC)
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

BOOST_INCLUDE	?= /usr/include/boost

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

# check, whether stxxl has been configured
ifeq (,$(strip $(wildcard $(STXXL_ROOT)/include/stxxl.h)))
$(warning *** WARNING: STXXL hasn't been configured correctly) #'
$(error ERROR: could not find a STXXL installation in STXXL_ROOT=$(STXXL_ROOT))
endif

# in the top dir, check whether STXXL_ROOT points to ourselves
ifneq (,$(wildcard make.settings))
stat1	 = $(shell stat -L -c '%d:%i' ./)
stat2	 = $(shell stat -L -c '%d:%i' $(STXXL_ROOT)/)

ifneq ($(stat1),$(stat2))
$(error ERROR: STXXL_ROOT=$(STXXL_ROOT) points to a different STXXL installation)
endif
endif

PTHREAD_FLAG	?= -pthread

STXXL_SPECIFIC	+= \
	$(PTHREAD_FLAG) \
	$(CPPFLAGS_ARCH) \
	-DSORT_OPTIMAL_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT))/include \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDFLAGS	+= $(PTHREAD_FLAG)
STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME)

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

UNAME_M		:= $(shell uname -m)
CPPFLAGS_ARCH	+= $(CPPFLAGS_$(UNAME_M))
CPPFLAGS_i686	?= -march=i686

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif

ifeq ($(strip $(USE_ICPC)),yes)
MCSTL_CPPFLAGS		+= $(ICPC_MCSTL_CPPFLAGS)
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -D__MCSTL__ $(MCSTL_INCLUDES_PREPEND) -I$(MCSTL_ROOT)/c++
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/bits/stl_algo.h)))
# not from libstdc++ branch, need to find the correct original symlink

ifneq (,$(strip $(wildcard $(MCSTL_ROOT)/originals)))
MCSTL_ORIG_BASE		?= $(MCSTL_ROOT)
endif
MCSTL_ORIG_BASE		?= $(MCSTL_BASE)

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_ORIG_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))

ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_ORIG_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= -I$(MCSTL_ORIGINALS)

else # from libstdc++ branch

MCSTL_INCLUDES_PREPEND	+= $(if $(findstring 4.3,$(COMPILER)),-I$(MCSTL_ROOT)/c++/mod_stl/gcc-4.3)

endif # (not) from libstdc++ branch

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	$(if $(strip $(BOOST_INCLUDE)),-I$(strip $(BOOST_INCLUDE)))

BOOST_LIB_COMPILER_SUFFIX	?=
BOOST_LIB_MT_SUFFIX		?= -mt
BOOST_LINKER_OPTIONS		 = \
	-lboost_thread$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_date_time$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_iostreams$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_filesystem$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX)

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h version.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h settings.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

%.$o: %.cpp ../make.settings
	@$(RM) $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDFLAGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make

# This -*- Makefile -*- is intended for processing with GNU make.

# Change this file according to your paths.

# Instead of modifying this file, you could also set your modified variables
# in make.settings.local (needs to be created first).
-include $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))make.settings.local

USE_BOOST	?= no	# set 'yes' to use Boost libraries or 'no' to not use Boost libraries
USE_LINUX	?= yes	# set 'yes' if you run Linux, 'no' otherwise
USE_MCSTL	?= no	# will be overriden from main Makefile
USE_ICPC	?= no	# will be overriden from main Makefile

STXXL_ROOT	?= $(HOME)/work/stxxl

ifeq ($(strip $(USE_ICPC)),yes)
COMPILER	?= icpc
OPENMPFLAG	?= -openmp
ICPC_MCSTL_CPPFLAGS	?= -gcc-version=420 -cxxlib=$(FAKEGCC)
endif

ifeq ($(strip $(USE_MCSTL)),yes)
COMPILER	?= g++-4.2
OPENMPFLAG	?= -fopenmp
LIBNAME		?= mcstxxl
# the base directory of your MCSTL installation
MCSTL_BASE	?= $(HOME)/work/mcstl
# mcstl branch, leave empty for default branch (e.g. if installed from release tarball)
MCSTL_BRANCH	?= #branches/standalone
# only set the following variables if autodetection does not work:
#MCSTL_ROOT		?= $(MCSTL_BASE)/$(MCSTL_BRANCH)
#MCSTL_ORIGINAL_INC_CXX	?= /path/to/your/$(COMPILER)'s/include/c++
#MCSTL_ORIGINALS	?= /where/you/put/the/original/symlink
endif

BOOST_INCLUDE	?= /usr/include/boost

COMPILER	?= g++
LINKER		?= $(COMPILER)
OPT		?= -O3 # compiler optimization level
WARNINGS	?= -Wall
DEBUG		?= # put here -g option to include the debug information into the binaries

LIBNAME		?= stxxl

#### TROUBLESHOOTING
#
# For automatical checking of order of the output elements in
# the sorters: stxxl::stream::sort, stxxl::stream::merge_runs,
# stxxl::sort, and stxxl::ksort use
#
#STXXL_SPECIFIC	+= -DSTXXL_CHECK_ORDER_IN_SORTS
#
# If your program aborts with message "read/write: wrong parameter"
# or "Invalid argument"
# this could be that your kernel does not support direct I/O
# then try to set it off recompiling the libs and your code with option
#
#STXXL_SPECIFIC	+= -DSTXXL_DIRECT_IO_OFF
#
# But for the best performance it is strongly recommended
# to reconfigure the kernel for the support of the direct I/O.
#
# FIXME: documentation needed
#
#STXXL_SPECIFIC += -DSTXXL_DEBUGMON

#### You usually shouldn't need to change the sections below #####

#### STXXL OPTIONS ###############################################

# check, whether stxxl has been configured
ifeq (,$(strip $(wildcard $(STXXL_ROOT)/include/stxxl.h)))
$(warning *** WARNING: STXXL hasn't been configured correctly)
$(error ERROR: could not find a STXXL installation in STXXL_ROOT=$(STXXL_ROOT))
endif

# in the top dir, check whether STXXL_ROOT points to ourselves
ifneq (,$(wildcard make.settings))
stat1	 = $(shell stat -L -c '%d:%i' ./)
stat2	 = $(shell stat -L -c '%d:%i' $(STXXL_ROOT)/)

ifneq ($(stat1),$(stat2))
$(error ERROR: STXXL_ROOT=$(STXXL_ROOT) points to a different STXXL installation)
endif
endif

STXXL_SPECIFIC	+= \
	$(CPPFLAGS_ARCH) \
	-DSORT_OPTIMAL_PREFETCHING \
	-DUSE_MALLOC_LOCK \
	-DCOUNT_WAIT_TIME \
	-I$(strip $(STXXL_ROOT))/include \
	-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
	$(POSIX_MEMALIGN) $(XOPEN_SOURCE)

STXXL_LDLIBS	+= -L$(strip $(STXXL_ROOT))/lib -l$(LIBNAME) -lpthread

STXXL_LIBDEPS	+= $(strip $(STXXL_ROOT))/lib/lib$(LIBNAME).$(LIBEXT)

UNAME_M		:= $(shell uname -m)
CPPFLAGS_ARCH	+= $(CPPFLAGS_$(UNAME_M))
CPPFLAGS_i686	?= -march=i686

##################################################################

#### ICPC OPTIONS ################################################

ifeq ($(strip $(USE_ICPC)),yes)

endif

##################################################################

#### MCSTL OPTIONS ###############################################

ifeq ($(strip $(USE_MCSTL)),yes)

MCSTL_ROOT		?= $(strip $(MCSTL_BASE))$(if $(strip $(MCSTL_BRANCH)),/$(strip $(MCSTL_BRANCH)))

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/mcstl.h)))
$(error ERROR: could not find a MCSTL installation in MCSTL_ROOT=$(MCSTL_ROOT))
endif

ifeq ($(strip $(USE_ICPC)),yes)
MCSTL_CPPFLAGS		+= $(ICPC_MCSTL_CPPFLAGS)
endif

MCSTL_CPPFLAGS		+= $(OPENMPFLAG) -D__MCSTL__ $(MCSTL_INCLUDES_PREPEND) -I$(MCSTL_ROOT)/c++
MCSTL_LDFLAGS		+= $(OPENMPFLAG)

ifeq (,$(strip $(wildcard $(MCSTL_ROOT)/c++/bits/stl_algo.h)))
# not from libstdc++ branch, need to find the correct original symlink

ifneq (,$(strip $(wildcard $(MCSTL_ROOT)/originals)))
MCSTL_ORIG_BASE		?= $(MCSTL_ROOT)
endif
MCSTL_ORIG_BASE		?= $(MCSTL_BASE)

# find a KEY=VALUE element in WORDS and return VALUE
# usage: $(call get_value,KEY,WORDS)
get_value		 = $(subst $(1)=,,$(filter $(1)=%,$(2)))
empty			 =#
space			 = $(empty) $(empty)
gcc_version_result	:= $(shell $(COMPILER) -v 2>&1)
gcc_version		 = $(call get_value,THE_GCC_VERSION,$(subst gcc$(space)version$(space),THE_GCC_VERSION=,$(gcc_version_result)))
gcc_prefix		 = $(call get_value,--prefix,$(gcc_version_result))
gcc_gxx_incdir		 = $(call get_value,--with-gxx-include-dir,$(gcc_version_result))
MCSTL_ORIGINAL_INC_CXX	?= $(firstword $(wildcard $(gcc_gxx_incdir) $(gcc_prefix)/include/c++/$(gcc_version)) $(cxx_incdir_from_compile))
ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
# do a test compilation, generate dependencies and parse the header paths
compile_test_vector_deps:= $(shell echo -e '\043include <vector>' > cxx-header-path-test.cpp; $(COMPILER) -M cxx-header-path-test.cpp 2>/dev/null; $(RM) cxx-header-path-test.cpp)
cxx_incdir_from_compile	 = $(patsubst %/vector,%,$(firstword $(filter %/vector, $(compile_test_vector_deps))))
export cxx_incdir_from_compile
endif
MCSTL_ORIGINALS		?= $(strip $(MCSTL_ORIG_BASE))/originals/$(subst /,_,$(MCSTL_ORIGINAL_INC_CXX))

ifeq (,$(strip $(MCSTL_ORIGINAL_INC_CXX)))
$(error ERROR: could not determine MCSTL_ORIGINAL_INC_CXX, please set this variable manually, it's your compilers ($(COMPILER)) include/c++ path)
endif
ifeq (,$(strip $(wildcard $(MCSTL_ORIGINALS)/original)))
$(error ERROR: your mcstl in $(MCSTL_ORIG_BASE) is not configured properly: $(MCSTL_ORIGINALS)/original does not exist)
endif

MCSTL_CPPFLAGS		+= -I$(MCSTL_ORIGINALS)

else # from libstdc++ branch

MCSTL_INCLUDES_PREPEND	+= $(if $(findstring 4.3,$(COMPILER)),-I$(MCSTL_ROOT)/c++/mod_stl/gcc-4.3)

endif # (not) from libstdc++ branch

endif

##################################################################

#### BOOST OPTIONS ###############################################

BOOST_COMPILER_OPTIONS	 = \
	-DSTXXL_BOOST_TIMESTAMP \
	-DSTXXL_BOOST_CONFIG \
	-DSTXXL_BOOST_FILESYSTEM \
	-DSTXXL_BOOST_THREADS \
	-DSTXXL_BOOST_RANDOM \
	-I$(strip $(BOOST_INCLUDE)) \
	-pthread

BOOST_LIB_COMPILER_SUFFIX	?=
BOOST_LIB_MT_SUFFIX		?= -mt
BOOST_LINKER_OPTIONS		 = \
	-lboost_thread$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_date_time$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_iostreams$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX) \
	-lboost_filesystem$(BOOST_LIB_COMPILER_SUFFIX)$(BOOST_LIB_MT_SUFFIX)

##################################################################

#### CPPUNIT OPTIONS ############################################

CPPUNIT_COMPILER_OPTIONS	+=

CPPUNIT_LINKER_OPTIONS		+= -lcppunit -ldl

##################################################################

#### DEPENDENCIES ################################################

HEADER_FILES_BITS	+= namespace.h version.h

HEADER_FILES_COMMON	+= aligned_alloc.h mutex.h rand.h semaphore.h state.h
HEADER_FILES_COMMON	+= timer.h utils.h gprof.h rwlock.h simple_vector.h
HEADER_FILES_COMMON	+= switch.h tmeta.h log.h exceptions.h debug.h tuple.h
HEADER_FILES_COMMON	+= types.h utils_ledasm.h settings.h

HEADER_FILES_IO		+= completion_handler.h io.h iobase.h iostats.h
HEADER_FILES_IO		+= mmap_file.h simdisk_file.h syscall_file.h
HEADER_FILES_IO		+= ufs_file.h wincall_file.h wfs_file.h boostfd_file.h

HEADER_FILES_MNG	+= adaptor.h async_schedule.h block_prefetcher.h
HEADER_FILES_MNG	+= buf_istream.h buf_ostream.h buf_writer.h mng.h
HEADER_FILES_MNG	+= write_pool.h prefetch_pool.h

HEADER_FILES_CONTAINERS	+= pager.h stack.h vector.h priority_queue.h queue.h
HEADER_FILES_CONTAINERS	+= map.h deque.h

HEADER_FILES_CONTAINERS_BTREE	+= btree.h iterator_map.h leaf.h node_cache.h
HEADER_FILES_CONTAINERS_BTREE	+= root_node.h node.h btree_pager.h iterator.h

HEADER_FILES_ALGO	+= adaptor.h inmemsort.h intksort.h run_cursor.h sort.h
HEADER_FILES_ALGO	+= async_schedule.h interleaved_alloc.h ksort.h
HEADER_FILES_ALGO	+= losertree.h scan.h stable_ksort.h random_shuffle.h

HEADER_FILES_STREAM	+= stream.h sort_stream.h

HEADER_FILES_UTILS	+= malloc.h

###################################################################

#### MISC #########################################################

DEPEXT	 = $(LIBNAME).d # extension of dependency files
OBJEXT	 = $(LIBNAME).o	# extension of object files
LIBEXT	 = a		# static library file extension
EXEEXT	 = $(LIBNAME).bin # executable file extension
RM	 = rm -f	# remove file command
LIBGEN	 = ar cr	# library generation
OUT	 = -o		# output file option for the compiler and linker

d	?= $(strip $(DEPEXT))
o	?= $(strip $(OBJEXT))
bin	?= $(strip $(EXEEXT))

###################################################################

#### COMPILE/LINK RULES ###########################################

%.$o: %.cpp ../make.settings
	@$(RM) $*.$d
	$(COMPILER) $(STXXL_COMPILER_OPTIONS) -MD -MF $*.$dT -c $(OUTPUT_OPTION) $< && mv $*.$dT $*.$d

LINK_STXXL	 = $(LINKER) $1 $(STXXL_LINKER_OPTIONS) -o $@

%.$(bin): %.$o $(STXXL_LIBDEPS)
	$(call LINK_STXXL, $<)

###################################################################

STXXL_COMPILER_OPTIONS	+= $(STXXL_SPECIFIC)
STXXL_COMPILER_OPTIONS	+= $(OPT) $(DEBUG) $(WARNINGS)
STXXL_LINKER_OPTIONS	+= $(STXXL_LDLIBS)

ifeq ($(strip $(USE_MCSTL)),yes)
STXXL_COMPILER_OPTIONS	+= $(MCSTL_CPPFLAGS)
STXXL_LINKER_OPTIONS	+= $(MCSTL_LDFLAGS)
endif

ifeq ($(strip $(USE_BOOST)),yes)
STXXL_COMPILER_OPTIONS	+= $(BOOST_COMPILER_OPTIONS)
STXXL_LINKER_OPTIONS	+= $(BOOST_LINKER_OPTIONS)
endif

STXXL_COMPILER_OPTIONS	+= $(CPPFLAGS)

# vim: syn=make


Modify figure

Modify figure

set terminal png  transparent enhanced  fontscale 1.0 size 500, 350
# set output 'contours.17.png'
set view 60, 30, 0.85, 1.1
set samples 25, 25
set isosamples 26, 26
set contour base
set cntrparam bspline
set title "3D gnuplot demo - contour of Sinc function"
set xlabel "Xx axis"
set ylabel "Yy axis"
set zlabel "Z axis"
set zlabel  offset character 1, 0, 0 font "" textcolor lt -1 norotate
splot [-5:5.01] [-5:5.01] sin(sqrt(x)) / sqrt(x**2+y**2)

set terminal png  transparent enhanced  fontscale 1.0 size 500, 350
# set output 'contours.17.png'
set view 60, 30, 0.85, 1.1
set samples 25, 25
set isosamples 26, 26
set contour base
set cntrparam bspline
set title "3D gnuplot demo - contour of Sinc function"
set xlabel "Xx axis"
set ylabel "Yy axis"
set zlabel "Z axis"
set zlabel  offset character 1, 0, 0 font "" textcolor lt -1 norotate
splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)