zoukankan      html  css  js  c++  java
  • sysbench下载安装

    涉及到sysbench源码的配置和编译,首先确认系统安装了gcc gcc-c++编译器;
    确认安装了autoconf 、automake、libtool等;
    [root@PC download]# rpm -qa | grep automake
    [root@PC download]# rpm -qa | grep autoconf
    [root@PC download]# rpm -qa | grep libtool

    必须安装MySQL-devel;

    否则后面make intall的时候会报错:/usr/bin/ld: cannot find -lmysqlclient_r。

    yum install mysql-devel -y

    --开始安装sysbench,点击这里下载:
    tar xzvf sysbench-0.5.tar.gz  
    cd sysbench-0.5  
    chmod +x autogen.sh  
    ./autogen.sh  
    ./configure --with-mysql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/lib64/mysql 
    make  
    make install
    确保make,make install无误才行。
    注意:
    ./configure --with-mysql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/lib64/mysql  这两个目录根据实际系统情况指定。
    不确定的话,可以查找一下:
    [root@PC local]# find / -name mysql
    --假如make时报错:

    [plain] view plain copy
     
    1. drv_mysql.c:36:19: error: mysql.h: No such file or directory  
    2. drv_mysql.c:37:26: error: mysqld_error.h: No such file or directory  
    3. drv_mysql.c:43:5: warning: "MYSQL_VERSION_ID" is not defined  
    4. drv_mysql.c:48:5: warning: "MYSQL_VERSION_ID" is not defined  
    5. drv_mysql.c: In function ‘mysql_drv_init’:  
    6. drv_mysql.c:240: warning: implicit declaration of function ‘mysql_library_init’  
    7. drv_mysql.c:240: warning: nested extern declaration of ‘mysql_library_init’  
    8. drv_mysql.c: In function ‘mysql_drv_connect’:  
    9. drv_mysql.c:262: error: ‘MYSQL’ undeclared (first use in this function)  
    10. drv_mysql.c:262: error: (Each undeclared identifier is reported only once  
    11. drv_mysql.c:262: error: for each function it appears in.)  
    12. drv_mysql.c:262: error: ‘con’ undeclared (first use in this function)  
    13. drv_mysql.c:268: error: expected expression before ‘)’ token  
    14. drv_mysql.c:274: warning: implicit declaration of function ‘mysql_init’  
    15. drv_mysql.c:274: warning: nested extern declaration of ‘mysql_init’  
    16. drv_mysql.c:300: warning: implicit declaration of function ‘mysql_ssl_set’  
    17. drv_mysql.c:300: warning: nested extern declaration of ‘mysql_ssl_set’  
    18. drv_mysql.c:303: error: ‘MYSQL_VERSION_ID’ undeclared (first use in this function)  
    19. drv_mysql.c:313: warning: implicit declaration of function ‘mysql_real_connect’  
    20. drv_mysql.c:313: warning: nested extern declaration of ‘mysql_real_connect’  
    21. drv_mysql.c:320:5: warning: "MYSQL_VERSION_ID" is not defined  
    22. drv_mysql.c:328: warning: implicit declaration of function ‘mysql_errno’  
    23. drv_mysql.c:328: warning: nested extern declaration of ‘mysql_errno’  
    24. drv_mysql.c:329: warning: implicit declaration of function ‘mysql_error’  
    25. drv_mysql.c:329: warning: nested extern declaration of ‘mysql_error’  
    26. drv_mysql.c: In function ‘mysql_drv_disconnect’:  
    27. drv_mysql.c:343: error: ‘MYSQL’ undeclared (first use in this function)  
    28. drv_mysql.c:343: error: ‘con’ undeclared (first use in this function)  
    29. drv_mysql.c:348: warning: implicit declaration of function ‘mysql_close’  
    30. drv_mysql.c:348: warning: nested extern declaration of ‘mysql_close’  
    31. drv_mysql.c: In function ‘mysql_drv_bind_param’:  
    32. drv_mysql.c:423: error: ‘MYSQL’ undeclared (first use in this function)  
    33. drv_mysql.c:423: error: ‘con’ undeclared (first use in this function)  
    34. drv_mysql.c:423: error: expected expression before ‘)’ token  
    35. drv_mysql.c: In function ‘mysql_drv_query’:  
    36. drv_mysql.c:639: error: ‘MYSQL’ undeclared (first use in this function)  
    37. drv_mysql.c:639: error: ‘con’ undeclared (first use in this function)  
    38. drv_mysql.c:643: warning: implicit declaration of function ‘mysql_real_query’  
    39. drv_mysql.c:643: warning: nested extern declaration of ‘mysql_real_query’  
    40. drv_mysql.c:649: error: ‘ER_LOCK_DEADLOCK’ undeclared (first use in this function)  
    41. drv_mysql.c:649: error: ‘ER_LOCK_WAIT_TIMEOUT’ undeclared (first use in this function)  
    42. drv_mysql.c:650: error: ‘ER_CHECKREAD’ undeclared (first use in this function)  
    43. drv_mysql.c: In function ‘mysql_drv_fetch_row’:  
    44. drv_mysql.c:678: warning: implicit declaration of function ‘mysql_fetch_row’  
    45. drv_mysql.c:678: warning: nested extern declaration of ‘mysql_fetch_row’  
    46. drv_mysql.c:678: warning: assignment makes pointer from integer without a cast  
    47. drv_mysql.c: In function ‘mysql_drv_store_results’:  
    48. drv_mysql.c:705: error: ‘MYSQL’ undeclared (first use in this function)  
    49. drv_mysql.c:705: error: ‘con’ undeclared (first use in this function)  
    50. drv_mysql.c:706: error: ‘MYSQL_RES’ undeclared (first use in this function)  
    51. drv_mysql.c:706: error: ‘res’ undeclared (first use in this function)  
    52. drv_mysql.c:707: error: ‘MYSQL_ROW’ undeclared (first use in this function)  
    53. drv_mysql.c:707: error: expected ‘;’ before ‘row’  
    54. drv_mysql.c:751: warning: implicit declaration of function ‘mysql_store_result’  
    55. drv_mysql.c:751: warning: nested extern declaration of ‘mysql_store_result’  
    56. drv_mysql.c:757: error: ‘ER_LOCK_DEADLOCK’ undeclared (first use in this function)  
    57. drv_mysql.c:757: error: ‘ER_LOCK_WAIT_TIMEOUT’ undeclared (first use in this function)  
    58. drv_mysql.c:758: error: ‘ER_CHECKREAD’ undeclared (first use in this function)  
    59. drv_mysql.c:765: warning: implicit declaration of function ‘mysql_field_count’  
    60. drv_mysql.c:765: warning: nested extern declaration of ‘mysql_field_count’  
    61. drv_mysql.c:772: warning: implicit declaration of function ‘mysql_num_rows’  
    62. drv_mysql.c:772: warning: nested extern declaration of ‘mysql_num_rows’  
    63. drv_mysql.c:776: error: ‘row’ undeclared (first use in this function)  
    64. drv_mysql.c: In function ‘mysql_drv_free_results’:  
    65. drv_mysql.c:799: warning: implicit declaration of function ‘mysql_free_result’  
    66. drv_mysql.c:799: warning: nested extern declaration of ‘mysql_free_result’  
    67. drv_mysql.c:799: error: ‘MYSQL_RES’ undeclared (first use in this function)  
    68. drv_mysql.c:799: error: expected expression before ‘)’ token  

    请检查下--with-mysql-includes=/usr/local/mysql/include该路径是否配置正确。如,最上方报错:drv_mysql.c:36:19: error: mysql.h: No such file or directory

    查找一下mysql.h是否在某个Include目录下存在。

    安装完成后,检查该工具是否可以使用:
    [root@PC local]# sysbench --help

    [plain] view plain copy
     
    1. Missing required command argument.  
    2. Usage:  
    3.   sysbench [general-options]... --test=<test-name> [test-options]... command  
    4.   
    5.   
    6. General options:  
    7.   --num-threads=N            number of threads to use [1]  
    8.   --max-requests=N           limit for total number of requests [10000]  
    9.   --max-time=N               limit for total execution time in seconds [0]  
    10.   --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off]  
    11.   --thread-stack-size=SIZE   size of stack per thread [64K]  
    12.   --tx-rate=N                target transaction rate (tps) [0]  
    13.   --tx-jitter=N              target transaction variation, in microseconds [0]  
    14.   --report-interval=N        periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]  
    15.   --test=STRING              test to run  
    16.   --debug=[on|off]           print more debugging info [off]  
    17.   --validate=[on|off]        perform validation checks where possible [off]  
    18.   --help=[on|off]            print help and exit  
    19.   --version=[on|off]         print version and exit [off]  
    20.   --rand-init=[on|off]       initialize random number generator [off]  
    21.   --rand-type=STRING         random numbers distribution {uniform,gaussian,special} [special]  
    22.   --rand-spec-iter=N         number of iterations used for numbers generation [12]  
    23.   --rand-spec-pct=N          percentage of values to be treated as 'special' (for special distribution) [1]  
    24.   --rand-spec-res=N          percentage of 'special' values to use (for special distribution) [75]  
    25.   --rand-seed=N              seed for random number generator, ignored when 0 [0]  
    26.   
    27.   
    28. Log options:  
    29.   --verbosity=N      verbosity level {5 - debug, 0 - only critical messages} [3]  
    30.   
    31.   
    32.   --percentile=N      percentile rank of query response times to count [95]  
    33.   
    34.   
    35. Compiled-in tests:  
    36.   fileio - File I/O test  
    37.   cpu - CPU performance test  
    38.   memory - Memory functions speed test  
    39.   threads - Threads subsystem performance test  
    40.   mutex - Mutex performance test  
    41.   
    42.   
    43. Commands: prepare run cleanup help version  
    44.   
    45.   
    46. See 'sysbench --test=<name> help' for a list of options for each test.  

    假如找不到sysbench命令,有可能make,make install的时候就报错了。请返回查看,解决报错问题后,重新编译。

    --本篇文章参考自:http://www.linuxidc.com/Linux/2014-02/97107p2.htmsysbench下载安装

                                  http://blog.csdn.net/yabingshi_tech/article/details/53113199

  • 相关阅读:
    Java8性能优化之字符串拼接
    Java8字符串分割的几种方式及性能比较
    【Collections:集合工具类:常用方法】
    【ArrayList嵌套HashMap】
    【集合工具类:Collections】
    【HashMap 嵌套 HashMap】
    【HashMap 嵌套 ArrayList】
    【TreeMapDemo】
    【LinkedHashMap】
    【TreeMap】
  • 原文地址:https://www.cnblogs.com/tianfen/p/7090920.html
Copyright © 2011-2022 走看看