Commit 96fd6058 authored by Mateusz Pawlik's avatar Mateusz Pawlik
Browse files

Putting building blocks together.

parent 5a93c4f8
cmake_minimum_required(VERSION 2.8)
# Create the project.
project(ted-join-experiments)
# Compiler flags.
# MUST be declared after project().
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
# Verify which timing implementation to use.
# NOTE: Comes from common-code.
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if(NOT HAVE_CLOCK_GETTIME)
add_definitions(-DGETRUSAGE)
endif()
# Build executable with the experiments.
add_executable(
ted-join-experiments # EXECUTABLE NAME
src/experiments.cc # EXECUTABLE SOURCE
)
# Link the timing library and header file.
add_library(
TimingLibrary # LIBRARY NAME
external/common-code/timings/timing.cxx # LIBRARY SOURCE
)
target_link_libraries(
ted-join-experiments # TARGET EXECUTABLE NAME
TimingLibrary # LIBRARY NAME
)
target_include_directories(
ted-join-experiments # TARGET EXECUTABLE NAME
PUBLIC external/common-code/timings # HEADER FILE
)
# Create header-only library 'TreeSimilarity' with our algorithms.
add_library(
TreeSimilarity INTERFACE
)
target_include_directories(
TreeSimilarity INTERFACE
external/tree-similarity-private/src/node
external/tree-similarity-private/src/label
external/tree-similarity-private/src/parser
)
# Let the compiler know to find the header files in TreeSimilarity library.
target_link_libraries(
ted-join-experiments # EXECUTABLE NAME
TreeSimilarity # LIBRARY NAME
)
# Tree Edit Distance similarity join - experiments
## Building
First clone the external libraries. Execute the following from the project's root directory.
```bash
mkdir external
cd external
# Timing library.
git clone git@frosch.cosy.sbg.ac.at:wmann/common-code.git
# Tree Similarity library.
git clone git@frosch.cosy.sbg.ac.at:thuetter/tree-similarity-private.git
```
Then execute the following from the project's root directory.
```bash
mkdir build
cd build
cmake ..
make
```
#include "experiments.h"
int main(int argc, char** argv) {
Timing timing;
// Initialized Timing object
Timing::Interval * tfib25 = timing.create_enroll("fib25");
//start timing
tfib25->start();
//execute what you want to time
int sum = 0;
for (int i = 0; i < 1000000; ++i) {
++sum;
}
// stop timing
tfib25->stop();
std::cout << timing;
parser::BracketNotationParser bnp;
// Verify the input format before parsing.
if (!bnp.validate_input(argv[1])) {
std::cerr << "Incorrect format of source tree. Is the number of opening and closing brackets equal?" << std::endl;
return -1;
}
}
#ifndef EXPERIMENTS_H
#define EXPERIMENTS_H
#include <iostream>
#include <time.h>
#include "timing.h"
#include "node.h"
#include "string_label.h"
#include "bracket_notation_parser.h"
#endif // EXPERIMENTS_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment