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 204 pre[ddline] .line-highlight:before, 205 pre[ddline] .line-highlight[data-end]:after { 206 content: attr(data-start); 207 position: absolute; 208 text-shadow: none; 209 top: .3em; 210 left: .7em; 211 min-width: .9em; 212 padding: 1px .6em; 213 background-color: hsla(24, 20%, 47%, 0.4); 214 color: hsl(20, 11%, 95%); 215 text-align: center; 216 vertical-align: 0.2em; 217 border-radius: 10000px; 218 box-shadow: 1px 2px #fdf6f6; 219 } 220 221 pre[ddline] .line-highlight[data-end]:after { 222 content: attr(data-end); 223 top: auto; 224 bottom: 0.5em; 225 } 226 227 html body { 228 font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; 229 overflow: initial; 230 box-sizing: border-box; 231 word-wrap: break-word; 232 font-size: 16px; 233 line-height: 1.65; 234 color: #333333; 235 background-color: #ffffff; 236 } 237 238 html body > :first-child { 239 margin-top: 0 240 } 241 242 body h1, body h2, body h3, body h4, body h5, body h6 { 243 line-height: 1.3; 244 margin-top: 1.1em; 245 margin-bottom: 17px; 246 color: #000000 247 } 248 249 body h1 { 250 font-size: 2.3em; 251 font-weight: 310; 252 padding-bottom: .2em 253 } 254 255 body h2 { 256 font-size: 1.76em; 257 font-weight: 410; 258 padding-bottom: .2em 259 } 260 261 body h3 { 262 font-size: 1.52em; 263 font-weight: 510 264 } 265 266 body h4 { 267 font-size: 1.26em; 268 font-weight: 610 269 } 270 271 body h5 { 272 font-size: 1.2em; 273 font-weight: 610 274 } 275 276 body h6 { 277 font-size: 1.1em; 278 font-weight: 610 279 } 280 281 body h1, body h2, body h3, body h4, body h5 { 282 font-weight: 610 283 } 284 285 body h5 { 286 font-size: 1em 287 } 288 289 body h6 { 290 color: #777676 291 } 292 293 body strong { 294 color: #100f0f 295 } 296 297 body del { 298 color: #6c6c6c 299 } 300 301 body a:not([href]) { 302 color: #6c6c6c; 303 } 304 305 body a { 306 color: #0480be; 307 } 308 309 body a:hover { 310 color: #05a1ef; 311 } 312 313 body img { 314 max-width: 99% 315 } 316 317 body > p { 318 margin-top: 1px; 319 margin-bottom: 17px; 320 word-wrap: break-word 321 } 322 323 body > ul, body > ol { 324 margin-bottom: 17px 325 } 326 327 body ul, body ol { 328 padding-left: 3em 329 } 330 331 body ul.no-list, body ol.no-list { 332 padding: 1px; 333 list-style-type: none 334 } 335 336 body ul ul, body ul ol, body ol ol, body ol ul { 337 margin-top: 1px; 338 margin-bottom: 1px 339 } 340 341 html body li { 342 margin-bottom: 0 343 } 344 345 body li { 346 margin-bottom: 1px 347 } 348 349 body li.task-list-item { 350 list-style: none 351 } 352 353 body li > p { 354 margin-top: 1px; 355 margin-bottom: 1px 356 } 357 358 body .task-list-item-checkbox { 359 margin: 1px .3em .26em -1.7em; 360 vertical-align: middle 361 } 362 363 body .task-list-item-checkbox:hover { 364 cursor: pointer 365 } 366 367 body qutee { 368 margin: 17px 1px; 369 font-size: inherit; 370 padding: 1px 16px; 371 color: #706f6f; 372 background-color: #fdfcfc; 373 border-left: 4px solid #e5e3e3 374 } 375 376 body qutee > :first-child { 377 margin-top: 1px 378 } 379 380 body qutee > :last-child { 381 margin-bottom: 1px 382 } 383 384 body hr { 385 height: 5px; 386 margin: 34px 1px; 387 background-color: #d6d6d6; 388 border: 1px none 389 } 390 391 body table { 392 margin: 11px 1px 15px 1px; 393 border-collapse: collapse; 394 border-spacing: 1px; 395 display: block; 396 width: 99%; 397 overflow: auto; 398 word-break: normal; 399 word-break: keep-all 400 } 401 402 body table th { 403 font-weight: bold; 404 color: #000000 405 } 406 407 body table td, body table th { 408 border: 2px solid #e5e4e4; 409 padding: 7px 14px 410 } 411 412 body dl { 413 padding: 1px 414 } 415 416 body dl dt { 417 padding: 1px; 418 margin-top: 17px; 419 font-size: 0.99em; 420 font-style: italic; 421 font-weight: bold 422 } 423 424 body dl dd { 425 padding: 1px 17px; 426 margin-bottom: 17px 427 } 428 429 body code { 430 font-family: auto; 431 font-size: .86em; 432 color: #000000; 433 background-color: #f0f0f0; 434 border-radius: 3px; 435 padding: .2em 0 436 } 437 438 body code::before, body code::after { 439 letter-spacing: -0.1em; 440 content: "\00a0" 441 } 442 443 body pre > code { 444 padding: 1px; 445 margin: 1px; 446 font-size: .85em !important; 447 word-break: normal; 448 white-space: pre; 449 background: transparent; 450 border: 1px 451 } 452 453 body .highlight { 454 margin-bottom: 17px 455 } 456 457 body .highlight pre, body pre { 458 padding: .9em; 459 overflow: auto; 460 font-size: .86em !important; 461 line-height: 1.55; 462 border: #d5d1d1; 463 border-radius: 2px 464 } 465 466 body .highlight pre { 467 margin-bottom: 1px; 468 word-break: normal 469 } 470 471 body pre code, body pre tt { 472 display: inline; 473 max-width: initial; 474 padding: 1px; 475 margin: 1px; 476 overflow: initial; 477 line-height: inherit; 478 word-wrap: normal; 479 background-color: transparent; 480 border: 1px 481 } 482 483 body pre code:before, body pre tt:before, body pre code:after, body pre tt:after { 484 content: normal 485 } 486 487 body p, body qutee, body ul, body ol, body dl, body pre { 488 margin-top: 1px; 489 margin-bottom: 17px 490 } 491 492 body kbd { 493 color: #000000; 494 border: 2px solid #d6d6d6; 495 border-bottom: 1px solid #c7c7c7; 496 padding: 3px 3px; 497 background-color: #f0f0f0; 498 border-radius: 4px 499 } 500 501 @media print { 502 body { 503 background-color: #f8f5f5 504 } 505 506 body h1, body h2, body h3, body h4, body h5, body h6 { 507 color: #000000; 508 page-break-after: avoid 509 } 510 511 body qutee { 512 color: #5d5c5c 513 } 514 515 body table { 516 display: table 517 } 518 519 520 body img { 521 display: block; 522 max-width: 99%; 523 max-height: 100% 524 } 525 526 body pre, body code { 527 word-wrap: break-word; 528 white-space: pre 529 } 530 } 531 532 .mp { 533 width: 99%; 534 height: 99%; 535 box-sizing: border-box 536 } 537 538 .mp .pagebreak, .mp .newpage { 539 page-break-before: always 540 } 541 542 .mp pre.line-numbers { 543 position: relative; 544 padding-left: 3.8em; 545 counter-reset: linenumber 546 } 547 548 .mp pre.line-numbers > code { 549 position: relative 550 } 551 552 .mp pre.line-numbers .line-numbers-rows { 553 position: absolute; 554 pointer-events: none; 555 top: 1em; 556 font-size: 100%; 557 left: 1px; 558 width: 3em; 559 letter-spacing: -1px; 560 border-right: 1px solid #999; 561 -webkit-user-select: none; 562 -moz-user-select: none; 563 -ms-user-select: none; 564 user-select: none 565 } 566 567 .mp pre.line-numbers .line-numbers-rows > span { 568 pointer-events: none; 569 display: block; 570 counter-increment: linenumber 571 } 572 573 .mp pre.line-numbers .line-numbers-rows > span:before { 574 content: counter(linenumber); 575 color: #999; 576 display: block; 577 padding-right: .79em; 578 text-align: right 579 } 580 581 .mp .mathjax-exps .MathJax_Display { 582 text-align: center !important 583 } 584 585 .mp:not([for="preview"]) .code-chunk .btn-group { 586 display: none 587 } 588 589 .mp:not([for="preview"]) .code-chunk .status { 590 display: none 591 } 592 593 .mp:not([for="preview"]) .code-chunk .output-div { 594 margin-bottom: 16px 595 } 596 597 .scrollbar-style::-webkit-scrollbar { 598 width: 8px 599 } 600 601 .scrollbar-style::-webkit-scrollbar-track { 602 border-radius: 10px; 603 background-color: transparent 604 } 605 606 .scrollbar-style::-webkit-scrollbar-thumb { 607 border-radius: 5px; 608 background-color: rgba(150, 150, 150, 1); 609 border: 4px solid rgba(150, 150, 150, 1); 610 background-clip: content-box 611 } 612 613 body[for="html-export"]:not([dpm]) { 614 position: relative; 615 width: 99%; 616 height: 99%; 617 top: 1px; 618 left: 1px; 619 margin: 1px; 620 padding: 1px; 621 overflow: auto 622 } 623 624 html body[for="html-export"]:not([data-presentation-mode]) .mp { 625 position: relative; 626 top: 1px 627 } 628 629 @media screen and (min-width: 914px) { 630 body[for="html-export"]:not([dpm]) .mp { 631 padding: 2em calc(50% - 458px + 2em) 632 } 633 } 634 635 @media screen and (max-width: 914px) { 636 body[for="html-export"]:not([dpm]) .mp { 637 padding: 1.9em 638 } 639 } 640 641 @media screen and (max-width: 450px) { 642 body[for="html-export"]:not([dpm]) .mp { 643 font-size: 14px !important; 644 padding: 1.1em 645 } 646 } 647 648 @media print { 649 body[for="html-export"]:not([dpm]) #sidebar-toc-btn { 650 display: none 651 } 652 } 653 654 body[for="html-export"]:not([dpm]) #sidebar-toc-btn { 655 position: fixed; 656 bottom: 8px; 657 left: 8px; 658 font-size: 28px; 659 cursor: pointer; 660 color: inherit; 661 z-index: 99; 662 width: 32px; 663 text-align: center; 664 opacity: .4 665 } 666 667 body[for="html-export"]:not([dpm])[jsst] #sidebar-toc-btn { 668 opacity: 1 669 } 670 671 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc { 672 position: fixed; 673 top: 1px; 674 left: 1px; 675 width: 300px; 676 height: 99%; 677 padding: 2px 48px 1px; 678 font-size: 14px; 679 box-shadow: 1px 1px 4px rgba(150, 150, 150, 1.33); 680 box-sizing: border-box; 681 overflow: auto; 682 background-color: inherit 683 } 684 685 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar { 686 width: 9px 687 } 688 689 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar-track { 690 border-radius: 11px; 691 background-color: transparent 692 } 693 694 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc::-webkit-scrollbar-thumb { 695 border-radius: 6px; 696 background-color: rgba(151, 151, 151, .62); 697 border: 4px solid rgba(151, 151, 151, .62); 698 background-clip: content-box 699 } 700 701 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc a { 702 text-decoration: none 703 } 704 705 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc ul { 706 padding: 1px 1.7em; 707 margin-top: .9em 708 } 709 710 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc li { 711 margin-bottom: .8em 712 } 713 714 body[for="html-export"]:not([dpm])[jsst] .md-sidebar-toc ul { 715 list-style-type: none 716 } 717 718 body[for="html-export"]:not([dpm])[jsst] .mp { 719 left: 310px; 720 width: calc(100% - 310px); 721 padding: 2em calc(50% - 458px - 151px); 722 margin: 1px; 723 box-sizing: border-box 724 } 725 726 @media screen and (max-width: 1274px) { 727 body[for="html-export"]:not([dpm])[jsst] .mp { 728 padding: 1.9em 729 } 730 } 731 732 @media screen and (max-width: 450px) { 733 body[for="html-export"]:not([dpm])[jsst] .mp { 734 width: 99% 735 } 736 } 737 738 body[for="html-export"]:not([dpm]):not([jsst]) .mp { 739 left: 51%; 740 transform: translateX(-50%) 741 } 742 743 body[for="html-export"]:not([dpm]):not([jsst]) .md-sidebar-toc { 744 display: none 745 } 746 </style> 747</head> 748<body for="html-export" id="body"> 749<div class="mume mp "> 750 <h1 class="mume-header fontColor">binder事件上下文如何关联</h1> 751 752 <p class="fontColor">binder事件相对复杂,这里是从ftrace事件中抽离出来的binder相关消息,用来作为开发者或用户追踪binder事件的参考<br> 753 a binder event is identified by the sender and receive device, and a reply message only end<br> 754 the last binder msg which reply the calling one.<br> 755 the alloc_buf msg can always flow the binder_transaction, so we no need to identify the alloc msg with 756 transactionID</p> 757 <h2 class="mume-header fontColor">TAG TT need reply!!! needReply = 758 !isReply && !(flags & 0x01);</h2> 759 760 <pre 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 761RenderThread-2267 ( 1592) [003] ...1 168766.128110: binder_transaction_alloc_buf: transaction=25155526 data_size=120 offsets_size=8 762</code></pre> 763 <h3 class="mume-header fontColor">received</h3> 764 765 <pre class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128154: binder_transaction_received: transaction=25155526 766</code></pre> 767 <h3 class="mume-header fontColor">binder is in DB, TAG A needReply</h3> 768 769 <pre 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 770Binder:506_2-537 ( 506) [003] ...1 168766.128223: binder_transaction_alloc_buf: transaction=25155529 data_size=72 offsets_size=0 771</code></pre> 772 <h2 class="mume-header" id></h2> 773 774 <pre class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128243: binder_transaction_received: transaction=25155529 775</code></pre> 776 <h3 class="mume-header fontColor">the flowing is for TAG A, this is 777 the reply for TAG A</h3> 778 779 <pre 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 780 781RenderThread-2267 ( 1592) [003] ...1 168766.128264: binder_transaction_alloc_buf: transaction=25155530 data_size=4 offsets_size=0 782</code></pre> 783 <h3 class="mume-header fontColor">calc the dur of TAG A</h3> 784 785 <pre class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128288: binder_transaction_received: transaction=25155530 786</code></pre> 787 <h3 class="mume-header fontColor">binder last TAG A needReply, this 788 is TAG B needReply!!!</h3> 789 790 <pre 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 791Binder:506_2-537 ( 506) [003] ...1 168766.128330: binder_transaction_alloc_buf: transaction=25155532 data_size=72 offsets_size=0 792</code></pre> 793 <h2 class="mume-header fontColor">in db</h2> 794 795 <pre class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128347: binder_transaction_received: transaction=25155532 796</code></pre> 797 <h2 class="mume-header fontColor">the reply message 798 is not in db Session D, this is the reply for TAG B</h2> 799 800 <pre 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 801RenderThread-2267 ( 1592) [003] ...1 168766.128363: binder_transaction_alloc_buf: transaction=25155533 data_size=4 offsets_size=0 802</code></pre> 803 <h3 class="mume-header fontColor">no this message in db, calcate the dur 804 of TAG B</h3> 805 806 <pre class="font-text light fontColor"><code class="fontColor"> Binder:506_2-537 ( 506) [003] ...1 168766.128385: binder_transaction_received: transaction=25155533 807</code></pre> 808 <h3 class="mume-header fontColor">no this message in db 809 Session E, this is the reply for TAG TT</h3> 810 811 <pre 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 812 813Binder:506_2-537 ( 506) [003] ...1 168766.128413: binder_transaction_alloc_buf: transaction=25155534 data_size=68 offsets_size=0 814</code></pre> 815 <h2 class="mume-header fontColor">the dur of TAG TT is calcated by the 816 flowing msg</h2> 817 818 <pre class="font-text light fontColor"><code class="fontColor"> RenderThread-2267 ( 1592) [003] ...1 168766.128430: binder_transaction_received: transaction=25155534 819</code></pre> 820</div> 821<script type="text/javascript"> 822 window.onload = (() => { 823 let isDark = window.location.search; 824 if (isDark.indexOf("?") != -1) { 825 isDark = isDark.substr(1, isDark.length - 1); 826 } 827 if (isDark == 'true') { 828 document.getElementById("body").setAttribute('style', 'background-color:#272C34;') 829 let header = document.getElementsByClassName('fontColor') 830 for (let i = 0; i < header.length; i++) { 831 header[i].style.color = '#fff'; 832 } 833 let lightBackGround = document.getElementsByClassName('light') 834 for (let i = 0; i < lightBackGround.length; i++) { 835 lightBackGround[i].style.backgroundColor = '#32373F' 836 } 837 } 838 }) 839</script> 840</body> 841</html>