Skip to content

Instantly share code, notes, and snippets.

View yuezato's full-sized avatar

Yuya Uezato yuezato

View GitHub Profile
/* Compile this file via `g++ -std=c++11 (-O3) FILENAME` */
#include <iostream>
#include <set>
#include <tuple>
#include <algorithm>
#include <ctime>
#include <chrono>
using namespace std;

PROGRAM2 cache1 <- cache1 + mem1

gcc -O3 -Wall -mavx2 read_write.c -DPROGRAM2
/Users/yuuya_uezato/cache$ for i in {0..10}; do ./a.out ; done
cache1 <- cache1 + mem1
elapsed = 353.935910 ms
cache1 <- cache1 + mem1
elapsed = 359.755992 ms
cache1 <- cache1 + mem1
elapsed = 363.224911 ms
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <immintrin.h>
__attribute__((noinline))
double milliDiff(struct timespec *start, struct timespec *end)
{
return
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <immintrin.h>
#include <xmmintrin.h>
#include <time.h>
#include <string.h>
double milliDiff(struct timespec *start, struct timespec *end)
{
$ gcc -O3 -Wall -mavx2 xor_program.c -DPROGRAM1
$ ./a.out
elapsed = 55.105000
$ gcc -O3 -Wall -mavx2 xor_program.c -DPROGRAM2
$ ./a.out
elapsed = 31.889001
@yuezato
yuezato / memkpy.c
Last active December 9, 2020 04:41
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include <stdint.h>
#include <stdlib.h>
double to_milli(struct timespec *time)
{
return
typedef struct Type {
  uint32_t v[2];
} Type;

memcpy1(){
  ...
  for(...) {
    b[i].v[0] = a[i].v[0];
 b[i].v[1] = a[i].v[1];
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <ctype.h>
#include <stdbool.h>
#!/usr/local/bin/bpftrace
#include "gfp.h"
#include "ahci.h"
#include <linux/fs.h>
#include <linux/uio.h>
#include <linux/bio.h>
#include <linux/genhd.h>
#include <linux/blkdev.h>
#include <scsi/scsi_device.h>

ファイルシステムのwriteがどうやってdiskにたどり着くか

dd if=/dev/urandom of=/dev/sdb oflag=direct bs=1K count=30

みたいなことをした時に、どう書き込まれるかを調べる。

[blk_account_io_start]
        blk_account_io_start+1