Skip to content
Closed
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
13 changes: 13 additions & 0 deletions .github/probe/heavy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <algorithm>
#include <format>
#include <functional>
#include <map>
#include <ranges>
#include <regex>
#include <sstream>
#include <string>
int main() {
std::regex re("a+b");
std::map<std::string, int> m{{"a", 1}};
return std::regex_match(std::format("{}ab", "a"), re) ? 0 : 1;
}
23 changes: 23 additions & 0 deletions .github/probe/macos-memory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Prints, never asserts: the counts behind mcpplibs.os memory_available on macOS while three and
# six compilers run, and the kernel's own measure beside them.
set -u
here=$(cd "$(dirname "$0")" && pwd)
work=$(mktemp -d)
sw_vers; sysctl hw.memsize hw.activecpu hw.physicalcpu kern.memorystatus_level
clang -O1 -o "$work/sampler" "$here/sampler.c" || exit 0
echo "== idle"; "$work/sampler" 5
for n in 3 6; do
echo "== $n compilers"
"$work/sampler" 120 > "$work/samples-$n.txt" &
sampler=$!
start=$(date +%s)
for i in $(seq 1 "$n"); do clang++ -std=c++23 -O2 -c "$here/heavy.cpp" -o "$work/heavy-$i.o" & done
wait $(jobs -p | grep -vx "$sampler")
echo "compiles took $(( $(date +%s) - start )) s"
kill "$sampler" 2>/dev/null; wait "$sampler" 2>/dev/null
sort -t'|' -k1,1 "$work/samples-$n.txt" | awk '{print $2}' | sort -n | head -1 | sed 's/^/min free+inactive MiB: /'
awk -F'level ' '{print $2}' "$work/samples-$n.txt" | sort -n | head -1 | sed 's/^/min memorystatus_level: /'
head -3 "$work/samples-$n.txt"; echo ...; tail -3 "$work/samples-$n.txt"
done
echo "== after"; "$work/sampler" 3
30 changes: 30 additions & 0 deletions .github/probe/sampler.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Samples the counts mcpplibs.os reads for memory_available on macOS (free + inactive), beside
// the other reclaimable counts and the kernel's own percentage (kern.memorystatus_level).
#include <mach/mach.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <unistd.h>

int main(int argc, char** argv) {
int samples = argc > 1 ? atoi(argv[1]) : 1;
vm_size_t page = 0;
host_page_size(mach_host_self(), &page);
for (int i = 0; i < samples; ++i) {
vm_statistics64_data_t vm;
mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t)&vm, &count);
int level = -1;
size_t len = sizeof level;
sysctlbyname("kern.memorystatus_level", &level, &len, NULL, 0);
const double mib = (double)page / (1024.0 * 1024.0);
printf("free+inactive %7.0f MiB | free %6.0f inactive %6.0f speculative %6.0f purgeable %6.0f "
"external %6.0f compressor %6.0f wired %6.0f | memorystatus_level %d%%\n",
(vm.free_count + vm.inactive_count) * mib, vm.free_count * mib, vm.inactive_count * mib,
vm.speculative_count * mib, vm.purgeable_count * mib, vm.external_page_count * mib,
vm.compressor_page_count * mib, vm.wire_count * mib, level);
fflush(stdout);
if (i + 1 < samples) usleep(200000);
}
return 0;
}
163 changes: 0 additions & 163 deletions .github/workflows/aur-publish.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .github/workflows/bench.yml

This file was deleted.

Loading
Loading