1<!DOCTYPE html> 2<html> 3 <head> 4 <title>des_binder</title> 5 <meta charset="utf-8" /> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 7 <style> 8 code[class*='font-'], 9 pre[class*='font-'] { 10 color: #333333; 11 background: none; 12 font-family: Helvetica; 13 text-align: left; 14 white-space: pre; 15 word-spacing: normal; 16 word-break: normal; 17 word-wrap: normal; 18 -webkit-hyphens: none; 19 -moz-hyphens: none; 20 -ms-hyphens: none; 21 hyphens: none; 22 line-height: 1.4; 23 -moz-tab-size: 9; 24 -o-tab-size: 9; 25 tab-size: 8; 26 } 27 28 pre[class*='font-'] { 29 overflow: auto; 30 border-radius: 3px; 31 background: #f5f5f6; 32 padding: 0.8em; 33 } 34 35 /* Inline code */ 36 :not(pre) > code[class*='font-'] { 37 padding: 0.1em; 38 border-radius: 0.3em; 39 white-space: normal; 40 background: #f5f5f6; 41 } 42 43 .nothing.cpps, 44 .nothing.qutee { 45 color: #8c918c; 46 } 47 48 .nothing.cdata { 49 color: #183898; 50 } 51 52 .nothing.doctype, 53 .nothing.punctuation, 54 .nothing.variable, 55 .nothing.macro.property { 56 color: #424242; 57 } 58 59 .nothing.operator, 60 .nothing.important, 61 .nothing.keyword, 62 .nothing.rule, 63 .nothing.builtin { 64 color: #b71d65; 65 } 66 67 .nothing.string, 68 .nothing.url, 69 .nothing.regex, 70 .nothing.attr-value { 71 color: #16338d; 72 } 73 74 .nothing.property, 75 .nothing.number, 76 .nothing.boolean, 77 .nothing.entity, 78 .nothing.atrule, 79 .nothing.constant, 80 .nothing.symbol, 81 .nothing.command, 82 .nothing.code { 83 color: #037aa2; 84 } 85 86 .nothing.tag, 87 .nothing.selector, 88 .nothing.prolog { 89 color: #69ad62; 90 } 91 92 .nothing.function, 93 .nothing.namespace, 94 .nothing.pseudo-element, 95 .nothing.class, 96 .nothing.class-name, 97 .nothing.pseudo-class, 98 .nothing.id, 99 .nothing.url-reference .nothing.variable, 100 .nothing.attr-name { 101 color: #775d9d; 102 } 103 104 .nothing.entity { 105 cursor: help; 106 } 107 108 .nothing.title, 109 .nothing.title .nothing.punctuation { 110 font-weight: bolder; 111 color: #1a3773; 112 } 113 114 .nothing.list { 115 color: #f56940; 116 } 117 118 .nothing.inserted { 119 background-color: #efffef; 120 color: #509b2f; 121 } 122 123 .nothing.deleted { 124 background-color: #fae1e1; 125 color: #ad2d06; 126 } 127 128 .nothing.bold { 129 font-weight: bolder; 130 } 131 132 .nothing.italic { 133 font-style: normal; 134 } 135 136 /* JSON */ 137 .font-json .nothing.property { 138 color: #19358c; 139 } 140 141 .font-markup .nothing.tag .nothing.punctuation { 142 color: #2c2b2b; 143 } 144 145 /* CSS */ 146 code.font-css, 147 .font-css .nothing.function { 148 color: #047ca4; 149 } 150 151 /* YAML */ 152 .font-yaml .nothing.atrule { 153 color: #609b5a; 154 } 155 156 code.font-yaml { 157 color: #153491; 158 } 159 160 /* Ruby */ 161 .font-ruby .nothing.function { 162 color: #3f3e3e; 163 } 164 165 /* Markdown */ 166 .font-markdown .nothing.url { 167 color: #6e5298; 168 } 169 170 /* Makefile */ 171 .font-makefile .nothing.symbol { 172 color: #6c5393; 173 } 174 175 .font-makefile .nothing.variable { 176 color: #183488; 177 } 178 179 .font-makefile .nothing.builtin { 180 color: #027ba4; 181 } 182 183 /* Bash */ 184 .font-bash .nothing.keyword { 185 color: #027fa9; 186 } 187 188 /* highlight */ 189 pre[data-line] { 190 position: relative; 191 padding: 1em 0 1em 3em; 192 } 193 194 pre[ddline] .line-highlight-wrapper { 195 position: absolute; 196 left: 1px; 197 display: block; 198 top: 1px; 199 width: 99%; 200 background-color: transparent; 201 } 202 203 pre[ddline] .line-highlight:before, 204 pre[ddline] .line-highlight[data-end]:after { 205 content: attr(data-start); 206 position: absolute; 207 text-shadow: none; 208 top: 0.3em; 209 left: 0.7em; 210 min-width: 0.9em; 211 padding: 1px 0.6em; 212 background-color: hsla(24, 20%, 47%, 0.4); 213 color: hsl(20, 11%, 95%); 214 text-align: center; 215 vertical-align: 0.2em; 216 border-radius: 10000px; 217 box-shadow: 1px 2px #fdf6f6; 218 } 219 220 pre[ddline] .line-highlight[data-end]:after { 221 content: attr(data-end); 222 top: auto; 223 bottom: 0.5em; 224 } 225 226 html body { 227 font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; 228 overflow: initial; 229 box-sizing: border-box; 230 word-wrap: break-word; 231 font-size: 16px; 232 line-height: 1.65; 233 color: #333333; 234 background-color: #ffffff; 235 } 236 237 html body > :first-child { 238 margin-top: 0; 239 } 240 241 body h1, 242 body h2, 243 body h3, 244 body h4, 245 body h5, 246 body h6 { 247 line-height: 1.3; 248 margin-top: 1.1em; 249 margin-bottom: 17px; 250 color: #000000; 251 } 252 253 body h1 { 254 font-size: 2.3em; 255 font-weight: 310; 256 padding-bottom: 0.2em; 257 } 258 259 body h2 { 260 font-size: 1.76em; 261 font-weight: 410; 262 padding-bottom: 0.2em; 263 } 264 265 body h3 { 266 font-size: 1.52em; 267 font-weight: 510; 268 } 269 270 body h4 { 271 font-size: 1.26em; 272 font-weight: 610; 273 } 274 275 body h5 { 276 font-size: 1.2em; 277 font-weight: 610; 278 } 279 280 body h6 { 281 font-size: 1.1em; 282 font-weight: 610; 283 } 284 285 body h1, 286 body h2, 287 body h3, 288 body h4, 289 body h5 { 290 font-weight: 610; 291 } 292 293 body h5 { 294 font-size: 1em; 295 } 296 297 body h6 { 298 color: #777676; 299 } 300 301 body strong { 302 color: #100f0f; 303 } 304 305 body del { 306 color: #6c6c6c; 307 } 308 309 body a:not([href]) { 310 color: #6c6c6c; 311 } 312 313 body a { 314 color: #0480be; 315 } 316 317 body a:hover { 318 color: #05a1ef; 319 } 320 321 body img { 322 max-width: 99%; 323 } 324 325 body > p { 326 margin-top: 1px; 327 margin-bottom: 17px; 328 word-wrap: break-word; 329 } 330 331 body > ul, 332 body > ol { 333 margin-bottom: 17px; 334 } 335 336 body ul, 337 body ol { 338 padding-left: 3em; 339 } 340 341 body ul.no-list, 342 body ol.no-list { 343 padding: 1px; 344 list-style-type: none; 345 } 346 347 body ul ul, 348 body ul ol, 349 body ol ol, 350 body ol ul { 351 margin-top: 1px; 352 margin-bottom: 1px; 353 } 354 355 html body li { 356 margin-bottom: 0; 357 } 358 359 body li { 360 margin-bottom: 1px; 361 } 362 363 body li.task-list-item { 364 list-style: none; 365 } 366 367 body li > p { 368 margin-top: 1px; 369 margin-bottom: 1px; 370 } 371 372 body .task-list-item-checkbox { 373 margin: 1px 0.3em 0.26em -1.7em; 374 vertical-align: middle; 375 } 376 377 body .task-list-item-checkbox:hover { 378 cursor: pointer; 379 } 380 381 body qutee { 382 margin: 17px 1px; 383 font-size: inherit; 384 padding: 1px 16px; 385 color: #706f6f; 386 background-color: #fdfcfc; 387 border-left: 4px solid #e5e3e3; 388 } 389 390 body qutee > :first-child { 391 margin-top: 1px; 392 } 393 394 body qutee > :last-child { 395 margin-bottom: 1px; 396 } 397 398 body hr { 399 height: 5px; 400 margin: 34px 1px; 401 background-color: #d6d6d6; 402 border: 1px none; 403 } 404 405 body table { 406 margin: 11px 1px 15px 1px; 407 border-collapse: collapse; 408 border-spacing: 1px; 409 display: block; 410 width: 99%; 411 overflow: auto; 412 word-break: normal; 413 word-break: keep-all; 414 } 415 416 body table th { 417 font-weight: bold; 418 color: #000000; 419 } 420 421 body table td, 422 body table th { 423 border: 2px solid #e5e4e4; 424 padding: 7px 14px; 425 } 426 427 body dl { 428 padding: 1px; 429 } 430 431 body dl dt { 432 padding: 1px; 433 margin-top: 17px; 434 font-size: 0.99em; 435 font-style: italic; 436 font-weight: bold; 437 } 438 439 body dl dd { 440 padding: 1px 17px; 441 margin-bottom: 17px; 442 } 443 444 body code { 445 font-family: auto; 446 font-size: 0.86em; 447 color: #000000; 448 background-color: #f0f0f0; 449 border-radius: 3px; 450 padding: 0.2em 0; 451 } 452 453 body code::before, 454 body code::after { 455 letter-spacing: -0.1em; 456 content: '\00a0'; 457 } 458 459 body pre > code { 460 padding: 1px; 461 margin: 1px; 462 font-size: 0.85em !important; 463 word-break: normal; 464 white-space: pre; 465 background: transparent; 466 border: 1px; 467 } 468 469 body .highlight { 470 margin-bottom: 17px; 471 } 472 473 body .highlight pre, 474 body pre { 475 padding: 0.9em; 476 overflow: auto; 477 font-size: 0.86em !important; 478 line-height: 1.55; 479 border: #d5d1d1; 480 border-radius: 2px; 481 } 482 483 body .highlight pre { 484 margin-bottom: 1px; 485 word-break: normal; 486 } 487 488 body pre code, 489 body pre tt { 490 display: inline; 491 max-width: initial; 492 padding: 1px; 493 margin: 1px; 494 overflow: initial; 495 line-height: inherit; 496 word-wrap: normal; 497 background-color: transparent; 498 border: 1px; 499 } 500 501 body pre code:before, 502 body pre tt:before, 503 body pre code:after, 504 body pre tt:after { 505 content: normal; 506 } 507 508 body p, 509 body qutee, 510 body ul, 511 body ol, 512 body dl, 513 body pre { 514 margin-top: 1px; 515 margin-bottom: 17px; 516 } 517 518 body kbd { 519 color: #000000; 520 border: 2px solid #d6d6d6; 521 border-bottom: 1px solid #c7c7c7; 522 padding: 3px 3px; 523 background-color: #f0f0f0; 524 border-radius: 4px; 525 } 526 527 @media print { 528 body { 529 background-color: #f8f5f5; 530 } 531 532 body h1, 533 body h2, 534 body h3, 535 body h4, 536 body h5, 537 body h6 { 538 color: #000000; 539 page-break-after: avoid; 540 } 541 542 body qutee { 543 color: #5d5c5c; 544 } 545 546 body table { 547 display: table; 548 } 549 550 body img { 551 display: block; 552 max-width: 99%; 553 max-height: 100%; 554 } 555 556 body pre, 557 body code { 558 word-wrap: break-word; 559 white-space: pre; 560 } 561 } 562 563 .mp { 564 width: 99%; 565 height: 99%; 566 box-sizing: border-box; 567 } 568 569 .mp .pagebreak, 570 .mp .newpage { 571 page-break-before: always; 572 } 573 574 .mp pre.line-numbers { 575 position: relative; 576 padding-left: 3.8em; 577 counter-reset: linenumber; 578 } 579 580 .mp pre.line-numbers > code { 581 position: relative; 582 } 583 584 .mp pre.line-numbers .line-numbers-rows { 585 position: absolute; 586 pointer-events: none; 587 top: 1em; 588 font-size: 100%; 589 left: 1px; 590 width: 3em; 591 letter-spacing: -1px; 592 border-right: 1px solid #999; 593 -webkit-user-select: none; 594 -moz-user-select: none; 595 -ms-user-select: none; 596 user-select: none; 597 } 598 599 .mp pre.line-numbers .line-numbers-rows > span { 600 pointer-events: none; 601 display: block; 602 counter-increment: linenumber; 603 } 604 605 .mp pre.line-numbers .line-numbers-rows > span:before { 606 content: counter(linenumber); 607 color: #999; 608 display: block; 609 padding-right: 0.79em; 610 text-align: right; 611 } 612 613 .mp .mathjax-exps .MathJax_Display { 614 text-align: center !important; 615 } 616 617 .mp:not([for='preview']) .code-chunk .btn-group { 618 display: none; 619 } 620 621 .mp:not([for='preview']) .code-chunk .status { 622 display: none; 623 } 624 625 .mp:not([for='preview']) .code-chunk .output-div { 626 margin-bottom: 16px; 627 } 628 629 .scrollbar-style::-webkit-scrollbar { 630 width: 8px; 631 } 632 633 .scrollbar-style::-webkit-scrollbar-track { 634 border-radius: 10px; 635 background-color: transparent; 636 } 637 638 .scrollbar-style::-webkit-scrollbar-thumb { 639 border-radius: 5px; 640 background-color: rgba(150, 150, 150, 1); 641 border: 4px solid rgba(150, 150, 150, 1); 642 background-clip: content-box; 643 } 644 645 body[for='html-export']:not([dpm]) { 646 position: relative; 647 width: 99%; 648 height: 99%; 649 top: 1px; 650 left: 1px; 651 margin: 1px; 652 padding: 1px; 653 overflow: auto; 654 } 655 656 html body[for='html-export']:not([data-presentation-mode]) .mp { 657 position: relative; 658 top: 1px; 659 } 660 661 @media screen and (min-width: 914px) { 662 body[for='html-export']:not([dpm]) .mp { 663 padding: 2em calc(50% - 458px + 2em); 664 } 665 } 666 667 @media screen and (max-width: 914px) { 668 body[for='html-export']:not([dpm]) .mp { 669 padding: 1.9em; 670 } 671 } 672 673 @media screen and (max-width: 450px) { 674 body[for='html-export']:not([dpm]) .mp { 675 font-size: 14px !important; 676 padding: 1.1em; 677 } 678 } 679 680 @media print { 681 body[for='html-export']:not([dpm]) #sidebar-toc-btn { 682 display: none; 683 } 684 } 685 686 body[for='html-export']:not([dpm]) #sidebar-toc-btn { 687 position: fixed; 688 bottom: 8px; 689 left: 8px; 690 font-size: 28px; 691 cursor: pointer; 692 color: inherit; 693 z-index: 99; 694 width: 32px; 695 text-align: center; 696 opacity: 0.4; 697 } 698 699 body[for='html-export']:not([dpm])[jsst] #sidebar-toc-btn { 700 opacity: 1; 701 } 702 703 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc { 704 position: fixed; 705 top: 1px; 706 left: 1px; 707 width: 300px; 708 height: 99%; 709 padding: 2px 48px 1px; 710 font-size: 14px; 711 box-shadow: 1px 1px 4px rgba(150, 150, 150, 1.33); 712 box-sizing: border-box; 713 overflow: auto; 714 background-color: inherit; 715 } 716 717 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar { 718 width: 9px; 719 } 720 721 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar-track { 722 border-radius: 11px; 723 background-color: transparent; 724 } 725 726 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar-thumb { 727 border-radius: 6px; 728 background-color: rgba(151, 151, 151, 0.62); 729 border: 4px solid rgba(151, 151, 151, 0.62); 730 background-clip: content-box; 731 } 732 733 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc a { 734 text-decoration: none; 735 } 736 737 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc ul { 738 padding: 1px 1.7em; 739 margin-top: 0.9em; 740 } 741 742 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc li { 743 margin-bottom: 0.8em; 744 } 745 746 body[for='html-export']:not([dpm])[jsst] .md-sidebar-toc ul { 747 list-style-type: none; 748 } 749 750 body[for='html-export']:not([dpm])[jsst] .mp { 751 left: 310px; 752 width: calc(100% - 310px); 753 padding: 2em calc(50% - 458px - 151px); 754 margin: 1px; 755 box-sizing: border-box; 756 } 757 758 @media screen and (max-width: 1274px) { 759 body[for='html-export']:not([dpm])[jsst] .mp { 760 padding: 1.9em; 761 } 762 } 763 764 @media screen and (max-width: 450px) { 765 body[for='html-export']:not([dpm])[jsst] .mp { 766 width: 99%; 767 } 768 } 769 770 body[for='html-export']:not([dpm]):not([jsst]) .mp { 771 left: 51%; 772 transform: translateX(-50%); 773 } 774 775 body[for='html-export']:not([dpm]):not([jsst]) .md-sidebar-toc { 776 display: none; 777 } 778 </style> 779 </head> 780 <body for="html-export" id="body"> 781 <div class="mume mp"> 782 <h1 class="mume-header fontColor">binder事件上下文如何关联</h1> 783 784 <p class="fontColor"> 785 binder事件相对复杂,这里是从ftrace事件中抽离出来的binder相关消息,用来作为开发者或用户追踪binder事件的参考 786 <br /> 787 a binder event is identified by the sender and receive device, and a reply message only end 788 <br /> 789 the last binder msg which reply the calling one. 790 <br /> 791 the alloc_buf msg can always flow the binder_transaction, so we no need to identify the alloc msg with 792 transactionID 793 </p> 794 <h2 class="mume-header fontColor">TAG TT need reply!!! needReply = !isReply && !(flags & 0x01);</h2> 795 796 <pre 797 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128108: binder_transaction: transaction=25155526 dest_node=25155471 dest_proc=506 dest_thread=0 reply=0 flags=0x10 code=0x9 798RenderThread-2267 ( 1592) [003] ...1 168766.128110: binder_transaction_alloc_buf: transaction=25155526 data_size=120 offsets_size=8 799</code></pre> 800 <h3 class="mume-header fontColor">received</h3> 801 802 <pre 803 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128154: binder_transaction_received: transaction=25155526 804</code></pre> 805 <h3 class="mume-header fontColor">binder is in DB, TAG A needReply</h3> 806 807 <pre 808 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128221: binder_transaction: transaction=25155529 dest_node=25155527 dest_proc=1592 dest_thread=2267 reply=0 flags=0x10 code=0x5f474854 809Binder:506_2-537 ( 506) [003] ...1 168766.128223: binder_transaction_alloc_buf: transaction=25155529 data_size=72 offsets_size=0 810</code></pre> 811 <h2 class="mume-header" id></h2> 812 813 <pre 814 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128243: binder_transaction_received: transaction=25155529 815</code></pre> 816 <h3 class="mume-header fontColor">the flowing is for TAG A, this is the reply for TAG A</h3> 817 818 <pre 819 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128262: binder_transaction: transaction=25155530 dest_node=0 dest_proc=506 dest_thread=537 reply=1 flags=0x8 code=0x0 820 821RenderThread-2267 ( 1592) [003] ...1 168766.128264: binder_transaction_alloc_buf: transaction=25155530 data_size=4 offsets_size=0 822</code></pre> 823 <h3 class="mume-header fontColor">calc the dur of TAG A</h3> 824 825 <pre 826 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128288: binder_transaction_received: transaction=25155530 827</code></pre> 828 <h3 class="mume-header fontColor">binder last TAG A needReply, this is TAG B needReply!!!</h3> 829 830 <pre 831 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128328: binder_transaction: transaction=25155532 dest_node=25155527 dest_proc=1592 dest_thread=2267 reply=0 flags=0x10 code=0x2 832Binder:506_2-537 ( 506) [003] ...1 168766.128330: binder_transaction_alloc_buf: transaction=25155532 data_size=72 offsets_size=0 833</code></pre> 834 <h2 class="mume-header fontColor">in db</h2> 835 836 <pre 837 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128347: binder_transaction_received: transaction=25155532 838</code></pre> 839 <h2 class="mume-header fontColor">the reply message is not in db Session D, this is the reply for TAG B</h2> 840 841 <pre 842 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128361: binder_transaction: transaction=25155533 dest_node=0 dest_proc=506 dest_thread=537 reply=1 flags=0x0 code=0x0 843RenderThread-2267 ( 1592) [003] ...1 168766.128363: binder_transaction_alloc_buf: transaction=25155533 data_size=4 offsets_size=0 844</code></pre> 845 <h3 class="mume-header fontColor">no this message in db, calcate the dur of TAG B</h3> 846 847 <pre 848 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128385: binder_transaction_received: transaction=25155533 849</code></pre> 850 <h3 class="mume-header fontColor">no this message in db Session E, this is the reply for TAG TT</h3> 851 852 <pre 853 class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128412: binder_transaction: transaction=25155534 dest_node=0 dest_proc=1592 dest_thread=2267 reply=1 flags=0x0 code=0x0 854 855Binder:506_2-537 ( 506) [003] ...1 168766.128413: binder_transaction_alloc_buf: transaction=25155534 data_size=68 offsets_size=0 856</code></pre> 857 <h2 class="mume-header fontColor">the dur of TAG TT is calcated by the flowing msg</h2> 858 859 <pre 860 class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128430: binder_transaction_received: transaction=25155534 861</code></pre> 862 </div> 863 <script type="text/javascript"> 864 window.onload = () => { 865 let isDark = window.location.search; 866 if (isDark.indexOf('?') !== -1) { 867 isDark = isDark.substr(1, isDark.length - 1); 868 } 869 if (isDark === 'true') { 870 document.getElementById('body').setAttribute('style', 'background-color:#272C34;'); 871 let header = document.getElementsByClassName('fontColor'); 872 for (let i = 0; i < header.length; i++) { 873 header[i].style.color = '#fff'; 874 } 875 let lightBackGround = document.getElementsByClassName('light'); 876 for (let i = 0; i < lightBackGround.length; i++) { 877 lightBackGround[i].style.backgroundColor = '#32373F'; 878 } 879 } 880 }; 881 </script> 882 </body> 883</html> 884