├── .clang-format
├── .github
└── workflows
│ └── ci.yaml
├── .gitignore
├── Makefile
├── README.md
├── lib
├── .spec_factory.hpp.swp
├── contention_point.hpp
├── cost.hpp
├── cps
│ ├── buggy_2l_rr_scheduler.hpp
│ ├── leaf_spine.hpp
│ ├── loom_mqprio.hpp
│ ├── priority_scheduler.hpp
│ ├── rr_scheduler.hpp
│ └── tbf.hpp
├── example.hpp
├── input_only_solver.hpp
├── metric.hpp
├── metrics
│ ├── aipg.hpp
│ ├── cblocked.hpp
│ ├── cdeq.hpp
│ ├── cenq.hpp
│ ├── deq.hpp
│ ├── dst.hpp
│ ├── ecmp.hpp
│ └── qsize.hpp
├── net_context.hpp
├── params.hpp
├── qms
│ ├── buggy_2l_rr_qm.hpp
│ ├── leaf_forwarding_qm.hpp
│ ├── loom_demux_qm.hpp
│ ├── loom_flow_enq_qm.hpp
│ ├── loom_nic_enq_qm.hpp
│ ├── priority_qm.hpp
│ ├── rr_qm.hpp
│ ├── spine_forwarding_qm.hpp
│ ├── switch_xbar_qm.hpp
│ └── tbf_qm.hpp
├── query.hpp
├── queue.hpp
├── queuing_module.hpp
├── search.hpp
├── shared_config.hpp
├── solver.hpp
├── spec_factory.hpp
├── tests.hpp
├── util.hpp
└── workload.hpp
├── scripts
├── perf.sh
└── run.sh
├── src
├── contention_point.cpp
├── cost.cpp
├── cps
│ ├── buggy_2l_rr_scheduler.cpp
│ ├── leaf_spine.cpp
│ ├── loom_mqprio.cpp
│ ├── priority_scheduler.cpp
│ ├── rr_scheduler.cpp
│ └── tbf.cpp
├── example.cpp
├── input_only_solver.cpp
├── main.cpp
├── metric.cpp
├── metrics
│ ├── aipg.cpp
│ ├── cblocked.cpp
│ ├── cdeq.cpp
│ ├── cenq.cpp
│ ├── deq.cpp
│ ├── dst.cpp
│ ├── ecmp.cpp
│ └── qsize.cpp
├── net_context.cpp
├── qms
│ ├── buggy_2l_rr_qm.cpp
│ ├── leaf_forwarding_qm.cpp
│ ├── loom_demux_qm.cpp
│ ├── loom_flow_enq_qm.cpp
│ ├── loom_nic_enq_qm.cpp
│ ├── priority_qm.cpp
│ ├── rr_qm.cpp
│ ├── spine_forwarding_qm.cpp
│ ├── switch_xbar_qm.cpp
│ └── tbf_qm.cpp
├── query.cpp
├── queue.cpp
├── queuing_module.cpp
├── search.cpp
├── shared_config.cpp
├── solver.cpp
├── spec_factory.cpp
├── tests.cpp
├── util.cpp
└── workload.cpp
└── tests
├── main.cpp
├── rr_scheduler_test.cpp
├── rr_scheduler_test.hpp
├── search_test.cpp
├── search_test.hpp
├── simple_cp.cpp
├── simple_cp.hpp
├── tbf_test.cpp
├── tbf_test.hpp
├── test_class.hpp
├── test_runner.cpp
└── test_runner.hpp
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | #Reference: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
3 | Language: Cpp
4 | IndentWidth: 4
5 | TabWidth: 4
6 | PointerAlignment: Left
7 | AccessModifierOffset: -4
8 | Cpp11BracedListStyle: true
9 | BinPackArguments: false
10 | BinPackParameters: false
11 | ColumnLimit: 100
12 | SpaceBeforeCpp11BracedList: false
13 | ConstructorInitializerIndentWidth: 0
14 | PackConstructorInitializers: CurrentLine
15 | AllowShortIfStatementsOnASingleLine: WithoutElse
16 | BreakConstructorInitializers: AfterColon
17 | SpaceBeforeInheritanceColon: true
18 | SpaceBeforeCtorInitializerColon: false
19 | #
20 | AllowShortFunctionsOnASingleLine: None
21 | SpaceBeforeParens: Custom
22 | SpaceBeforeParensOptions:
23 | AfterOverloadedOperator: false
24 | SpaceAfterCStyleCast: true
25 | MaxEmptyLinesToKeep: 3
26 | PenaltyBreakAssignment: 200
27 | PenaltyBreakBeforeFirstCallParameter: 100
28 | AllowShortCaseLabelsOnASingleLine: true
29 | AlignAfterOpenBracket: Align
30 | IndentCaseLabels: true
31 | ...
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yaml:
--------------------------------------------------------------------------------
1 | name: CI Workflow
2 | on: [ push ]
3 | jobs:
4 | format:
5 | runs-on: self-hosted
6 | steps:
7 | - name: Checkout the repository
8 | uses: actions/checkout@v3
9 | - name: Check format
10 | run: make check-format
11 | build:
12 | runs-on: self-hosted
13 | needs: [ format ]
14 | steps:
15 | - name: Checkout the repository
16 | uses: actions/checkout@v3
17 | - name: Make
18 | run: make -j2 clean all build/fperf_test
19 | - name: Upload fperf executable
20 | uses: actions/upload-artifact@v3
21 | with:
22 | name: fperf
23 | path: build/fperf
24 | - name: Upload unit test executable
25 | uses: actions/upload-artifact@v3
26 | with:
27 | name: fperf_test
28 | path: build/fperf_test
29 | unit-test:
30 | runs-on: self-hosted
31 | needs: [ build ]
32 | steps:
33 | - name: Download test artifact
34 | uses: actions/download-artifact@v3
35 | with:
36 | name: fperf_test
37 | - name: Making test artifact executable
38 | run: chmod +x fperf_test
39 | - name: Run tests
40 | run: ./fperf_test
41 | e2e-test:
42 | runs-on: self-hosted
43 | needs: [ build, unit-test ]
44 | steps:
45 | - name: Download fperf artifact
46 | uses: actions/download-artifact@v3
47 | with:
48 | name: fperf
49 | - name: Making fperf artifact executable
50 | run: chmod +x fperf
51 | - name: Run the fperf
52 | run: ./fperf rr
53 |
54 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.log
3 |
4 | # For Windows/Visual Studio installations
5 | .vs/
6 | x64/
7 | fperf.*
8 | libz3.dll
9 | .DS_Store
10 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CXX := g++
2 | CXXFLAGS := -pedantic-errors -Wno-sign-compare -Wno-unknown-pragmas -Wall -Wextra -Werror -std=c++17 -O3
3 | LDFLAGS := -L/usr/lib -L/usr/local/lib/ -lstdc++ -lm -lz3
4 | BUILD := ./build
5 | OBJ_DIR := $(BUILD)/objects
6 | APP_DIR := $(BUILD)
7 | TARGET := fperf
8 | INCLUDE := -I/usr/local/include -Ilib/ -Ilib/metrics/ -Ilib/cps -Ilib/qms
9 | SRC := $(wildcard src/*.cpp) \
10 | $(wildcard src/*/*.cpp)
11 | TEST_SRC := $(wildcard tests/*.cpp)
12 | TEST_TARGET_PATH := $(APP_DIR)/$(TARGET)_test
13 |
14 | HEADERS := $(patsubst src/%.cpp,lib/%.hpp, $(filter-out src/main.cpp, $(SRC)))
15 | OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
16 |
17 | all: build $(APP_DIR)/$(TARGET)
18 |
19 | $(OBJ_DIR)/%.o: %.cpp
20 | @mkdir -p $(@D)
21 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
22 |
23 | $(APP_DIR)/$(TARGET): $(OBJECTS)
24 | @mkdir -p $(@D)
25 | $(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
26 |
27 | .PHONY: all build clean test check-format format
28 |
29 | build:
30 | @mkdir -p $(APP_DIR)
31 | @mkdir -p $(OBJ_DIR)
32 |
33 | run:
34 | ./$(APP_DIR)/$(TARGET)
35 |
36 | $(TEST_TARGET_PATH): $(OBJECTS) $(TEST_SRC)
37 | $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ $(TEST_SRC) $(filter-out ./build/objects/src/main.o, $(OBJECTS)) $(LDFLAGS)
38 |
39 | test: $(TEST_TARGET_PATH)
40 | $^
41 |
42 | check-format: $(HEADERS) $(SRC)
43 | clang-format --dry-run -Werror $^
44 |
45 | format: $(HEADERS) $(SRC)
46 | clang-format -i $^
47 |
48 | clean:
49 | -@rm -rvf $(OBJ_DIR)/*
50 | -@rm -rvf $(APP_DIR)/*
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # fperf
2 |
3 | [Formal Methods for Network Performance Analysis](https://mina.arashloo.net/docs/fperf.pdf), Mina Tahmasbi Arashloo, Ryan Beckett, Rachit Agarwal, NSDI'23
4 |
5 |
6 |
7 | The stand-alone priority schedulers, composition of schedulers, and throughput analysis on a leaf-spine topology. More to come soon!
8 |
9 | ## Installation
10 | fperf currently runs on Z3 v4.8.11 [link](https://github.com/Z3Prover/z3/releases/tag/z3-4.8.11)
11 |
12 | ### Windows with Visual Studio
13 | 1. Download fperf through github
14 | 2. Create a new project in Visual Studio in the fperf folder
15 | 3. Download Z3 for windows [here](https://github.com/Z3Prover/z3/releases/tag/z3-4.8.11)
16 | 4. Build Z3 with the instructions from [here](https://github.com/exercism/z3/blob/main/docs/INSTALLATION.md) under **Building Z3 on Windows using Visual Studio Command Prompt**
17 | 5. Go to "Project" -> "Properties" and in the General tab and perform the following:
18 | - Set "Platform Toolset" to "LLVM"
19 | - Set "C++ Language Standard" to "C++ 17 Standard"
20 | 6. Under the same "Configuration Properties" page, go to "C/C++" -> "General" -> "Include Additional Directories" and add the following:
21 | - `[path to z3]\z3\src\api`
22 | - `[path to z3]\z3\src\api\c++`
23 | The following may be required if Visual Studio doesn't recognize the subfolders of fperf
24 | - `[path to fperf]\fperf\src\qms`
25 | - `[path to fperf]\fperf\src\metrics`
26 | - `[path to fperf]\fperf\src\cps`
27 | - `[path to fperf]\fperf\src`
28 | - `[path to fperf]\fperf\lib\cps`
29 | - `[path to fperf]\fperf\lib\metrics`
30 | - `[path to fperf]\fperf\lib\qms`
31 | - `[path to fperf]\fperf\lib`
32 | 7. Under "Linker" -> "General" -> "Include Additional Directories", add `[path to z3]\z3\build\`
33 | 8. Under "Linker" -> "Input", add `[path to z3]\z3\build\libz3.lib`
34 | 9. Press the green arrow in the top bar of Visual Studio to run fperf
35 |
--------------------------------------------------------------------------------
/lib/.spec_factory.hpp.swp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-things-networking/fperf/ec3f914929f4e6456ea87a4103239a3520820371/lib/.spec_factory.hpp.swp
--------------------------------------------------------------------------------
/lib/contention_point.hpp:
--------------------------------------------------------------------------------
1 | // contention_point.hpp
2 | // FPerf
3 | //
4 | // Created by Mina Tahmasbi Arashloo on 11/12/20.
5 | // Copyright © 2020 Mina Tahmasbi Arashloo. All rights reserved.
6 | //
7 |
8 | #ifndef contention_point_hpp
9 | #define contention_point_hpp
10 |
11 | #include