Skip to content

Commit ad03785

Browse files
committed
implementation of huge page
Add io_uring mode selection (IOPOLL requires further code changes) update subgitmodule
1 parent 1195e6e commit ad03785

31 files changed

+1390
-865
lines changed

cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
2020

2121
add_subdirectory(pixels-common)
2222
add_subdirectory(pixels-core)
23-
#add_subdirectory(pixels-cli)
23+
add_subdirectory(pixels-cli)
2424
add_subdirectory(third-party/googletest)
2525
add_subdirectory(tests)
2626

cpp/include/PixelsReadBindData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace duckdb
4242
std::shared_ptr <PixelsReader> initialPixelsReader;
4343
std::shared_ptr <TypeDescription> fileSchema;
4444
vector <string> files;
45-
atomic <idx_t> curFileId;
45+
atomic <int> curFileId;
4646
};
4747

4848
}

cpp/include/PixelsReadGlobalState.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace duckdb
4040
{
4141
mutex lock;
4242

43-
atomic<int> active_threads; // 活跃线程数
44-
atomic<bool> all_done; // 是否所有线程都已完成
43+
atomic<int> active_threads; // Number of active threads
44+
atomic<bool> all_done; // Whether all threads have completed
4545

4646
//! The initial reader from the bind phase
4747
std::shared_ptr <PixelsReader> initialPixelsReader;

cpp/include/PixelsScanFunction.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ namespace duckdb
113113
PixelsScanInitLocal(ExecutionContext &context, TableFunctionInitInput &input,
114114
GlobalTableFunctionState *gstate_p);
115115

116-
static bool PixelsParallelStateNext(ClientContext &context, const PixelsReadBindData &bind_data,
116+
static bool PixelsParallelStateNext(ClientContext &context, PixelsReadBindData &bind_data,
117117
PixelsReadLocalState &scan_data, PixelsReadGlobalState &parallel_state,
118118
bool is_init_state = false);
119119

cpp/perf.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
# Check number of arguments
4+
if [ $# -ne 2 ]; then
5+
echo "Usage: $0 <query_file> <output_file_prefix>"
6+
echo "Example: $0 test_q01.sql query_1"
7+
exit 1
8+
fi
9+
10+
# Assign parameters
11+
QUERY_FILE="$1"
12+
OUTPUT_PREFIX="$2"
13+
14+
# Record start time (nanoseconds)
15+
START_TIME=$(date +%s%N)
16+
PREVIOUS_TIME=$START_TIME
17+
18+
# Function to display time duration
19+
show_time() {
20+
local start=$1
21+
local end=$2
22+
local stage=$3
23+
24+
# Calculate duration in milliseconds (integer arithmetic in bash)
25+
local duration=$(( (end - start) / 1000000 ))
26+
echo "Stage '$stage' duration: ${duration}ms"
27+
}
28+
29+
echo "Starting performance analysis..."
30+
31+
# Run perf recording
32+
echo "1. Running perf record..."
33+
sudo -E perf record -F 1 --call-graph=dwarf -g ./build/release/duckdb < "$QUERY_FILE"
34+
CURRENT_TIME=$(date +%s%N)
35+
show_time $PREVIOUS_TIME $CURRENT_TIME "Running perf record"
36+
PREVIOUS_TIME=$CURRENT_TIME
37+
38+
# Generate perf script output
39+
echo "2. Generating perf script output..."
40+
sudo perf script -i perf.data > "${OUTPUT_PREFIX}.perf"
41+
CURRENT_TIME=$(date +%s%N)
42+
show_time $PREVIOUS_TIME $CURRENT_TIME "Generating perf script output"
43+
PREVIOUS_TIME=$CURRENT_TIME
44+
45+
# Collapse call stacks
46+
echo "3. Collapsing call stacks..."
47+
stackcollapse-perf.pl "${OUTPUT_PREFIX}.perf" > "${OUTPUT_PREFIX}.folded"
48+
CURRENT_TIME=$(date +%s%N)
49+
show_time $PREVIOUS_TIME $CURRENT_TIME "Collapsing call stacks"
50+
PREVIOUS_TIME=$CURRENT_TIME
51+
52+
# Generate flame graph
53+
echo "4. Generating flame graph..."
54+
flamegraph.pl "${OUTPUT_PREFIX}.folded" > "${OUTPUT_PREFIX}-cpu.svg"
55+
CURRENT_TIME=$(date +%s%N)
56+
show_time $PREVIOUS_TIME $CURRENT_TIME "Generating flame graph"
57+
PREVIOUS_TIME=$CURRENT_TIME
58+
59+
# Rename perf data file
60+
echo "5. Renaming perf data file..."
61+
mv perf.data "${OUTPUT_PREFIX}-perf.data"
62+
CURRENT_TIME=$(date +%s%N)
63+
show_time $PREVIOUS_TIME $CURRENT_TIME "Renaming files"
64+
PREVIOUS_TIME=$CURRENT_TIME
65+
66+
# Calculate total duration
67+
TOTAL_DURATION=$(( (CURRENT_TIME - START_TIME) / 1000000 ))
68+
echo "Total duration: ${TOTAL_DURATION}ms"
69+
70+
echo "Operation completed. Generated files:"
71+
echo "${OUTPUT_PREFIX}.perf"
72+
echo "${OUTPUT_PREFIX}.folded"
73+
echo "${OUTPUT_PREFIX}-cpu.svg"
74+
echo "${OUTPUT_PREFIX}-perf.data"

0 commit comments

Comments
 (0)