Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: CMake on multiple platforms

on:
push:
branches: [ "main" ]
branches: [ "main" , "flat"]
pull_request:
branches: [ "main" ]

Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ add_library(SR STATIC
src/data.c
include/file_source.h
src/file_source.c
include/mutli_source.h
src/multi_source.c
include/operator.h
include/memory.h
src/memory.c
Expand Down
1 change: 0 additions & 1 deletion benchmark/Query1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ namespace
}

state.counters["Allocs"] = (double) get_alloc_count();
state.counters["Peak"] = (double) get_peak_allocated();
state.counters["Total"] = (double) get_total_allocated();

free_file_source(source1);
Expand Down
2 changes: 2 additions & 0 deletions include/file_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ void free_file_source(source_t *source);

void free_file_sink(sink_t *sink);

void reset_file_source(source_t *source); //TODO: add for the source in general

#endif //FILE_SOURCE_H
4 changes: 0 additions & 4 deletions include/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@

void* tracked_malloc(size_t size);

void tracked_free(void* ptr, size_t size);

size_t get_alloc_count();

size_t get_peak_allocated();

size_t get_total_allocated();

void reset_memory_counter();
Expand Down
26 changes: 0 additions & 26 deletions include/mutli_source.h

This file was deleted.

15 changes: 15 additions & 0 deletions include/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
#include <stdint.h>


typedef struct ExecutionStep {
const operator_t *operator_;
data_t *left_input;
data_t *right_input;
data_t *output;
} step_t;

#define MAX_OPERATOR_COUNT 256 //uint8_t

typedef struct ExecutionPlan {
struct ExecutionStep *steps;
uint8_t num_steps;
} plan_t;

typedef struct Query {
struct Operator *root;
Expand All @@ -24,6 +37,8 @@ typedef struct {

void execute_query(const query_t *query, sink_t *sink);

void flatten_query(const operator_t* operator_, data_t *results, uint8_t index, plan_t *plan);

void join_triple_copy(const data_t *src1, uint32_t index1,
const data_t *src2, uint32_t index2, data_t *dest);

Expand Down
11 changes: 2 additions & 9 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
#ifndef UTILS_H
#define UTILS_H

static int min(const int a, const int b) {
return a < b ? a : b;
}

/*
static int max(const int a, const int b) {
return a > b ? a : b;
}
*/
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

#endif //UTILS_H
12 changes: 11 additions & 1 deletion src/file_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data_t *get_next_file(const source_t *source, const uint32_t size, const uint32_
data_t *data = malloc(sizeof(data_t));
assert(data);
data->data = fs->source.buffer.data + (fs->source.index * fs->source.buffer.width);
data->size = min(size, fs->source.buffer.size - fs->source.index);
data->size = MIN(size, fs->source.buffer.size - fs->source.index);
data->width = source->buffer.width;

if (++fs->source.consumed == fs->source.consumers) {
Expand Down Expand Up @@ -71,6 +71,16 @@ source_t *create_file_source(const char *filename, const uint8_t consumers)
return (source_t*) fs;
}


void reset_file_source(source_t *source)
{
file_source_t *fs = (file_source_t*) source;

fs->source.index = 0;
fs->source.consumed = 0;
}


void push_next_fsink(sink_t *sink, const data_t *data)
{
file_sink_t *fs = (file_sink_t*) sink;
Expand Down
18 changes: 0 additions & 18 deletions src/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <stdlib.h>

static size_t total_allocated = 0;
static size_t current_allocated = 0;
static size_t peak_allocated = 0;
static size_t allocation_count = 0;

//static pthread_mutex_t mem_lock = PTHREAD_MUTEX_INITIALIZER;
Expand All @@ -16,33 +14,17 @@ void* tracked_malloc(size_t size) {
void* ptr = malloc(size);
if (ptr) {
total_allocated += size;
current_allocated += size;
allocation_count++;
if (current_allocated > peak_allocated) {
peak_allocated = current_allocated;
}
}
//pthread_mutex_unlock(&mem_lock);
return ptr;
}


void tracked_free(void* ptr, const size_t size) {
if (!ptr) return;
//pthread_mutex_lock(&mem_lock);
free(ptr);
current_allocated -= size;
//pthread_mutex_unlock(&mem_lock);
}

size_t get_alloc_count() {return allocation_count;}
size_t get_peak_allocated() {return peak_allocated;}
size_t get_total_allocated() {return total_allocated;}

void reset_memory_counter()
{
total_allocated = 0;
peak_allocated = 0;
allocation_count = 0;
current_allocated = 0;
}
103 changes: 0 additions & 103 deletions src/multi_source.c

This file was deleted.

Loading