1<!DOCTYPE html> 2<html> 3<head> 4 <title>compile_smartperf</title> 5 <meta charset="utf-8"> 6 <meta content="width=device-width, initial-scale=1.0" name="viewport"> 7 8 <style> 9 code[class*="font-"], 10 pre[class*="font-"] { 11 text-align: left; 12 color: #333333; 13 background: none; 14 word-spacing: normal; 15 white-space: pre; 16 word-break: normal; 17 word-wrap: normal; 18 line-height: 1.5; 19 -moz-hyphens: none; 20 -ms-hyphens: none; 21 -o-tab-size: 8; 22 tab-size: 8; 23 -moz-tab-size: 8; 24 -webkit-hyphens: none; 25 hyphens: none; 26 font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 27 } 28 29 pre[class*="font-"] { 30 border-radius: 3px; 31 background: #F5F5F5; 32 padding: 0.8em; 33 overflow: auto; 34 } 35 36 :not(pre) > code[class*="font-"] { 37 white-space: normal; 38 background: #F5F5F5; 39 padding: 0.2em; 40 border-radius: 0.3em; 41 } 42 43 44 .temporary.cdata { 45 color: #183690; 46 } 47 48 .temporary.comment, 49 .temporary.blockquote { 50 color: #969897; 51 } 52 53 .temporary.doctype, 54 .temporary.punctuation, 55 .temporary.variable, 56 .temporary.macro.property { 57 color: #333333; 58 } 59 60 61 .temporary.string, 62 .temporary.url, 63 .temporary.regex, 64 .temporary.attr-value { 65 color: #183690; 66 } 67 68 .temporary.operator, 69 .temporary.important, 70 .temporary.keyword, 71 .temporary.rule, 72 .temporary.builtin { 73 color: #a71d5c; 74 } 75 76 .temporary.atrule, 77 .temporary.constant, 78 .temporary.symbol, 79 .temporary.command, 80 .temporary.property, 81 .temporary.number, 82 .temporary.boolean, 83 .temporary.entity, 84 .temporary.code { 85 color: #0086b2; 86 } 87 88 .temporary.tag, 89 .temporary.selector, 90 .temporary.prolog { 91 color: #63a35e; 92 } 93 94 .temporary.entity { 95 cursor: help; 96 } 97 98 .temporary.title, 99 .temporary.title .temporary.punctuation { 100 font-weight: bold; 101 color: #1d3e89; 102 } 103 104 .temporary.list { 105 color: #ed6a48; 106 } 107 108 .temporary.function, 109 .temporary.namespace, 110 .temporary.pseudo-element, 111 .temporary.class, 112 .temporary.class-name, 113 .temporary.pseudo-class, 114 .temporary.id, 115 .temporary.url-reference .temporary.variable, 116 .temporary.attr-name { 117 color: #795da2; 118 } 119 120 .temporary.inserted { 121 color: #55a535; 122 background-color: #eaffee; 123 } 124 125 .temporary.bold { 126 font-weight: bold; 127 } 128 129 .temporary.deleted { 130 color: #bd2c08; 131 background-color: #ffecea; 132 } 133 134 .font-json .temporary.property { 135 color: #183690; 136 } 137 138 .temporary.italic { 139 font-style: italic; 140 } 141 142 .font-markup .temporary.tag .temporary.punctuation { 143 color: #333333; 144 } 145 146 .font-yaml .temporary.atrule { 147 color: #63a35a; 148 } 149 150 code.font-css, 151 .font-css .temporary.function { 152 color: #0086b8; 153 } 154 155 code.font-yaml { 156 color: #183690; 157 } 158 159 .font-ruby .temporary.function { 160 color: #333333; 161 } 162 163 .font-markdown .temporary.url { 164 color: #795da2; 165 } 166 167 .font-makefile .temporary.variable { 168 color: #183690; 169 } 170 171 .font-makefile .temporary.builtin { 172 color: #0086b3; 173 } 174 175 .font-makefile .temporary.symbol { 176 color: #795da2; 177 } 178 179 .font-bash .temporary.keyword { 180 color: #0086b3; 181 } 182 183 pre[data-wire] { 184 padding: 1em 0 1em 2em; 185 position: relative; 186 } 187 188 pre[data-wire] .line-highlight-wrapper { 189 background-color: transparent; 190 top: 2px; 191 left: 2px; 192 display: block; 193 width: 100%; 194 position: absolute; 195 } 196 197 pre[data-wire] .line-highlight { 198 position: absolute; 199 left: 2px; 200 right: 2px; 201 pointer-events: none; 202 margin-top: 3em; 203 background: hsla(25, 10%, 55%,.06); 204 background: linear-gradient(to right, hsla(25, 10%, 40%,.2) 80%, hsla(23, 24%, 52%,0)); 205 line-height: inherit; 206 white-space: pre; 207 } 208 209 pre[data-wire] .line-highlight:before, 210 pre[data-wire] .line-highlight[data-end]:after { 211 content: attr(data-start); 212 position: absolute; 213 background-color: hsla(22, 25%, 54%,.5); 214 min-width: 2em; 215 padding: 0 .6em; 216 top: 0.5em; 217 left: 0.4em; 218 color: hsl(22, 23%, 90%); 219 vertical-align: 0.3em; 220 border-radius: 10px; 221 text-shadow: none; 222 box-shadow: 0 2px white; 223 font: bold 60%/1.6 sans-serif; 224 text-align: center; 225 } 226 227 pre[data-wire] .line-highlight[data-end]:after { 228 bottom: 0.6em; 229 content: attr(data-end); 230 top: auto; 231 } 232 233 body > :first-child { 234 margin-top: 0; 235 } 236 237 body { 238 font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; 239 line-height: 1.6; 240 color: #333333; 241 background-color: #FFFFFF; 242 font-size: 16px; 243 overflow: initial; 244 word-wrap: break-word; 245 box-sizing: border-box; 246 } 247 248 body h1, body h2, body h3, body h4, body h5{ 249 line-height: 1.2; 250 margin-bottom: 16px; 251 margin-top: 1em; 252 color: #000000; 253 } 254 255 body h1 { 256 font-weight: 300; 257 font-size: 2.25em; 258 padding-bottom: 0.3em 259 } 260 261 body h2 { 262 font-weight: 400; 263 padding-bottom: 0.3em; 264 font-size: 1.75em; 265 } 266 267 body h3 { 268 font-weight: 500; 269 font-size: 1.5em; 270 } 271 272 body h4 { 273 font-weight: 600; 274 font-size: 1.25em; 275 } 276 277 body h5 { 278 font-weight: 600; 279 font-size: 1.1em; 280 } 281 282 body strong { 283 color: #000000; 284 } 285 286 body h1, body h2, body h3, body h4, body h5 { 287 font-weight: 600; 288 } 289 290 body del { 291 color: #5c5c5c; 292 } 293 294 body a:not([href]) { 295 text-decoration: none; 296 color: inherit; 297 } 298 299 body a { 300 text-decoration: none; 301 color: #08c; 302 } 303 304 body a:hover { 305 color: #00a3f5; 306 text-decoration: none; 307 } 308 309 body > p { 310 margin-bottom: 16px; 311 margin-top: 0; 312 word-wrap: break-word; 313 } 314 315 body img { 316 max-width: 100%; 317 } 318 319 body > ul, body > ol { 320 margin-bottom: 16px; 321 } 322 323 body ul, body ol { 324 padding-left: 2em; 325 } 326 327 body ul ul, body ul ol, body ol ol, body ol ul { 328 margin-top: 0; 329 margin-bottom: 0; 330 } 331 332 body ul.no-list, body ol.no-list { 333 padding: 0; 334 list-style-type: none; 335 } 336 337 body li.task-list-item { 338 list-style: none; 339 } 340 341 body li { 342 margin-bottom: 0; 343 } 344 345 body .task-list-item-checkbox { 346 vertical-align: middle; 347 margin: 0 .2em .25em -1.8em; 348 } 349 350 body li > p { 351 margin-bottom: 0; 352 margin-top: 0; 353 } 354 355 body .task-list-item-checkbox:hover { 356 cursor: pointer; 357 } 358 359 body blockquote { 360 color: #5c5c5c; 361 margin: 16px 0 0 0; 362 font-size: inherit; 363 padding: 0 15px; 364 background-color: #f0f0f0; 365 border-left: 4px solid #d6d6d6; 366 } 367 368 body blockquote > :first-child { 369 margin-top: 0; 370 } 371 372 body blockquote > :last-child { 373 margin-bottom: 0; 374 } 375 376 body hr { 377 margin: 32px 0 0 0; 378 height: 4px; 379 border: 0 none; 380 background-color: #d6d6d6; 381 } 382 383 body table { 384 display: block; 385 width: 100%; 386 margin: 10px 0 15px 0; 387 border-collapse: collapse; 388 border-spacing: 0; 389 word-break: normal; 390 overflow: auto; 391 word-break: keep-all; 392 } 393 394 body table th { 395 font-weight: bold; 396 color: #000000; 397 } 398 399 body table td, body table th { 400 padding: 6px 13px 0 0; 401 border: 1px solid #d6d6d6; 402 } 403 404 body dl { 405 padding: 0; 406 } 407 408 body dl dd { 409 padding: 0 16px 0 0; 410 margin-bottom: 16px; 411 } 412 413 body dl dt { 414 margin-top: 16px; 415 font-size: 1em; 416 padding: 0; 417 font-style: italic; 418 font-weight: bold; 419 } 420 421 body code { 422 color: #000000; 423 font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; 424 font-size: .85em !important; 425 background-color: #f0f0f0; 426 padding: 0.2em 0 0 0; 427 border-radius: 3px; 428 } 429 430 body code::before, body code::after { 431 content: "\00a0"; 432 letter-spacing: -0.2em; 433 } 434 435 body pre > code { 436 font-size: .85em !important; 437 padding: 0; 438 margin: 0; 439 background: transparent; 440 word-break: normal; 441 white-space: pre; 442 border: 0; 443 } 444 445 body .highlight { 446 margin-bottom: 16px; 447 } 448 449 body .highlight pre, body pre { 450 border: #d6d6d6; 451 font-size: 0.85em !important; 452 line-height: 1.45; 453 border-radius: 3px; 454 padding: 1em; 455 overflow: auto; 456 } 457 458 body .highlight pre { 459 word-break: normal; 460 margin-bottom: 0; 461 } 462 463 body pre code, body pre tt { 464 background-color: transparent; 465 padding: 0; 466 margin: 0; 467 display: inline; 468 max-width: initial; 469 overflow: initial; 470 line-height: inherit; 471 word-wrap: normal; 472 border: 0; 473 } 474 475 body pre code:before, body pre tt:before, body pre code:after, body pre tt:after { 476 content: normal; 477 } 478 479 body p, body blockquote, body ul, body ol, body dl, body pre { 480 margin-top: 0; 481 margin-bottom: 16px; 482 } 483 484 body kbd { 485 border: 1px solid #d6d6d6; 486 border-bottom: 2px solid #c7c7c7; 487 padding: 2px 4px; 488 background-color: #f0f0f0; 489 border-radius: 3px; 490 color: #000000; 491 } 492 493 @media print { 494 body { 495 background-color: #FFFFFF; 496 } 497 498 body h1, body h2, body h3, body h4, body h5{ 499 page-break-after: avoid; 500 color: #000000; 501 } 502 503 body blockquote { 504 color: #5c5c5c; 505 } 506 507 body pre { 508 page-break-inside: avoid; 509 } 510 511 body table { 512 display: table; 513 } 514 515 body img { 516 display: block; 517 max-width: 100%; 518 max-height: 100%; 519 } 520 521 body pre, body code { 522 white-space: pre; 523 word-wrap: break-word; 524 } 525 } 526 527 .md-preview { 528 width: 100%; 529 height: 100%; 530 box-sizing: border-box; 531 } 532 533 .md-preview, .md-preview { 534 page-break-before: always; 535 } 536 537 .md-preview pre.figure-numbers { 538 position: relative; 539 padding-left: 3.8em; 540 counter-reset: linenumber; 541 } 542 543 .md-preview pre.figure-numbers > code { 544 position: relative; 545 } 546 547 .md-preview pre.figure-numbers .figure-numbers-rows { 548 top: 1em; 549 font-size: 100%; 550 left: 0; 551 width: 3em; 552 position: absolute; 553 pointer-events: none; 554 letter-spacing: -1px; 555 border-right: 1px solid #999; 556 -webkit-user-select: none; 557 user-select: none; 558 -moz-user-select: none; 559 -ms-user-select: none; 560 } 561 562 .md-preview pre.figure-numbers .figure-numbers-rows > span:before { 563 content: counter(linenumber); 564 color: #999999; 565 display: block; 566 text-align: right; 567 padding-right: 0.8em; 568 } 569 570 .md-preview pre.figure-numbers .figure-numbers-rows > span { 571 display: block; 572 pointer-events: none; 573 counter-increment: linenumber; 574 } 575 576 .md-preview:not([for="preview"]) .code-block .btn-group { 577 display: none; 578 } 579 580 .md-preview:not([for="preview"]) .code-block .status { 581 display: none; 582 } 583 584 .md-preview:not([for="preview"]) .code-block .output-div { 585 margin-bottom: 16px; 586 } 587 588 .scrollbar-type::-webkit-scrollbar { 589 width: 8px; 590 } 591 592 .scrollbar-type::-webkit-scrollbar-track { 593 background-color: transparent; 594 border-radius: 10px; 595 } 596 597 .scrollbar-type::-webkit-scrollbar-thumb { 598 border-radius: 5px; 599 border: 4px solid rgba(150, 150, 150, 0.66); 600 background-clip: content-box; 601 background-color: rgba(150, 150, 150, 0.66); 602 } 603 604 body[for="native-export"]:not([data-display-mode]) { 605 position: relative; 606 top: 0; 607 left: 0; 608 margin: 0; 609 padding: 0; 610 overflow: auto; 611 width: 100%; 612 height: 100%; 613 } 614 615 body[for="native-export"]:not([data-display-mode]) .md-preview { 616 position: relative; 617 top: 0; 618 } 619 620 621 @media screen and (max-width: 450px) { 622 body[for="native-export"]:not([data-display-mode]) .md-preview { 623 font-size: 14px !important; 624 padding: 1em; 625 } 626 } 627 628 @media print { 629 body[for="native-export"]:not([data-display-mode]) #sidebarButton { 630 display: none; 631 } 632 } 633 634 @media screen and (min-width: 914px) { 635 body[for="native-export"]:not([data-display-mode]) .md-preview { 636 padding: 2em calc(50% - 457px + 2em); 637 } 638 } 639 640 @media screen and (max-width: 914px) { 641 body[for="native-export"]:not([data-display-mode]) .md-preview { 642 padding: 2em; 643 } 644 } 645 646 body[for="native-export"]:not([data-display-mode]) #sidebarButton { 647 position: fixed; 648 bottom: 8px; 649 left: 8px; 650 font-size: 28px; 651 cursor: pointer; 652 color: inherit; 653 text-align: center; 654 opacity: 0.4; 655 z-index: 99; 656 width: 32px; 657 } 658 659 body[for="native-export"]:not([data-display-mode])[sidebarToc] #sidebarButton { 660 opacity: 1; 661 } 662 663 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc { 664 position: fixed; 665 top: 0; 666 left: 0; 667 padding: 32px 0 48px 0; 668 width: 300px; 669 height: 100%; 670 font-size: 14px; 671 box-shadow: 0 0 4px rgba(150, 150, 150, 0.33); 672 box-sizing: border-box; 673 overflow: auto; 674 background-color: inherit; 675 } 676 677 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar { 678 width: 8px; 679 } 680 681 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar-track { 682 background-color: transparent; 683 border-radius: 10px; 684 } 685 686 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc::-webkit-scrollbar-thumb { 687 background-color: rgba(150, 150, 150, 0.66); 688 border-radius: 5px; 689 border: 4px solid rgba(150, 150, 150, 0.66); 690 background-clip: content-box; 691 } 692 693 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc a { 694 text-decoration: none; 695 } 696 697 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc li { 698 margin-bottom: 0.8em; 699 } 700 701 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc ul { 702 margin-top: 0.8em; 703 padding: 0 1.6em 0 0; 704 } 705 706 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-sidebar-toc ul { 707 list-style-type: none; 708 } 709 710 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 711 padding: 2em calc(50% - 457px - 150px); 712 margin: 0; 713 box-sizing: border-box; 714 left: 300px; 715 width: calc(100% - 300px); 716 } 717 718 @media screen and (max-width: 450px) { 719 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 720 width: 100%; 721 } 722 } 723 724 @media screen and (max-width: 1274px) { 725 body[for="native-export"]:not([data-display-mode])[sidebarToc] .md-preview { 726 padding: 2em; 727 } 728 } 729 730 body[for="native-export"]:not([data-display-mode]):not([sidebarToc]) .md-preview { 731 transform: translateX(-50%); 732 left: 50%; 733 } 734 735 body[for="native-export"]:not([data-display-mode]):not([sidebarToc]) .md-sidebar-toc { 736 display: none; 737 } 738 </style> 739</head> 740<body for="native-export" id="body"> 741<div class="mume md-preview "> 742 <h1 class="mume-header fontColor" >SmartPerf 编译指导</h1> 743 744 <h2 class="mume-header fontColor">1. 编译环境搭建:</h2> 745 746 <pre class="font-text fontColor light"> 注意:在linux编译环境安装时以root或者其他 sudo 用户身份运行下面的命令 747</pre> 748 <h3 class="mume-header fontColor" >1.1 node 环境安装:</h3> 749 750 <h5 class="mume-header fontColor"> 751 1.1.1 下载Node js安装包(windows推荐, linux跳过此步骤)</h5> 752 753 <pre class="font-text fontColor light"> 从网站 下载node js安装包 https://nodejs.org/en/download/current/ 754</pre> 755 <h5 class="mume-header fontColor">1.1.2 安装nodejs.</h5> 756 757 <ul class="fontColor"> 758 <li>ubuntu 20.04 与Debian 11系统中, 直接用apt-get安装,命令如下:</li> 759 </ul> 760 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor"> 先切换到 root用户下 sudo su 761 apt-get update 762 apt-get install nodejs npm 763</code></pre> 764 <ul class="fontColor"> 765 <li>centos 系统中 使用yum 安装,命令如下:</li> 766 </ul> 767 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor"> 先切换到 root用户下 sudo su 768 sudo yum -y install nodejs npm 769</code></pre> 770 <ul class="fontColor"> 771 <li> 772 <p>windows系统中, 用安装包一路next即可:</p> 773 </li> 774 <li> 775 <p>安装完成后运行检查是否安装成功:</p> 776 </li> 777 </ul> 778 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor"> node -v 779 npm -v 780</code></pre> 781 <p class="fontColor">出现版本号就代表安装成功了.</p> 782 <h5 class="mume-header fontColor">1.1.3 安装tsc typeScript 编译器</h5> 783 784 <ul class="fontColor"> 785 <li>直接使用npm 安装运行命令:</li> 786 </ul> 787 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">npm install -g typescript 788 789备注:如果安装失败可以更换npm源,再次尝试. 790 tsc -v 791</code></pre> 792 <h3 class="mume-header fontColor">1.2 go 编译环境安装: 793 </h3> 794 795 <ul class="fontColor"> 796 <li>ubuntu 环境下直接使用apt安装:</li> 797 </ul> 798 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor"> apt-get install golang-go 799</code></pre> 800 <ul class="fontColor"> 801 <li>centos 系统中 使用yum 安装,命令如下:</li> 802 </ul> 803 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor">先切换到 root用户下 sudo su 804 805 sudo yum -y install go 806</code></pre> 807 <ul class="fontColor"> 808 <li> 809 <p>windows 系统请自行下载安装包并完成安装。</p> 810 </li> 811 <li> 812 <p>安装完成后 命令行运行验证是否安装成功:</p> 813 </li> 814 </ul> 815 <pre class="font- light" data-info data-role="codeBlock"><code class="fontColor"> go version 816</code></pre> 817 <h2 class="mume-header fontColor" >2. 818 项目编译:</h2> 819 820 <h4 class="mume-header fontColor" 821 >2.1 先下载sql.js的二进制包,: 822 </h4> 823 824 <pre class="font-text light fontColor"> 从如下 https://github.com/sql-js/sql.js/releases/download/v1.6.2/sqljs-all.zip 获取到sql.js的二进制包. 825 将压缩包解压后, 将文件放置到项目third-party 目录下. 826</pre> 827 <h4 class="mume-header fontColor" 828 > 829 2.2 先编译获取trace_streamer 的二进制包:</h4> 830 831 <pre class="font-text light fontColor">参照:smartperf/trace_streamer/compile_trace_streamer.md 编译出wasm 、linux、Windows版本的二进制文件 832 将获取到二进制文件放入到项目bin目录下,如果项目目录中无bin目录 先创建bin目录. 833 然后将trace_streamer的二进制文件放入bin目录中. 834</pre> 835 <h4 class="mume-header fontColor" 836 > 837 2.3 代码编译(依赖于上面node环境 和 go环境)</h4> 838 839 <pre class="font-text fontColor light"> 1) 在项目目录安装项目依赖: 840 npm install 841 2) 在项目目录下运行命令: 842 npm run compile 843编译成功后会有main 可执行文件生成 844</pre> 845 <h2 class="mume-header fontColor" >3. 846 项目部署: 847 </h2> 848 849 <pre class="font-text fontColor light"> 1. linux 版本部署需要给trace_stream程序赋予执行权限: 850 cd dist/bin 目录下,执行 chmod +x trace_streamer_* 851 852 直接运行 ./main 可执行程序,完成项目的部署; 853</pre> 854 <h2 class="fontColor">4. 访问项目:</h2> 855 <pre class="font-text fontColor light"> 在浏览器上打开 https://[部署机器ip地址]:9000/application/ 856 !!! 注意一定是https. 857 858 备注:如果未出现如图所示网页.而是显示 无法访问此网站 859 可以在window cmd 里执行telnet [部署机器ip地址] 9000 860 如果显示端口连接失败 可能是防火墙未对9000 端口放开即可 861</pre> 862 863</div> 864<script type="text/javascript"> 865 window.onload = (() => { 866 let isDark = window.location.search; 867 if (isDark.indexOf("?") != -1) { 868 isDark = isDark.substr(1, isDark.length - 1); 869 } 870 if (isDark == 'true') { 871 document.getElementById("body").setAttribute('style', 'background-color:#272C34;') 872 let header = document.getElementsByClassName('fontColor') 873 for (let i = 0; i < header.length; i++) { 874 header[i].style.color = '#fff'; 875 } 876 let lightBackGround = document.getElementsByClassName('light') 877 for (let i = 0; i < lightBackGround.length; i++) { 878 lightBackGround[i].style.backgroundColor = '#32373F' 879 } 880 } 881 }) 882</script> 883</body> 884</html>