-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/CFG-6-cpu_config
- Loading branch information
Showing
14 changed files
with
865 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,141 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Lib-Test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/shared/lib_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "cpu", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/cpu.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
"name": "Lib-Test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/shared/lib_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "cpu-Test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/cpu_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
"name": "Memory", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/memory.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "cpu", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/cpu.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Console", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/console.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "cpu-Test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/cpu_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Memory_test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/memory_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
"name": "Console-test", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/console_test.out", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
IP_KERNEL=127.0.0.1 | ||
PUERTO_KERNEL=8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PUERTO_ESCUCHA=8002 | ||
TAM_MEMORIA=4096 | ||
TAM_PAGINA=64 | ||
PAGINAS_POR_TABLA=4 | ||
RETARDO_MEMORIA=1000 | ||
ALGORITMO_REEMPLAZO=CLOCK-M | ||
MARCOS_POR_PROCESO=4 | ||
RETARDO_SWAP=2000 | ||
PATH_SWAP=/home/utnso/swap | ||
|
||
# TO DO: Define path swap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# C Makefile using gcc, gdb and valgrind. | ||
# Modified version of Makefile using g++ & gdb by Roberto Nicolas Savinelli <rsavinelli@est.frba.utn.edu.ar> | ||
# Tomas Agustin Sanchez <tosanchez@est.frba.utn.edu.ar> | ||
|
||
# ? Most defined will not required further modifycation ----------------------------------------------------------------------------------- | ||
|
||
# C Compiler | ||
CC = gcc | ||
# Compiler Flags | ||
CFLAGS = -Wall -Wextra -g3 | ||
# Test Compiler flags | ||
TCFLAGS = -Wall -Wextra -Wshadow -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-variable -Wno-pragmas -O3 -g3 | ||
# Used libraries | ||
# * Add libraries when needed | ||
LIBS = -lreadline -lcommons -pthread | ||
#Log Folder | ||
LOG_FOLDER=../log | ||
# Build Folder | ||
BUILD_FOLDER=../build | ||
# Include directory | ||
INCLUDE_DIRECTORY=./include/ ../lib/inc/ | ||
# Source directory | ||
SOURCE_DIRECTORY=./src | ||
# Test Directory | ||
TEST_DIRECTORY=./test | ||
# The main file path | ||
MAIN_FILE= ./src/main.c | ||
# The shared library source directory | ||
LIB_DIRECTORY= ../lib/src | ||
# Inlcude folder | ||
# ? Loops [includeDirectory].forEach(includeDirectory => concat("-I ", "includeDirectory")) | ||
INCLUDES = $(foreach dir, $(shell find $(INCLUDE_DIRECTORY) -type d -print), $(addprefix -I , $(dir))) | ||
# The shared library source files | ||
LIB_SOURCES = ../shared/*.o | ||
# Source files | ||
# ? Obtains all source files except MAIN | ||
SOURCES = $(filter-out $(MAIN_FILE), $(shell find $(SOURCE_DIRECTORY) -name '*.c')) $(LIB_SOURCES) | ||
# Test cases files | ||
# ? Obtains all test source files | ||
TESTS = $(shell find $(TEST_DIRECTORY) -name '*.c') | ||
# Module name | ||
# ! auto-generated module name (name of directory) | ||
# ? eg. /user/home/dev/so-starter/memory will be memory | ||
MODULE_NAME = $(notdir $(shell pwd)) | ||
# Output file name | ||
OUTPUT = $(BUILD_FOLDER)/$(MODULE_NAME).out | ||
# Test Output file | ||
TEST_OUTPUT = $(BUILD_FOLDER)/$(MODULE_NAME)_test.out | ||
# Leaks log file | ||
LEAKS = $(LOG_FOLDER)/$(MODULE_NAME)_leaks.log | ||
# Thread chek log file | ||
HELGRIND = $(LOG_FOLDER)/$(MODULE_NAME)_threads.log | ||
|
||
|
||
all : compile run | ||
|
||
.PHONY: all | ||
|
||
# ! Avoid modifying this section - (Unless you know what you are doing) -------------------------------------------------------------- | ||
|
||
# Compilation rule | ||
# ? Generates .out executable | ||
compile: | ||
@mkdir -p $(BUILD_FOLDER) | ||
@mkdir -p $(LOG_FOLDER) | ||
@echo Building module: [$(MODULE_NAME)]... | ||
$(CC) $(CFLAGS) $(MAIN_FILE) $(SOURCES) $(INCLUDES) $(LIBS) -o $(OUTPUT) | ||
@echo Build completed. | ||
|
||
# Compiles & Runs executable | ||
# Test compilation | ||
# ? Generates *_test.out executable | ||
run: compile | ||
./$(OUTPUT) | ||
|
||
# Test compilation | ||
# ? Generates *_test.out executable | ||
test-build: | ||
@mkdir -p $(BUILD_FOLDER) | ||
@echo Preparing tests... | ||
$(CC) $(TCFLAGS) $(TESTS) $(SOURCES) $(INCLUDES) $(LIBS) -o $(TEST_OUTPUT) | ||
@echo Test builds! | ||
|
||
# Runs tests cases | ||
test: test-build | ||
@echo Running test cases... | ||
./$(TEST_OUTPUT) | ||
@echo Tests completed. | ||
|
||
# ! Uses Valgrind MemCheck tool | ||
leaks: compile | ||
@mkdir -p log | ||
valgrind --leak-check=yes --log-file="$(LEAKS)" --track-origins=yes ./$(OUTPUT) | ||
|
||
# ! Uses Valgrind Helgrind tool | ||
threads: compile | ||
@mkdir -p log | ||
valgrind --tool=helgrind --log-file="$(HELGRIND)" ./$(OUTPUT) | ||
|
||
# Removes Output files | ||
clean: | ||
$(RM) ./$(OUTPUT) | ||
$(RM) ./$(TEST_OUTPUT) | ||
|
||
# Removes log files | ||
cleanLogs: | ||
$(RM) -r $(LOG_FOLDER) || true | ||
|
||
remove: clean cleanLogs |
Oops, something went wrong.