Browse Source

最初のコミット

main
first_user 10 months ago
commit
4b96cc9bcd
  1. 32
      hoge.sh

32
hoge.sh

@ -0,0 +1,32 @@
cat >hoge.cpp <<EOF
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <cstdint>
int main() {
int f = open("hoge.txt", O_CREAT|O_SYNC|O_RDWR, 0644);
uint8_t data[4096] = {0};
while(true) {
write(f, data, 4096);
lseek(f, 0, SEEK_SET);
}
close(f);
return 0;
}
EOF
g++ -g hoge.cpp -o hoge
for pcount in $(seq 0 $(nproc --all)); do
echo "[dummy process count: $pcount]"
/usr/bin/time ./hoge&
pid_time=$!
pid_dummy=''
for i in $(seq $pcount); do
sh -c 'while :;do :;done'&
pid_dummy="$pid_dummy $!"
done
vmstat 1 10
pid_hoge=$(ps -o pid= --ppid $pid_time)
kill $pid_hoge $pid_dummy
wait
done
Loading…
Cancel
Save