u0u0 发布的文章

Qemu在Linux安装新系统一次成功,在window下卡启动报告~

安装 qemu

apt-get instll qemu qemu-utils qemu-system-x86

新建虚拟机,安装系统

qemu-img create -f qcow2 ubunut18_x86_64.img 10G
qemu-img info ubunut18_x86_64.img
qemu-system-x86_64 --enable-kvm -m 1G -smp 2 -boot order=dc -hda /home/u0u0/works/qemu-images/ubuntu18.img -cdrom /home/u0u0/ubuntu-18.04.5-live-server-amd64.iso

阅读剩余部分

win10下用WSL编译

环境

  1. win10安装WSL
  2. 安装Ubuntu 20.04 LTS
  3. sudo apt-get install yasm make

编译

  1. "D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
  2. bash
  3. ./configure --toolchain=msvc --arch=x86_32 --enable-x86asm --enable-shared --enable-w32threads --disable-doc --disable-static --enable-optimizations --disable-debug --prefix=output
  4. make install

Mac 编译

m1机器编译arm64

./configure --arch=arm64 --disable-shared --enable-pthreads --disable-doc --enable-static --enable-optimizations --disable-debug --prefix=output_arm64
make install

intel机器编译x86_64

./configure --arch=x86_64 --disable-shared --enable-pthreads --disable-doc --enable-static --enable-optimizations --disable-debug --prefix=output_x86_64
make install

合并

lipo -create output_arm64/lib/libavcodec.a output_x86_64/lib/libavcodec.a -output /prebuilt/mac/libavcodec.a
strip -S /prebuilt/mac/libavcodec.a

now1 := time.Now()
time.Sleep(18 * time.Microsecond)
now2 := time.Now()
fmt.Println(now2.Sub(now1))

---- output ----
30.938µs
33.749µs
26.979µs
26.146µs
25.52µs
25.209µs
27.292µs
25µs
150.52µs
28.021µs
27.656µs
25.52µs
146.77µs
27.709µs
25µs
142.447µs
149.843µs

安装gcc7和g++7

sudo apt install gcc-7 g++-7

添加配置

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7

切换gcc版本

sudo update-alternatives --config gcc

测试命令

sysbench --test=oltp_read_write --tables=10 --table-size=1000000 --report-interval=10 --time=3600 --threads=50 --db-driver=mysql --mysql-socket=/tmp/mysql.sock --mysql-user=root --mysql-password='xxxx' --mysql-db=sbtest run

8.0.21 测试结果

SQL statistics:
    queries performed:
        read:                            15339058
        write:                           4382588
        other:                           2191294
        total:                           21912940
    transactions:                        1095647 (304.28 per sec.)
    queries:                             21912940 (6085.57 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          3600.8045s
    total number of events:              1095647

Latency (ms):
         min:                                    2.74
         avg:                                  164.30
         max:                                 5033.06
         95th percentile:                      707.07
         sum:                            180014353.79

Threads fairness:
    events (avg/stddev):           21912.9400/80.08
    execution time (avg/stddev):   3600.2871/0.22

8.0.23 测试结果

SQL statistics:
    queries performed:
        read:                            2969064
        write:                           848304
        other:                           424152
        total:                           4241520
    transactions:                        212076 (58.89 per sec.)
    queries:                             4241520 (1177.79 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          3601.2587s
    total number of events:              212076

Latency (ms):
         min:                                    3.57
         avg:                                  848.89
         max:                                 6098.82
         95th percentile:                     1973.38
         sum:                            180029441.14

Threads fairness:
    events (avg/stddev):           4241.5200/32.35
    execution time (avg/stddev):   3600.5888/0.34

清空日志

mysql> reset master;

查询是否开启了binlog

$mysql -uroot -p
mysql>use mysql;
mysql>
mysql> show variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.01 sec)

阅读剩余部分