gprofng-gui-2.1/0000755000175000017500000000000015044723235010606 500000000000000gprofng-gui-2.1/images/0000755000175000017500000000000015044723235012053 500000000000000gprofng-gui-2.1/images/gprofng-48x48.png0000644000175000017500000000500514726067021014740 00000000000000PNG  IHDR00WiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME ! IDAThIo{7Q%b(YR`[^|8˧H>_N9nQc#΢Ċ ;FLg8[/U/tr f -hA ZDU p{D%t6YdR>!`*̈E֚ʽ)RxnsBMEKxrs-GRu(xbm14iD1"r3c Tf릣LODd+`}J\|^g? }uS1}B%@k!BdȂ5LxcB)5;Hs%! KP05ŦRjW${{7! 9乒0QP V,. bkY+RJ_7L<cjY;% -8,aʫ@=KKm''GXpe2G$YjvC—LŽB`$ւux>D#Q0{ ~;k>!KW]Ke<9>> ~ӷQUyJ K*V0SP_0{i=(^$ ++ܾ]vx%Z6Os7u.)ys^|V΍Ca<‹^ Z"I3mD DUr8z)ᘿ?zĕ-/ǏH i2!ro|M0}xL%\ŝ;= e*)өk`c#!08~g_9Z2,uߟ+\ɘ16qlH0 .2u*6g08FlD4M0$M&!W.v <[薚Jy;_"fIQqyd2@]N#02c _lߋعpui "Bnwwtm.onGAZQbWOԫ(B$$' z=Z&v50 MHҧD!CF6Ybp. AK,>}1X1INjqfY$ Y3"U ,/쬒OqIv#!16 YpM&ٻI`f,b!,JyϰN ĜI t\z10 J&AOdaK bL1Ŝ1u9Ռ,`-HohJ $SҼvU3Jk,&"\US4768,4Y0AQECY+4"-_xū>RTR{S-r>͌sH1q=FEZ*N/4)(nK*M\2YB*LLQ=J֊ՆG+=tyPbjYSsM׮Z@`HFʳM}m~Tbn)|C;K[,Cr\p oT+Ugo.~OY-OZ-hA ZЂmFIENDB`gprofng-gui-2.1/images/gprofng-128x128.ico0000644000175000017500000020407614744453367015111 00000000000000 (( ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''οξνννͽννξξξϿϿϿξ̻˺˹˺˺̻̻̻ͼͼͼͽννξξϾϿϿϿϿͼ˹ʸʸʸʹʹ˹˺˺˺̻̻̼ͼͼͼͽννξξϿϿϿϿʹɷɷɷɷɸʸʸʹʹʹ˺˺˺̺̻̻̼ͼͼͽνξξξϾϿϿͽȶȵȶȶȶɶɷɷʸʸʸʹʹ˹˺˺˺̻̻̻ͼͼͽννξξοϿϿϿ̻ȶǴǵȵȶȶȶɶɷɷɷʸʸʹʹ˹˹˺̺˻̻̻̼ͼͼͽνν̼ȸڵЬʧŤȧ׳ȹϿȶǴǴǴǴǵȵȶȶȶɶɷɷɸʸʸʹʹ˹˺˺̺̻̻̻̼̼̼ͼͼô~cQIJ;69/*B@>[^\npnadbHDBs_Xϭĵɻ;̼ǴƳƳǴǴǴǵȵȵȶȶɶȶƴųòŴǶʸ˹˹˺˺̻̻̻̼²ȥog011;/,zd_~haulv´ض཰öȻ˺ƳƲƳƳƳǴǴǵǵȵȶǵ쾬̥uh^w_VoYQw_Vmc輬ȷǶŴ㺫ݵѫ~f]Þͦ᷶@21rxwnts_`_576~SBAݳ庹ݳŠzFD|IDhIDtr|zrprmtnsmzs}uyyħͯӵغݾĸùĪ|vunpj|nh{mgxrìͼƳŲƲƳƳƳdzǴǴ콫䷦ˣtWE>(  'bOIlet_[}gckhur~feͦ㸶5*(lqpgmlmpo:0/޴db! yw淶齼绺ᶵլ̥ǢŠxvdTO§çok{dcfRQ9--9;;;87ǵŲŲŲƲƳƳƳǴǴ左{ğx_]2'$ ,&%>54YNNi_^xmmϴݾݶҪ̥㸷8,*'''t|{~)#"֮WV0/&%98ZY{yΑҡܱ湹ⶵ۫Ć)('%CA׮rqput6.-~˻ŲıŲŲƲƳƳƳƳǴ콫zs乸د٦{yutĆԬᶵ9-*"""?A@&֭஭֐poCA/-('%%54BAWVcblknnkjWV>>.-&% ?>Ѡr[[PTTVHH||̶ȶııűŲŲƲƳƳƳǴƳѩ~}؞̫ў('.-ӣɣnmI&% adcPSRX\[JNM-"!׮߬ҘxvYXSRBA87762187;:HGUSfe}{ܭeQPQTT{mqphmlzdcȱǴİıűŲŲƲƳƳƳƴǴخ><--32̤GEZYⷶ鼻rrED.GKJcgf! f1/㸷㸶㹶ߵප乸꾽쿾쿾쿾꾽뾽䶵ۯڮثۯޱ躹ϥJ44FJJehfosrw_^ʥƴİıűűŲŲŲƳƳƳǴǴҨǡ..%$Ĝwv!!ͧ绺绺ڰPOCBB/,+`eepwvkpp;87S""CBwv൴ඵ۲֭ڱ޴޴ܲܲ޴ߵ庸滹乸庹޴ٰڱׯ׮ܲڱ̥Ϩٰܳ}65nrr~G<<{XVШȵİİıűŲŲŲƲƳƳƴǴƳڸKJ#"yw!!wwǶ绺뾽WWQQ=>53ƞpn\[kjĠuuaaWWRR[Z^]⼻ON77N"!;'&b'&?>ĭűİİıűŲŲŲƳƳƳƳǴǴƴ?> ""~}ҽʮssXWYYĪηɸİİİıűŲŲƲƳƳƳǴǴǴǵǠʹkjvua_൴鼻溹ᶵШШӫϨѩ޴ߴدڷ̻ïͺʲIJ͸ֿıİİıűŲŲƲƳƳƳƳǴǴǵǵ뽫ԮѨ齼Ȣ~|ϧ޴庹齼๹Ѳʴпмͷҹػ߿ͭqo̕ՙВшԀ}}~~{{wwwvxwwvllml`_]]onɊȢ|{vtȱİİıűűŲŲƲƳƳƳǴǴǴǵȵǵ鼫ݲɢĞϨ幸꿾ֲͯͶ̼ݵӮ{qzfiYbQVGTFTFTFXIhWydntzȣ޵Щjia̱ɾͽİİıűűŲŲƲƳƳƴǴǴǵǵȵȵȶȶɶȶǵƵò㸨ΧÞǡ庸ᄑ꺹ⲲzxUT][zeƸܱǢqyãݾ̼İİűűŲŲŲƳƳƳƴǴǴǵȵȵȶȶɶɷɷɷʸʸʹ˹˹˹˺˺˺ʹ²޶Ω|vsrphfgebaWVVUKJA@;9-,'&%#2+I=p]ЋqЧŠϨ۲Ԭ}qٷȼͽİıűűŲŲƳƳƳƳƴǴǵǵȵȵȶȶɷɷɷʸʸʸʹ˹˹˺˺̻̻̻̼ͼͼ˻Ƿׯxn\TB=1.)'$##"#"######"!#"%$"!!!! 0-72=6A8QGZN`RiZk]mauѳǻϿİűűŲŲŲƳƳƳǴǴǴǵȵȵȶɶɶɷɷɷʸʸʹʹʹ˺˺̺̻̻̻ͼͼͼͽννξͽ̼ɹڱˠ͗}É~ɉ|ɕƒȗƠȢʦΪֳ޻¶Ȼ̾űűűŲŲƳƳƳƳǴǴǵǵȵȵȶɶɶɷɷɷʸʸʹʹ˹˺˺̺ʹ绫۰خݲ뿯̻νد޴ξϿϿ㾰ٵ俱ɽݼٺ޾˿ȶűűŲƲƲƳƳƴǴǴǵȵȵȶȶɶɷɷɷʸʸʸʹʹ˹˺̺ʸwI;k9*m=/n=.{NAȸ۲i6(THȸϿϿͿl`e1"rC6ȧyOCk;.m?3n?2yODŲŲŲƲƳƳƳǴǴǴǵȵȵȶȶɷɷɷʸʸʸʹʹ˹˺˺̺뿮xH:i6'ě۱ˢfYe0ě龯wH:j9*ܳϿÞ~sd/m=/㾱XMj8)¡ݽϰshe1!ɷŲƲƳƳƳƴǴǴǵȵȵȶȶȶɷɷʷʸʸʸʹ˹˺˺˺̻ijgYm<.ݲɸǷĚb+tfŵdWc,ȟ;ʻͽοsha)ßuko?1ڹ˪d0 xnǴƲƳƳƳƴǴǴǵȵȶȶɶɷɷɷɸʸʸʹʹ˹˺˺̺̻̻幩tfwI;\NXKo?0a*v̼ua*u\OqdܴƞbT۵th\OeY˽`(zoʽm`h\Ÿڷg[|pɽxwL?bV_TrE9a*~ǴƳƳƴǴǴǵȵȵȶȶɶɷɷɷʸʸʹʹ˹˹˺˺̻̻̻̻ʡc.h5&]Qoa{ξΥd.qA2rD7~THa+vH;ݵϩd/bVʻ侰xK>b+}TIpB5c.{pͿЬb,VJWKc-ѮŹpD8pA3ǻںh5&f4%bXukǴƳǴǴǵǵȵȵȶɶɷɷɷɸʸʸʹʹ˹˺˺̺̻̻̻̼իl;,tf轭ƶ˻ξϿߴk:*d.ǟym`(nbͽqB5k;-侰`'h\ŷڵwK?d/ɥµn?2pB5öz`(_Tb-ұrE9tjʿȵǴǴǵȵȵȵȶȶɷɷɷʸʸʸʹ˹˹˺˺̻̻̻̼ͼ˺n=.~REVIzm置ϿĵxK?h4#޵ษo@3m=0߷̽WIb+ͧ_'wa)thg\c.ͪĠa)mbt`'ȧn@3~WL[P}sǽʹǵǵȵȵȶȶɷɷɷɷʸʸʸ˹˹˺˺˺̻̻̻̼ͼɸm`b+uzmd-j^ɹͽqdc-ЧʻfZb+Ɵ{o`'_'maѫd.{M?ʽta)ٷe1 tH<Ȼ`)wlvc.z}d0 i_Ͽȶȵȶȶɶɷɷɷʸʸʸʹ˹˹˺˺˻̻̻̻ͼͼǷ|N?f3$滬}PDj7(ܲϿa)ym̽;oba*Ýa)tG;߹ܷg4%o@3㽰ӭd/wG8ɼa+tiǺvJ>c/áںe2#}TH`Vg4$ٺYOf3$˺ȶȶɷɷɷɸʸʸʹʹ˹˺̺̺̻̻̻ͼͼͽȸ_Qb,ɟĴ`Tf0ѧξҨc-j7(լzNAb,Ğݶf3"g3$}RF}̧˽mba)mbسxa)fZͿĠe1!|SHصķrh`(}SGέb,tI=qhc.Ĥqhc/ն˺ɷɷɷɸʸʹʹʹ˺˺˺̻̻̻̻ͼͼͽ̼ͣn>/tE7reh5%a)VIϧ翯l;-\O^Qf3$`(}RF澰ĶtD5i^znd/YMͿ⼯cWc-e2!a+qC6Ϋ޻xLA`(`(f3$^Qj8)xMAc.`)|qԵsF:rF:zph8*`(XMȫ˺ɸʸʸʹʹ˹˺˺˺̻̻̻ͼͼͼͽν˻׭y}px|}ϧ˻Ûʢ߸οƟǡɺɣ˽ȺǣཱܸXM`'l_޼ƺݽܽ}˭ͼ˹˹˹˹˺˺̺̻̻̻ͼͼͽνννξͽ̼ͽξοϿ`(yͼ˺˺˺̻̻̻̼ͼͼͽννξξϿϿϿϿݺm=0g3$j`|̼̻̻̼ͼͼͽννξξϾϿϿϿǥ]QpB6qfξͽͽͽννξξοϿϿϿξξϿϿϿ gprofng-gui-2.1/images/gprofng-128x128.png0000644000175000017500000002431014726067021015076 00000000000000PNG  IHDR>aiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME 4`K IDATxyu?bq.HD)"m%-ٖe;bؕrURUJqʊmEE*OP@AE`q.9叞ҩJԯNOOw~QDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDk"!D-M%I!%Jr"S$?y?J|Ik]Xg4"S)l<3vƾvL/-&Ļ'x/| DXyI0CR0 hapduLϱv9huh̊I@6+jX=^R/M&@JO)9 }gԾaאRVz6Rz?\h׮=JA";7!lh+ĨV^mI?p=k0 b]]S݆\Zb*CDo>Z ck%&9:թB{NlWڝ*vlxǧڽ^D&50%QPD"$ {\qp\nQG%HNցw#*e2ю-DU&gjeK,eH2D/{YlvSnשjWHtM*iՅPDb% 4oH>būk/ZؚtЁ.QڑGBǑXNmq^.Df'dEJ>̋ pŲeuMhDS1Uz SM-r-E )ЂџXc`M:Q&G]zcK,*Rۑ8RTAh`@"\W k޸Dԙ'0*Ԧ"_51]kuM :/k+y@+%ضlAٔTLbuh$C\n`; >i8AUT Coµ-v\(`hCw5{ `E+A.֎nOf߳(U$eZRB݄6s=B86G=snOJ5ȅ+Uk!M  hKݷ*.[P(KLm~ݴRK8gA63\|oZp;Lj_0=£kf?KRP$&H\ 5q4gό&U@` @D l(V$D+˦quń@|Um-#D/,Ij]zRy!Ǐsy.~.>zGT UUq"RȆ3ZV}Rb k@ԅvH*$ WD8cFTŪ1PJ.ZdBw0.qlsIDM([n׉bl)ܹXű#`rΜ:"vDUΜ>}6FFPUv:Ë/‘pef^}o.qs\s.':a{]]k{E|8ys\k#q3+C]/$;wff _?ؙ_}E~'uSN'?Mw?>l[Nw5&3߻qBIR6%qC5u:<-V ;^XMa,'xUz۽dL㟸m;ciӗw%>±S:6RJWYXZᅃ'x3|桏{>8?#Op{g?udyOS)OM&gPi^zCUx7, 4yg0?uxﭻIT>S} O7d]c RΡTkQe=*iC4*ˁX&2`7dq)K21:۶fs$bT !"eo!6s4|+Lsi4/_a{>~/T*&q=uӴHS8Mbi8'&Plvo#Sk5\pJ%B`&K ~lazf]SI&(B}1 _4$n@*Qo: r޳:a BQشqSgS*8qv;߳Aɓ4kU0+&bE4ps؎G?^]&%ξb^KOooUubǑ\[f0p7&'AKY)l2/zW^yUQ9ru'=>i쮃Zˏt%4Z8NZ/I$Y.ԃ7b JEpZQعk'ch}{?rb|ӧd::<'Og'0ms02:ZX#>EAJʦ i79%6Б K8**I{^ѓh~CR)eur$>-Kryp0ĚkY_\l8HX-9XЌz˼E&{So}|#?F"@uTU2sK9di~L,sχno`|."}] =7ēI˗VXfyѧ*{C48y2 TcW._–={v(*cq%ƍ!r?xOL&0 MF mRZt?'UYp o2U深ی Xȳ+̳07{nFFFHg2,/[-3Л>qɉ>i:\]q  Iv{O>wsL sW2u&d)Rѓu~pM¥˳ u7Џ* 02:wBOOOpW'8(; J<ZQ?%yG ˊVL}\\co0>Goo'x/c&#}4eswБN꫇C;?Ș+"7ްw5 _yYguK7?t{K<@J<%a Օk}$[Ye˖H$YZZ^ax,S<ݗ) OT5.Z#aKjQCo ?o;]m 촊î)-/F,J~7jƉ _u_"@Jx8;e#A Zƒ܀ A{vBХ ŗ.oKT''N3pXhaSa)W,fA:,gyW1tmTe.^+(ޘYiY9SxWK3q jb P*̠k*+^~ULNnGQ,7tN:w̲$Ų" kY0Kdh=8XL瞻z?ڷ5;~ssWgX\\ab|`a Bm8͡CG8:x/4I%5M{?·}{{ROWoL[r1ִ@mp J|i2 1ThE#r|~hN:A:FQVs+,-.#kp@qT,H k8+ˬr8U} ] C8^J& V}enkљĪz&xF+E7#B(BvOgRJlۢ\*͒]ZTTsXD(l2JqlMWPFp1iDXa$ؾmc8,gϾM6;Ggw'F16nZ qtAgUUɸ[+eXYhY{”׸in0bU4886qiVX]5SͯptM!/kzH3k:"( ٥2 y4ׇ"|oO2dm,DӁ;k_0b;RcǮE.]QD7۷ؽ;7NP.6Մ> N$4r> CP2үfTs%YBQ4Mi88<q7UhX1u{VF(w07R,(Wd:@Hr#Gr= *OdQշٻ7;]׿9uL"WP$j)T(W6xxqvs"L,--18؏M7,Yzǘ:sή.6o5O *Jf Kj;sFzx# m{tql E)NEVU$*UcUe[cIuLI$7RMx<8A.w'nu=T+!&68C*w T˖-4}-$tJe!$h+J7^dr -S/,,,3?%.LT*,-%(HbUud3yzطw;7ntY6m؆Q4u)8ehh~kldyyŅlXuԤ˺|]kθ; Hmu(,%j=zғ˾}saTURB!B t#BGQ*Pp* H<0+ezzzp 7;$)JDd2]wÓO~@o};.i#9 j>_ea!˅ Ο/q|70CgWLƢ$vH$J3?o13ʕAJ-Lkv(*Jf(ؿzfg܁:7Ǎͣ"Cl:PB^l\tRGD*b%=@!Dds7|M?q_z"TFGA2 =):2$bIvaWs rIvp.ܺ{8##CtwwOy6QK{^. lڴ-Ttwitv%I$)Tpb1 |ӧ1=䯾~_&,b`pG>P5g<Ϟ=)K ._9M1'n"SHޓ֠\ "ƕЎ^nxǰm7?&'p!r)EE 4=\v6l["Ok:dtUѹt?%!WH;mT6|arirYT`Md2FafG%z({$}h ccmQ*0 *r6JD.eye݇BpO=|9Μ>,Gᅦq^|aj&!D!DAWy7Dg@ @_oiXٔݞB&O +ݕ2;}g`v"*fntt1u7;wD*qAccYr ӬP,a놭nqFG'XZ9z9~|︕gyeN8}}~<<|X,N\b~ao~.IDATbkw OP(䰱>#CQU7%%xbx0t] !(K,13} Sg-g)Xf1RJuom\zthp.HJ=7BX]`( ʏL[.BN A:v1("$Q \xr-<}uͯ0w~W;RJfffm~IqÍC4R&ؼC>#s;{uO&;!BMoHզ-Szd!c14Qm7o]%"\ RfRR=Ŋ['x>*-|q^y ND_wazzzY]q4O?8܄JK*u'zvUՖp] Y-/^*%a;zն)VH#l`lQzVsDR kmDUUNzIwPvnʣ)D;5}* n(ϔZ󛁶 g 3"`ˆ)TB -UyPP4<X+ ZWh0qݳTÄ3ٺI`sA榑 ꪸT),i vBPMb; o Tzځݢ\ ji jh\UDIhg=NXEgU6F ŸJJvm!e  ag.o-C\wA *5|ZcS/->-@klX!Z@ 6;i $D{4Ur ]$=JR L\3x U¿si6A ckUmV#XU\o Zrv D0ohwuJCL~L ؅\=k}sDUyqw Y mpһS7| dSgumbvC U;AAʕ*/{򖭇w(o銶z˦ͱ2`VsK(PSpL ]mh}l ѴVlPjnH[72[ceq܈vq{5|]Np {5K˻Wlkۚg\^\SAr$["&+e)b*_<26*;cTzi|/ymWj Bn$2sI۽{<Zջ5oy1e}+Ct;ZzlCSRiGyp^M 4Ch٨ * W)60Ey\W%N }] 4F3ݶB@tgZƬ0Ne ShC&Բ"KYU&f86G9 niVJvd5as'M$pK2.ֿ?zؔ"ds/,3sw#Bi@!a#%nҀ2ﺦ4$r2"("("("("("("("("("("("("("("W@.@ zIENDB`gprofng-gui-2.1/images/gprofng-32x32.png0000644000175000017500000000304114726067021014720 00000000000000PNG  IHDR szziCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME !6${ IDATXKoE3=^;Il#H|n(< J $c}̳N">ZSw.NkW@Qj8=T{+$iyBd1Hs7+@]]+oU(b6+yCЀ |puNNNyPS|R*%/`m($(jm ' Kl$0H=!ϑ2J #kL; CQL/r2˘:"l :ZǹO7NaD^B> FqX3 s8^Odu$H[kzSG0LY53Avww@Ea5''cn}֎1 /_ͣ_ }@7t@, %N+ǔg8fEex'f8r^X^8e:S%d{kv>y¯T5m(`d+xД_?{O1QdIScM3BZSsgg Xl$]:PV&^l:7t.l*5hcIw ցފ6zQJo6]~igT+'=.4]2:˝^u;cyTou+ ea2 1eуi;4yK-M΢_^\^%]$ :2hrIENDB`gprofng-gui-2.1/images/gprofng.iconset/0000755000175000017500000000000015044723235015160 500000000000000gprofng-gui-2.1/images/gprofng.iconset/icon_32.png0000644000175000017500000000304114744453367017054 00000000000000PNG  IHDR szziCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME !6${ IDATXKoE3=^;Il#H|n(< J $c}̳N">ZSw.NkW@Qj8=T{+$iyBd1Hs7+@]]+oU(b6+yCЀ |puNNNyPS|R*%/`m($(jm ' Kl$0H=!ϑ2J #kL; CQL/r2˘:"l :ZǹO7NaD^B> FqX3 s8^Odu$H[kzSG0LY53Avww@Ea5''cn}֎1 /_ͣ_ }@7t@, %N+ǔg8fEex'f8r^X^8e:S%d{kv>y¯T5m(`d+xД_?{O1QdIScM3BZSsgg Xl$]:PV&^l:7t.l*5hcIw ցފ6zQJo6]~igT+'=.4]2:˝^u;cyTou+ ea2 1eуi;4yK-M΢_^\^%]$ :2hrIENDB`gprofng-gui-2.1/images/gprofng.iconset/icon_256.png0000644000175000017500000010103014744453367017141 00000000000000PNG  IHDR\rfiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs  tIME #1)*- IDATxW$ו;Y>;C6 fȡqZiw"V&B㆞E(V ncvg8K3%le\=dUVU+iD].39s L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L(0d?\6`dCI&Xd?8q?LK2$SdI2$LdI&$L.VJ(<\H5]I|oݷ5^%wBd`nz1h~ `~գdTRHWdPvR$lWV~ABȠ{O!C໒,/kVnd H_Tg}ylA/ʴEkC:U&7UPw4@|@+ 7i9)eM)B! *_G TgH.–΢/ ]. ʫsmcJ⻪yS[rؽP w+,4[BR~&|EoUlʺߗؑe*j/иzof K6^ҞY T}hJGgP* Th5;;Pa:[G|7IH(Ou㩆tQ$Mh]ϫ @GL%7-ư Gv"(h$%4sU"&6 %F)unX;pwC;cϠT1B3($)ߥB֝F{܍4c'ϫҬ4JT3)h8oU(†JT}R‡$w ,>5@KU"c{8\TPn;_C\ ɤV*6Go YJ: NȴU1K>s5Ԡ$ F4"t*Xs\0"/Zy@oa뫰=3%苻*2<'yь0Cе K'fwDTB*9ע41R,ͦh z~ fjbPL>+U&!ZuFUz.Ql߻@dߓ/'R78bwc~7.7-5ׁLa}"juU˧_EЪύáTRoQzeϨҟ;a *C1hT_#n%}E$ԍ(g$}C5/uT&VZ )淄8uc? $Øu t~X%0D~N;y7z B%b0-zHK)M(]$XNA R{M]5*2d&&LрSJD$6} wå7.1\|"aIU?N"CP"ڋGJgʉ{IS^%8ճoH-P6U 4[J"`ZiUl=wWi~XǐT`h!n:X*7+tWC{!$^P)|&uVǘ*Z6ZeIBIJg"PC8 t[ 0To6Xч/Ibw,r_Kr"!>WwZ{R]HT L>$kD)zJ>AQ5#%;IhKNQ郓, lz,},2'Z:D#a[L,AN0U G%J\KNi] ND_LԄP=ڗo=B (yBa]>$pîCD~p.h}2a M`"0U#YT]PN-8"}vV#t*v'Kqv=ֻ#c Y%mS)YfˆQy{WTL!Qpf7 *d-9yL'~h<U3$z਴Ԥ+-+DaI,n@$. . S`*R7 Q➵$xA1ӣ7⸊^`e9- HwcޒUy Ja U46 鉤q,%ġFtZ(\7-cjǑL)d8uf|WbkrdSoQJyKNG oocaf& (|x{3 `A!/)CXg=> z>Q4Ĥy?p @mذrW׀.q3fC4'U i4OAVr$#RBKJt* S4NWU'FsT6ކHh-=*Ythi4i(,S,[ÛRmJc (_\4Te|c'p@8+,AR$= ;L"~d OovU^O7lֻ#щKS@{HTVsM+q1A )xpģ6I80M B!Ll;c.$$gu$єMPNthNV m!?]Wh)ZxZi=ʟX1Ai hp黗ߓA 271yQ$Wڐh[PI]p]T&9~ C1/uQ}8G)gH 3=׼o{SJW 3q>fA㨗hj+lWz!FVة _?MlVPObcYKzUÈn\5KBvA)I z.(2M,BU;apP S[62B4HDba$gucܳb%DBh8M(UH0iP@{J0h-". #nm.TB ʥSrv䏙deuo~<_y䑇z*=?{U!yt'B!1re{y~/1F\hrEGW>>@hhNA*q??wC M :ĸωY4iaŕb`fL! ߗD"l$ at$4[rh~?״_sI 9Sc?QP.}o~;<9Sxjh7[=b୻(ˈOl6\_=8o_󭇅U=w///~ѱѨRi6y8{ W?|<!hVyǞWo^b pma߼}Yn>v3ium[Y< k[#"!_(^ݳ>Yݶ9i^ nj:&SVԚr<1F[[,laepm~7|Gn=zXGNn~[m(u0ID-4DSѴC84PHv%ZZjf$˄w 77`d;`)Emk3HػvM?]-ˊS=cme3.}VVTThlh5m;D=Μ>-CO>k_btt$Bvv (xOqZp>pNF]P} *[`m:Q( 9 J|90djI }a:%w$uUEہGE4reۢOg-C(4ᄏyW/l,}9M~s"xO~M7x͎,=Zk4NVHrl 8{m h\lX_Amlh5Zz i(Oy4u7͌077Igayi\MM{pssq/-ގi3y<~|O^q\x%_ZN/|mz8,AT ر Q]HhT$$=zZ.CU# 3=^'J턵b1Rkm)R t闆apӡEmZϞԶ7(-v̎/}cv&/]e'{R&{wW9{|ͱR_u9s N'vHlڡ |Ik+˸?f{rtnTvX`yH01>TBImsP A+ kפqh<uˏV$jġD_ (nvi'u]\ScO%)  ri._G#_( Qs`&sssJPOQ=ǶpJ,Ւv^ 9w{fFVu8/_wh9=MzU*W޻ocG:אP-4t|j$c.9mkx*&ߨyTJB)J0ҖR1?x8+z@@xJQoFSg(\cJj&iefIƬ* ŹW׸p}2_#x'XIu|Τs6Ro4\R_/5F˖ig.vZމ)oDt"m;G5sj}m߁aXArTũSg)uɱT:9+<Ņyl_0[T*E7k5U_4>?i hcugHb4zc}2EY=O5}`\m9Z0Tc?U$\B(Tlֽ;*l=H,GG# %U{lW0E( Z:vb@ZP,v3"][_c\ËϿKh6?w'~3b>Zq=wFz*[~Y'&0 #%"T#;r9jW._ⱟ^yǕ7Lɩ ):Oz)@ٹkw\]F/mnɩt\s.K^mΞ9O_<Y=סQSVJNU :: Tz[]uꋨ Tt/+W 77*sXڰ#zg*Z[X$RN|@užS # 4`WjGdrjrBP\w^ÈTZ_Vok[Mə3xų}2 >CM9.-+#}wT_bv3S`\r^<CS;/>Ƕ~g/~f_t_?EyP}玐_^+,/nsgf|s]I w~mfgV%J*d n{)O"t+tx?FkZ"x!P,H Qmxp5p'8?3mGQvjх C*2JH 7#+eNA _6!e޺3V3˧:r4JmmDv;'ػw'':/^8X0>>q b s>`f+]~ҭC;ɓ}y~9,e2| avn.Nmz 6I&'CU56XR ?Ɠ<_`tʳϿjݧ*w\dn½:'?ss&2{cU2{FVBOq8|pO+xǹXlLرmB`밼ȩޡe_<*hYoYoqea:sss=z$BIDC>tBo+"Jnbk6Q1 yUWT,C+Z}À*(HDG+FqTI xZ^k2 #@{z^|\X{8כ8nw.tEΝ;PJqU<}-xrvۭ鳸CT[q1Bbu<>¶E.cfnb5w<~;qzRi259wɮ]1 st<a~a9`-#GnJu#݅c;ܾsgM)6>clX迤bIBW_. &G |sr}3RA uqlEO=O9NmRM#T+K%z~0-Lض};_/$Nkl zPwqw߲re gQ`c0J33ٟ~%+)iZ<0JZCqS/AT+ |~&''0-pMǞCFuC&oqUi)*qRrtwD)W-J;!:DPmEEP7K'$ڦ;QtCv72Josm}mz~xw?cyjY\ٹ9vI(#* 4 V;*ժw#gmULi'q҇ 40 |!_!Jh4x_p<T,,BE*UB#IV^$#/^]'~4[x {avn6L-:TT!g4qEZ2$aUK_&K~ (ǝn U9Ȇ+sD6A7jUj$\BPX\ VE$zRi|5Ǹ?|3Զ1:9>u~NJ];'Q1;)M:YlCՠ ,h@mXE)T uYZ\¶[7O^e p{taToᅨe*h.p=FMV< ϜWOh9xJq9g0;2?WQ0\B<B 5R*t~!€hيE4'ȉ9{:i9Ͽv7N]TMzˡvPs+#Gx^s ;x_E(e2짔m=7<ʥtX'MVgWWяp:<^?uJɏ,4Z.M'[̌؉|0IĊ7x*OJBkKDgd"HZX Jmn„-uitzHϣ{S[Pa@ѣZY>z|eqw/xsm~յ-k-km Ac(cUon8Bw#-]Bk!LMO3:6nW=Ig vD^CԹTj@~Lxk<ӕT%JX)[&!!(#Y* NKZ*P Vf1a- ~K;zM-[&1n RhJEk J%C9PEX0 C<%Xժ9i)+m_[C)o:KGwEfƗG`O-x|s9ZT#l۾]vxRw%.`o#DKw\|U`B>_TPc9&.PiID|V*)¤o%i0$`D" !?dbx1Dr=]B ]RM(C]}EsZ^D 4p"&ѐm]yZ5N40d.t]/t7t&J* BdnNJXxJG.ݔ^駞[])Ŷmvnl֩omvY"n\jPduyW/quV]gcZ&k'l:MVsǵrH7#Y[:V. J-cBuk!.CM>gdlctl+\vabY9r}<%-y3叿(V I>RM.i֙0rՑr.ӳ9涕)UʔK%JŢ~mn$!h&QN;[EѨ~ tX1p] 5)=S 7Z"Lw2WЫ#v^҂.wmcAiE}Z~@zs)qvvI ׯ^ڕy~`=TFv!LЬoGaU`_ uZ6xX &c-F ml7)U0̵6nc+Mx(5ҼrϱwǾس&fmgttB@.XmMՎZqX!o$ i7{Bax0F#y J6zUWXZK?{k/aYYIed=L>?q18B)x.ȁ ]M rI#x$"l(Gbe@2+ӥbzCNbdHhxf6W\_am}eLà+&1VnUi4llrt6[&"&1F6Jmݦ(.^XZbמq *QA Jj5oRmXG-& g,S,MR%W(b`,\4)$CnXYama!󊙙3{ncR#.$ lvmHj2dN"]z8UϺHSn_dj ur7DzvTIܐWShzD* &z[pZ;>0:!ö[4j[̳0+.c&gvr-091K.P(b: ;sb.xM p]m<uPuGXX.aMrmK,^w_<y`-?tf(\LäZa[]\:SbIb J#+eAG( 8 |Aabo^+,^dc*5}9zggVG!%7<'Sg+J HT' *%+ex4_u=;IHV6!h$x։bvf0FEV`rbruB8V-l/FcltݻRR{,^Dzh[8c׷p6X\@d099(vd|l|) qq<]<ٶg7b (t7s9znmpjX8mc/ IDATB$)aG+)8v·`zGryR56WWx78ڻ\z2^]fjz|AmET0HA}S0L C0 41-sOCh,0J @KrtU #e@LG}FF/Cbɘ QSEc㷚u^,\M7S)* EFFƱ++ \ve/㣓NP.W8X0*fX1=86Fzv5POZ2::J:yuu]j4-'ض BR vJ2r-닼q oLOOjj=0Mj5zcsuzMX[k8 򋇊QAד= `j?oOXR4 GAդ#pn2`z&[KM6W;ګ\tjw[n,bQ媿 0òL3b0>>f˒8ӌOLRmےƸu! /}@4+P.Qp mmXSb@Mi0ݿ_1r//40 m._>K:"?*RnfÌOM*]e|:FP,~aY>>uRQ4u.]>8vr0\"SSӾn4u7Z,..jrELy\edd\oQ*)X թIhnq5~/YXg)i4P@UDZ\wd.Tv𼤪7D0Lzۨh2}Ccc.ŢblrxnnRf!8m+)!>## |؝[rUoݢj:+45 "9+ϫAPT022A.(ˬ,ŭRY4u_ha\~(ӓۨ 0:2~\.G20L7b-y%66V&ϳJRϬ7uzC͎p3T ټ;x6v:L @!jGػf:ҥ+/wu 8>@u*j[M~ZgxK+6z`Tz]Ȗ2Mdue$'/:@Mb"`X@_],ECRaeLJUK"ĉ/v+?~:QEk:XXG=HRL-v^ܶmn(Al;h6(`ss\.u6تhqɱcR,h;S<ԏج13 mIZ}|@y~ nB.gQ.WMDz{b( (M&w%}6O>$|af0#D^~ Ĺs;KxRضZW.aY8rx7SLLL:μs<,UJ]k^@8I( f3ϥ0 Fw{pMI|NY-'C-n`J|!H(?@ MZ &'gFiR2?ߜ^]~ÿa߾LvO4`YYEc},"iwLRPʣ/7V?;vLjֹzm^|*w?8LOg>FF(X.e)}N5ܜo( s[|糟]vlA?r9ǏsU.\8- QRf~~^~^R[ ,Ӡ\7KwqnŏS_ypg|DNg0 ŕ+/a&/e~;rx}S̮hiZ4mV78{"/sM{8xp?łiB>:2i!`wCV_:_}\QGC{Mg^,sA|o:@Z~vee{<2}-s.Ц\qX7y˘c|'xO|U~P?^ST1%]żK~-Vݕ BhkE>cI$&ލfϵ* bV+ & m?\cY?yLO(Pp_8Cxj|3S!Pm;pKK\Tdm2ًa()6LM,qϽrȭ gݍ FU>|7*;0ѻ.[BYy6-{?wSM\saa<"SST_ m9Dր㌍~|a}5Nw|b>~ǽ>"R7S" !֯nX3'0uv7K,[uUݭڠoҠgЁ7ͦ/f+bQAk`f KQzŸ $LxbLBTƻDOQPdj*J"HWgRޑسsXkVb à/M3LlDI$2А h/+՘Gsq7hMTN37w|٥Q&'I$c^u=V !Lr|;`oE_ ]]_&HTs57lrӍ[e{QzP!T罅E`F,/2(1 &b- ej&G I$a'N.p![{wq:N8ïsqQfgOn=|]]/k-MWD2b]5/SY5/+it:A 0W%RE$Ǥۍ'>T#{ E.N`LL| 4-BtdڧU~j`ƪ R;m*oER3 f$ꯩ{Ѩ 8M: ,tuͲ+VYbrjlWʊIȾ/,gnz!|<,3ӧ)G(xh[h``VJ}OyulASxbtt.s[)}v 6W~g'?ei&r L:J$")yg9sfq_35y m۶qǝ>@?--gt2><_C7ozK/}>o&JSө!L#O&\ W7TßIX'h6/CebקV%Wb$7bfzB`Kĸ{y󴤋LLD\#njhXXH L)1MiB4*pؐ#a%"ŢQhkк ̘`|ȅs0ij$Sizi癙"rGǙ3ݬz/RJfgss䖧J: MK2`aac,Co1: kohr1]ړ}Ƈy9pI&TeGPhգȦ?5* sj-E( ͟J'ϱ-bI09~g\^𷘞:Mԧ>wF__/K%yq* O~O룭m GȽ|no=w>ykv—З5Dʉ d!h~v$\)]?Щ#6dMazH4M>C0KW5~0#LM!"YR&|@)fZFѻMeY6 @Ubf0,XK&Jgfarl ӳ[n[!ېQ}w#ɥˏebڦ۵{wޱx2Kz%\xG?Ȇ ?NKZ~qǽvXUX*508#L_fݺӰ w5&7pW#ѨBV{5A6T{%bUB],]H$B|c敗_㩧%Cu[9s-FFq5V m•|t(r?UJHӯ XGiٞt6 yJQ0&+4 u, Oٹ xSoL:J2VF4cF]Ou [C,.[s5x3}5}ustuupϽw#r0M&G'(MgM` M'q t )+ m)JE%ŸQD [vs .n}CK@XZ:M]a#G(VpطZ3}5no:/~Dl'$NkW>J2'C/pqxtK+pgΜ宻``pOqq9v뻁5lݲ!T]Oޖ;/JL-/a"0r$ "D'>߷sslݲT2͙Ǹjv6_} J!p`^qi 2z_5V4I] D3 bB{Zh'.2x<#}^/,D_ϓ7a3C=ٳ`FJ9&ȫT*|}Xr V02r-/rH)_;݇agHgr;?ő{unfOk_E} G~>~w?d!e?ªUkZC ,_\.S)Y-1e۶y8cjj 9u_—ܰw7gN&366LRKbB1O>czz)NbbjKNfфn- qS}~INFR)K&sDrEV>Ć-{֭ڮh4N"©şX$q*{/~T*ᯁK1??ju)jM~JKNSq0W?wHpJ$&zTqN43sMz' +kW'lܼW^x~!'L30}{pozb/ݛj@ξrŠR6( e(Wspݬ8̴ G)S\ًatӽ<7z0%Ɓu\Ǎ(<rVInV7F1"XD H'%%WEVn i], cns,u6CSPJXݿwQ`Ϟim`;'O= ^}-K:N2$ƈEcә!!O1c LƠ\:r_ڵfbr\N eJd(c:5 moth4Xf=ޫ`a9WK >fhhvK>bH4J2d߰W^y͗C"s,,2>>ŋ 8QSrۉ)ېJcaf" bf%: 2-Q ӈJf2Y  3 ]BK#v#eR1EW;)G>7_[0ҩ2-No~/{|.o;w0~ɩLS,F#j|p5âZb3JƣVǽJw(p& 9X٥JI/ zЪ }׍}R{iiigϞyq&F):Y;KwG;kCXTJ覵d*E,!OJeH$36;m&IS ,QV\D"MgGMjơT*V@KKC\>EOL`ㆭ<'}?A"l, s5aǎbњ1 vG8{<3ӳtwwq]daa#99ΞqbcoD\d_/Q*-03&}Y"I%DU=Δhi]M&݊`Ö:J"KK ,.YӁ./179N,r~b~Ld~II[k}\iFbNSqϽws58q:ˇ_fٻwz3={ķs<#,eX3mq;E[Xɸ5X 2WM*}Q mUŴ,T0 1\IDAT&!H?4#lݱH$<ˌ T*p[o8}g9pD -V:Vii::%bc1::\M2"NmѫiD"\) b7ǹjӵtvfΞ;oe.u۲G2ttq hmme`pbD,VϽ9|,,,;OXB&y$yo~,㟠ozeY2-H&Gٰ1U%h%t:1ǒlB [ת3VzK #BKK'--,%re~#GFdcY t>I28R LU1=~۷=ڡ _n4?g:yW9} ˡ|>@>EJ) KA[{t XT2EkK;64hd2E&B[k6L3F:JTbnv_ynD"櫮c[.vdKD#&%qx8r ~G)%̲drmݾX4fKŒ)\n|~'*qH Orm}`Vm!5ǓLQSOVW*uvd`uvvB~\\nyZ2']xDrq$w~2X")d~챧d|C?K"}N+_jg~ӻI&tkJ\:ӴDfBQ%V+uB6`@_bF6]&:p_:BvF1:́~pݞۙt1.{\xbaY)7}7ʥFOO/kR[S.WZp*H$G") ;mWjRr\ rB1_RdKJE&&.ed9HXd){<:9$X̴̓p}'~=(crenvlv1.E,[_ͮ]yVp[yXq+?_~7A:{F:Ӱ2 i O |h^ LpAxJ} A$YJ l<t^ WP\ ikf츞˜=u3'2z,c37;ʫ]K[G}kټu7`Ӗ]DQ+2RRD>eybsɥ3>%"˗e86n lUv5\>UٓO=ǁoλp(z)y/b_¹?Wxq5ӓ#wZ[;}4rJ$.ciUcq@ENmo2;;'ba~ refg''D00"ZՠiF0 *yޞ~::{ Kx;Dx|=tx^4#R]$i{D5?́;gzrΟ}3dbbqe <|\.Όط#rլ侽wrI3ES?Έ6pKw\|@3?!'G,d&zɫ(rrIhيE.qq]P/39~,-Α]ZXCB\,Lg0dt^6ZeAG}_k);ω7^g#i:ڻff'ٸqxdRc"iuutD"Eg*;im Lii#OIHBZo˷(c@X%JڵXnc{};^` A, ' pd`[V񕉂6ST!%UJ5 wFJH1Ayx$aԉPk7?V?˥"rh,0̰ɫU=#TC*wB~(S#jMOdiq|a(?HҼ}wqw!e,`U^N6mDT׎o=ĸf_8SO=0/cff?dho_/ѵtX,sSDqx ̈(djqM~r `C R){6[{ E\`]ttv'JTxiJŒA7MU~8R܅ab/f/AAo$m{l8E/Zap ʒl^zKyJ=Lz߯erI W~V7K;m&lq~>?\gV pͮX;@[{ݴwdHēIk7߭DEV,@:T=yGyuxᨙـ5A=[Z}ɸUb4C)ra W4mD'Un hd0aUXڌs("YM1sC|%] <ǿ$K SY}}ܹլ颳X,4cc={om}n{D ki4f>sGYsp_PanR`#/Tk9保ex7#'6p\%0Q(`V6 >;fsUڮbN)I! qYI\h`3}Bq* INx'q正 9 KK,.R,,o7AX*RttovŸM!=.\5%d(\< '8g֮KH]C#x'Ak@| @SE!S*>ns er\SP"U"D!`k)ix=pJتYRHnylvIK)msvL֚`[ZdX;ʹwaFu H5F' @KB}/p.&{z{"D\5mnsL ZI!>\xLՔP?ܘRLj6hHՍbY/Hekq=lwьF0!74'[u\]"žkÆ56iȃ4{~We?^ py4\=3l_ĄicQA4r X~gF@s@Q'u9;J@O]E2JkL6J|QR, e/4XD[I&QYl+E^IUgq)ڃ ,C>E&eC^HE=P֟8vRv:aOމGX>^2U~C&_o>I[ g>`;Zz~Kx5j>HGÐQA,*HƭJ*].Jб%6 6S;/3SFn} M^r6l.,ޙ! C._mjI:nB5'=D11#^>roP]An8<).R Kqnl1q'/bV}AV䋒| ܜ>wY_ϝRU5b4.}/Eݒ<$$"-d3+ע=)׽TXOݨ@N6c/aaMpҳуȚ7#;^JRr*EAYf:];!8&;oa^=8MWKqj1-UUIN.!z`dP]95+Tsr NoJ( BsVf֐PoRI^qzTW !Eay:r+O1i!O d+WnNܣdCT_.:F$ ,TZ@4c=BIR*YT$ez cX%] ǫwrW[R6NmJϩӨ\B 8UEHw !0Mшz}MnuA>:'ޢ/FmSoͼpOaE5!җQ>p QAϤeOjS HDn_eEVnvð`C728,C/eqˀ7Rw:/!T+ݫc!Y,bpC]\K(-EJudX[xRA] FZ͸\GD*;=N뗬ԜM{[ZҲ~~Oeɮ M +!tVhoz@Q>/x}>|l;:9,;Ūr̵AR 㲦XGP(B"*bOqrHoku F*Ru!==UI62Y?`|\̯m0M+%˔Mfzo7sͥj AP&̧6r 4j((4tH9+*ws]Xq]],Gl ͗m^RZ-ev zZE;s`U>ZCP[dp:Y}aEZX b{d O[%Ǐg=pYk"BI{ gӥ@dos2D6`]`NzԄ' F8x]ORY쐀=(D$gX\&%eɖvk 1PH#/2.G+0aK5#`<2FF"isBx4:y/a"_z+ Lt>#f{r•pFs`B[6IOawDɨTKܥCD;qꞇ+<Ϯ_Χ5%+WjQjz Ou^LLءP=}(63VqC6 Վlj-sÛzM`nsXNBuHqj;eb-)fDOoaziVHð?tWV&'Ĥ U&Tۣ!РV&R0>SԜQ*Ih}3B]JE`C,)h8iI‹ƶmm4'C_fץϒHߙwvlaHtTS+ C{Q)]Y7" m" %$ŕ-q B%:M{a-XRRys+\KE+r"R8*(C@qۤ0Vb|E3&$=}ɪ:%|KJ BY :cTg*K}_@(}ET4WxK#7FjE6Hz u`#/o0p? " NW`썦:D X,K!*{RiD/G!ҫr"]I2tĉRzً  HVֳ!^aIsM 'K &֯ ?TYJvT{T('l֊B!G-.*XtKԂR.Uar+\ő[j>f8W4v|G6I* X!_V^,])a"[UC ߁?wrE7X6)w#+q[Z#m$vVaD_xsS2li* +}&?ӐA˕]T8&`QS!c2쐾rJIqHEФWh}^eC0o.3ڰ48r|fڄJ owC+H4Y gūaK#&zmelIXY Î+PsNe[6t]#W%o9@I'!ԌjUH7ȟtGZz\1նB '+#y\++𼧻 ȆwJe"xtX{1졦%/_O c.P3DO|3sDss 5]IGIJSTFRf28@~H>to <{& eHJE|׈\~P^>gR\*P4 BHU'DCR5S(NfNYĽMX0KRtJQM5qNi ,Q&\rw JDqbe{5x{S"X?8Jޓ Glr 5)LFSD\=MI-6ve#DTn`ϗ _H[qT)EјM$mގ < fT[4aRJ(nݗj #E;NH:CIvDЖu?Jqi2lJ<g\.{:ٌʳͤJ )`;ӬkdkU2lUKDTW[shʫMyJ| ];hd|Tkstb2qo?Jf)KUp?ɻ7W5Guڃ?PK46;xxUjFˈ!;TQEE9wt^20FQKl}~L^7wR\R*%UdyJ5Frr B>RPEB2))3</jf訏,q=Iܷ}h8S)yŕA<Bd ~BSA]DH Wij1W)-XM=\^[DY_ B:np ـ oeC @CC m444@CC8R۠V}444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444ܜ|XIENDB`gprofng-gui-2.1/images/gprofng.iconset/icon_48.png0000644000175000017500000000500514744453367017065 00000000000000PNG  IHDR00WiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME ! IDAThIo{7Q%b(YR`[^|8˧H>_N9nQc#΢Ċ ;FLg8[/U/tr f -hA ZDU p{D%t6YdR>!`*̈E֚ʽ)RxnsBMEKxrs-GRu(xbm14iD1"r3c Tf릣LODd+`}J\|^g? }uS1}B%@k!BdȂ5LxcB)5;Hs%! KP05ŦRjW${{7! 9乒0QP V,. bkY+RJ_7L<cjY;% -8,aʫ@=KKm''GXpe2G$YjvC—LŽB`$ւux>D#Q0{ ~;k>!KW]Ke<9>> ~ӷQUyJ K*V0SP_0{i=(^$ ++ܾ]vx%Z6Os7u.)ys^|V΍Ca<‹^ Z"I3mD DUr8z)ᘿ?zĕ-/ǏH i2!ro|M0}xL%\ŝ;= e*)өk`c#!08~g_9Z2,uߟ+\ɘ16qlH0 .2u*6g08FlD4M0$M&!W.v <[薚Jy;_"fIQqyd2@]N#02c _lߋعpui "Bnwwtm.onGAZQbWOԫ(B$$' z=Z&v50 MHҧD!CF6Ybp. AK,>}1X1INjqfY$ Y3"U ,/쬒OqIv#!16 YpM&ٻI`f,b!,JyϰN ĜI t\z10 J&AOdaK bL1Ŝ1u9Ռ,`-HohJ $SҼvU3Jk,&"\US4768,4Y0AQECY+4"-_xū>RTR{S-r>͌sH1q=FEZ*N/4)(nK*M\2YB*LLQ=J֊ՆG+=tyPbjYSsM׮Z@`HFʳM}m~Tbn)|C;K[,Cr\p oT+Ugo.~OY-OZ-hA ZЂmFIENDB`gprofng-gui-2.1/images/gprofng.iconset/icon_64.png0000644000175000017500000000723014744453367017065 00000000000000PNG  IHDR@@iqiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME  bedE IDATxُ}?U}͵'9<\0):bb9Q$EV$H yI#`( rMaߋ9 wԪ+( 0ѨS>\vjUF)EXZ]Ŷ-Gg!>MLP˲8|}VPZ瘚@kEBnD\%JD4ctF%J{>ࣟY^fii0wv+tcWWRN`2<~qݫ7{?ر2~x}u&'':=0}Wp[BQ ed T(Qhv^32Jq' R]]chh!fN_y^xM֪so6C#|v x=sjubĹ'ˬ,/s,/AJbDX`vtggR'bk7٢\2B'@;6(XCfQ\cܿ0<'NVr&Bmp#GT:uPT*K}i NL02:?.bZIN=ŒC]a!tKF)+5Un _ϳN>.>'OF;z8S Oqpmf̲ʃ2׮nJZ=(}( >-U'~k7n+?>۷9}fu^kia 5  gh*o__P. 40$|x[7ϰL3QDeDeh&ZD$y%`/={,ق&/nJue' TW)KLϜDŘwJw@nj勗0 #5qD}Ň8ŋ(3T{ŜTPXFOm[pGܲK|4lﰹڲh iNΣX( S,ڔ9Fpl ,"IX!U* T"HE a ~Fc xX@>~+@ i\p VVvN3ϗ8t!|´ Ah5]Z aR/32:eĢ)@Tq{%ti5wެRȗ(>iZ( KAvQGQehr-;HkMT6v>$jp'W֘9((9\>JqPZ!Y!QA3@ށF+ى.mwjLz 19W/cYy-: I:ǎ\.S,bht邇Vc|$RZdCyzm"Sf8qj6rDjL;]"ɤXf7v,:OǵkG|y DL°Z-[Qdzn?Yǻj)-4. hQq[د:44~3ey}.^׿2Y\\Ξ⍓ESNlG Xx o-q6x&}T$L\@h&.⳺ {a5 3daa/%~l~gyevwضkZPڤhZ ؘaX4g _essknxss(mvb(pL(Uώ̖uZxIӈ8"+xi(9 4"ZȈEOm!27{sM=>jJťRqY_0 r|FA(_8SS1 <LO7F\ q6YJ=dђ±`w_C3lRgl0?$뢵3stJ&ccY89res;ǽ;V]DI3r̝Ba茡eɱ{ !xT@pwlW)r=IjQyBV=*vghM VXFGT=V VXFC"$@ ?5{j=TOO=oIDB/G"BdjS d @2 d ȓ% ܀2{IENDB`gprofng-gui-2.1/images/gprofng.iconset/icon_128.png0000644000175000017500000002431014744453367017144 00000000000000PNG  IHDR>aiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs'_'_jtIME 4`K IDATxyu?bq.HD)"m%-ٖe;bؕrURUJqʊmEE*OP@AE`q.9叞ҩJԯNOOw~QDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDEQDk"!D-M%I!%Jr"S$?y?J|Ik]Xg4"S)l<3vƾvL/-&Ļ'x/| DXyI0CR0 hapduLϱv9huh̊I@6+jX=^R/M&@JO)9 }gԾaאRVz6Rz?\h׮=JA";7!lh+ĨV^mI?p=k0 b]]S݆\Zb*CDo>Z ck%&9:թB{NlWڝ*vlxǧڽ^D&50%QPD"$ {\qp\nQG%HNցw#*e2ю-DU&gjeK,eH2D/{YlvSnשjWHtM*iՅPDb% 4oH>būk/ZؚtЁ.QڑGBǑXNmq^.Df'dEJ>̋ pŲeuMhDS1Uz SM-r-E )ЂџXc`M:Q&G]zcK,*Rۑ8RTAh`@"\W k޸Dԙ'0*Ԧ"_51]kuM :/k+y@+%ضlAٔTLbuh$C\n`; >i8AUT Coµ-v\(`hCw5{ `E+A.֎nOf߳(U$eZRB݄6s=B86G=snOJ5ȅ+Uk!M  hKݷ*.[P(KLm~ݴRK8gA63\|oZp;Lj_0=£kf?KRP$&H\ 5q4gό&U@` @D l(V$D+˦quń@|Um-#D/,Ij]zRy!Ǐsy.~.>zGT UUq"RȆ3ZV}Rb k@ԅvH*$ WD8cFTŪ1PJ.ZdBw0.qlsIDM([n׉bl)ܹXű#`rΜ:"vDUΜ>}6FFPUv:Ë/‘pef^}o.qs\s.':a{]]k{E|8ys\k#q3+C]/$;wff _?ؙ_}E~'uSN'?Mw?>l[Nw5&3߻qBIR6%qC5u:<-V ;^XMa,'xUz۽dL㟸m;ciӗw%>±S:6RJWYXZᅃ'x3|桏{>8?#Op{g?udyOS)OM&gPi^zCUx7, 4yg0?uxﭻIT>S} O7d]c RΡTkQe=*iC4*ˁX&2`7dq)K21:۶fs$bT !"eo!6s4|+Lsi4/_a{>~/T*&q=uӴHS8Mbi8'&Plvo#Sk5\pJ%B`&K ~lazf]SI&(B}1 _4$n@*Qo: r޳:a BQشqSgS*8qv;߳Aɓ4kU0+&bE4ps؎G?^]&%ξb^KOooUubǑ\[f0p7&'AKY)l2/zW^yUQ9ru'=>i쮃Zˏt%4Z8NZ/I$Y.ԃ7b JEpZQعk'ch}{?rb|ӧd::<'Og'0ms02:ZX#>EAJʦ i79%6Б K8**I{^ѓh~CR)eur$>-Kryp0ĚkY_\l8HX-9XЌz˼E&{So}|#?F"@uTU2sK9di~L,sχno`|."}] =7ēI˗VXfyѧ*{C48y2 TcW._–={v(*cq%ƍ!r?xOL&0 MF mRZt?'UYp o2U深ی Xȳ+̳07{nFFFHg2,/[-3Л>qɉ>i:\]q  Iv{O>wsL sW2u&d)Rѓu~pM¥˳ u7Џ* 02:wBOOOpW'8(; J<ZQ?%yG ˊVL}\\co0>Goo'x/c&#}4eswБN꫇C;?Ș+"7ްw5 _yYguK7?t{K<@J<%a Օk}$[Ye˖H$YZZ^ax,S<ݗ) OT5.Z#aKjQCo ?o;]m 촊î)-/F,J~7jƉ _u_"@Jx8;e#A Zƒ܀ A{vBХ ŗ.oKT''N3pXhaSa)W,fA:,gyW1tmTe.^+(ޘYiY9SxWK3q jb P*̠k*+^~ULNnGQ,7tN:w̲$Ų" kY0Kdh=8XL瞻z?ڷ5;~ssWgX\\ab|`a Bm8͡CG8:x/4I%5M{?·}{{ROWoL[r1ִ@mp J|i2 1ThE#r|~hN:A:FQVs+,-.#kp@qT,H k8+ˬr8U} ] C8^J& V}enkљĪz&xF+E7#B(BvOgRJlۢ\*͒]ZTTsXD(l2JqlMWPFp1iDXa$ؾmc8,gϾM6;Ggw'F16nZ qtAgUUɸ[+eXYhY{”׸in0bU4886qiVX]5SͯptM!/kzH3k:"( ٥2 y4ׇ"|oO2dm,DӁ;k_0b;RcǮE.]QD7۷ؽ;7NP.6Մ> N$4r> CP2үfTs%YBQ4Mi88<q7UhX1u{VF(w07R,(Wd:@Hr#Gr= *OdQշٻ7;]׿9uL"WP$j)T(W6xxqvs"L,--18؏M7,Yzǘ:sή.6o5O *Jf Kj;sFzx# m{tql E)NEVU$*UcUe[cIuLI$7RMx<8A.w'nu=T+!&68C*w T˖-4}-$tJe!$h+J7^dr -S/,,,3?%.LT*,-%(HbUud3yzطw;7ntY6m؆Q4u)8ehh~kldyyŅlXuԤ˺|]kθ; Hmu(,%j=zғ˾}saTURB!B t#BGQ*Pp* H<0+ezzzp 7;$)JDd2]wÓO~@o};.i#9 j>_ea!˅ Ο/q|70CgWLƢ$vH$J3?o13ʕAJ-Lkv(*Jf(ؿzfg܁:7Ǎͣ"Cl:PB^l\tRGD*b%=@!Dds7|M?q_z"TFGA2 =):2$bIvaWs rIvp.ܺ{8##CtwwOy6QK{^. lڴ-Ttwitv%I$)Tpb1 |ӧ1=䯾~_&,b`pG>P5g<Ϟ=)K ._9M1'n"SHޓ֠\ "ƕЎ^nxǰm7?&'p!r)EE 4=\v6l["Ok:dtUѹt?%!WH;mT6|arirYT`Md2FafG%z({$}h ccmQ*0 *r6JD.eye݇BpO=|9Μ>,Gᅦq^|aj&!D!DAWy7Dg@ @_oiXٔݞB&O +ݕ2;}g`v"*fntt1u7;wD*qAccYr ӬP,a놭nqFG'XZ9z9~|︕gyeN8}}~<<|X,N\b~ao~.IDATbkw OP(䰱>#CQU7%%xbx0t] !(K,13} Sg-g)Xf1RJuom\zthp.HJ=7BX]`( ʏL[.BN A:v1("$Q \xr-<}uͯ0w~W;RJfffm~IqÍC4R&ؼC>#s;{uO&;!BMoHզ-Szd!c14Qm7o]%"\ RfRR=Ŋ['x>*-|q^y ND_wazzzY]q4O?8܄JK*u'zvUՖp] Y-/^*%a;zն)VH#l`lQzVsDR kmDUUNzIwPvnʣ)D;5}* n(ϔZ󛁶 g 3"`ˆ)TB -UyPP4<X+ ZWh0qݳTÄ3ٺI`sA榑 ꪸT),i vBPMb; o Tzځݢ\ ji jh\UDIhg=NXEgU6F ŸJJvm!e  ag.o-C\wA *5|ZcS/->-@klX!Z@ 6;i $D{4Ur ]$=JR L\3x U¿si6A ckUmV#XU\o Zrv D0ohwuJCL~L ؅\=k}sDUyqw Y mpһS7| dSgumbvC U;AAʕ*/{򖭇w(o銶z˦ͱ2`VsK(PSpL ]mh}l ѴVlPjnH[72[ceq܈vq{5|]Np {5K˻Wlkۚg\^\SAr$["&+e)b*_<26*;cTzi|/ymWj Bn$2sI۽{<Zջ5oy1e}+Ct;ZzlCSRiGyp^M 4Ch٨ * W)60Ey\W%N }] 4F3ݶB@tgZƬ0Ne ShC&Բ"KYU&f86G9 niVJvd5as'M$pK2.ֿ?zؔ"ds/,3sw#Bi@!a#%nҀ2ﺦ4$r2"("("("("("("("("("("("("("("W@.@ zIENDB`gprofng-gui-2.1/images/gprofng.icns0000644000175000017500000015602614744453367014341 00000000000000icnsinfo>bplist00 X$versionY$archiverT$topX$objects_NSKeyedArchiver Troot U$null WNS.keysZNS.objectsV$classTname_assetcatalog-referenceTicon  !"Z$classnameX$classes\NSDictionary!#XNSObject$)27ILQS[ahp{$ic05ARGB ŽȺ~z|¶yͳ£Ʊtʲkžžнơȱ˿ρЀ4 ʼϙ̜ʏã×ήƾƾDZİƾǡZɱƭȿļ΀̀ځڀ1ƶ̫ǪĿȯBͥҌࠕ͒¡ic08PNG  IHDR\rfiCCPICC Profile(};H#Q? -\"ZB-l"E&ID]Xv_ 6.,V"fDE?{5V B.8ё19Ũϒ~M+"0˸=Bz@n1,w-]}["ɼ𠥜pL8PPYJ@s3q/5a陆1zfqrz@"кSs7]ƹCҞ-bq%K9mQD{b0s(HOt dRR8$,:i[OkKڜx%- vCXE>PcJI_*W$Sxo{]j~òޯú4}i0 ‡Ιw-g?rQL8eXIfMM*iD"8s@IDATxgp^Ǚ.2H9LJ3lX3eONlݟںw4Srmid`%*PH1g$ Iԡ@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{@j=P{FGG[~zkj| <`716@ap :[k=P{c1 ~_;ߗk>;MM=@<_=1@| nBmBߗZo큏gK2w&A ;IT8$`7 i*!HT]YP1WF:*{9I()q9k~;袈T-~;nM,LU+bGDNuh b]cDMtҭk}Jm?e09{%cR рpUo@g|ȋTPfrRH=J q` edp?6%J3JK/BF ڋ* C@ nK:p*Q1|P(Hl}{(' A| ƞAtP@<3@fu2UP aJA&g Yr+':F{q oYHo>9x#_&ag ElJDq%*LUA>ے!4΅SСQx˭1@r3\KVeL5R:J̚1j㥜Hc:DHOZ73GDGXq_`L"vz2 |&Tfr@oIl"lXrXI%HX-PY$ .)i #< :`^!E)E(yy*J'  C$R#MC**]@G, 7Fiw@I RAUb!)elzM"Sej ȁ^%\fQ&I1 ~$őP8/M X8u+!0Y˩chﯗL&z-i H eMTP$>!$ VH0Є8sjTO.y&r} Ece:IPa/[bh6KUTdGHOI%ghNT+{r{ؐЊZ> I R <]OT Et_WH) 肔UCU!a*&d u 2*u( 6!O9Vr)A0572|ll͌GE΅ҿe[Y'eȆtInQvA4.E=!Jw4U A(Jx\#y qj@e)C@GT4@- )LRVj9ڙb]З[2Fc}m] js;y/31AZA:' Ъ\z+ BHB=[9I88I&n,L2eΐs&`f*𹪉nJLoI>.I{ޒ 5Ƣ.\K47B^9%@w`@mr L} #`ŋGXI4!x# % >WxBϨ T\_jT;F _2?6b0I0ZhÔU UFҍ "CJ<ګy6TA)( ˨p%1$(TkkA( Ro)cti0v)ԈIªSm*$%\ b~^Cr>Y6 8T0>ѕ%|ƣtaWQ٪.bz;;>N:U֯[.7xyǭ2gTXugeg&*U$4V.#*Τ"LBDag~#!<4LD"ps&EԸV=!f3OdG[>9>x, qLIw uUUFN&Fgaz L;1B nRqBv;4yʚB[MeGVuYEU HF^} .^'>)S'kc='vJ+ob)6$6ɍLjj#JxxGȭHaa0/PPL8wL: 0! cf SEɳ{+mv\gr0&\F1ջG(BCN`O-dEӳ`/YiaT^**R‹G逡rKaWҸ!yc+5.7jonp&F B3xPx.[b0DV2Wjpۯ}G薶iSj |KkKlذVӿZQj]GK5[ VxfAAQX  &+:9Seƈr@G|EF(47eE]XV4kۅ"cJ2jGclPFi)θ1)q*,,Lv4&|3tqv6FeO4y XT ŦVANZB8,Qj^TØ$?R">8RVW"keY*[4*G*oЯM9|K/;Cwɂsbj6m=3Lz!.7TP%w %:jU= ш 0{d<@8}Gs0 r&D˜ h$d ή](PN-V:hB(;L|yG)U ǐ-eH6/K)UMdjƃ2AsW{}l1D/%4IF.6jPp5ۡq)@{3N ܽ*2 !囥9tXRdt)!v JۮLO?lT#ȢAGbQD$4:S @c:`c%ҤBVrPz܈DBCMOFfJk S&~3#. i4|֢tzqy(y.NVzmooөv?(Vɋ.Ν3elmܹ^8#1S6{,4Ue%"3GzK~̚ >La T8s2 gHی9Vsd:Mȵ`w,I %[P{Ҡ`>؇K:i*AUE+*$vYr*8|XgA ` +jwg ([%#7{{pqx "ΪhS-Y+/,zkttHA*3Z1K\v _#V!w#oW,䋟7݄yWWFd}7M* .ʌ SO>%?n~wȃ7C~Xz(>&V HP^0Щb) >ʷg.w /wHڰY"$z |MŌ][?/ϾttH7\W_yU~僃 gdρ3/|AG.V#>_}=𘾃˧)k2 $\^:o 3xS~djXDGl{g|KUW_rxnC~}0}(#',[.ЀyΞɞGe & ىP1%qHgK<d j^L1dܥ(q'{(ӘP+g"S\ڄK Ȧ1j @68ׇQir#Xehy$"nrJB)w/o<*3`7EZg)4mZLny> aӧgPgZ݇^iLt[^|mYvuAv8bp9}1,?{Iٳe@&qb[nYx&>E}Qv7gV/MͿڽl2g/9mMnbX13K_X{tyt$ĩ3h_)9_wZ^Y~4OnֺD={V~Yy==*'+E?PZZLv&YY1RQ+, j(Peel"YT0\C<_eZ 37rA ' (BQ1^i0IW,%BɋH2Fd#*os^@sC, @QVbߧȠI" gr֛eGѱ2m\B/ls]ıu=;nZ#J?E_ FMv\LW%gȿòaF\+>&ܬsdnS` r~!3ҳZt'06md{? 9sn@:GV̓S#=Sn% .Nd ^uw;vO,w7n^"z>`-D< 1qަ3<̯y筘giv[ 8.jZ xgQ^Dձ\ZG "Ib`ا1g`ʡJ168 :"٠ yj:JNLp<?; Y P# [VxLG:m2*цC uvLXA㞊w=N@5UT}e&B> C6m7k\:Tr* k?'*?*ݘg;@dc,'Cgӏj{骫ѐUaq ^RQGGOukeX8l'mm gu-XPtYMsd92pæ%r߶;1 ~;Y,Y3 L_ϟg+Ӿ'(|^;ͅNF;!St6bMu>D9% ^@@Oꝑ]k=0 *T":*=EI[7YVNʘȹ-ǡ PzAP0P'}X>2A%K$U['d);3Hq$i̡t7d\CibTa) gX!5-buz/d4k:̛ {:ߗ,|wgv95Luwގ<*^P' I&)GrrtR-88;Rڄ2߀ *2I{4ޚ5+6IPAQK^{Ci2ׂHkFj"og +$h%|URU"L0pfG!qܪ =,7m/4 U 3xsuLGSˆ(ct%Cc:o*;(xٙNvV<t o+V,XU|A9!V8G0s\-?\ dкwvO8Kb2\gwyinnO=)5kwTϿ&&s"뮑6#`+_p/ "4/>ǧתS8=A8CpԎM,ӧЊNGݳ_'(O +a$Q qDeE^S;!eGYXvǡ6JFEX[hҘz=t3 :C+%4GNX7\Ȋ%Y M߰zso'&}-9ywcˢ !3&V pGQbB>b&I m ȼL̹M(\\WThRe(J :2Z#B#xBn4~#kl@PǤ9:TFd^ sM&u6_StW<*ֱ!PQq.%_-[ AtG_>OmmiȮO&wbks0ނ' |r"܇z:reѨj7:F;>RټR$\l\8LY3]ΛW*0²sғ\ewbsf><׮]'= @Nu }rcKm/r3fm~ $ jL#Qr|9'BfAPHp]p{Rw'1= ɩ& 0AL嘶|~ J`pD3j//2HHp0PrUHլj! 1yoR*4f#*9 ؑòs}/zbLbӎOVl;7c|E {6wb=3>;|y#乷I+ƍG!؈9\n?o6{Q(FFARVSyIŻ [k>5kV+Occg:]h 2_e>:U/6Hn&Zj,p=X3? Ӏ%KUjuqxW׹r[gdQHÉo,,}8ҋk~ZᇍPb`?懴# 'Z>eS$csapGxyob#zЯOgKy}l[3sz|󍶥|lOs=aC6-Į;E(ޗCɾ 槡Eҫr#I|э;p[^VsI+f#C$HMO'0R)V/MSxU0IG]`x6n\W|{'OyPH8/h3m?' mHoj/a\٨rYdtFWҰj8cS2Rc5X i%0.` Rt&4hu&V F9 TG @3f6wE@L+Lu.P X29]FVH>N2deЗv}b}hdժU2| .c$o$}OV\&/ź-&j w4.7P#_sFZӚG:(&tuI/e"z87|mr]Y9-3_͜"kV.GlݜJγ m]l:e*=d{MO< 3^zy!ETCp<2^n۸jytQId*+XV7nn|󟑅x@ >܍5fkĤ9sv1GG<(u)ggiLN{#6Y$-xW:2@zN:ݣ7HH?]yZv^lku+C+6SID*ѼTZaTF:(ȅbE":@>C69y)GZ{p_:-~Zk `b%(y+)MD%D{ة ӻwulXZ~g7`P'Ossu7c~h`&Ya1pB:a垃-ϣɫ+e'ַܺK1z |<ځFmwYD3 Xi@m]Bq_ ,0~D< JP1@~h<7n% ]~(;GIټ.q:z sb_Z-- U 5r-OP"q6h:2ƆĔ JUHLAu<3xۛ[I3$!Q :%tQ^x@KyTKFފ`B XEDa t> y8xkӟ>)qY7\.QMA ;d]h;?:'3"jE>H7{ak[ٲg~ K}nZ6ホi0*:a 6l$Q$oRYe+ӯn<79t [ U8qVG > Me.vwX%UN/vSw AVrn\Zfb?Vy2 ]n#rQ o/ׄ[& PŰ~TqSJ2JE_iDf 2K!Nc#0 H佈(CPU :/o(fZIBGrK- )0xѓC )rq"*ȔM1Oo6ߕo|2 sۛr8AqgΜ|tL!͜803>y{ mw߳Mnƒ,}i|?_i0NC[%E~^)z#v^Kt[eRƔԅ-NG9flՎJ L ?}L_sWҳ ^DF߮w__gz {';G wPms.ADP>2" fWh'>`Fd*S`E5|ün`6 ]Yǩi$ V#`f7+`HP@M p ZèH=YH< C"dC9aW86yw+?t8+x;Ocf Nr^:j#(6MB/%\$Uav&u"єP8#JE!Ͽ`˄]:̏ ` n#>0 :4q?KxU9ܳ5'a-Z'hPs>4QOO2@L_HbS:x'cl"!#>3OIJxss0E*rL:fr~~d¥3~cs޵ ja5b.[Im8OC[1?gWlf77JSFe*0!GA tg&9oTv>=C!͋aѴMYXPF+xMAY|[EʧtU ܣq>ehL ;`k$l~Sjj3)B`iP .ӲNB+Oڑhj̙-sw"rL|ߐMbqЎalwL$̧R丷$NE8kݺ٫u+浂zɂL(\c)xdaq lδj%׮]]LB+fTdéĚ$$3m`>aBpDcg8g)%`e~p0Jq9.c0-f+SW`v{Bu>_CYP0V;fNI,Wk889펜Z˙ P{T-QL a]$Ę AVz)hTsD)?b zG}@IDATkTBw=I9}_o6ǖ|CTᐐ݇sq**$w8!uV߆Juvu)Z^.YS#a5E Ysܩ;Ga moQ= 5$Ǫ_jOhs /nhD-,wL>S2t (WU;2HIF /.*GBBΘL!Do5\r[ff!GP結h(]q_;C錊WIURWxdvGd n {j"%qGHJhl)[YFmAAM*(%8Y T/ArȞ*^˝C)44[t),)]Pr~| Ic>vFmV1* 3ֹ ͧ#; 'x&6c/>MS&S0~G^9a5Q"A:?%)A:AM VSpK@T3 p9HL+}6BSbI9KJB*ֈ#F2\*`r5N2}p$`FG&:LJڜ`fN3\^(&{lFpҘ-@p*o X\Ptc */]-;wqvGw`ѥŘ/q294ir$a`$qN#ِͤIЍ|hmğc32x c#qcSqO&ғvc1q|%";f CGzafh 6RCO3έ4. Ʉf;U f  TWU!BtUґYF! /&P~gRp @B)MAVb(񼒩Z?!m1!0$.M.KaM3O@\8@8]"@1z apV<0v0~ t a/OvWAms]?~#/NMO59SG)Ϡ6kx,^庀÷ C~as`%v2ixs=r`SӔ~Ӄ'Of';ڗat7$No!7 9T{u/u*E3< Aȓ_뽧`(! [ VRC]]!Q#\@x\Rtۅ'>Gr(Ϙ^NZ ~tx#3o4Ys\|AgakToՠu44T,/S; C 0 l 8&+&MӸʰ҉S⃨S{= %5ֻ_3C'3?H>8R<8+SWqܔĹp=(@FmS:@5όQ݊L(&PUQ.(B%i}BzqjQrV0j̒2T _Ҥc&%4aƌ `}1\|w;+iq'^Z4=k.` YmedDE/⧮y.>lhUE`A+&q&aV:lan`, 8pax?XfPg^UW_ʜEݾdi>6 yZ;_8ȹӇ\K\gWD\J<ѧuw?|$O{j BV Ųd9^%8o"4vZRn/,5O `\QPʦeSR"À)Dk,;3fM%9>SRb&v3bA`JX|}hDQpTqHhn 71h0hhm!;QBsse=&8"K,é<79 uX<8Y!nO̘: /|r=\ 0lG3c>~Aƫ1\o;\-8椬4([(oY++ׯMx;T|][‘:Fn> zN|c0}t@|zV궖(dtnr/Zg!:Fct;=` ~+ӛd^V9Bឫh,AiXx(SЬBb\ޓPEYDFN{cAs~ٿ]m80`+_ɂK0 @GĆY>6F- ֤#A KY>1g +=/guwˇ%cr9*g bbqtxer+Q&8/Kq4O@44%+GSiאźX *mS88р'=mѴ q J;<(7I"gzP G; Q$61 ̱^Ņ7Xx#_3U` gу:0>1!qf/=]ᔩhfa~Ow.@#q_sMbbLc$Jf?+@/ҍ_"}ya&I ^zeُ[Őfg0 3` 74#m=3.1{&BD`N#kXTyx$3q'nőx+B'BNfc#҃9' \ 7a 3|3Jwei4>CHiXp +:OD02DEcyj!m GdFl $J( 4lQ}Bq/xGR"P8>8Їm f^43'Paz0,_ގ|I,΁Cn\ZWW>F_}s5u&~@NN#N;82GCM'p!,MMs1I6S4٘,r=n#4j}׆"? a&Wh7),?h};G!As#؄AsdŮ'ՠ05*U>#S`'q-rE8|ѻ4wg!wl.lO^^`FQטah\w˔'(ӜZNfԭh#(!0j0e2@0߰(bV;a v5܂FSnxfKÙy,_=-GeӺ0'ΟXiW]\\2#~$" NJmxtFS\dޜvTz9g1f:0v<8s CxUAFvvLE eie *'|D\}1?f)+.S.(.b s pbl&r_D|1i2-[ŧv}d8o>V&R`7&CȦߵJ V'VmNLa|${_ EjRtSeQ:1 eE(++D8Ӎ3ijEML@Ξ30eLO8*WQ:$HX0BbMfʀ101[i~Gj+_l/x3#"i`}7l~MH`URvDN~㫱[Pa[o-[iݏ4 g'$39Y{܈ fꀵ{4x`dg_1,,NT@QP?~Mw|6 ؇NOa4 :*"H8mCQ8?)-Xg#&,sdW>_+|Bp'O^|A:Nw> 蠀c  ;~Ji_-cz>'Ud?CR uŽbo tx4F9F#p)J306j޻_~w⣓ xCsa?BVgχK<`Yl%&$ ^K=cu2FCFN-1FO I\'afP(w>^w㧌y0az-x{qX1d"E9XrdQ? a^CoQ{Bd c4J'C=]F7|t@e0n>z9Θy^M:EF)g?jFT[F~IU2' AL?w1vAGq󵄧ݙnl. c+qO6XoYVbP#[AgpNVYp&:QEB77\ai48 Y n>Q./0\`x)t9A:*G-_M7^NXX6RA,+>4jWFaB9 |)'NcΈ|[:`*cki;mPBDå|zHJ@¼:ֆI2:/ܹ z? O8#Rt*x>%W ["36*ؼ SC^(OF(G*io$}K:|vyO+=ϲgbMYfX@!NY \~c3;7mZ#wuk1ηA<'x9/ތk\)8j GzQ#<%_6믿$џ`.i:Z6fI|Sǐ% D; h"jep$/yz@%[Y_+OSwJ!7§(Ȋ>b6s1К:*a n= %աtw~a ۸n;vb<΀pݟ,\ c(gE|;xể3[ytO j<0Q&N2wM[t{p@' ' k$淿#W0bov=ܑ8&RQ6^,_)w8:]|Nn^BB#uYQ|&L H?*u7ܪ#+V(da%Xͼ_U|BTJW1@W|[j^YΌ;08\)<΁ i4ae;qnJ91*G_pEӇYٹjtuur-7j5~}x/|;3LC)կ#1=1:Gt5s~mBZ: TT@ұ|CYKe :0 Ԫ!g2%4 4xQ)guDZ ^O`-Wo;*~_><7d%r-x0CGR9ЧF8 Xv\J?v 8PuM 1d$&ump8?t_a48jOZr+:Ц7x~*llz~x* a;3zkEU0)7J-w;G{9EΒOyFj(M> ?-?ڰ +'_o~r|Gbf~'ȳO?QF{#/JEgUq2k!5yb[`] <[&@Ist2>AyXhf3 Gtjr,0'͵ V7c͏m}OTVv޽̥*[PqXnv~ &mpvWl\q?1[{:g `sPItKpU_?U3<,?oNU5t$X1 v$uo:&?k3 j]&(-+lJn寕p d)%3 5|ĐP$|1ӐA ue?w~CΰyVToqM8ȥN%?Mny'ų/vpX&G E1z@L;C.4ɤhV.-Y^Vb23tg;hS, p?S$zBv8dmpmALCE@g'/?v`ֲ[_W}y_EfA_H$!aIa""bEQQqv89E[g>QVAPVM1$!@@H $0[UJ[ok{ku/}:;%qKMTx% l<[ ~&v-W^] u; *Qo+Woa7ikBߝx]y:mϴdM=ſŨ~:׾kKgtşM~ӭܞ:apޜ|Douz:ܢ,<u8˽]2$^vo"#w$3Sr]SJo[١m5ySfB)bsDՙT%䍞3+ݨV-~but5q~$p+!J^ϢaLt7f:YW,8M8sH۴q[[/8~.>/4iɛA6@ncub izҋ)ma.}?9l<E Cv ,;'p\:5wz<.MG}0 BA0Q6ANU`̎{vŧлUuq%g E5[|9:I:}͍\G<~&7mZ)38?~d.}砃ӧ?҇>tfKgnԟ睍WSXQ!&~@]rp[^H(L[ 0cGP #TMD~k3WI @9"pG8RK_-8|1i0l\ y?4k0yxnNPE?)ļGR6.p4>XƧo\e_pFB! GLC?LC9?~ӅhX醟ޔZ Ǐ>xtX,O}Fէ5]w=Ns[q1r%ۖ+fig+6riN |ǃLnl |ӆ̤'8b$QH[90ӿ̡?c1,XV=xhAzOI?ܷ5Z=h4/}锓OC6-N>jܷt袣ҢÎrl#̉Êl:cqٕgm[4&6v,x}Yq:QaFg7C~rY㎻M7݌o"?}44j.l-<]yəT{̿s4FD;%Yͼ'A^.Uo1]G7֥3zIbU%Vygad<:lYe%|-zt)'bG+0Hr+`E(>sY`k֯H OC~ov-0L  w֍Ȅoۢ|Zk|A|_C8-2[ƌvuKΉ'8q TrJ?.AGz 9H<Q nI_Ggm\Xx&/p^b=j>1VjlESf+}x`^Z@*CY;̂Ѯ݃-(O7+ccd:k0$+oEǥ[o*]}e o}uI'-tȆšGD;$5y'u#޾3: 1͗I,Ըp*)b%Vc T; .]lm-:;ڧE ݿ9]~?dŪ#1jIğa4]cz<{[tHVt駥Z|>}7h:Fg!d#W9bׯ_{MH8sOw$ ^~nEzu+~_籓s>^kfo B܌?n=?9sm [7m?#ܿxo.ƭ쎆NZkTR7otߣ1Z0f БH^*فdXDܢLÔ,VQ^$:(^&υ*!W\@ HIpw".-7ǀ׾tw̙tSUoÍCP1Ğ{OŠ`~_4xрy]9`uYlwYn

ٌoVDûHnv=|/f|Mqt\+8h`>J83@}ڄ΂_=YG6bs? fQx64N&aSO<2<jQIaQ4k/2ϲÈ;~sb /; ~:'k#`6>=LC{ ǤnMi:TkP؀#sL'Ĉ)}3K|׽l2{*}O?s]޷c:m kZ~͏"K_noa E&>1eN6Gr +q-_3<,;j4N۟JR -U $8\Euil;\v n6T:2~Vz}/}AϚ]psl?w{|nMAy LlH|M>SLÞir&8{cQ _׀ܪʝw?+s0q dhS>y=v3QUVcvW:acSNzX~؂?-݅c֭=`ܨY<Gmϛ=y~&ӳxbŦl+9 >+Jv{wYACk’{?GW'%#}.-'MǘEZk,"CoAʫ9hǠCXt̮l3NO_wATJժUu}Z7c:wU}r`^6A)00 -Q1xf]AxO/Me^Hv39x=q)#j>׉{'\j40dqiF(;vQ OP_"!< fĨCESCfs#`+-: Wpcw-{8?`a2d8H_btV879ҳ>wqo8U[ ` e;uE Y~I5X>{<8N)IM >]8s0'3LBCmBZ>kO&~t{Ѽ5ZEWUQd=y8=N@Oڰ?Gf^\"Qwi eDFɐsϦ:u1Q97Љ__94}{:]ŧUi6V e3Ppغe#6<40i)hdS49c/JFǣ7|nn>s~?oK &-RB%\ _~UZ~W!\9HNmo{\qŏ7$2CJ굸n< ][3~B 0~g[-OaޢׂlzEpVh o`#ل>t.ukOv|N6]Ur<Zգ;7;б⣠Qt܂QZj")l|yn\Ju_1/EV{V5KBhLam.7X! cqht,6 yHUy9RzS^XE)hl9W8:|%V[v'^UL=*Z9U[)^{98NLyN` V*Vpϰb4u'UMjz;?q +Ga3_>ǚ|~1^gM?H+(WOG=:aXT[5jd;#ݏ,{9|sWZo6y>ǖ7⃦'ނx޼0>-;Y<Ι;vxct,,r|-Gys* ְM!vXoOKξ@)"+Ŷ{~#~;Gې߷:]˱na{2AG9y= ӒހsT^T΅uaZIdQ;H/xv*v轗~b7$P#vب<6PÃ&@Th~d0 ]C,V躢9\l@- OEu降Jᚢ/WMd]^P:]e\o*u4V#KGԍM;cn= ͖6GI)֬p]% 8U̒VAɓkXG.8rk_}u:9=5c>CCkFшm+#=0CrE'+__a+⬋w4?#]/x曍m,V`Zyr9Ev̌3KȂ13•H>P1;uy**AYNi1ʑV&%0 \+b#6̖U Z0b:n^ tCFw\3eoߕ +a;5sx<m`_4N>s%M+a"nhDYCFe8\D\s&\_yCt}uZ+mfs=O坌~gÂs]k5b3Kn)) :fT Gbrl}9<\WQ=7G>̈́n~~t`H8 N҉A W,V2G+>bV~l~(>ZF GZf&崊fo$VJkLԁ$=Es'G56vs5{t":C|I Kհ~:zin5 `mVcA0[ZusB)ӵ"NGDtFҋuZ(FJͽ'K9vvN!y$`ˏESWoPӸIJB6RZZC*08= wu+>4e\~O#Q(=bn@j7&󕚎&PytLXy-)Y7+rϺ3(,Bn[6~b#:"lF nZBC,8W;]=QTa@AC4^ X$ڤTqZIX_^B(k4~. PlQPu𒅄qH&Y~`"ߜ M>)HQK#4x0&4||Jx˓\DH:Q aA:P]|*,Xs`4EL8x̂Jʂ1Q5BHcKVH7ƒ O:b7Lڨ5:2PWSY#EC?騔!QD4^%21H<ޝSۉ|^tu@Xޜ G| -@ʂPT#uƥ7'ف@.blG {y?';#PNV;qvփ BZ q̀k_8a瀅ro]6`UGp JKLLP4_Tx׀B[B9čEeX`Q&W'abCzB(ʷ\nj =, oA Y!b RNvϴ'9ƽ؇@ W+ geuHVtNN|LGH w3ZwD%6ʛK 6Zb0^v%%$ˍ, 2udR~V&q6)Lo>8 ?+J`ңLҵfԺ蠺/4 Vgx Joq2$0*G0ڕ*)ţl *\j,)<jojCJ&uu605:GBq#ĉ2-aQVv3OGtCJ1ɽ䈄ς*<1;*;v\ t-&N 9C`"" ,av|l,б:o#JKOpMe*5:>]j5BU <7Tq;+}KUl)~0);N՜5x<Ɲ []dmө"1Z{Bj2DDH8#RQhB@C/阪`|f3VLd@d&U*N%EFzX% U1=v/ٺ;J攐g r` l7V\]:iyOj2CK,p,E0"L]tuén LtOFbC |% ԍ]ln<t0)g^ _"c0}䟕Q"&1jI- Đ|¨>2KQ s 9Cy;9+xІ_>8@SE. 0PIXMv [u,$ٚ\*PyBQZ)f*D4H(1*&1@JbD0)pՊHfaL=R눌w^Uk Gs~|>)h L,! l8Bcy Ln5 &HvV䃢Z::Urۈf%i1wǘW eBy1`BSCb30:шe SeGxG2lL0*pU ٭@7p/ŒMDvr/9N~Ld+BiN"tLƉb#Z GrRWXM֮*F*lQ-8)TϏ"/9Z[5Y]6<>#RF3,¾ȈG/k0] ]`уiq@_Gl`?BȞ;Oڍ'Ҧ,K(s,{#ev HmvU\ S D&*.H_Ĕ/p &^ݪ('<$B(֮ԥ `hG8bP>*w\^˄[^L]3FW,1:FvjJzFdKF]ykC^. fB >>  T:h,VD!t2;;TQ>YG\)#J)vCAT!D#ݏ'Bs-XK 0alӳ739Q o*3T гT댅rs<(&X*,DLrA΂ A!m L\łT7@,du`N{V&&2u:Vڲá6O10¸i TcpV1/@E- ;llH'.pWi pb fp\Q=B0QَZ1a kTT2t'Ѫ֜P&fWʝ3;LyIqE~+y > tnkl1:TeaZ|6Zb_eFf kGWEP7Awȕ "uŠ"S1B0u(8{'aҟX?ԛNƇr-f̙ƮD\cGq' }R߸uy}8i$Qsu_ ._]ShBA HyE##BqGCI|,!*lƇXJ8P$ԒNYġ"8.216 XK ʢHT 0h6ICiOX w*i6L7[8*@0YdUQ@hBfB!TeӺ و K`ilf6Hb._d.1kE,JdBLvӂJ+;TʠB:W2ȋɚ} 7kD7j%lxGWuhƑ;jȈ?C!PJ>Bd{!\PlezMg 5^㷴Aty*FL) AFC+0`T:T/\#\OM('ŠzȒDCn F$@AʣU K&kpDlbDɊ)N 3%Woq+ffͰuj8hz![:9wL#G~2Y; KPUMS1+ |%;)bSqd+4Tx"U!?dQ@+ZN]ZSKl owN4qPV/SWorVbBy!1Q5@ 9HN -q@VcvB`LktGaQld?ɊW9!?pġJw P&C+F_x.^B ɍi CDhPQ8Ru KAиd8Sk]X{@. f&G&d5I>)m&SOu$6 38[g|-8̚`?Ef\q71\׌+D \gVSCϬwX;"0:3RQY$*FY9=E=c7=JUNe)R+C=U!̾Pq# ;`ƬL9bDM4=LTA:8TBGkf}B(jy֥F:0BVҨqi0l&I T&5*b`tJQC0MVꭒb' u-9UINBP>Ը"C,- ;ٱkV"@UpD\Md 8Wϑ UeeRQq?fO;}*Kj*P"=8@C)ZgB;ټ=^fׅ5J }Hu4CèhN:]Bb6@6$ݽdzKv"L#=D/L.rS⯔W`?(: c ;"ICG.JI M])Yk9qduW3pr]Q5=?,/q+`@@@/<@^vyxu jxyu/[ aiCCPICC Profile(};H#Q? -\"ZB-l"E&ID]Xv_ 6.,V"fDE?{5V B.8ё19Ũϒ~M+"0˸=Bz@n1,w-]}["ɼ𠥜pL8PPYJ@s3q/5a陆1zfqrz@"кSs7]ƹCҞ-bq%K9mQD{b0s(HOt dRR8$,:i[OkKڜx%- vCXE>PcJI_*W$Sxo{]j~òޯú4}i0 ‡Ιw-g?rQL8eXIfMM*ikF&M.IDATx|w^qgo l"  9I$)$RmK}pwu|v]RՕNW)I[DRL9"H$b6{_|-(U鏣 ,d4i @L2 d4i @L2 d4i @L2 d4i @L2 d4i @L2 d4i @L2 d4i @L% սdjp,~l3n f l{DL߬f*=-3\f.ٍ~0+8!L"6J+W!+T  )i#`HDC1!jw 1M9@SȘu(ꋊ#h2g=I yT%I fc:<&r5 9$()cd'Z62giXLk'",&)C|#3BH[^q 7CPtEt+EO@"6=/D@KԈ>e5`qFHʓT>X| `w!4f CUṿRZRߜe0 Wzz,h6,/$ux*4Mȇ@geN$eM$IN4 LH"qh3CL+yviDI=}<FMcf傳DEYfܬA _'60F;(}mR%81U*m(jT 2LL#,S0()BJt+6b(lƆkID'߬LMM3g1ŗHyyFxJSϋi,tc(Ap?ac9T*Q8#MS"=v'j!?<瘍O1k{UcRf`vr<_W)}ٳk<'ԩ.ٶu|ӟښG;B2:6@g3b1ܲ9(1ppdEiᖷaY1 c8`޷hU*}#u#}tSsڌ,XitPFGJJ˰grֺ{RѸr*y~͛7ɒ˴3wܻ{7n$G^˥RCՃ-[lذ^-_.Nw/Y[Grwޑos9[F/ضm,lX2pO8)헑_ rH/dIV (@{ϦznG[ FPcワNanewRgP YA-&O,zL7UFCos˃!rkd `xxH~5K1KeᄋodR.8{|$Mj8??+CwֳWW^)~"ϼ&bzjB?-"mo}WPE? /:_vG~#rcNjrxO];]){ao/4iN.p%lTg?sl?P90˙^ B][`3 oh[ֈiY`TWD͙Y*k ;} @|c+]%MV`6zᥘW3?TkjTyp2gD.2YJiёQކsJ֯j?ҀSNrnŋq1Q}4|R /;q,仺3M1ol%rM[ѥDjjT@o"8308u%R]]|bũGpU sjh>4"5U]y2rbr|0 \$hq4xܐp\q PEYB&/>,q9V|}۴8<(8?缭RRZ*S1EZ\y_/YC-}m+/;Ovv@ѩwtY[5rOV-mLQtS286%ZS"+ޖ_~F>\ufijjvnO`HGqRf F3!ˆo jLU,!v0Y)C(X 0#n,pm>{kڵZrU;:R##pJZ[W_"8wr1YX#-lrV;*yltDҬn8|X7o\upwOjJm։gl|Z6_)uuW #+/漸ƱUٳ:x|#`JL\H]B@l#-2k0 Ou "=Tob8z2+ kH2j|4>\I.l\{GW*;@dsNÈxǀt"#CC+ d1,NUWOjA~'0ȶz{{0%utP'< l;Y:8-0r;R]^,WnM\rri4b~P CS9|v  c]bY1wb|#vՅo,ǔ8սMQ:5@Nĸ,Kޞnycjyp^u@zE=tqF>+W^L>e+ё1Ͳy˦6ɗ{ԓO9;A9w6Y[d_R} 9\eUZCrYeѢFT'/,] F3X(833x&\δqy1ZY5GTUH0'd^⋯lܸAw FZr|p2Bq{ `ӸS-|!1uXABf5Z>HmuMtu? '>(Xij߿ܭX;Ji^Ԣ5#&l~=_-;-~G' iv|u{á o^;Iqa|s7B])* =[b#+S 0aDC'8t߬sJHe7N,<[)Y9 C>#c`agԡW#m#zYY9{n(!@sf1o_Gw4D3ĬǺXk4e%‹i^ 9xrYq]>1{Pn[q@chaE{Z|/ypA8%ť`aTT!ߏG%^7`)̳8OASFӷx-2BNz.$j:gL#D \{NhNI\Go /3(qb|WN1;dpC23(؆͵HFi9 F(fY,~fN1i\<*'yy,dF|uT׮ŒoH'3 ss2 Yz;;ݯ!Ylx \&\f@~l\T72WbLA)>V 8QaF@}. 0hC|?Dރ2Di=q~y ;dS2 XMe4-\$K*9zY=Yeox8==^xX\jkASJ3b`:gPN$;OvH'v.mOHeQ^Ce8Z'ԭ$!-#O(S]~5` /0Ba^*Z>G&&1gtİDz: N F-%lRYY e6qr[a[:x< + AtX?RaUxWw}]ٲ MsK e`eҔ3 僩D[rL֯VEbɂid˫pd.)[H;>qY<_sJl@UW׾A$NqPHCCpN˿@V|Un'G`Wbzf/Cfch(xQYDÖY3&8bu*C nh^1ˠj-^|#V lzh`/2^](Tk)(DL=W{Umk90=޽mcP?ҀweK~17 9ZӉ>臫m28$ XQqs|ŠLQ֋ !_ctMcpCJkxy1T]5M]/l  /]qxsF@ ݻ}U8ᮡak-۶ʅnv{q3N7z% )b-iJ1:TF~ZC O˪KFY_af| ~BF<= ]hk `A~r_SPb f `h)8RitbWl]F$IȂz:yB6S,F5TIpPU%={i4=x0RVxK^ziz}-|I/eB*,W`]&vXI,-uKpݻK|%fJcF/a+r1^w/{ȏ#',6zZNߪi|t@jFC`L!aJi =׌b<K>ӹ'pEp:;{`k+t b[ŌKmM;'ύ2oǔe9 ۟*UdFI[mdQ2`ghŚW㒆ELSÕi]I8%rqGS؝LMΝƒv(NKqnj'i0r`pJ?JleKaEm@6wrݟ~kOO}N-;[>vҳfTA,*ET]5v Yȁ8 0rah;c !`J_$-0/>[yYF\#P t$iTL"s]-} #f9Ӻ;P0׾0 J/\~ťr.GyR3ɴl~9me)x d*8fq,7WǮ%8R.)Pʔm爒a}2ytcdzr=wbma_Dz<2ٱh:==}HeY2>"1{oяeoDzmt]YKrY7d=>6|{p`Kz{N2r/W8VHcbd5*FӪS+g/<lwW;9ц| o˫up]9'P#GY[{ON<"kb jl&y{JB|'_Mc smn]mGu{FQ={ XBBF˓dZ4^ m 9#RC oq\g5} ]p r%cT2BZt*۾⊋td-%NOxFIO+ -[+9cu!F7{1bK'1S'ZX 6VٙTxpu>&?aU?pWe5:@_>;t@g)D; ڰUb `0JynP c8ļ3L"B D+NVq{nӵU.Эr}ҳ[wct&SY*z9ۮTy.a0r:U5^.+cyUU(<_ǘCs{0MOI9{[v 6؁o움wFx|^N<)3QuGIt"e]rӭ\xavbzUn&,/˿#_sk 6ڷ?kOj;`:Kɜg`$d##~BØ.DZ$TbPZm΋qF*SP.>?n:_Ytx+n7T)oL~j'x[nÏ趏#CAnG e&!Z H΢4&>J廂Ʀ5R1#2/0igv$USS//\9|5Q$xcǻbH>#C;;wP lc32|#-0vF6?NJs  {-=]m:Y U.IxW725[#\t`Mun5W(k7\bE;ӼNxRN>6U_4tCA?TyyIĥxk5:Orb&>x~- Pf41g8Z0^C$A"w 4VV"%p8!s/<&=۱IsCg)Mk0rcT2 F_ {Y4˽>RK2vfl 6Ax/Ĝ\0rx,Yp5\ ?O C㈱v8i` D-1pHcr|b?2go b.S`LD23AbǢ30N/y'>Q(p !5r2"&V0ˉʻp:vT,K#G qC+w ʈS,O\ k ZFp)/mAϹt!#N' jD8$ۧs3MPp#.DU151pRΜy㼲V8M3m _~XI8Ś7b@D(7WENdf :,  s)7 G@[/) D@S>6;S9\=v8s!b@;y)Kj U4b$'e^ %Tq: sM! v% 21] hPABʋ=;I}6e4G4;lxb` .(^ s EQF>(RC"#K( 螷fbXygIV@щ37ɇL1rrE(}uv*G-`8NdZ0&| HZ d4:br֤܌ZI*oDv2'I+V\kj`hDw`V% L (àsh7"cy6q-o=1CЙclmڡGe0ˠU#ÿy&PuOQsvTe18NhȶAA#(btS;es?Ge"% ,b @up&/Ile<%)pO&ʙ0%"vk7J*\p01܊,N)419@iֹ<a+7<Qy$*\_yXy步W"STx1f+]' 0b炂}#0 XAA0ys/@X@cd|R+(D04Z"!9$pY}İ3]".NpNX1v_2oSqL-4IIВ`PcfyrXi4剙"i5`o1qls O)lR96WvL ~< + *#OF|=( rMaߋ9 wԪ+( 0ѨS>\vjUF)EXZ]Ŷ-Gg!>MLP˲8|}VPZ瘚@kEBnD\%JD4ctF%J{>ࣟY^fii0wv+tcWWRN`2<~qݫ7{?ر2~x}u&'':=0}Wp[BQ ed T(Qhv^32Jq' R]]chh!fN_y^xM֪so6C#|v x=sjubĹ'ˬ,/s,/AJbDX`vtggR'bk7٢\2B'@;6(XCfQ\cܿ0<'NVr&Bmp#GT:uPT*K}i NL02:?.bZIN=ŒC]a!tKF)+5Un _ϳN>.>'OF;z8S Oqpmf̲ʃ2׮nJZ=(}( >-U'~k7n+?>۷9}fu^kia 5  gh*o__P. 40$|x[7ϰL3QDeDeh&ZD$y%`/={,ق&/nJue' TW)KLϜDŘwJw@nj勗0 #5qD}Ň8ŋ(3T{ŜTPXFOm[pGܲK|4lﰹڲh iNΣX( S,ڔ9Fpl ,"IX!U* T"HE a ~Fc xX@>~+@ i\p VVvN3ϗ8t!|´ Ah5]Z aR/32:eĢ)@Tq{%ti5wެRȗ(>iZ( KAvQGQehr-;HkMT6v>$jp'W֘9((9\>JqPZ!Y!QA3@ށF+ى.mwjLz 19W/cYy-: I:ǎ\.S,bht邇Vc|$RZdCyzm"Sf8qj6rDjL;]"ɤXf7v,:OǵkG|y DL°Z-[Qdzn?Yǻj)-4. hQq[د:44~3ey}.^׿2Y\\Ξ⍓ESNlG Xx o-q6x&}T$L\@h&.⳺ {a5 3daa/%~l~gyevwضkZPڤhZ ؘaX4g _essknxss(mvb(pL(Uώ̖uZxIӈ8"+xi(9 4"ZȈEOm!27{sM=>jJťRqY_0 r|FA(_8SS1 <LO7F\ q6YJ=dђ±`w_C3lRgl0?$뢵3stJ&ccY89res;ǽ;V]DI3r̝Ba茡eɱ{ !xT@pwlW)r=IjQyBV=*vghM VXFGT=V VXFC"$@ ?5{j=TOO=oIDB/G"BdjS d @2 d ȓ% ܀2{IENDB`gprofng-gui-2.1/images/installer-README0000644000175000017500000000365314744453367014671 00000000000000 gprofng-gui is a Java application that can run on a standard Java implementation. This makes it possible to run on Java implementations for Windows and MacOS. The remote analysis feature added to gprofng-gui 2.0 makes it possible to run the gprofng-gui on a client and connect with ssh to remote servers where gprofng is installed. In order to install the gprofng-gui on these clients running Java, we provide native installers built with the Java jpackage application. Below we give the commands we execute on the native OSs to create the native installers. MacOS: jpackage --name gprofng-gui --java-options "-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Xmx1024m" --main-jar gprofng-analyzer.jar --input lib --icon gprofng.icns --about-url https://www.gnu.org/software/gprofng-gui/ --app-version 2.0 Windows: jpackage --name gprofng-gui --java-options "-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Xmx1024m" --main-jar gprofng-analyzer.jar --input lib --icon gprofng-128x128.ico --about-url https://www.gnu.org/software/gprofng-gui/ --app-version 2.0 --win-shortcut --win-menu --win-shortcut-prompt Notes: - gprofng-analyzer.jar is the main jar for gprofng-gui - a directory on the native OS named "lib" needs to be created - the gprofng gui jar files need to be copied into this directory - the icons used by the installers are located in the images directory - the format of icons is native OS specific, but all are derived from common gprofng.png using gimp - a native MacOS utility, iconutil, was used to create the gprofng.icns file from several .png files iconutil -c icns gprofng.iconset $ ls gprofng.iconset icon_128.png icon_256.png icon_32.png icon_48.png icon_64.png - For Windows, jpackage requires WiX 3.0 or later gprofng-gui-2.1/images/gprofng-256x256.png0000644000175000017500000010103014726067021015075 00000000000000PNG  IHDR\rfiCCPICC profile(}=H@_SvPqP" EjVL.& IZpc⬫ ~8;8)HK -b=8ǻ{wP/3nD\dW+0YƜ$%q|׻(|ѯ,D3Lxxf68YQVω'L #8\xfLb6fES#&NBcg\e{s2i"E,AUP(:)Rqrȱ 4Ȯ~wk&`~q1 4j}8 \-~^ki# \\4e ٔ]OS3,0x y5q pp({û{{LJrJ bKGD pHYs  tIME #1)*- IDATxW$ו;Y>;C6 fȡqZiw"V&B㆞E(V ncvg8K3%le\=dUVU+iD].39s L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L2$L(0d?\6`dCI&Xd?8q?LK2$SdI2$LdI&$L.VJ(<\H5]I|oݷ5^%wBd`nz1h~ `~գdTRHWdPvR$lWV~ABȠ{O!C໒,/kVnd H_Tg}ylA/ʴEkC:U&7UPw4@|@+ 7i9)eM)B! *_G TgH.–΢/ ]. ʫsmcJ⻪yS[rؽP w+,4[BR~&|EoUlʺߗؑe*j/иzof K6^ҞY T}hJGgP* Th5;;Pa:[G|7IH(Ou㩆tQ$Mh]ϫ @GL%7-ư Gv"(h$%4sU"&6 %F)unX;pwC;cϠT1B3($)ߥB֝F{܍4c'ϫҬ4JT3)h8oU(†JT}R‡$w ,>5@KU"c{8\TPn;_C\ ɤV*6Go YJ: NȴU1K>s5Ԡ$ F4"t*Xs\0"/Zy@oa뫰=3%苻*2<'yь0Cе K'fwDTB*9ע41R,ͦh z~ fjbPL>+U&!ZuFUz.Ql߻@dߓ/'R78bwc~7.7-5ׁLa}"juU˧_EЪύáTRoQzeϨҟ;a *C1hT_#n%}E$ԍ(g$}C5/uT&VZ )淄8uc? $Øu t~X%0D~N;y7z B%b0-zHK)M(]$XNA R{M]5*2d&&LрSJD$6} wå7.1\|"aIU?N"CP"ڋGJgʉ{IS^%8ճoH-P6U 4[J"`ZiUl=wWi~XǐT`h!n:X*7+tWC{!$^P)|&uVǘ*Z6ZeIBIJg"PC8 t[ 0To6Xч/Ibw,r_Kr"!>WwZ{R]HT L>$kD)zJ>AQ5#%;IhKNQ郓, lz,},2'Z:D#a[L,AN0U G%J\KNi] ND_LԄP=ڗo=B (yBa]>$pîCD~p.h}2a M`"0U#YT]PN-8"}vV#t*v'Kqv=ֻ#c Y%mS)YfˆQy{WTL!Qpf7 *d-9yL'~h<U3$z਴Ԥ+-+DaI,n@$. . S`*R7 Q➵$xA1ӣ7⸊^`e9- HwcޒUy Ja U46 鉤q,%ġFtZ(\7-cjǑL)d8uf|WbkrdSoQJyKNG oocaf& (|x{3 `A!/)CXg=> z>Q4Ĥy?p @mذrW׀.q3fC4'U i4OAVr$#RBKJt* S4NWU'FsT6ކHh-=*Ythi4i(,S,[ÛRmJc (_\4Te|c'p@8+,AR$= ;L"~d OovU^O7lֻ#щKS@{HTVsM+q1A )xpģ6I80M B!Ll;c.$$gu$єMPNthNV m!?]Wh)ZxZi=ʟX1Ai hp黗ߓA 271yQ$Wڐh[PI]p]T&9~ C1/uQ}8G)gH 3=׼o{SJW 3q>fA㨗hj+lWz!FVة _?MlVPObcYKzUÈn\5KBvA)I z.(2M,BU;apP S[62B4HDba$gucܳb%DBh8M(UH0iP@{J0h-". #nm.TB ʥSrv䏙deuo~<_y䑇z*=?{U!yt'B!1re{y~/1F\hrEGW>>@hhNA*q??wC M :ĸωY4iaŕb`fL! ߗD"l$ at$4[rh~?״_sI 9Sc?QP.}o~;<9Sxjh7[=b୻(ˈOl6\_=8o_󭇅U=w///~ѱѨRi6y8{ W?|<!hVyǞWo^b pma߼}Yn>v3ium[Y< k[#"!_(^ݳ>Yݶ9i^ nj:&SVԚr<1F[[,laepm~7|Gn=zXGNn~[m(u0ID-4DSѴC84PHv%ZZjf$˄w 77`d;`)Emk3HػvM?]-ˊS=cme3.}VVTThlh5m;D=Μ>-CO>k_btt$Bvv (xOqZp>pNF]P} *[`m:Q( 9 J|90djI }a:%w$uUEہGE4reۢOg-C(4ᄏyW/l,}9M~s"xO~M7x͎,=Zk4NVHrl 8{m h\lX_Amlh5Zz i(Oy4u7͌077Igayi\MM{pssq/-ގi3y<~|O^q\x%_ZN/|mz8,AT ر Q]HhT$$=zZ.CU# 3=^'J턵b1Rkm)R t闆apӡEmZϞԶ7(-v̎/}cv&/]e'{R&{wW9{|ͱR_u9s N'vHlڡ |Ik+˸?f{rtnTvX`yH01>TBImsP A+ kפqh<uˏV$jġD_ (nvi'u]\ScO%)  ri._G#_( Qs`&sssJPOQ=ǶpJ,Ւv^ 9w{fFVu8/_wh9=MzU*W޻ocG:אP-4t|j$c.9mkx*&ߨyTJB)J0ҖR1?x8+z@@xJQoFSg(\cJj&iefIƬ* ŹW׸p}2_#x'XIu|Τs6Ro4\R_/5F˖ig.vZމ)oDt"m;G5sj}m߁aXArTũSg)uɱT:9+<Ņyl_0[T*E7k5U_4>?i hcugHb4zc}2EY=O5}`\m9Z0Tc?U$\B(Tlֽ;*l=H,GG# %U{lW0E( Z:vb@ZP,v3"][_c\ËϿKh6?w'~3b>Zq=wFz*[~Y'&0 #%"T#;r9jW._ⱟ^yǕ7Lɩ ):Oz)@ٹkw\]F/mnɩt\s.K^mΞ9O_<Y=סQSVJNU :: Tz[]uꋨ Tt/+W 77*sXڰ#zg*Z[X$RN|@užS # 4`WjGdrjrBP\w^ÈTZ_Vok[Mə3xų}2 >CM9.-+#}wT_bv3S`\r^<CS;/>Ƕ~g/~f_t_?EyP}玐_^+,/nsgf|s]I w~mfgV%J*d n{)O"t+tx?FkZ"x!P,H Qmxp5p'8?3mGQvjх C*2JH 7#+eNA _6!e޺3V3˧:r4JmmDv;'ػw'':/^8X0>>q b s>`f+]~ҭC;ɓ}y~9,e2| avn.Nmz 6I&'CU56XR ?Ɠ<_`tʳϿjݧ*w\dn½:'?ss&2{cU2{FVBOq8|pO+xǹXlLرmB`밼ȩޡe_<*hYoYoqea:sss=z$BIDC>tBo+"Jnbk6Q1 yUWT,C+Z}À*(HDG+FqTI xZ^k2 #@{z^|\X{8כ8nw.tEΝ;PJqU<}-xrvۭ鳸CT[q1Bbu<>¶E.cfnb5w<~;qzRi259wɮ]1 st<a~a9`-#GnJu#݅c;ܾsgM)6>clX迤bIBW_. &G |sr}3RA uqlEO=O9NmRM#T+K%z~0-Lض};_/$Nkl zPwqw߲re gQ`c0J33ٟ~%+)iZ<0JZCqS/AT+ |~&''0-pMǞCFuC&oqUi)*qRrtwD)W-J;!:DPmEEP7K'$ڦ;QtCv72Josm}mz~xw?cyjY\ٹ9vI(#* 4 V;*ժw#gmULi'q҇ 40 |!_!Jh4x_p<T,,BE*UB#IV^$#/^]'~4[x {avn6L-:TT!g4qEZ2$aUK_&K~ (ǝn U9Ȇ+sD6A7jUj$\BPX\ VE$zRi|5Ǹ?|3Զ1:9>u~NJ];'Q1;)M:YlCՠ ,h@mXE)T uYZ\¶[7O^e p{taToᅨe*h.p=FMV< ϜWOh9xJq9g0;2?WQ0\B<B 5R*t~!€hيE4'ȉ9{:i9Ͽv7N]TMzˡvPs+#Gx^s ;x_E(e2짔m=7<ʥtX'MVgWWяp:<^?uJɏ,4Z.M'[̌؉|0IĊ7x*OJBkKDgd"HZX Jmn„-uitzHϣ{S[Pa@ѣZY>z|eqw/xsm~յ-k-km Ac(cUon8Bw#-]Bk!LMO3:6nW=Ig vD^CԹTj@~Lxk<ӕT%JX)[&!!(#Y* NKZ*P Vf1a- ~K;zM-[&1n RhJEk J%C9PEX0 C<%Xժ9i)+m_[C)o:KGwEfƗG`O-x|s9ZT#l۾]vxRw%.`o#DKw\|U`B>_TPc9&.PiID|V*)¤o%i0$`D" !?dbx1Dr=]B ]RM(C]}EsZ^D 4p"&ѐm]yZ5N40d.t]/t7t&J* BdnNJXxJG.ݔ^駞[])Ŷmvnl֩omvY"n\jPduyW/quV]gcZ&k'l:MVsǵrH7#Y[:V. J-cBuk!.CM>gdlctl+\vabY9r}<%-y3叿(V I>RM.i֙0rՑr.ӳ9涕)UʔK%JŢ~mn$!h&QN;[EѨ~ tX1p] 5)=S 7Z"Lw2WЫ#v^҂.wmcAiE}Z~@zs)qvvI ׯ^ڕy~`=TFv!LЬoGaU`_ uZ6xX &c-F ml7)U0̵6nc+Mx(5ҼrϱwǾس&fmgttB@.XmMՎZqX!o$ i7{Bax0F#y J6zUWXZK?{k/aYYIed=L>?q18B)x.ȁ ]M rI#x$"l(Gbe@2+ӥbzCNbdHhxf6W\_am}eLà+&1VnUi4llrt6[&"&1F6Jmݦ(.^XZbמq *QA Jj5oRmXG-& g,S,MR%W(b`,\4)$CnXYama!󊙙3{ncR#.$ lvmHj2dN"]z8UϺHSn_dj ur7DzvTIܐWShzD* &z[pZ;>0:!ö[4j[̳0+.c&gvr-091K.P(b: ;sb.xM p]m<uPuGXX.aMrmK,^w_<y`-?tf(\LäZa[]\:SbIb J#+eAG( 8 |Aabo^+,^dc*5}9zggVG!%7<'Sg+J HT' *%+ex4_u=;IHV6!h$x։bvf0FEV`rbruB8V-l/FcltݻRR{,^Dzh[8c׷p6X\@d099(vd|l|) qq<]<ٶg7b (t7s9znmpjX8mc/ IDATB$)aG+)8v·`zGryR56WWx78ڻ\z2^]fjz|AmET0HA}S0L C0 41-sOCh,0J @KrtU #e@LG}FF/Cbɘ QSEc㷚u^,\M7S)* EFFƱ++ \ve/㣓NP.W8X0*fX1=86Fzv5POZ2::J:yuu]j4-'ض BR vJ2r-닼q oLOOjj=0Mj5zcsuzMX[k8 򋇊QAד= `j?oOXR4 GAդ#pn2`z&[KM6W;ګ\tjw[n,bQ媿 0òL3b0>>f˒8ӌOLRmےƸu! /}@4+P.Qp mmXSb@Mi0ݿ_1r//40 m._>K:"?*RnfÌOM*]e|:FP,~aY>>uRQ4u.]>8vr0\"SSӾn4u7Z,..jrELy\edd\oQ*)X թIhnq5~/YXg)i4P@UDZ\wd.Tv𼤪7D0Lzۨh2}Ccc.ŢblrxnnRf!8m+)!>## |؝[rUoݢj:+45 "9+ϫAPT022A.(ˬ,ŭRY4u_ha\~(ӓۨ 0:2~\.G20L7b-y%66V&ϳJRϬ7uzC͎p3T ټ;x6v:L @!jGػf:ҥ+/wu 8>@u*j[M~ZgxK+6z`Tz]Ȗ2Mdue$'/:@Mb"`X@_],ECRaeLJUK"ĉ/v+?~:QEk:XXG=HRL-v^ܶmn(Al;h6(`ss\.u6تhqɱcR,h;S<ԏج13 mIZ}|@y~ nB.gQ.WMDz{b( (M&w%}6O>$|af0#D^~ Ĺs;KxRضZW.aY8rx7SLLL:μs<,UJ]k^@8I( f3ϥ0 Fw{pMI|NY-'C-n`J|!H(?@ MZ &'gFiR2?ߜ^]~ÿa߾LvO4`YYEc},"iwLRPʣ/7V?;vLjֹzm^|*w?8LOg>FF(X.e)}N5ܜo( s[|糟]vlA?r9ǏsU.\8- QRf~~^~^R[ ,Ӡ\7KwqnŏS_ypg|DNg0 ŕ+/a&/e~;rx}S̮hiZ4mV78{"/sM{8xp?łiB>:2i!`wCV_:_}\QGC{Mg^,sA|o:@Z~vee{<2}-s.Ц\qX7y˘c|'xO|U~P?^ST1%]żK~-Vݕ BhkE>cI$&ލfϵ* bV+ & m?\cY?yLO(Pp_8Cxj|3S!Pm;pKK\Tdm2ًa()6LM,qϽrȭ gݍ FU>|7*;0ѻ.[BYy6-{?wSM\saa<"SST_ m9Dր㌍~|a}5Nw|b>~ǽ>"R7S" !֯nX3'0uv7K,[uUݭڠoҠgЁ7ͦ/f+bQAk`f KQzŸ $LxbLBTƻDOQPdj*J"HWgRޑسsXkVb à/M3LlDI$2А h/+՘Gsq7hMTN37w|٥Q&'I$c^u=V !Lr|;`oE_ ]]_&HTs57lrӍ[e{QzP!T罅E`F,/2(1 &b- ej&G I$a'N.p![{wq:N8ïsqQfgOn=|]]/k-MWD2b]5/SY5/+it:A 0W%RE$Ǥۍ'>T#{ E.N`LL| 4-BtdڧU~j`ƪ R;m*oER3 f$ꯩ{Ѩ 8M: ,tuͲ+VYbrjlWʊIȾ/,gnz!|<,3ӧ)G(xh[h``VJ}OyulASxbtt.s[)}v 6W~g'?ei&r L:J$")yg9sfq_35y m۶qǝ>@?--gt2><_C7ozK/}>o&JSө!L#O&\ W7TßIX'h6/CebקV%Wb$7bfzB`Kĸ{y󴤋LLD\#njhXXH L)1MiB4*pؐ#a%"ŢQhkк ̘`|ȅs0ij$Sizi癙"rGǙ3ݬz/RJfgss䖧J: MK2`aac,Co1: kohr1]ړ}Ƈy9pI&TeGPhգȦ?5* sj-E( ͟J'ϱ-bI09~g\^𷘞:Mԧ>wF__/K%yq* O~O룭m GȽ|no=w>ykv—З5Dʉ d!h~v$\)]?Щ#6dMazH4M>C0KW5~0#LM!"YR&|@)fZFѻMeY6 @Ubf0,XK&Jgfarl ӳ[n[!ېQ}w#ɥˏebڦ۵{wޱx2Kz%\xG?Ȇ ?NKZ~qǽvXUX*508#L_fݺӰ w5&7pW#ѨBV{5A6T{%bUB],]H$B|c敗_㩧%Cu[9s-FFq5V m•|t(r?UJHӯ XGiٞt6 yJQ0&+4 u, Oٹ xSoL:J2VF4cF]Ou [C,.[s5x3}5}ustuupϽw#r0M&G'(MgM` M'q t )+ m)JE%ŸQD [vs .n}CK@XZ:M]a#G(VpطZ3}5no:/~Dl'$NkW>J2'C/pqxtK+pgΜ宻``pOqq9v뻁5lݲ!T]Oޖ;/JL-/a"0r$ "D'>߷sslݲT2͙Ǹjv6_} J!p`^qi 2z_5V4I] D3 bB{Zh'.2x<#}^/,D_ϓ7a3C=ٳ`FJ9&ȫT*|}Xr V02r-/rH)_;݇agHgr;?ő{unfOk_E} G~>~w?d!e?ªUkZC ,_\.S)Y-1e۶y8cjj 9u_—ܰw7gN&366LRKbB1O>czz)NbbjKNfфn- qS}~INFR)K&sDrEV>Ć-{֭ڮh4N"©şX$q*{/~T*ᯁK1??ju)jM~JKNSq0W?wHpJ$&zTqN43sMz' +kW'lܼW^x~!'L30}{pozb/ݛj@ξrŠR6( e(Wspݬ8̴ G)S\ًatӽ<7z0%Ɓu\Ǎ(<rVInV7F1"XD H'%%WEVn i], cns,u6CSPJXݿwQ`Ϟim`;'O= ^}-K:N2$ƈEcә!!O1c LƠ\:r_ڵfbr\N eJd(c:5 moth4Xf=ޫ`a9WK >fhhvK>bH4J2d߰W^y͗C"s,,2>>ŋ 8QSrۉ)ېJcaf" bf%: 2-Q ӈJf2Y  3 ]BK#v#eR1EW;)G>7_[0ҩ2-No~/{|.o;w0~ɩLS,F#j|p5âZb3JƣVǽJw(p& 9X٥JI/ zЪ }׍}R{iiigϞyq&F):Y;KwG;kCXTJ覵d*E,!OJeH$36;m&IS ,QV\D"MgGMjơT*V@KKC\>EOL`ㆭ<'}?A"l, s5aǎbњ1 vG8{<3ӳtwwq]daa#99ΞqbcoD\d_/Q*-03&}Y"I%DU=Δhi]M&݊`Ö:J"KK ,.YӁ./179N,r~b~Ld~II[k}\iFbNSqϽws58q:ˇ_fٻwz3={ķs<#,eX3mq;E[Xɸ5X 2WM*}Q mUŴ,T0 1\IDAT&!H?4#lݱH$<ˌ T*p[o8}g9pD -V:Vii::%bc1::\M2"NmѫiD"\) b7ǹjӵtvfΞ;oe.u۲G2ttq hmme`pbD,VϽ9|,,,;OXB&y$yo~,㟠ozeY2-H&Gٰ1U%h%t:1ǒlB [ת3VzK #BKK'--,%re~#GFdcY t>I28R LU1=~۷=ڡ _n4?g:yW9} ˡ|>@>EJ) KA[{t XT2EkK;64hd2E&B[k6L3F:JTbnv_ynD"櫮c[.vdKD#&%qx8r ~G)%̲drmݾX4fKŒ)\n|~'*qH Orm}`Vm!5ǓLQSOVW*uvd`uvvB~\\nyZ2']xDrq$w~2X")d~챧d|C?K"}N+_jg~ӻI&tkJ\:ӴDfBQ%V+uB6`@_bF6]&:p_:BvF1:́~pݞۙt1.{\xbaY)7}7ʥFOO/kR[S.WZp*H$G") ;mWjRr\ rB1_RdKJE&&.ed9HXd){<:9$X̴̓p}'~=(crenvlv1.E,[_ͮ]yVp[yXq+?_~7A:{F:Ӱ2 i O |h^ LpAxJ} A$YJ l<t^ WP\ ikf츞˜=u3'2z,c37;ʫ]K[G}kټu7`Ӗ]DQ+2RRD>eybsɥ3>%"˗e86n lUv5\>UٓO=ǁoλp(z)y/b_¹?Wxq5ӓ#wZ[;}4rJ$.ciUcq@ENmo2;;'ba~ refg''D00"ZՠiF0 *yޞ~::{ Kx;Dx|=tx^4#R]$i{D5?́;gzrΟ}3dbbqe <|\.Όط#rլ侽wrI3ES?Έ6pKw\|@3?!'G,d&zɫ(rrIhيE.qq]P/39~,-Α]ZXCB\,Lg0dt^6ZeAG}_k);ω7^g#i:ڻff'ٸqxdRc"iuutD"Eg*;im Lii#OIHBZo˷(c@X%JڵXnc{};^` A, ' pd`[V񕉂6ST!%UJ5 wFJH1Ayx$aԉPk7?V?˥"rh,0̰ɫU=#TC*wB~(S#jMOdiq|a(?HҼ}wqw!e,`U^N6mDT׎o=ĸf_8SO=0/cff?dho_/ѵtX,sSDqx ̈(djqM~r `C R){6[{ E\`]ttv'JTxiJŒA7MU~8R܅ab/f/AAo$m{l8E/Zap ʒl^zKyJ=Lz߯erI W~V7K;m&lq~>?\gV pͮX;@[{ݴwdHēIk7߭DEV,@:T=yGyuxᨙـ5A=[Z}ɸUb4C)ra W4mD'Un hd0aUXڌs("YM1sC|%] <ǿ$K SY}}ܹլ颳X,4cc={om}n{D ki4f>sGYsp_PanR`#/Tk9保ex7#'6p\%0Q(`V6 >;fsUڮbN)I! qYI\h`3}Bq* INx'q正 9 KK,.R,,o7AX*RttovŸM!=.\5%d(\< '8g֮KH]C#x'Ak@| @SE!S*>ns er\SP"U"D!`k)ix=pJتYRHnylvIK)msvL֚`[ZdX;ʹwaFu H5F' @KB}/p.&{z{"D\5mnsL ZI!>\xLՔP?ܘRLj6hHՍbY/Hekq=lwьF0!74'[u\]"žkÆ56iȃ4{~We?^ py4\=3l_ĄicQA4r X~gF@s@Q'u9;J@O]E2JkL6J|QR, e/4XD[I&QYl+E^IUgq)ڃ ,C>E&eC^HE=P֟8vRv:aOމGX>^2U~C&_o>I[ g>`;Zz~Kx5j>HGÐQA,*HƭJ*].Jб%6 6S;/3SFn} M^r6l.,ޙ! C._mjI:nB5'=D11#^>roP]An8<).R Kqnl1q'/bV}AV䋒| ܜ>wY_ϝRU5b4.}/Eݒ<$$"-d3+ע=)׽TXOݨ@N6c/aaMpҳуȚ7#;^JRr*EAYf:];!8&;oa^=8MWKqj1-UUIN.!z`dP]95+Tsr NoJ( BsVf֐PoRI^qzTW !Eay:r+O1i!O d+WnNܣdCT_.:F$ ,TZ@4c=BIR*YT$ez cX%] ǫwrW[R6NmJϩӨ\B 8UEHw !0Mшz}MnuA>:'ޢ/FmSoͼpOaE5!җQ>p QAϤeOjS HDn_eEVnvð`C728,C/eqˀ7Rw:/!T+ݫc!Y,bpC]\K(-EJudX[xRA] FZ͸\GD*;=N뗬ԜM{[ZҲ~~Oeɮ M +!tVhoz@Q>/x}>|l;:9,;Ūr̵AR 㲦XGP(B"*bOqrHoku F*Ru!==UI62Y?`|\̯m0M+%˔Mfzo7sͥj AP&̧6r 4j((4tH9+*ws]Xq]],Gl ͗m^RZ-ev zZE;s`U>ZCP[dp:Y}aEZX b{d O[%Ǐg=pYk"BI{ gӥ@dos2D6`]`NzԄ' F8x]ORY쐀=(D$gX\&%eɖvk 1PH#/2.G+0aK5#`<2FF"isBx4:y/a"_z+ Lt>#f{r•pFs`B[6IOawDɨTKܥCD;qꞇ+<Ϯ_Χ5%+WjQjz Ou^LLءP=}(63VqC6 Վlj-sÛzM`nsXNBuHqj;eb-)fDOoaziVHð?tWV&'Ĥ U&Tۣ!РV&R0>SԜQ*Ih}3B]JE`C,)h8iI‹ƶmm4'C_fץϒHߙwvlaHtTS+ C{Q)]Y7" m" %$ŕ-q B%:M{a-XRRys+\KE+r"R8*(C@qۤ0Vb|E3&$=}ɪ:%|KJ BY :cTg*K}_@(}ET4WxK#7FjE6Hz u`#/o0p? " NW`썦:D X,K!*{RiD/G!ҫr"]I2tĉRzً  HVֳ!^aIsM 'K &֯ ?TYJvT{T('l֊B!G-.*XtKԂR.Uar+\ő[j>f8W4v|G6I* X!_V^,])a"[UC ߁?wrE7X6)w#+q[Z#m$vVaD_xsS2li* +}&?ӐA˕]T8&`QS!c2쐾rJIqHEФWh}^eC0o.3ڰ48r|fڄJ owC+H4Y gūaK#&zmelIXY Î+PsNe[6t]#W%o9@I'!ԌjUH7ȟtGZz\1նB '+#y\++𼧻 ȆwJe"xtX{1졦%/_O c.P3DO|3sDss 5]IGIJSTFRf28@~H>to <{& eHJE|׈\~P^>gR\*P4 BHU'DCR5S(NfNYĽMX0KRtJQM5qNi ,Q&\rw JDqbe{5x{S"X?8Jޓ Glr 5)LFSD\=MI-6ve#DTn`ϗ _H[qT)EјM$mގ < fT[4aRJ(nݗj #E;NH:CIvDЖu?Jqi2lJ<g\.{:ٌʳͤJ )`;ӬkdkU2lUKDTW[shʫMyJ| ];hd|Tkstb2qo?Jf)KUp?ɻ7W5Guڃ?PK46;xxUjFˈ!;TQEE9wt^20FQKl}~L^7wR\R*%UdyJ5Frr B>RPEB2))3</jf訏,q=Iܷ}h8S)yŕA<Bd ~BSA]DH Wij1W)-XM=\^[DY_ B:np ـ oeC @CC m444@CC8R۠V}444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444ܜ|XIENDB`gprofng-gui-2.1/config.sub0000755000175000017500000010645015044713766012527 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gprofng-gui-2.1/compile0000755000175000017500000001635014517772130012113 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: gprofng-gui-2.1/ChangeLog0000644000175000017500000000011514517772113012300 000000000000002023-10-24 Jose E. Marchesi * New changelog. gprofng-gui-2.1/configure.ac0000644000175000017500000000333615044710303013011 00000000000000dnl Copyright (C) 2022-2025 Free Software Foundation dnl dnl This program is free software: you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation, either version 3 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program. If not, see . AC_INIT([gprofng-gui], 2.1) AM_INIT_AUTOMAKE AC_PROG_CC AC_CHECK_PROGS([JAVA],[java],[no]) AC_CHECK_PROGS([JAVAC],[javac],[no]) AC_CHECK_PROGS([JAR],[jar],[no]) AC_CONFIG_FILES(Makefile) AM_MAINTAINER_MODE if test "x$JAVA" = "xno"; then AC_ERROR([java is needed to build gprofng-gui. Please install the JRE.]) fi if test "x$JAVAC" = "xno"; then AC_ERROR([A java compiler is needed to build gprofng-gui. Please install the JDK.]) fi if test "x$JAR" = "xno"; then AC_ERROR([JAR is needed to buidl gprofng-guil. Please install the JDK.]) fi AC_CANONICAL_HOST build_linux=no build_windows=no build_mac=no echo "host_os=${host_os}" case "${host_os}" in linux*) build_linux=yes ;; cygwin*|mingw*) build_windows=yes ;; darwin*) build_mac=yes ;; *) AC_MSG_ERROR(["OS $host_os is not supported"]) ;; esac AM_CONDITIONAL([BUILD_LINUX], [test "$build_linux" = "yes"]) AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"]) AM_CONDITIONAL([BUILD_OSX], [test "$build_mac" = "yes"]) AC_OUTPUT gprofng-gui-2.1/mdate-sh0000755000175000017500000001373214730333464012166 00000000000000#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1995-2020 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST fi case $1 in '') echo "$0: No file. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification day of FILE, in the format: 1 January 1970 Report bugs to . EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac error () { echo "$0: $1" >&2 exit 1 } # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # Use UTC to get reproducible result. TZ=UTC0 export TZ # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume 'unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # Avoid user/group names that might have spaces, when possible. if ls -n /dev/null 1>/dev/null 2>&1; then ls_command="$ls_command -n" fi # A 'ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named "Jan", or "Feb", etc. However, it's unlikely that '/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`$ls_command /` # Find which argument is the month. month= command= until test $month do test $# -gt 0 || error "failed parsing '$ls_command /' output" shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done test -n "$month" || error "failed parsing '$ls_command /' output" # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\\\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: gprofng-gui-2.1/gprofng-gui.mf0000644000175000017500000000073714517772113013310 00000000000000Manifest-Version: 1.0 OpenIDE-Module-Layer: org/gprofng/mpmt/resources/mf-layer.xml Specification-Title: gprofng GUI OpenIDE-Module-Public-Packages: org.gprofng.mpmt.** OpenIDE-Module: org.gprofng.mpmt/1 Specification-Version: 8.2 OpenIDE-Module-Specification-Version: 8.2 OpenIDE-Module-Localizing-Bundle: org/gprofng/mpmt/Bundle.properties Implementation-Title: org.gprofng.mpmt Specification-Vendor: gprofng GUI Implementation-Version: 8.2 Implementation-Vendor: gprofng GUI gprofng-gui-2.1/README0000644000175000017500000000440215044723101011376 00000000000000The GNU gprofng GUI is a feature rich graphical user interface for the GNU gprofng tool. It makes it possible to interactively analyze and compare gprofng profiling experiments. Users can drill into an applications profile together with the applications code to gather an understanding and insight into what an application is doing throughout its runtime. The GUI is a Java application utilizing the Swing GUI framework. 1. To build gprofng-gui on GNU/Linux from a released tarball: $ wget https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui.VERSION.tar.gz $ tar xzvf gprofng-gui.VERSION.tar.gz $ cd gprofng-gui.VERSION $ mkdir build && cd build/ $ ../configure --prefix=PREFIX && make && make install 2. To build gprofn-gui on GNU/Linux from the development git repo: $ git clone https://git.savannah.gnu.org/git/gprofng-gui.git $ cd gprofng-gui $ autoreconf -i -f $ mkdir build && cd build/ $ ../configure --prefix=PREFIX && make && make install This GUI requires gprofng to be installed in the system to be used. The gprofng profiler is part of the GNU binutils. Make sure to have installed in your system and available in your PATH. Then you can launch the GUI using the following gprofng command: $ gprofng display gui [GUI_OPTIONS] [EXPERIMENT] REMOTE CONNECTION FROM WINDOWS AND MACOS The remote analysis feature added to gprofng-gui 2.0 makes it possible to run the gprofng-gui on a client (including Windows and macOS) and connect with ssh to remote GNU/Linux servers where gprofng is installed. To build gprofng-gui on macOS: - Do (1) or (2) to install the GUI. To build gprofng-gui on Windows: - Install JDK and msys2 - Run msys2 and install software: pacman -Syu # You may need to close and reopen msys2 pacman -S mingw-w64-ucrt-x86_64-gcc pacman -S autotools pacman -S git - Add javac to $PATH, for example: PATH="$PATH:/c/Program Files/OpenLogic/jre-21.0.6.7-hotspot/bin" - Do (1) or (2) to install the GUI. Before connecting to a remote host, configure ssh to connect without password and questions from ssh. Check that this command runs without any questions from ssh: ssh YOUR_SERVER uname -a Launch the GUI using the following commands: on Windows PREFIX/bin/gprofng-gui.ps1 on macOS PREFIX/bin/gprofng-gui gprofng-gui-2.1/Makefile.in0000644000175000017500000020204515044713766012606 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Copyright (C) 2022-2025 Free Software Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Copyright (C) 2012-2025 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # . # VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(srcdir)/doc/version.texi \ $(srcdir)/doc/stamp-vti $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" \ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgdatadir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) am__v_DVIPS_0 = @echo " DVIPS " $@; am__v_DVIPS_1 = AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; am__v_MAKEINFO_1 = AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) am__v_INFOHTML_0 = @echo " INFOHTML" $@; am__v_INFOHTML_1 = AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; am__v_TEXI2DVI_1 = AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; am__v_TEXI2PDF_1 = AM_V_texinfo = $(am__v_texinfo_@AM_V@) am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) am__v_texinfo_0 = -q am__v_texinfo_1 = AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) am__v_texidevnull_0 = > /dev/null am__v_texidevnull_1 = am__dirstamp = $(am__leading_dot)dirstamp INFO_DEPS = doc/gprofng-gui.info am__TEXINFO_TEX_DIR = $(srcdir)/. DVIS = doc/gprofng-gui.dvi PDFS = doc/gprofng-gui.pdf PSS = doc/gprofng-gui.ps HTMLS = doc/gprofng-gui.html TEXINFOS = doc/gprofng-gui.texi TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(pkgdata_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/doc/local.mk AUTHORS \ COPYING ChangeLog INSTALL NEWS README compile config.guess \ config.sub install-sh mdate-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JAR = @JAR@ JAVA = @JAVA@ JAVAC = @JAVAC@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = info-in-builddir foreign no-texinfo.tex ACLOCAL_AMFLAGS = -I . JAVA_FLAGS = JAVAC_FLAGS = JAR_FLAGS = cfvm MPMT_DIR = org/gprofng/mpmt ANALYZER_DIR = org/gprofng/analyzer COLLECTOR_DIR = org/gprofng/collector ANALYZER_JAR = gprofng-analyzer.jar GPROFNG_JAR = gprofng.jar COLLECTOR_JAR = gprofng-collector.jar @BUILD_LINUX_TRUE@GPROFNG_DISPLAY_GUI = gprofng-display-gui @BUILD_OSX_TRUE@GPROFNG_DISPLAY_GUI = gprofng-gui @BUILD_WINDOWS_TRUE@GPROFNG_DISPLAY_GUI = gprofng-gui.ps1 @BUILD_LINUX_TRUE@INSTAL_EXEC_OS = install-exec-local-linux @BUILD_OSX_TRUE@INSTAL_EXEC_OS = install-exec-local-osx @BUILD_WINDOWS_TRUE@INSTAL_EXEC_OS = install-exec-local-windows @BUILD_LINUX_TRUE@DesktopLauncher = gprofng-gui.desktop @BUILD_OSX_TRUE@DesktopLauncher = @BUILD_WINDOWS_TRUE@DesktopLauncher = MPMT_SRC = \ $(MPMT_DIR)/AboutPanel.java \ $(MPMT_DIR)/AnAction.java \ $(MPMT_DIR)/AnAddress.java \ $(MPMT_DIR)/Analyzer.java \ $(MPMT_DIR)/AnChooser.java \ $(MPMT_DIR)/AnCompDisp.java \ $(MPMT_DIR)/AnDialog.java \ $(MPMT_DIR)/AnDisplay.java \ $(MPMT_DIR)/AnDouble.java \ $(MPMT_DIR)/AnEvent.java \ $(MPMT_DIR)/AnFile.java \ $(MPMT_DIR)/AnFileSystemView.java \ $(MPMT_DIR)/AnFrame.java \ $(MPMT_DIR)/AnHotGap.java \ $(MPMT_DIR)/AnIconButton.java \ $(MPMT_DIR)/AnInteger.java \ $(MPMT_DIR)/AnListener.java \ $(MPMT_DIR)/AnList.java \ $(MPMT_DIR)/AnLocale.java \ $(MPMT_DIR)/AnLong.java \ $(MPMT_DIR)/AnMemoryManager.java \ $(MPMT_DIR)/AnMetric.java \ $(MPMT_DIR)/AnObject.java \ $(MPMT_DIR)/AnShellCommand.java \ $(MPMT_DIR)/AnString.java \ $(MPMT_DIR)/AnTable.java \ $(MPMT_DIR)/AnTree.java \ $(MPMT_DIR)/AnVariable.java \ $(MPMT_DIR)/AnWindow.java \ $(MPMT_DIR)/CalledByCallsDisassemblyView.java \ $(MPMT_DIR)/CalledByCallsDisp.java \ $(MPMT_DIR)/CalledByCallsFunctionsView.java \ $(MPMT_DIR)/CalledByCallsSourceView.java \ $(MPMT_DIR)/CallerCalleesView.java \ $(MPMT_DIR)/CallTreeView.java \ $(MPMT_DIR)/CannotFindFilePanel.java \ $(MPMT_DIR)/collect/CollectDialog.java \ $(MPMT_DIR)/collect/Collector.java \ $(MPMT_DIR)/collect/CollectorOpenPanel.java \ $(MPMT_DIR)/collect/CollectPanel2.java \ $(MPMT_DIR)/collect/CollectPanel3.java \ $(MPMT_DIR)/collect/CollectPanel.java \ $(MPMT_DIR)/collect/CollectUtility.java \ $(MPMT_DIR)/collect/HWCEntry.java \ $(MPMT_DIR)/collect/HWCSelectDialog.java \ $(MPMT_DIR)/collect/HWCSelectPanel.java \ $(MPMT_DIR)/compare/AnTransferHandler.java \ $(MPMT_DIR)/compare/CompareAdvancedDialog.java \ $(MPMT_DIR)/compare/CompareGroupsPanel.java \ $(MPMT_DIR)/compare/CompareNavigationPanel.java \ $(MPMT_DIR)/compare/CompareSimpleDialog.java \ $(MPMT_DIR)/compare/CompareSimplePanel.java \ $(MPMT_DIR)/compare/CompareStatusPanel.java \ $(MPMT_DIR)/compare/ExperimentGroupsPanel.java \ $(MPMT_DIR)/ConfigurationPanel.java \ $(MPMT_DIR)/control_panel/CPDetailsScrollPane.java \ $(MPMT_DIR)/control_panel/CPFilterPanelHandler.java \ $(MPMT_DIR)/control_panel/CPLayoutPanel.java \ $(MPMT_DIR)/control_panel/CPToolbarHandler.java \ $(MPMT_DIR)/control_panel/CPToolbar.java \ $(MPMT_DIR)/DataLayoutView.java \ $(MPMT_DIR)/DataObjectsView.java \ $(MPMT_DIR)/DisasmDisp.java \ $(MPMT_DIR)/DisassemblyView.java \ $(MPMT_DIR)/DualSourceView.java \ $(MPMT_DIR)/event/AnChangeEvent.java \ $(MPMT_DIR)/event/AnChangeListener.java \ $(MPMT_DIR)/event/AnEventManager.java \ $(MPMT_DIR)/event/AnSelectionEvent.java \ $(MPMT_DIR)/ExperimentPickListElement.java \ $(MPMT_DIR)/ExperimentPickList.java \ $(MPMT_DIR)/ExperimentPickLists.java \ $(MPMT_DIR)/experiment_props/DataDescriptor.java \ $(MPMT_DIR)/experiment_props/ExperimentProperties.java \ $(MPMT_DIR)/experiment_props/Experiments.java \ $(MPMT_DIR)/experiment_props/PropDescriptor.java \ $(MPMT_DIR)/ExperimentsView.java \ $(MPMT_DIR)/export/ExportDialog.java \ $(MPMT_DIR)/export/Export.java \ $(MPMT_DIR)/export/ExportPanel.java \ $(MPMT_DIR)/export/ExportSupport.java \ $(MPMT_DIR)/filter/CustomEditPanel.java \ $(MPMT_DIR)/filter/CustomFilterAction.java \ $(MPMT_DIR)/filter/CustomFilterDialog.java \ $(MPMT_DIR)/filter/CustomPanel.java \ $(MPMT_DIR)/filter/FilterClause.java \ $(MPMT_DIR)/filter/FilterNavigationPanel.java \ $(MPMT_DIR)/filter/FilterParser.java \ $(MPMT_DIR)/filter/Filters.java \ $(MPMT_DIR)/filter/FilterStatusPanel.java \ $(MPMT_DIR)/filter/FilterTextField.java \ $(MPMT_DIR)/filter/KeywordsPanel.java \ $(MPMT_DIR)/filter/RedoFilterAction.java \ $(MPMT_DIR)/filter/RemoveAllFilterAction.java \ $(MPMT_DIR)/filter/UndoFilterAction.java \ $(MPMT_DIR)/flame/FlameBlock.java \ $(MPMT_DIR)/flame/FlameData.java \ $(MPMT_DIR)/flame/FlamePanel.java \ $(MPMT_DIR)/flame/FlameRow.java \ $(MPMT_DIR)/flame/FlameToolBar.java \ $(MPMT_DIR)/flame/FlameView.java \ $(MPMT_DIR)/FuncListDisp.java \ $(MPMT_DIR)/FunctionsView.java \ $(MPMT_DIR)/guitesting/GUITesting.java \ $(MPMT_DIR)/HeapView.java \ $(MPMT_DIR)/HotGapPanel.java \ $(MPMT_DIR)/IDispToModel.java \ $(MPMT_DIR)/IExtTreeModel.java \ $(MPMT_DIR)/InstructionFrequencyView.java \ $(MPMT_DIR)/IOView.java \ $(MPMT_DIR)/ipc/IPCCancelledException.java \ $(MPMT_DIR)/ipc/IPCContext.java \ $(MPMT_DIR)/ipc/IPCErrorReader.java \ $(MPMT_DIR)/ipc/IPCHandle.java \ $(MPMT_DIR)/ipc/IPCListener.java \ $(MPMT_DIR)/ipc/IPCLogger.java \ $(MPMT_DIR)/ipc/IPCProtocol.java \ $(MPMT_DIR)/ipc/IPCReader.java \ $(MPMT_DIR)/ipc/IPCRequestHeader.java \ $(MPMT_DIR)/ipc/IPCRequest.java \ $(MPMT_DIR)/ipc/IPCResponseHeader.java \ $(MPMT_DIR)/ipc/IPCResponse.java \ $(MPMT_DIR)/ipc/IPCResult.java \ $(MPMT_DIR)/ipc/IPCTester.java \ $(MPMT_DIR)/IPC.java \ $(MPMT_DIR)/IPCProcess.java \ $(MPMT_DIR)/ITreeToPanel.java \ $(MPMT_DIR)/KeyboardShortcuts.java \ $(MPMT_DIR)/LibraryVisibilityDialog.java \ $(MPMT_DIR)/LibraryVisibilityPanel.java \ $(MPMT_DIR)/LinesView.java \ $(MPMT_DIR)/mainview/BorderPanel.java \ $(MPMT_DIR)/mainview/MainViewPanel.java \ $(MPMT_DIR)/mainview/Panel.java \ $(MPMT_DIR)/mainview/SubviewAreaPanel.java \ $(MPMT_DIR)/mainview/Subview.java \ $(MPMT_DIR)/MemoryIndexObjectView.java \ $(MPMT_DIR)/metrics/BasicMetric.java \ $(MPMT_DIR)/metrics/CompareBarData.java \ $(MPMT_DIR)/metrics/IPCMetricsAPI.java \ $(MPMT_DIR)/metrics/MetricAttr.java \ $(MPMT_DIR)/metrics/MetricColors.java \ $(MPMT_DIR)/metrics/MetricLabel.java \ $(MPMT_DIR)/metrics/MetricNode.java \ $(MPMT_DIR)/metrics/MetricOption.java \ $(MPMT_DIR)/metrics/MetricsGUI.java \ $(MPMT_DIR)/metrics/MetricValue.java \ $(MPMT_DIR)/metrics/SelectableMetricNode.java \ $(MPMT_DIR)/metrics/ValueMetricNode.java \ $(MPMT_DIR)/MiniFuncListDisp.java \ $(MPMT_DIR)/navigation/ActionPanel.java \ $(MPMT_DIR)/navigation/NavigationPanel.java \ $(MPMT_DIR)/navigation/PanelDropTargetListener.java \ $(MPMT_DIR)/navigation/TopNavigationPanel.java \ $(MPMT_DIR)/navigation/View.java \ $(MPMT_DIR)/navigation/ViewPanel.java \ $(MPMT_DIR)/navigation/ViewsPanel.java \ $(MPMT_DIR)/NoMetricsSelectedPanel.java \ $(MPMT_DIR)/overview/AnBarTree.java \ $(MPMT_DIR)/overview/BarColorKey.java \ $(MPMT_DIR)/overview/Bar.java \ $(MPMT_DIR)/overview/BarPanel.java \ $(MPMT_DIR)/overview/CheckBoxBarPanel.java \ $(MPMT_DIR)/overview/GradientPanel.java \ $(MPMT_DIR)/overview/OuterPanel.java \ $(MPMT_DIR)/overview/Overview.java \ $(MPMT_DIR)/overview/OverviewPanel.java \ $(MPMT_DIR)/overview/OverviewView.java \ $(MPMT_DIR)/overview/ProgressBarPanel.java \ $(MPMT_DIR)/overview/TopButtonPanel.java \ $(MPMT_DIR)/overview/TurnerLabelPanel.java \ $(MPMT_DIR)/overview/TurnerPanel.java \ $(MPMT_DIR)/PCsView.java \ $(MPMT_DIR)/persistence/UserPref.java \ $(MPMT_DIR)/persistence/UserPrefPersistence.java \ $(MPMT_DIR)/picklist/PickListElement.java \ $(MPMT_DIR)/picklist/PickListEvent.java \ $(MPMT_DIR)/picklist/PickList.java \ $(MPMT_DIR)/picklist/PickListListener.java \ $(MPMT_DIR)/picklist/StringPickListElement.java \ $(MPMT_DIR)/picklist/StringPickList.java \ $(MPMT_DIR)/progress/CancelContext.java \ $(MPMT_DIR)/progress/Cancellable.java \ $(MPMT_DIR)/progress/InternalHandle.java \ $(MPMT_DIR)/progress/ProgressHandle.java \ $(MPMT_DIR)/progress/ProgressPanel.java \ $(MPMT_DIR)/progress/SystemProgressPanel.java \ $(MPMT_DIR)/PsParser.java \ $(MPMT_DIR)/remote/Authentication.java \ $(MPMT_DIR)/remote/AuthenticationPanel.java \ $(MPMT_DIR)/remote/CheckBoxList.java \ $(MPMT_DIR)/remote/CloseExperimentDialog.java \ $(MPMT_DIR)/remote/CloseExperimentPanel.java \ $(MPMT_DIR)/remote/ConnectionDialog.java \ $(MPMT_DIR)/remote/ConnectionManager.java \ $(MPMT_DIR)/remote/ConnectionPanel.java \ $(MPMT_DIR)/ResolveFilePathDialog.java \ $(MPMT_DIR)/ResolveFilePathPanel.java \ $(MPMT_DIR)/SelectedObject.java \ $(MPMT_DIR)/SelectionManager.java \ $(MPMT_DIR)/settings/AnSettingChangeEvent.java \ $(MPMT_DIR)/settings/CallTreePanel.java \ $(MPMT_DIR)/settings/CallTreeSetting.java \ $(MPMT_DIR)/settings/CompareModeSetting.java \ $(MPMT_DIR)/settings/ExportSettingsDialog.java \ $(MPMT_DIR)/settings/ExportSettingsPanel.java \ $(MPMT_DIR)/settings/FormatSetting.java \ $(MPMT_DIR)/settings/ImportSettingsDialog.java \ $(MPMT_DIR)/settings/ImportSettingsPanel.java \ $(MPMT_DIR)/settings/LibraryVisibilitySetting.java \ $(MPMT_DIR)/settings/MetricAttributes.java \ $(MPMT_DIR)/settings/MetricNameSelected.java \ $(MPMT_DIR)/settings/MetricNameSelection.java \ $(MPMT_DIR)/settings/MetricSelection.java \ $(MPMT_DIR)/settings/MetricsPanel.java \ $(MPMT_DIR)/settings/MetricsSetting.java \ $(MPMT_DIR)/settings/MetricState.java \ $(MPMT_DIR)/settings/MetricStates.java \ $(MPMT_DIR)/settings/MetricType.java \ $(MPMT_DIR)/settings/MMetric.java \ $(MPMT_DIR)/settings/PathMapSetting.java \ $(MPMT_DIR)/settings/PathmapsPanel.java \ $(MPMT_DIR)/settings/SearchPathPanel.java \ $(MPMT_DIR)/settings/SearchPathSetting.java \ $(MPMT_DIR)/settings/Setting.java \ $(MPMT_DIR)/settings/Settings.java \ $(MPMT_DIR)/settings/SourceDisassemblySetting.java \ $(MPMT_DIR)/settings/TableSettings.java \ $(MPMT_DIR)/settings/TimelineSetting.java \ $(MPMT_DIR)/settings/ViewModeEnabledSetting.java \ $(MPMT_DIR)/settings/ViewModeSetting.java \ $(MPMT_DIR)/settings/ViewsSetting.java \ $(MPMT_DIR)/SourceDisassemblyView.java \ $(MPMT_DIR)/SourceDisp.java \ $(MPMT_DIR)/SourceView.java \ $(MPMT_DIR)/statecolors/AnColorChooser.java \ $(MPMT_DIR)/statecolors/ChooserStateView.java \ $(MPMT_DIR)/statecolors/ColorMap.java \ $(MPMT_DIR)/statecolors/ColorRule.java \ $(MPMT_DIR)/statecolors/StackState.java \ $(MPMT_DIR)/statecolors/StackStateList.java \ $(MPMT_DIR)/statecolors/StackView.java \ $(MPMT_DIR)/statecolors/StackViewState.java \ $(MPMT_DIR)/statecolors/StateColorMap.java \ $(MPMT_DIR)/StatisticsView.java \ $(MPMT_DIR)/statuspanel/StatusComponentHandle.java \ $(MPMT_DIR)/statuspanel/StatusComponent.java \ $(MPMT_DIR)/statuspanel/StatusHandleFactory.java \ $(MPMT_DIR)/statuspanel/StatusLabelHandle.java \ $(MPMT_DIR)/statuspanel/StatusLabel.java \ $(MPMT_DIR)/statuspanel/StatusLabelValueHandle.java \ $(MPMT_DIR)/statuspanel/StatusPanel.java \ $(MPMT_DIR)/SummaryPanel.java \ $(MPMT_DIR)/table/AnJTable.java \ $(MPMT_DIR)/table/AnTableHeaderPanel.java \ $(MPMT_DIR)/table/AnTableScrollPane.java \ $(MPMT_DIR)/table/AttributePanel.java \ $(MPMT_DIR)/table/ExclusiveAndInclusivePanel.java \ $(MPMT_DIR)/table/ExclusiveOrInclusivePanel.java \ $(MPMT_DIR)/table/HeaderMouseHandler.java \ $(MPMT_DIR)/table/MetricPanelDropTargetListener.java \ $(MPMT_DIR)/table/MetricPanel.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorEvent.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorMoveEvent.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorSetEvent.java \ $(MPMT_DIR)/timeline2/data/GenericEvent.java \ $(MPMT_DIR)/timeline2/data/SampleEvent.java \ $(MPMT_DIR)/timeline2/data/StackEvent.java \ $(MPMT_DIR)/timeline2/Entity.java \ $(MPMT_DIR)/timeline2/EventDetails.java \ $(MPMT_DIR)/timeline2/IconRuler.java \ $(MPMT_DIR)/timeline2/MetaExperiment.java \ $(MPMT_DIR)/timeline2/RowData.java \ $(MPMT_DIR)/timeline2/RowDataRequestParams.java \ $(MPMT_DIR)/timeline2/RowDefinition.java \ $(MPMT_DIR)/timeline2/RowGeometry.java \ $(MPMT_DIR)/timeline2/TimelineDraw.java \ $(MPMT_DIR)/timeline2/TimelineSelectionEvent.java \ $(MPMT_DIR)/timeline2/TimelineSelectionRowEvent.java \ $(MPMT_DIR)/timeline2/TimelineVariable.java \ $(MPMT_DIR)/timeline2/TimelineView.java \ $(MPMT_DIR)/timeline2/TL2ControlPanel.java \ $(MPMT_DIR)/timeline2/TL2CoordCalcData.java \ $(MPMT_DIR)/timeline2/TL2DataFetcher.java \ $(MPMT_DIR)/timeline2/TL2DataSnapshot.java \ $(MPMT_DIR)/timeline2/TL2Drawer.java \ $(MPMT_DIR)/timeline2/TLExperiment.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataImpl.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataMaster.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataReader.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeImpl.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeMaster.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeReader.java \ $(MPMT_DIR)/timeline_common/TimelineCaliper.java \ $(MPMT_DIR)/timeline_common/TimelineCursor.java \ $(MPMT_DIR)/timeline_common/TimelineDrawer.java \ $(MPMT_DIR)/timeline_common/TimelinePanel.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionCaliperEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionGenericEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionHistoryEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionListener.java \ $(MPMT_DIR)/timeline_common/VerticalRowRuler.java \ $(MPMT_DIR)/timeline/events/DeadlockEvent.java \ $(MPMT_DIR)/timeline/events/DetailsIPC.java \ $(MPMT_DIR)/timeline/events/DurationEvent.java \ $(MPMT_DIR)/timeline/events/EventDetail.java \ $(MPMT_DIR)/timeline/events/ExtendedEvent.java \ $(MPMT_DIR)/timeline/events/HeapEvent.java \ $(MPMT_DIR)/timeline/events/HWCEvent.java \ $(MPMT_DIR)/timeline/events/IOEvent.java \ $(MPMT_DIR)/timeline/events/MPIEvent.java \ $(MPMT_DIR)/timeline/events/ProfileEvent.java \ $(MPMT_DIR)/timeline/events/RaceEvent.java \ $(MPMT_DIR)/timeline/events/Sample.java \ $(MPMT_DIR)/timeline/events/StateEvent.java \ $(MPMT_DIR)/timeline/events/SyncEvent.java \ $(MPMT_DIR)/toolbar/FindTextPanel.java \ $(MPMT_DIR)/toolbar/ToolBarFiller.java \ $(MPMT_DIR)/toolbar/ToolBarPanel.java \ $(MPMT_DIR)/toolbar/ToolBarSeparator.java \ $(MPMT_DIR)/util/gui/ActionTextField.java \ $(MPMT_DIR)/util/gui/AnBorderPanel.java \ $(MPMT_DIR)/util/gui/AnCheckBox.java \ $(MPMT_DIR)/util/gui/AnDialog2.java \ $(MPMT_DIR)/util/gui/AnDialogOuterPanel.java \ $(MPMT_DIR)/util/gui/AnGradientPanel.java \ $(MPMT_DIR)/util/gui/AnInsetsPanel.java \ $(MPMT_DIR)/util/gui/AnJList.java \ $(MPMT_DIR)/util/gui/AnJPanel.java \ $(MPMT_DIR)/util/gui/AnJScrollPane.java \ $(MPMT_DIR)/util/gui/AnJTree.java \ $(MPMT_DIR)/util/gui/AnLongScrollBar.java \ $(MPMT_DIR)/util/gui/AnMenuBar.java \ $(MPMT_DIR)/util/gui/AnScrollBarUI.java \ $(MPMT_DIR)/util/gui/AnSplitPaneFixedRightSize.java \ $(MPMT_DIR)/util/gui/AnSplitPaneInternal.java \ $(MPMT_DIR)/util/gui/AnSplitPane.java \ $(MPMT_DIR)/util/gui/AnTabbedPane.java \ $(MPMT_DIR)/util/gui/AnTabbedPaneUI.java \ $(MPMT_DIR)/util/gui/AnTextIcon.java \ $(MPMT_DIR)/util/gui/AnUtility.java \ $(MPMT_DIR)/util/gui/RainbowColorScale.java \ $(MPMT_DIR)/util/gui/ToolTipPopup.java \ $(MPMT_DIR)/util/ruler/LabelCoordinateCalculator.java \ $(MPMT_DIR)/util/ruler/RangeRuler.java \ $(MPMT_DIR)/util/ruler/Ruler.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesBytes.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesGeneric.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesLabelList.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesLong.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesNanoseconds.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesWithUnits.java \ $(MPMT_DIR)/util/zoomruler/OverlayMouseHandler.java \ $(MPMT_DIR)/util/zoomruler/PaintListener.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerComponent.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerEvent.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerListener.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerOverlay.java \ $(MPMT_DIR)/ViewDisplayPanel.java \ $(MPMT_DIR)/welcome/WelcomeButton.java \ $(MPMT_DIR)/welcome/WelcomeInnerPanel.java \ $(MPMT_DIR)/welcome/WelcomePanel.java \ $(MPMT_DIR)/welcome/WelcomeView.java MPMT_FILES = \ $(MPMT_SRC:%.java=$(srcdir)/%.java) \ $(ANALYZER_FILES) ICONS = \ $(MPMT_DIR)/icons/add.png \ $(MPMT_DIR)/icons/addtablecolumns.png \ $(MPMT_DIR)/icons/analyzer64.png \ $(MPMT_DIR)/icons/apply_filter.png \ $(MPMT_DIR)/icons/apply_mtrs.png \ $(MPMT_DIR)/icons/attributed.png \ $(MPMT_DIR)/icons/back_filter.png \ $(MPMT_DIR)/icons/backward.png \ $(MPMT_DIR)/icons/badexperiment.png \ $(MPMT_DIR)/icons/base1.png \ $(MPMT_DIR)/icons/base2.png \ $(MPMT_DIR)/icons/blank.png \ $(MPMT_DIR)/icons/bubble_icon_16.png \ $(MPMT_DIR)/icons/callee.png \ $(MPMT_DIR)/icons/caller.png \ $(MPMT_DIR)/icons/cancelProcess.png \ $(MPMT_DIR)/icons/class.png \ $(MPMT_DIR)/icons/collect.png \ $(MPMT_DIR)/icons/color.png \ $(MPMT_DIR)/icons/compareAbsolute.png \ $(MPMT_DIR)/icons/compareDelta.png \ $(MPMT_DIR)/icons/compareHamburger.png \ $(MPMT_DIR)/icons/compare.png \ $(MPMT_DIR)/icons/compareRatio.png \ $(MPMT_DIR)/icons/compareReverse.png \ $(MPMT_DIR)/icons/connect.png \ $(MPMT_DIR)/icons/data.png \ $(MPMT_DIR)/icons/delete.png \ $(MPMT_DIR)/icons/down.png \ $(MPMT_DIR)/icons/errorNew.png \ $(MPMT_DIR)/icons/error.png \ $(MPMT_DIR)/icons/errorWarningNew.png \ $(MPMT_DIR)/icons/exclusive.png \ $(MPMT_DIR)/icons/exe_elf.png \ $(MPMT_DIR)/icons/expandcollaps.png \ $(MPMT_DIR)/icons/experiment.png \ $(MPMT_DIR)/icons/expgroup.png \ $(MPMT_DIR)/icons/fileResolved.png \ $(MPMT_DIR)/icons/fileUnResolved.png \ $(MPMT_DIR)/icons/filter.png \ $(MPMT_DIR)/icons/find_next.png \ $(MPMT_DIR)/icons/find_prev.png \ $(MPMT_DIR)/icons/forward_filter.png \ $(MPMT_DIR)/icons/forward.png \ $(MPMT_DIR)/icons/func_item.png \ $(MPMT_DIR)/icons/gear.png \ $(MPMT_DIR)/icons/gobackward.png \ $(MPMT_DIR)/icons/godown.png \ $(MPMT_DIR)/icons/goforward.png \ $(MPMT_DIR)/icons/goup.png \ $(MPMT_DIR)/icons/green100.png \ $(MPMT_DIR)/icons/hamburgerBlank.png \ $(MPMT_DIR)/icons/hamburgerFocused.png \ $(MPMT_DIR)/icons/hamburger.png \ $(MPMT_DIR)/icons/heaptrace.png \ $(MPMT_DIR)/icons/hollowArrowDown.png \ $(MPMT_DIR)/icons/hollowArrowLeft.png \ $(MPMT_DIR)/icons/hollowArrowRight.png \ $(MPMT_DIR)/icons/hollowArrowUp.png \ $(MPMT_DIR)/icons/hot.png \ $(MPMT_DIR)/icons/hwc.png \ $(MPMT_DIR)/icons/inclusive.png \ $(MPMT_DIR)/icons/i_o_usage_16.png \ $(MPMT_DIR)/icons/jar.png \ $(MPMT_DIR)/icons/more_icon.png \ $(MPMT_DIR)/icons/mpitrace.png \ $(MPMT_DIR)/icons/nav_bar_arrow.png \ $(MPMT_DIR)/icons/nextview.png \ $(MPMT_DIR)/icons/number.png \ $(MPMT_DIR)/icons/oldexperiment.png \ $(MPMT_DIR)/icons/open.png \ $(MPMT_DIR)/icons/panhand.png \ $(MPMT_DIR)/icons/percent.png \ $(MPMT_DIR)/icons/previousview.png \ $(MPMT_DIR)/icons/profile.png \ $(MPMT_DIR)/icons/races.png \ $(MPMT_DIR)/icons/redo.png \ $(MPMT_DIR)/icons/removeBlank.png \ $(MPMT_DIR)/icons/removeFocused.png \ $(MPMT_DIR)/icons/remove.png \ $(MPMT_DIR)/icons/reset.png \ $(MPMT_DIR)/icons/sample.png \ $(MPMT_DIR)/icons/save.png \ $(MPMT_DIR)/icons/smallBlank.png \ $(MPMT_DIR)/icons/small_down_focused.png \ $(MPMT_DIR)/icons/small_down.png \ $(MPMT_DIR)/icons/small_left.png \ $(MPMT_DIR)/icons/small_right.png \ $(MPMT_DIR)/icons/small_up_focused.png \ $(MPMT_DIR)/icons/small_up.png \ $(MPMT_DIR)/icons/stop.png \ $(MPMT_DIR)/icons/synctrace.png \ $(MPMT_DIR)/icons/tab.png \ $(MPMT_DIR)/icons/time.png \ $(MPMT_DIR)/icons/undo.png \ $(MPMT_DIR)/icons/up.png \ $(MPMT_DIR)/icons/values.png \ $(MPMT_DIR)/icons/warnexperiment.png \ $(MPMT_DIR)/icons/warningNew.png \ $(MPMT_DIR)/icons/warning.png \ $(MPMT_DIR)/icons/welcomeBackgroundShadow.png \ $(MPMT_DIR)/icons/zoom_in.png \ $(MPMT_DIR)/icons/zoom_out.png \ $(MPMT_DIR)/icons/circleBlue.gif \ $(MPMT_DIR)/icons/circleGreen.gif \ $(MPMT_DIR)/icons/circleOrange.gif \ $(MPMT_DIR)/icons/circleRed.gif \ $(MPMT_DIR)/icons/performanceAnalyzerSplash.gif GPROFNG_CLASSES = \ $(MPMT_DIR)/*.class \ $(MPMT_DIR)/*/*.class \ $(MPMT_DIR)/*/*/*.class \ $(MPMT_DIR)/*/*/*/*.class GPROFNG_FORMS = \ $(MPMT_DIR)/AboutPanel.form \ $(MPMT_DIR)/CannotFindFilePanel.form \ $(MPMT_DIR)/collect/CollectorOpenPanel.form \ $(MPMT_DIR)/collect/CollectPanel2.form \ $(MPMT_DIR)/collect/CollectPanel3.form \ $(MPMT_DIR)/collect/HWCSelectPanel.form \ $(MPMT_DIR)/compare/CompareGroupsPanel.form \ $(MPMT_DIR)/compare/CompareSimplePanel.form \ $(MPMT_DIR)/compare/CompareStatusPanel.form \ $(MPMT_DIR)/compare/ExperimentGroupsPanel.form \ $(MPMT_DIR)/ConfigurationPanel.form \ $(MPMT_DIR)/export/ExportPanel.form \ $(MPMT_DIR)/filter/CustomPanel.form \ $(MPMT_DIR)/filter/FilterNavigationPanel.form \ $(MPMT_DIR)/filter/FilterStatusPanel.form \ $(MPMT_DIR)/filter/KeywordsPanel.form \ $(MPMT_DIR)/LibraryVisibilityPanel.form \ $(MPMT_DIR)/mainview/BorderPanel.form \ $(MPMT_DIR)/mainview/MainViewPanel.form \ $(MPMT_DIR)/navigation/ActionPanel.form \ $(MPMT_DIR)/navigation/TopNavigationPanel.form \ $(MPMT_DIR)/navigation/ViewPanel.form \ $(MPMT_DIR)/navigation/ViewsPanel.form \ $(MPMT_DIR)/NoMetricsSelectedPanel.form \ $(MPMT_DIR)/overview/BarPanel.form \ $(MPMT_DIR)/overview/CheckBoxBarPanel.form \ $(MPMT_DIR)/overview/GradientPanel.form \ $(MPMT_DIR)/overview/OuterPanel.form \ $(MPMT_DIR)/overview/OverviewPanel.form \ $(MPMT_DIR)/overview/ProgressBarPanel.form \ $(MPMT_DIR)/overview/TopButtonPanel.form \ $(MPMT_DIR)/overview/TurnerLabelPanel.form \ $(MPMT_DIR)/overview/TurnerPanel.form \ $(MPMT_DIR)/progress/ProgressPanel.form \ $(MPMT_DIR)/remote/AuthenticationPanel.form \ $(MPMT_DIR)/remote/CloseExperimentPanel.form \ $(MPMT_DIR)/remote/ConnectionPanel.form \ $(MPMT_DIR)/ResolveFilePathPanel.form \ $(MPMT_DIR)/settings/CallTreePanel.form \ $(MPMT_DIR)/settings/ExportSettingsPanel.form \ $(MPMT_DIR)/settings/ImportSettingsPanel.form \ $(MPMT_DIR)/settings/MetricsPanel.form \ $(MPMT_DIR)/settings/PathmapsPanel.form \ $(MPMT_DIR)/settings/SearchPathPanel.form \ $(MPMT_DIR)/statuspanel/StatusPanel.form \ $(MPMT_DIR)/util/gui/AnDialogOuterPanel.form \ $(MPMT_DIR)/util/gui/AnInsetsPanel.form \ $(MPMT_DIR)/welcome/WelcomeInnerPanel.form \ $(MPMT_DIR)/welcome/WelcomePanel.form anmodule_MF = $(srcdir)/gprofng-gui.mf MPMT_PROPERTIES = $(MPMT_DIR)/Bundle.properties # # Standalone gprofng GUI # ANALYZER_SRC = \ $(ANALYZER_DIR)/AnEnvironment.java \ $(ANALYZER_DIR)/AnLog.java \ $(ANALYZER_DIR)/AnMain.java ANALYZER_FILES = $(ANALYZER_SRC:%.java=$(srcdir)/%.java) ANALYZER_MF = $(srcdir)/analyzer_st.mf ANALYZER_CLASSES = $(ANALYZER_DIR)/*.class ANALYZER_PROPERTIES = $(ANALYZER_DIR)/Bundle.properties # Rules for generating a jar file implementing Java collector API # COLLECTOR_SRC = $(COLLECTOR_DIR)/CollectorAPI.java collector_FILES = $(COLLECTOR_SRC:%.java=$(srcdir)/%.java) collector_MF = $(srcdir)/gprofng-collector.mf collector_CLASSES = $(COLLECTOR_DIR)/*.class bin_SCRIPTS = $(GPROFNG_DISPLAY_GUI) CLEANFILES = $(GPROFNG_DISPLAY_GUI) $(GPROFNG_JAR) $(ANALYZER_JAR) \ $(COLLECTOR_JAR) $(GPROFNG_CLASSES) $(ANALYZER_CLASSES) \ $(collector_CLASSES) $(ANALYZER_PROPERTIES) $(MPMT_PROPERTIES) \ LocaleString*.class $(DesktopLauncher) $(man_MANS) pkgdata_DATA = $(ANALYZER_JAR) $(COLLECTOR_JAR) $(GPROFNG_JAR) PNG_DIR = $(srcdir)/images PNG_FILES = $(PNG_DIR)/gprofng-32x32.png $(PNG_DIR)/gprofng-48x48.png \ $(PNG_DIR)/gprofng-48x48.png $(PNG_DIR)/gprofng-64x64.png \ $(PNG_DIR)/gprofng-128x128.png $(PNG_DIR)/gprofng-256x256.png CLR_DIR = $(DESTDIR)$(datarootdir)/icons/hicolor EXTRA_DIST = $(MPMT_SRC) $(ANALYZER_SRC) $(COLLECTOR_SRC) $(ICONS) \ $(GPROFNG_FORMS) $(PNG_FILES) aclocal.m4 analyzer_st.mf \ compile configure.ac configure gprofng-collector.mf \ gprofng-gui.mf gprofng-gui.sh gprofng-gui.spec \ gprofng.properties install-sh Makefile.am Makefile.in missing \ $(PNG_DIR)/gprofng-128x128.ico $(PNG_DIR)/gprofng.icns \ $(PNG_DIR)/installer-README \ $(PNG_DIR)/gprofng.iconset/icon_32.png \ $(PNG_DIR)/gprofng.iconset/icon_48.png \ $(PNG_DIR)/gprofng.iconset/icon_64.png \ $(PNG_DIR)/gprofng.iconset/icon_128.png \ $(PNG_DIR)/gprofng.iconset/icon_256.png README AUTHORS NEWS \ tools $(man_MANS) $(srcdir)/doc/gp-macros.texi \ $(srcdir)/doc/gprofng-display-gui.texi # Options to extract the man page MANCONF = -Dman TEXI2POD = perl $(srcdir)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="User Commands" \ --release="gprofng-gui-$(VERSION)" --section=1 info_TEXINFOS = doc/gprofng-gui.texi gprofng_gui_TEXINFOS = gprofng-gui.texi gp-macros.texi TEXINFO_TEX = . MAKEINFOHTML = $(MAKEINFO) --html --no-split man_MANS = gprofng-display-gui.1 all: all-am .SUFFIXES: .SUFFIXES: .dvi .ps am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/doc/local.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(srcdir)/doc/local.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) doc/$(am__dirstamp): @$(MKDIR_P) doc @: > doc/$(am__dirstamp) doc/gprofng-gui.info: doc/gprofng-gui.texi $(srcdir)/doc/version.texi @test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ -o $@ `test -f 'doc/gprofng-gui.texi' || echo '$(srcdir)/'`doc/gprofng-gui.texi; \ then \ rc=0; \ else \ rc=$$?; \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc doc/gprofng-gui.dvi: doc/gprofng-gui.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ `test -f 'doc/gprofng-gui.texi' || echo '$(srcdir)/'`doc/gprofng-gui.texi doc/gprofng-gui.pdf: doc/gprofng-gui.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ `test -f 'doc/gprofng-gui.texi' || echo '$(srcdir)/'`doc/gprofng-gui.texi doc/gprofng-gui.html: doc/gprofng-gui.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ -o $(@:.html=.htp) `test -f 'doc/gprofng-gui.texi' || echo '$(srcdir)/'`doc/gprofng-gui.texi; \ then \ rm -rf $@ && mv $(@:.html=.htp) $@; \ else \ rm -rf $(@:.html=.htp); exit 1; \ fi $(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti $(srcdir)/doc/stamp-vti: doc/gprofng-gui.texi $(top_srcdir)/configure @test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) @(dir=.; test -f ./doc/gprofng-gui.texi || dir=$(srcdir); \ set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/gprofng-gui.texi`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ (cmp -s vti.tmp$$$$ $(srcdir)/doc/version.texi \ || (echo "Updating $(srcdir)/doc/version.texi" && \ cp vti.tmp$$$$ $(srcdir)/doc/version.texi.tmp$$$$ && \ mv $(srcdir)/doc/version.texi.tmp$$$$ $(srcdir)/doc/version.texi)) && \ rm -f vti.tmp$$$$ $(srcdir)/doc/version.texi.$$$$ @cp $(srcdir)/doc/version.texi $@ mostlyclean-vti: -rm -f vti.tmp* $(srcdir)/doc/version.texi.tmp* maintainer-clean-vti: @MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi .dvi.ps: $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf doc/gprofng-gui.t2d doc/gprofng-gui.t2p clean-aminfo: -test -z "doc/gprofng-gui.dvi doc/gprofng-gui.pdf doc/gprofng-gui.ps \ doc/gprofng-gui.html" \ || rm -rf doc/gprofng-gui.dvi doc/gprofng-gui.pdf doc/gprofng-gui.ps \ doc/gprofng-gui.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-pkgdataDATA: $(pkgdata_DATA) @$(NORMAL_INSTALL) @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ done uninstall-pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f doc/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-aminfo clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: $(DVIS) html: html-am html-am: $(HTMLS) info: info-am info-am: $(INFO_DEPS) install-data-am: install-info-am install-man install-pkgdataDATA install-dvi: install-dvi-am install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-binSCRIPTS install-exec-local install-html: install-html-am install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-am install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf: pdf-am pdf-am: $(PDFS) ps: ps-am ps-am: $(PSS) uninstall-am: uninstall-binSCRIPTS uninstall-dvi-am uninstall-html-am \ uninstall-info-am uninstall-local uninstall-man \ uninstall-pdf-am uninstall-pkgdataDATA uninstall-ps-am uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am am--refresh check check-am clean clean-aminfo \ clean-generic cscopelist-am ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-info dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip dist-zstd distcheck distclean distclean-generic \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-binSCRIPTS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-local install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-pkgdataDATA \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-aminfo maintainer-clean-generic \ maintainer-clean-vti mostlyclean mostlyclean-aminfo \ mostlyclean-generic mostlyclean-vti pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-dvi-am uninstall-html-am uninstall-info-am \ uninstall-local uninstall-man uninstall-man1 uninstall-pdf-am \ uninstall-pkgdataDATA uninstall-ps-am .PRECIOUS: Makefile LocaleString.class: $(srcdir)/tools/LocaleString.java $(AM_V_GEN)$(JAVAC) $(JAVAC_FLAGS) -d . $(srcdir)/tools/LocaleString.java $(MPMT_PROPERTIES): $(MPMT_FILES) LocaleString.class \ $(srcdir)/gprofng.properties $(AM_V_GEN)mkdir -m 777 -p $(@D) || echo "mkdir -m 777 -p $(@D) failed" echo "# THIS FILE IS AUTO-GENERATED. DON'T EDIT IT." > $@ echo "" >> $@ echo "gui_version=$(VERSION)" >> $@ cat $(srcdir)/gprofng.properties >> $@ ( cd $(srcdir); cat $(MPMT_SRC) $(ANALYZER_SRC) ) | $(JAVA) $(JAVA_FLAGS) -cp . LocaleString >> $@ $(GPROFNG_JAR): $(anmodule_MF) $(MPMT_FILES) \ $(MPMT_PROPERTIES) $(ICONS:%=$(srcdir)/%) $(AM_V_GEN)rm -f $(GPROFNG_CLASSES) $(AM_V_at)$(JAVAC) -cp $(srcdir) $(JAVAC_FLAGS) -d . $(srcdir)/$(MPMT_DIR)/Analyzer.java $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(anmodule_MF) $(MPMT_PROPERTIES) $(MPMT_DIR) \ -C $(srcdir) $(MPMT_DIR)/icons $(ANALYZER_PROPERTIES): $(ANALYZER_FILES) LocaleString.class $(AM_V_GEN)mkdir -m 777 -p $(@D) || echo "mkdir -m 777 -p $(@D) failed" @echo "# THIS FILE IS AUTO-GENERATED. DON'T EDIT IT." > $@ @echo "" >> $@ $(AM_V_GEN)( cd $(srcdir); cat $(ANALYZER_SRC) ) | \ $(JAVA) $(JAVA_FLAGS) -cp . LocaleString >> $@ $(ANALYZER_JAR): $(GPROFNG_JAR) \ $(ANALYZER_MF) $(ANALYZER_FILES) $(ANALYZER_PROPERTIES) @echo "================= $@" $(AM_V_GEN)rm -f $(ANALYZER_CLASSES) $(AM_V_at)d=`pwd` ; (cd $(srcdir) ; $(JAVAC) -classpath $$d/$(GPROFNG_JAR) \ $(JAVAC_FLAGS) -d $$d $(ANALYZER_SRC) ) $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(ANALYZER_MF) $(ANALYZER_CLASSES) \ $(ANALYZER_PROPERTIES) $(COLLECTOR_JAR): $(GPROFNG_JAR) $(collector_FILES) $(collector_MF) @echo "================= $@" $(AM_V_GEN)rm -f $(collector_CLASSES) $(AM_V_at)$(JAVAC) $(JAVAC_FLAGS) -d . $(collector_FILES) $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(collector_MF) $(collector_CLASSES) gprofng-display-gui: $(srcdir)/gprofng-gui.sh $(AM_V_GEN)sed -e "s~REPLACE_ME_WITH_VERSION~$(VERSION)~" < $(srcdir)/gprofng-gui.sh \ | sed -e "s~GPROFNG_bindir=~GPROFNG_bindir='$(bindir)'~" \ | sed -e "s~GPROFNG_libdir=~GPROFNG_libdir='$(libdir)'~" \ | sed -e "s~GPROFNG_datadir=~GPROFNG_datadir='$(datadir)'~" \ > $@ $(AM_V_at)chmod +x $@ gprofng-gui.ps1: @echo "java -Xmx1024m -jar $(datadir)/$(PACKAGE)/gprofng-analyzer.jar \$Args" > $@ $(AM_V_GEN)chmod +x $@ gprofng-gui: @echo "#!/bin/sh" > $@ @echo "java -Xmx1024m -jar $(datadir)/$(PACKAGE)/gprofng-analyzer.jar \$@" >> $@ $(AM_V_GEN)chmod +x $@ $(DesktopLauncher): @echo '[Desktop Entry]' > $@ @echo "Encoding=UTF-8" >> $@ @echo "Version=$(VERSION)" >> $@ @echo "Type=Application" >> $@ @echo "Name=gprofngg gui" >> $@ @echo "Exec=$(prefix)/bin/gprofng-display-gui" >> $@ @echo "Icon=gprofng" >> $@ @echo "Categories=Profiling;" >> $@ @echo "Comment=Graphical tool to create and analyze gprofng experiments" >> $@ PHONY: install-exec-local install-exec-local-linux install-exec-local-windows \ install-exec-local-osx install-exec-local: $(INSTAL_EXEC_OS) install-exec-local-linux: $(DesktopLauncher) $(PNG_FILES) $(AM_V_GEN)for d in 32x32 48x48 64x64 128x128 256x256 ; do \ $(mkinstalldirs) $(CLR_DIR)/$$d/apps ; \ cp $(PNG_DIR)/gprofng-$$d.png $(CLR_DIR)/$$d/apps/gprofng.png ; \ chmod 644 $(CLR_DIR)/$$d/apps/gprofng.png ; \ done $(AM_V_at)$(mkinstalldirs) $(DESTDIR)$(datarootdir)/applications $(AM_V_at)cp $(DesktopLauncher) $(DESTDIR)$(datarootdir)/applications/ $(AM_V_at)chmod 644 $(DESTDIR)$(datarootdir)/applications/$(DesktopLauncher) $(AM_V_at)$(mkinstalldirs) $(DESTDIR)$(bindir) $(AM_V_at)rm -f $(DESTDIR)$(bindir)/gp-display-gui $(AM_V_at)ln -s gprofng-display-gui $(DESTDIR)$(bindir)/gp-display-gui install-exec-local-windows install-exec-local-osx: @echo "================= $@" uninstall-local: rm -f $(CLR_DIR)/*/apps/gprofng.png $(DESTDIR)$(bindir)/gp-display-gui \ $(DESTDIR)$(datarootdir)/applications/$(DesktopLauncher) # Build the man page from the texinfo file # The sed command removes the no-adjust Nroff command so that # the man output looks standard. $(man_MANS): $(srcdir)/doc/gp-macros.texi $(AM_V_GEN)touch $@ $(AM_V_at)( nm=`basename $@ .1` ; \ $(TEXI2POD) $(MANCONF) < $(srcdir)/doc/$$nm.texi > $$nm.pod ; \ ($(POD2MAN) $$nm.pod | sed -e '/^.if n .na/d' > $@.tmp && \ mv -f $@.tmp $@) || (rm -f $@.tmp && exit 1) ; \ rm -f $$nm.pod ) gprofng-display-gui.1: $(srcdir)/doc/gprofng-gui.texi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: gprofng-gui-2.1/NEWS0000644000175000017500000000166315044723101011223 00000000000000This NEWS file records noteworthy changes, very tersely. See the manual for detailed information. Copyright 2023-2025 The gprofng-gui authors. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Version 2.1 (August 2025) - Build on Windows and macOS to support the remote analysis from Linux servers. - Fixed -Xlint:rawtypes,cast warnings. Version 2.0 (January 2025) - Remote analysis feature added. Learn how to use gprofng-gui on Windows and MacOS in images/installer-README. - Manual pages upgraded. - Bugs fixed. Version 1.1 (19 January 2024) - Disable help buttons in the interface, as these are not useful at this point. - Disable buttons for remote profiling features, as these are not implemented yet. - Manual pages upgraded and improved. Version 1.0 (30 October 2023) - Initial release. gprofng-gui-2.1/gprofng-collector.mf0000644000175000017500000000023214517772113014500 00000000000000Manifest-Version: 1.0 OpenIDE-Module-Public-Packages: org.gprofng.collector.** OpenIDE-Module: org.gprofng.collector/1 Specification-Version: 1.0 gprofng-gui-2.1/AUTHORS0000644000175000017500000000006314517772113011600 00000000000000Vladimir Mezentsev gprofng-gui-2.1/analyzer_st.mf0000644000175000017500000000015014517772113013404 00000000000000Class-Path: gprofng.jar gprofng-collector.jar analyzer_help.jar Main-Class: org.gprofng.analyzer.AnMain gprofng-gui-2.1/gprofng.properties0000644000175000017500000000126214517772113014312 00000000000000OpenIDE-Module-Name=gprofng GUI OpenIDE-Module-Display-Category=Tools OpenIDE-Module-Short-Description=gprofng GUI OpenIDE-Module-Long-Description=gprofng GUI Actions/Analyze=Analyze Menu/Analyze=&Analyze Menu/Help/HelpShortcuts/org-gprofng-mpmt-help-Welcome_Analyzer.xml=gprofng GUI Help LBL_loaderName=gprofng GUI Data Loader LBL_Action=Analyze CTL_Analyzing=Analyzing CTL_AnalyzingDescription=gprofng GUI CTL_display=gprofng GUI CTL_displayDescription=gprofng GUI CTL_editor=Editor Window CTL_editorDescription=gprofng GUI Editor CTL_explorer=Explorer CTL_explorerDescription=gprofng GUI Explorer CTL_properties=Properties Window CTL_propertiesDescription=gprofng GUI Properties Window gprofng-gui-2.1/Makefile.am0000644000175000017500000007046515044710303012566 00000000000000# Copyright (C) 2022-2025 Free Software Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . AUTOMAKE_OPTIONS = ACLOCAL_AMFLAGS = -I . JAVA = @JAVA@ JAVAC = @JAVAC@ JAR = @JAR@ JAVA_FLAGS = JAVAC_FLAGS = JAR_FLAGS = cfvm MPMT_DIR = org/gprofng/mpmt ANALYZER_DIR = org/gprofng/analyzer COLLECTOR_DIR = org/gprofng/collector ANALYZER_JAR = gprofng-analyzer.jar GPROFNG_JAR = gprofng.jar COLLECTOR_JAR = gprofng-collector.jar if BUILD_LINUX GPROFNG_DISPLAY_GUI = gprofng-display-gui INSTAL_EXEC_OS = install-exec-local-linux DesktopLauncher = gprofng-gui.desktop endif if BUILD_OSX GPROFNG_DISPLAY_GUI = gprofng-gui INSTAL_EXEC_OS = install-exec-local-osx DesktopLauncher = endif if BUILD_WINDOWS GPROFNG_DISPLAY_GUI = gprofng-gui.ps1 INSTAL_EXEC_OS = install-exec-local-windows DesktopLauncher = endif MPMT_SRC = \ $(MPMT_DIR)/AboutPanel.java \ $(MPMT_DIR)/AnAction.java \ $(MPMT_DIR)/AnAddress.java \ $(MPMT_DIR)/Analyzer.java \ $(MPMT_DIR)/AnChooser.java \ $(MPMT_DIR)/AnCompDisp.java \ $(MPMT_DIR)/AnDialog.java \ $(MPMT_DIR)/AnDisplay.java \ $(MPMT_DIR)/AnDouble.java \ $(MPMT_DIR)/AnEvent.java \ $(MPMT_DIR)/AnFile.java \ $(MPMT_DIR)/AnFileSystemView.java \ $(MPMT_DIR)/AnFrame.java \ $(MPMT_DIR)/AnHotGap.java \ $(MPMT_DIR)/AnIconButton.java \ $(MPMT_DIR)/AnInteger.java \ $(MPMT_DIR)/AnListener.java \ $(MPMT_DIR)/AnList.java \ $(MPMT_DIR)/AnLocale.java \ $(MPMT_DIR)/AnLong.java \ $(MPMT_DIR)/AnMemoryManager.java \ $(MPMT_DIR)/AnMetric.java \ $(MPMT_DIR)/AnObject.java \ $(MPMT_DIR)/AnShellCommand.java \ $(MPMT_DIR)/AnString.java \ $(MPMT_DIR)/AnTable.java \ $(MPMT_DIR)/AnTree.java \ $(MPMT_DIR)/AnVariable.java \ $(MPMT_DIR)/AnWindow.java \ $(MPMT_DIR)/CalledByCallsDisassemblyView.java \ $(MPMT_DIR)/CalledByCallsDisp.java \ $(MPMT_DIR)/CalledByCallsFunctionsView.java \ $(MPMT_DIR)/CalledByCallsSourceView.java \ $(MPMT_DIR)/CallerCalleesView.java \ $(MPMT_DIR)/CallTreeView.java \ $(MPMT_DIR)/CannotFindFilePanel.java \ $(MPMT_DIR)/collect/CollectDialog.java \ $(MPMT_DIR)/collect/Collector.java \ $(MPMT_DIR)/collect/CollectorOpenPanel.java \ $(MPMT_DIR)/collect/CollectPanel2.java \ $(MPMT_DIR)/collect/CollectPanel3.java \ $(MPMT_DIR)/collect/CollectPanel.java \ $(MPMT_DIR)/collect/CollectUtility.java \ $(MPMT_DIR)/collect/HWCEntry.java \ $(MPMT_DIR)/collect/HWCSelectDialog.java \ $(MPMT_DIR)/collect/HWCSelectPanel.java \ $(MPMT_DIR)/compare/AnTransferHandler.java \ $(MPMT_DIR)/compare/CompareAdvancedDialog.java \ $(MPMT_DIR)/compare/CompareGroupsPanel.java \ $(MPMT_DIR)/compare/CompareNavigationPanel.java \ $(MPMT_DIR)/compare/CompareSimpleDialog.java \ $(MPMT_DIR)/compare/CompareSimplePanel.java \ $(MPMT_DIR)/compare/CompareStatusPanel.java \ $(MPMT_DIR)/compare/ExperimentGroupsPanel.java \ $(MPMT_DIR)/ConfigurationPanel.java \ $(MPMT_DIR)/control_panel/CPDetailsScrollPane.java \ $(MPMT_DIR)/control_panel/CPFilterPanelHandler.java \ $(MPMT_DIR)/control_panel/CPLayoutPanel.java \ $(MPMT_DIR)/control_panel/CPToolbarHandler.java \ $(MPMT_DIR)/control_panel/CPToolbar.java \ $(MPMT_DIR)/DataLayoutView.java \ $(MPMT_DIR)/DataObjectsView.java \ $(MPMT_DIR)/DisasmDisp.java \ $(MPMT_DIR)/DisassemblyView.java \ $(MPMT_DIR)/DualSourceView.java \ $(MPMT_DIR)/event/AnChangeEvent.java \ $(MPMT_DIR)/event/AnChangeListener.java \ $(MPMT_DIR)/event/AnEventManager.java \ $(MPMT_DIR)/event/AnSelectionEvent.java \ $(MPMT_DIR)/ExperimentPickListElement.java \ $(MPMT_DIR)/ExperimentPickList.java \ $(MPMT_DIR)/ExperimentPickLists.java \ $(MPMT_DIR)/experiment_props/DataDescriptor.java \ $(MPMT_DIR)/experiment_props/ExperimentProperties.java \ $(MPMT_DIR)/experiment_props/Experiments.java \ $(MPMT_DIR)/experiment_props/PropDescriptor.java \ $(MPMT_DIR)/ExperimentsView.java \ $(MPMT_DIR)/export/ExportDialog.java \ $(MPMT_DIR)/export/Export.java \ $(MPMT_DIR)/export/ExportPanel.java \ $(MPMT_DIR)/export/ExportSupport.java \ $(MPMT_DIR)/filter/CustomEditPanel.java \ $(MPMT_DIR)/filter/CustomFilterAction.java \ $(MPMT_DIR)/filter/CustomFilterDialog.java \ $(MPMT_DIR)/filter/CustomPanel.java \ $(MPMT_DIR)/filter/FilterClause.java \ $(MPMT_DIR)/filter/FilterNavigationPanel.java \ $(MPMT_DIR)/filter/FilterParser.java \ $(MPMT_DIR)/filter/Filters.java \ $(MPMT_DIR)/filter/FilterStatusPanel.java \ $(MPMT_DIR)/filter/FilterTextField.java \ $(MPMT_DIR)/filter/KeywordsPanel.java \ $(MPMT_DIR)/filter/RedoFilterAction.java \ $(MPMT_DIR)/filter/RemoveAllFilterAction.java \ $(MPMT_DIR)/filter/UndoFilterAction.java \ $(MPMT_DIR)/flame/FlameBlock.java \ $(MPMT_DIR)/flame/FlameData.java \ $(MPMT_DIR)/flame/FlamePanel.java \ $(MPMT_DIR)/flame/FlameRow.java \ $(MPMT_DIR)/flame/FlameToolBar.java \ $(MPMT_DIR)/flame/FlameView.java \ $(MPMT_DIR)/FuncListDisp.java \ $(MPMT_DIR)/FunctionsView.java \ $(MPMT_DIR)/guitesting/GUITesting.java \ $(MPMT_DIR)/HeapView.java \ $(MPMT_DIR)/HotGapPanel.java \ $(MPMT_DIR)/IDispToModel.java \ $(MPMT_DIR)/IExtTreeModel.java \ $(MPMT_DIR)/InstructionFrequencyView.java \ $(MPMT_DIR)/IOView.java \ $(MPMT_DIR)/ipc/IPCCancelledException.java \ $(MPMT_DIR)/ipc/IPCContext.java \ $(MPMT_DIR)/ipc/IPCErrorReader.java \ $(MPMT_DIR)/ipc/IPCHandle.java \ $(MPMT_DIR)/ipc/IPCListener.java \ $(MPMT_DIR)/ipc/IPCLogger.java \ $(MPMT_DIR)/ipc/IPCProtocol.java \ $(MPMT_DIR)/ipc/IPCReader.java \ $(MPMT_DIR)/ipc/IPCRequestHeader.java \ $(MPMT_DIR)/ipc/IPCRequest.java \ $(MPMT_DIR)/ipc/IPCResponseHeader.java \ $(MPMT_DIR)/ipc/IPCResponse.java \ $(MPMT_DIR)/ipc/IPCResult.java \ $(MPMT_DIR)/ipc/IPCTester.java \ $(MPMT_DIR)/IPC.java \ $(MPMT_DIR)/IPCProcess.java \ $(MPMT_DIR)/ITreeToPanel.java \ $(MPMT_DIR)/KeyboardShortcuts.java \ $(MPMT_DIR)/LibraryVisibilityDialog.java \ $(MPMT_DIR)/LibraryVisibilityPanel.java \ $(MPMT_DIR)/LinesView.java \ $(MPMT_DIR)/mainview/BorderPanel.java \ $(MPMT_DIR)/mainview/MainViewPanel.java \ $(MPMT_DIR)/mainview/Panel.java \ $(MPMT_DIR)/mainview/SubviewAreaPanel.java \ $(MPMT_DIR)/mainview/Subview.java \ $(MPMT_DIR)/MemoryIndexObjectView.java \ $(MPMT_DIR)/metrics/BasicMetric.java \ $(MPMT_DIR)/metrics/CompareBarData.java \ $(MPMT_DIR)/metrics/IPCMetricsAPI.java \ $(MPMT_DIR)/metrics/MetricAttr.java \ $(MPMT_DIR)/metrics/MetricColors.java \ $(MPMT_DIR)/metrics/MetricLabel.java \ $(MPMT_DIR)/metrics/MetricNode.java \ $(MPMT_DIR)/metrics/MetricOption.java \ $(MPMT_DIR)/metrics/MetricsGUI.java \ $(MPMT_DIR)/metrics/MetricValue.java \ $(MPMT_DIR)/metrics/SelectableMetricNode.java \ $(MPMT_DIR)/metrics/ValueMetricNode.java \ $(MPMT_DIR)/MiniFuncListDisp.java \ $(MPMT_DIR)/navigation/ActionPanel.java \ $(MPMT_DIR)/navigation/NavigationPanel.java \ $(MPMT_DIR)/navigation/PanelDropTargetListener.java \ $(MPMT_DIR)/navigation/TopNavigationPanel.java \ $(MPMT_DIR)/navigation/View.java \ $(MPMT_DIR)/navigation/ViewPanel.java \ $(MPMT_DIR)/navigation/ViewsPanel.java \ $(MPMT_DIR)/NoMetricsSelectedPanel.java \ $(MPMT_DIR)/overview/AnBarTree.java \ $(MPMT_DIR)/overview/BarColorKey.java \ $(MPMT_DIR)/overview/Bar.java \ $(MPMT_DIR)/overview/BarPanel.java \ $(MPMT_DIR)/overview/CheckBoxBarPanel.java \ $(MPMT_DIR)/overview/GradientPanel.java \ $(MPMT_DIR)/overview/OuterPanel.java \ $(MPMT_DIR)/overview/Overview.java \ $(MPMT_DIR)/overview/OverviewPanel.java \ $(MPMT_DIR)/overview/OverviewView.java \ $(MPMT_DIR)/overview/ProgressBarPanel.java \ $(MPMT_DIR)/overview/TopButtonPanel.java \ $(MPMT_DIR)/overview/TurnerLabelPanel.java \ $(MPMT_DIR)/overview/TurnerPanel.java \ $(MPMT_DIR)/PCsView.java \ $(MPMT_DIR)/persistence/UserPref.java \ $(MPMT_DIR)/persistence/UserPrefPersistence.java \ $(MPMT_DIR)/picklist/PickListElement.java \ $(MPMT_DIR)/picklist/PickListEvent.java \ $(MPMT_DIR)/picklist/PickList.java \ $(MPMT_DIR)/picklist/PickListListener.java \ $(MPMT_DIR)/picklist/StringPickListElement.java \ $(MPMT_DIR)/picklist/StringPickList.java \ $(MPMT_DIR)/progress/CancelContext.java \ $(MPMT_DIR)/progress/Cancellable.java \ $(MPMT_DIR)/progress/InternalHandle.java \ $(MPMT_DIR)/progress/ProgressHandle.java \ $(MPMT_DIR)/progress/ProgressPanel.java \ $(MPMT_DIR)/progress/SystemProgressPanel.java \ $(MPMT_DIR)/PsParser.java \ $(MPMT_DIR)/remote/Authentication.java \ $(MPMT_DIR)/remote/AuthenticationPanel.java \ $(MPMT_DIR)/remote/CheckBoxList.java \ $(MPMT_DIR)/remote/CloseExperimentDialog.java \ $(MPMT_DIR)/remote/CloseExperimentPanel.java \ $(MPMT_DIR)/remote/ConnectionDialog.java \ $(MPMT_DIR)/remote/ConnectionManager.java \ $(MPMT_DIR)/remote/ConnectionPanel.java \ $(MPMT_DIR)/ResolveFilePathDialog.java \ $(MPMT_DIR)/ResolveFilePathPanel.java \ $(MPMT_DIR)/SelectedObject.java \ $(MPMT_DIR)/SelectionManager.java \ $(MPMT_DIR)/settings/AnSettingChangeEvent.java \ $(MPMT_DIR)/settings/CallTreePanel.java \ $(MPMT_DIR)/settings/CallTreeSetting.java \ $(MPMT_DIR)/settings/CompareModeSetting.java \ $(MPMT_DIR)/settings/ExportSettingsDialog.java \ $(MPMT_DIR)/settings/ExportSettingsPanel.java \ $(MPMT_DIR)/settings/FormatSetting.java \ $(MPMT_DIR)/settings/ImportSettingsDialog.java \ $(MPMT_DIR)/settings/ImportSettingsPanel.java \ $(MPMT_DIR)/settings/LibraryVisibilitySetting.java \ $(MPMT_DIR)/settings/MetricAttributes.java \ $(MPMT_DIR)/settings/MetricNameSelected.java \ $(MPMT_DIR)/settings/MetricNameSelection.java \ $(MPMT_DIR)/settings/MetricSelection.java \ $(MPMT_DIR)/settings/MetricsPanel.java \ $(MPMT_DIR)/settings/MetricsSetting.java \ $(MPMT_DIR)/settings/MetricState.java \ $(MPMT_DIR)/settings/MetricStates.java \ $(MPMT_DIR)/settings/MetricType.java \ $(MPMT_DIR)/settings/MMetric.java \ $(MPMT_DIR)/settings/PathMapSetting.java \ $(MPMT_DIR)/settings/PathmapsPanel.java \ $(MPMT_DIR)/settings/SearchPathPanel.java \ $(MPMT_DIR)/settings/SearchPathSetting.java \ $(MPMT_DIR)/settings/Setting.java \ $(MPMT_DIR)/settings/Settings.java \ $(MPMT_DIR)/settings/SourceDisassemblySetting.java \ $(MPMT_DIR)/settings/TableSettings.java \ $(MPMT_DIR)/settings/TimelineSetting.java \ $(MPMT_DIR)/settings/ViewModeEnabledSetting.java \ $(MPMT_DIR)/settings/ViewModeSetting.java \ $(MPMT_DIR)/settings/ViewsSetting.java \ $(MPMT_DIR)/SourceDisassemblyView.java \ $(MPMT_DIR)/SourceDisp.java \ $(MPMT_DIR)/SourceView.java \ $(MPMT_DIR)/statecolors/AnColorChooser.java \ $(MPMT_DIR)/statecolors/ChooserStateView.java \ $(MPMT_DIR)/statecolors/ColorMap.java \ $(MPMT_DIR)/statecolors/ColorRule.java \ $(MPMT_DIR)/statecolors/StackState.java \ $(MPMT_DIR)/statecolors/StackStateList.java \ $(MPMT_DIR)/statecolors/StackView.java \ $(MPMT_DIR)/statecolors/StackViewState.java \ $(MPMT_DIR)/statecolors/StateColorMap.java \ $(MPMT_DIR)/StatisticsView.java \ $(MPMT_DIR)/statuspanel/StatusComponentHandle.java \ $(MPMT_DIR)/statuspanel/StatusComponent.java \ $(MPMT_DIR)/statuspanel/StatusHandleFactory.java \ $(MPMT_DIR)/statuspanel/StatusLabelHandle.java \ $(MPMT_DIR)/statuspanel/StatusLabel.java \ $(MPMT_DIR)/statuspanel/StatusLabelValueHandle.java \ $(MPMT_DIR)/statuspanel/StatusPanel.java \ $(MPMT_DIR)/SummaryPanel.java \ $(MPMT_DIR)/table/AnJTable.java \ $(MPMT_DIR)/table/AnTableHeaderPanel.java \ $(MPMT_DIR)/table/AnTableScrollPane.java \ $(MPMT_DIR)/table/AttributePanel.java \ $(MPMT_DIR)/table/ExclusiveAndInclusivePanel.java \ $(MPMT_DIR)/table/ExclusiveOrInclusivePanel.java \ $(MPMT_DIR)/table/HeaderMouseHandler.java \ $(MPMT_DIR)/table/MetricPanelDropTargetListener.java \ $(MPMT_DIR)/table/MetricPanel.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorEvent.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorMoveEvent.java \ $(MPMT_DIR)/timeline2/cursorevent/CursorSetEvent.java \ $(MPMT_DIR)/timeline2/data/GenericEvent.java \ $(MPMT_DIR)/timeline2/data/SampleEvent.java \ $(MPMT_DIR)/timeline2/data/StackEvent.java \ $(MPMT_DIR)/timeline2/Entity.java \ $(MPMT_DIR)/timeline2/EventDetails.java \ $(MPMT_DIR)/timeline2/IconRuler.java \ $(MPMT_DIR)/timeline2/MetaExperiment.java \ $(MPMT_DIR)/timeline2/RowData.java \ $(MPMT_DIR)/timeline2/RowDataRequestParams.java \ $(MPMT_DIR)/timeline2/RowDefinition.java \ $(MPMT_DIR)/timeline2/RowGeometry.java \ $(MPMT_DIR)/timeline2/TimelineDraw.java \ $(MPMT_DIR)/timeline2/TimelineSelectionEvent.java \ $(MPMT_DIR)/timeline2/TimelineSelectionRowEvent.java \ $(MPMT_DIR)/timeline2/TimelineVariable.java \ $(MPMT_DIR)/timeline2/TimelineView.java \ $(MPMT_DIR)/timeline2/TL2ControlPanel.java \ $(MPMT_DIR)/timeline2/TL2CoordCalcData.java \ $(MPMT_DIR)/timeline2/TL2DataFetcher.java \ $(MPMT_DIR)/timeline2/TL2DataSnapshot.java \ $(MPMT_DIR)/timeline2/TL2Drawer.java \ $(MPMT_DIR)/timeline2/TLExperiment.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataImpl.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataMaster.java \ $(MPMT_DIR)/timeline_common/CoordCalcDataReader.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeImpl.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeMaster.java \ $(MPMT_DIR)/timeline_common/CoordCalcTimeReader.java \ $(MPMT_DIR)/timeline_common/TimelineCaliper.java \ $(MPMT_DIR)/timeline_common/TimelineCursor.java \ $(MPMT_DIR)/timeline_common/TimelineDrawer.java \ $(MPMT_DIR)/timeline_common/TimelinePanel.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionCaliperEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionGenericEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionHistoryEvent.java \ $(MPMT_DIR)/timeline_common/TimelineSelectionListener.java \ $(MPMT_DIR)/timeline_common/VerticalRowRuler.java \ $(MPMT_DIR)/timeline/events/DeadlockEvent.java \ $(MPMT_DIR)/timeline/events/DetailsIPC.java \ $(MPMT_DIR)/timeline/events/DurationEvent.java \ $(MPMT_DIR)/timeline/events/EventDetail.java \ $(MPMT_DIR)/timeline/events/ExtendedEvent.java \ $(MPMT_DIR)/timeline/events/HeapEvent.java \ $(MPMT_DIR)/timeline/events/HWCEvent.java \ $(MPMT_DIR)/timeline/events/IOEvent.java \ $(MPMT_DIR)/timeline/events/MPIEvent.java \ $(MPMT_DIR)/timeline/events/ProfileEvent.java \ $(MPMT_DIR)/timeline/events/RaceEvent.java \ $(MPMT_DIR)/timeline/events/Sample.java \ $(MPMT_DIR)/timeline/events/StateEvent.java \ $(MPMT_DIR)/timeline/events/SyncEvent.java \ $(MPMT_DIR)/toolbar/FindTextPanel.java \ $(MPMT_DIR)/toolbar/ToolBarFiller.java \ $(MPMT_DIR)/toolbar/ToolBarPanel.java \ $(MPMT_DIR)/toolbar/ToolBarSeparator.java \ $(MPMT_DIR)/util/gui/ActionTextField.java \ $(MPMT_DIR)/util/gui/AnBorderPanel.java \ $(MPMT_DIR)/util/gui/AnCheckBox.java \ $(MPMT_DIR)/util/gui/AnDialog2.java \ $(MPMT_DIR)/util/gui/AnDialogOuterPanel.java \ $(MPMT_DIR)/util/gui/AnGradientPanel.java \ $(MPMT_DIR)/util/gui/AnInsetsPanel.java \ $(MPMT_DIR)/util/gui/AnJList.java \ $(MPMT_DIR)/util/gui/AnJPanel.java \ $(MPMT_DIR)/util/gui/AnJScrollPane.java \ $(MPMT_DIR)/util/gui/AnJTree.java \ $(MPMT_DIR)/util/gui/AnLongScrollBar.java \ $(MPMT_DIR)/util/gui/AnMenuBar.java \ $(MPMT_DIR)/util/gui/AnScrollBarUI.java \ $(MPMT_DIR)/util/gui/AnSplitPaneFixedRightSize.java \ $(MPMT_DIR)/util/gui/AnSplitPaneInternal.java \ $(MPMT_DIR)/util/gui/AnSplitPane.java \ $(MPMT_DIR)/util/gui/AnTabbedPane.java \ $(MPMT_DIR)/util/gui/AnTabbedPaneUI.java \ $(MPMT_DIR)/util/gui/AnTextIcon.java \ $(MPMT_DIR)/util/gui/AnUtility.java \ $(MPMT_DIR)/util/gui/RainbowColorScale.java \ $(MPMT_DIR)/util/gui/ToolTipPopup.java \ $(MPMT_DIR)/util/ruler/LabelCoordinateCalculator.java \ $(MPMT_DIR)/util/ruler/RangeRuler.java \ $(MPMT_DIR)/util/ruler/Ruler.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesBytes.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesGeneric.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesLabelList.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesLong.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesNanoseconds.java \ $(MPMT_DIR)/util/ruler/valuetypes/ValuesWithUnits.java \ $(MPMT_DIR)/util/zoomruler/OverlayMouseHandler.java \ $(MPMT_DIR)/util/zoomruler/PaintListener.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerComponent.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerEvent.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerListener.java \ $(MPMT_DIR)/util/zoomruler/ZoomRulerOverlay.java \ $(MPMT_DIR)/ViewDisplayPanel.java \ $(MPMT_DIR)/welcome/WelcomeButton.java \ $(MPMT_DIR)/welcome/WelcomeInnerPanel.java \ $(MPMT_DIR)/welcome/WelcomePanel.java \ $(MPMT_DIR)/welcome/WelcomeView.java MPMT_FILES = \ $(MPMT_SRC:%.java=$(srcdir)/%.java) \ $(ANALYZER_FILES) ICONS = \ $(MPMT_DIR)/icons/add.png \ $(MPMT_DIR)/icons/addtablecolumns.png \ $(MPMT_DIR)/icons/analyzer64.png \ $(MPMT_DIR)/icons/apply_filter.png \ $(MPMT_DIR)/icons/apply_mtrs.png \ $(MPMT_DIR)/icons/attributed.png \ $(MPMT_DIR)/icons/back_filter.png \ $(MPMT_DIR)/icons/backward.png \ $(MPMT_DIR)/icons/badexperiment.png \ $(MPMT_DIR)/icons/base1.png \ $(MPMT_DIR)/icons/base2.png \ $(MPMT_DIR)/icons/blank.png \ $(MPMT_DIR)/icons/bubble_icon_16.png \ $(MPMT_DIR)/icons/callee.png \ $(MPMT_DIR)/icons/caller.png \ $(MPMT_DIR)/icons/cancelProcess.png \ $(MPMT_DIR)/icons/class.png \ $(MPMT_DIR)/icons/collect.png \ $(MPMT_DIR)/icons/color.png \ $(MPMT_DIR)/icons/compareAbsolute.png \ $(MPMT_DIR)/icons/compareDelta.png \ $(MPMT_DIR)/icons/compareHamburger.png \ $(MPMT_DIR)/icons/compare.png \ $(MPMT_DIR)/icons/compareRatio.png \ $(MPMT_DIR)/icons/compareReverse.png \ $(MPMT_DIR)/icons/connect.png \ $(MPMT_DIR)/icons/data.png \ $(MPMT_DIR)/icons/delete.png \ $(MPMT_DIR)/icons/down.png \ $(MPMT_DIR)/icons/errorNew.png \ $(MPMT_DIR)/icons/error.png \ $(MPMT_DIR)/icons/errorWarningNew.png \ $(MPMT_DIR)/icons/exclusive.png \ $(MPMT_DIR)/icons/exe_elf.png \ $(MPMT_DIR)/icons/expandcollaps.png \ $(MPMT_DIR)/icons/experiment.png \ $(MPMT_DIR)/icons/expgroup.png \ $(MPMT_DIR)/icons/fileResolved.png \ $(MPMT_DIR)/icons/fileUnResolved.png \ $(MPMT_DIR)/icons/filter.png \ $(MPMT_DIR)/icons/find_next.png \ $(MPMT_DIR)/icons/find_prev.png \ $(MPMT_DIR)/icons/forward_filter.png \ $(MPMT_DIR)/icons/forward.png \ $(MPMT_DIR)/icons/func_item.png \ $(MPMT_DIR)/icons/gear.png \ $(MPMT_DIR)/icons/gobackward.png \ $(MPMT_DIR)/icons/godown.png \ $(MPMT_DIR)/icons/goforward.png \ $(MPMT_DIR)/icons/goup.png \ $(MPMT_DIR)/icons/green100.png \ $(MPMT_DIR)/icons/hamburgerBlank.png \ $(MPMT_DIR)/icons/hamburgerFocused.png \ $(MPMT_DIR)/icons/hamburger.png \ $(MPMT_DIR)/icons/heaptrace.png \ $(MPMT_DIR)/icons/hollowArrowDown.png \ $(MPMT_DIR)/icons/hollowArrowLeft.png \ $(MPMT_DIR)/icons/hollowArrowRight.png \ $(MPMT_DIR)/icons/hollowArrowUp.png \ $(MPMT_DIR)/icons/hot.png \ $(MPMT_DIR)/icons/hwc.png \ $(MPMT_DIR)/icons/inclusive.png \ $(MPMT_DIR)/icons/i_o_usage_16.png \ $(MPMT_DIR)/icons/jar.png \ $(MPMT_DIR)/icons/more_icon.png \ $(MPMT_DIR)/icons/mpitrace.png \ $(MPMT_DIR)/icons/nav_bar_arrow.png \ $(MPMT_DIR)/icons/nextview.png \ $(MPMT_DIR)/icons/number.png \ $(MPMT_DIR)/icons/oldexperiment.png \ $(MPMT_DIR)/icons/open.png \ $(MPMT_DIR)/icons/panhand.png \ $(MPMT_DIR)/icons/percent.png \ $(MPMT_DIR)/icons/previousview.png \ $(MPMT_DIR)/icons/profile.png \ $(MPMT_DIR)/icons/races.png \ $(MPMT_DIR)/icons/redo.png \ $(MPMT_DIR)/icons/removeBlank.png \ $(MPMT_DIR)/icons/removeFocused.png \ $(MPMT_DIR)/icons/remove.png \ $(MPMT_DIR)/icons/reset.png \ $(MPMT_DIR)/icons/sample.png \ $(MPMT_DIR)/icons/save.png \ $(MPMT_DIR)/icons/smallBlank.png \ $(MPMT_DIR)/icons/small_down_focused.png \ $(MPMT_DIR)/icons/small_down.png \ $(MPMT_DIR)/icons/small_left.png \ $(MPMT_DIR)/icons/small_right.png \ $(MPMT_DIR)/icons/small_up_focused.png \ $(MPMT_DIR)/icons/small_up.png \ $(MPMT_DIR)/icons/stop.png \ $(MPMT_DIR)/icons/synctrace.png \ $(MPMT_DIR)/icons/tab.png \ $(MPMT_DIR)/icons/time.png \ $(MPMT_DIR)/icons/undo.png \ $(MPMT_DIR)/icons/up.png \ $(MPMT_DIR)/icons/values.png \ $(MPMT_DIR)/icons/warnexperiment.png \ $(MPMT_DIR)/icons/warningNew.png \ $(MPMT_DIR)/icons/warning.png \ $(MPMT_DIR)/icons/welcomeBackgroundShadow.png \ $(MPMT_DIR)/icons/zoom_in.png \ $(MPMT_DIR)/icons/zoom_out.png \ $(MPMT_DIR)/icons/circleBlue.gif \ $(MPMT_DIR)/icons/circleGreen.gif \ $(MPMT_DIR)/icons/circleOrange.gif \ $(MPMT_DIR)/icons/circleRed.gif \ $(MPMT_DIR)/icons/performanceAnalyzerSplash.gif GPROFNG_CLASSES = \ $(MPMT_DIR)/*.class \ $(MPMT_DIR)/*/*.class \ $(MPMT_DIR)/*/*/*.class \ $(MPMT_DIR)/*/*/*/*.class GPROFNG_FORMS = \ $(MPMT_DIR)/AboutPanel.form \ $(MPMT_DIR)/CannotFindFilePanel.form \ $(MPMT_DIR)/collect/CollectorOpenPanel.form \ $(MPMT_DIR)/collect/CollectPanel2.form \ $(MPMT_DIR)/collect/CollectPanel3.form \ $(MPMT_DIR)/collect/HWCSelectPanel.form \ $(MPMT_DIR)/compare/CompareGroupsPanel.form \ $(MPMT_DIR)/compare/CompareSimplePanel.form \ $(MPMT_DIR)/compare/CompareStatusPanel.form \ $(MPMT_DIR)/compare/ExperimentGroupsPanel.form \ $(MPMT_DIR)/ConfigurationPanel.form \ $(MPMT_DIR)/export/ExportPanel.form \ $(MPMT_DIR)/filter/CustomPanel.form \ $(MPMT_DIR)/filter/FilterNavigationPanel.form \ $(MPMT_DIR)/filter/FilterStatusPanel.form \ $(MPMT_DIR)/filter/KeywordsPanel.form \ $(MPMT_DIR)/LibraryVisibilityPanel.form \ $(MPMT_DIR)/mainview/BorderPanel.form \ $(MPMT_DIR)/mainview/MainViewPanel.form \ $(MPMT_DIR)/navigation/ActionPanel.form \ $(MPMT_DIR)/navigation/TopNavigationPanel.form \ $(MPMT_DIR)/navigation/ViewPanel.form \ $(MPMT_DIR)/navigation/ViewsPanel.form \ $(MPMT_DIR)/NoMetricsSelectedPanel.form \ $(MPMT_DIR)/overview/BarPanel.form \ $(MPMT_DIR)/overview/CheckBoxBarPanel.form \ $(MPMT_DIR)/overview/GradientPanel.form \ $(MPMT_DIR)/overview/OuterPanel.form \ $(MPMT_DIR)/overview/OverviewPanel.form \ $(MPMT_DIR)/overview/ProgressBarPanel.form \ $(MPMT_DIR)/overview/TopButtonPanel.form \ $(MPMT_DIR)/overview/TurnerLabelPanel.form \ $(MPMT_DIR)/overview/TurnerPanel.form \ $(MPMT_DIR)/progress/ProgressPanel.form \ $(MPMT_DIR)/remote/AuthenticationPanel.form \ $(MPMT_DIR)/remote/CloseExperimentPanel.form \ $(MPMT_DIR)/remote/ConnectionPanel.form \ $(MPMT_DIR)/ResolveFilePathPanel.form \ $(MPMT_DIR)/settings/CallTreePanel.form \ $(MPMT_DIR)/settings/ExportSettingsPanel.form \ $(MPMT_DIR)/settings/ImportSettingsPanel.form \ $(MPMT_DIR)/settings/MetricsPanel.form \ $(MPMT_DIR)/settings/PathmapsPanel.form \ $(MPMT_DIR)/settings/SearchPathPanel.form \ $(MPMT_DIR)/statuspanel/StatusPanel.form \ $(MPMT_DIR)/util/gui/AnDialogOuterPanel.form \ $(MPMT_DIR)/util/gui/AnInsetsPanel.form \ $(MPMT_DIR)/welcome/WelcomeInnerPanel.form \ $(MPMT_DIR)/welcome/WelcomePanel.form anmodule_MF = $(srcdir)/gprofng-gui.mf MPMT_PROPERTIES = $(MPMT_DIR)/Bundle.properties LocaleString.class: $(srcdir)/tools/LocaleString.java $(AM_V_GEN)$(JAVAC) $(JAVAC_FLAGS) -d . $(srcdir)/tools/LocaleString.java $(MPMT_PROPERTIES): $(MPMT_FILES) LocaleString.class \ $(srcdir)/gprofng.properties $(AM_V_GEN)mkdir -m 777 -p $(@D) || echo "mkdir -m 777 -p $(@D) failed" echo "# THIS FILE IS AUTO-GENERATED. DON'T EDIT IT." > $@ echo "" >> $@ echo "gui_version=$(VERSION)" >> $@ cat $(srcdir)/gprofng.properties >> $@ ( cd $(srcdir); cat $(MPMT_SRC) $(ANALYZER_SRC) ) | $(JAVA) $(JAVA_FLAGS) -cp . LocaleString >> $@ $(GPROFNG_JAR): $(anmodule_MF) $(MPMT_FILES) \ $(MPMT_PROPERTIES) $(ICONS:%=$(srcdir)/%) $(AM_V_GEN)rm -f $(GPROFNG_CLASSES) $(AM_V_at)$(JAVAC) -cp $(srcdir) $(JAVAC_FLAGS) -d . $(srcdir)/$(MPMT_DIR)/Analyzer.java $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(anmodule_MF) $(MPMT_PROPERTIES) $(MPMT_DIR) \ -C $(srcdir) $(MPMT_DIR)/icons # # Standalone gprofng GUI # ANALYZER_SRC = \ $(ANALYZER_DIR)/AnEnvironment.java \ $(ANALYZER_DIR)/AnLog.java \ $(ANALYZER_DIR)/AnMain.java ANALYZER_FILES = $(ANALYZER_SRC:%.java=$(srcdir)/%.java) ANALYZER_MF = $(srcdir)/analyzer_st.mf ANALYZER_CLASSES = $(ANALYZER_DIR)/*.class ANALYZER_PROPERTIES = $(ANALYZER_DIR)/Bundle.properties $(ANALYZER_PROPERTIES): $(ANALYZER_FILES) LocaleString.class $(AM_V_GEN)mkdir -m 777 -p $(@D) || echo "mkdir -m 777 -p $(@D) failed" @echo "# THIS FILE IS AUTO-GENERATED. DON'T EDIT IT." > $@ @echo "" >> $@ $(AM_V_GEN)( cd $(srcdir); cat $(ANALYZER_SRC) ) | \ $(JAVA) $(JAVA_FLAGS) -cp . LocaleString >> $@ $(ANALYZER_JAR): $(GPROFNG_JAR) \ $(ANALYZER_MF) $(ANALYZER_FILES) $(ANALYZER_PROPERTIES) @echo "================= $@" $(AM_V_GEN)rm -f $(ANALYZER_CLASSES) $(AM_V_at)d=`pwd` ; (cd $(srcdir) ; $(JAVAC) -classpath $$d/$(GPROFNG_JAR) \ $(JAVAC_FLAGS) -d $$d $(ANALYZER_SRC) ) $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(ANALYZER_MF) $(ANALYZER_CLASSES) \ $(ANALYZER_PROPERTIES) # Rules for generating a jar file implementing Java collector API # COLLECTOR_SRC = $(COLLECTOR_DIR)/CollectorAPI.java collector_FILES = $(COLLECTOR_SRC:%.java=$(srcdir)/%.java) collector_MF = $(srcdir)/gprofng-collector.mf collector_CLASSES = $(COLLECTOR_DIR)/*.class $(COLLECTOR_JAR): $(GPROFNG_JAR) $(collector_FILES) $(collector_MF) @echo "================= $@" $(AM_V_GEN)rm -f $(collector_CLASSES) $(AM_V_at)$(JAVAC) $(JAVAC_FLAGS) -d . $(collector_FILES) $(AM_V_at)$(JAR) $(JAR_FLAGS) $@ $(collector_MF) $(collector_CLASSES) bin_SCRIPTS = $(GPROFNG_DISPLAY_GUI) CLEANFILES = $(GPROFNG_DISPLAY_GUI) $(GPROFNG_JAR) $(ANALYZER_JAR) $(COLLECTOR_JAR) \ $(GPROFNG_CLASSES) $(ANALYZER_CLASSES) $(collector_CLASSES) \ $(ANALYZER_PROPERTIES) $(MPMT_PROPERTIES) LocaleString*.class \ $(DesktopLauncher) gprofng-display-gui: $(srcdir)/gprofng-gui.sh $(AM_V_GEN)sed -e "s~REPLACE_ME_WITH_VERSION~$(VERSION)~" < $(srcdir)/gprofng-gui.sh \ | sed -e "s~GPROFNG_bindir=~GPROFNG_bindir='$(bindir)'~" \ | sed -e "s~GPROFNG_libdir=~GPROFNG_libdir='$(libdir)'~" \ | sed -e "s~GPROFNG_datadir=~GPROFNG_datadir='$(datadir)'~" \ > $@ $(AM_V_at)chmod +x $@ gprofng-gui.ps1: @echo "java -Xmx1024m -jar $(datadir)/$(PACKAGE)/gprofng-analyzer.jar \$Args" > $@ $(AM_V_GEN)chmod +x $@ gprofng-gui: @echo "#!/bin/sh" > $@ @echo "java -Xmx1024m -jar $(datadir)/$(PACKAGE)/gprofng-analyzer.jar \$@" >> $@ $(AM_V_GEN)chmod +x $@ pkgdata_DATA = $(ANALYZER_JAR) $(COLLECTOR_JAR) $(GPROFNG_JAR) PNG_DIR = $(srcdir)/images PNG_FILES = $(PNG_DIR)/gprofng-32x32.png $(PNG_DIR)/gprofng-48x48.png \ $(PNG_DIR)/gprofng-48x48.png $(PNG_DIR)/gprofng-64x64.png \ $(PNG_DIR)/gprofng-128x128.png $(PNG_DIR)/gprofng-256x256.png CLR_DIR = $(DESTDIR)$(datarootdir)/icons/hicolor EXTRA_DIST = $(MPMT_SRC) $(ANALYZER_SRC) $(COLLECTOR_SRC) \ $(ICONS) $(GPROFNG_FORMS) $(PNG_FILES) \ aclocal.m4 analyzer_st.mf compile configure.ac configure \ gprofng-collector.mf gprofng-gui.mf gprofng-gui.sh gprofng-gui.spec \ gprofng.properties install-sh Makefile.am Makefile.in missing \ $(PNG_DIR)/gprofng-128x128.ico $(PNG_DIR)/gprofng.icns \ $(PNG_DIR)/installer-README $(PNG_DIR)/gprofng.iconset/icon_32.png \ $(PNG_DIR)/gprofng.iconset/icon_48.png \ $(PNG_DIR)/gprofng.iconset/icon_64.png \ $(PNG_DIR)/gprofng.iconset/icon_128.png \ $(PNG_DIR)/gprofng.iconset/icon_256.png \ README AUTHORS NEWS tools $(DesktopLauncher): @echo '[Desktop Entry]' > $@ @echo "Encoding=UTF-8" >> $@ @echo "Version=$(VERSION)" >> $@ @echo "Type=Application" >> $@ @echo "Name=gprofngg gui" >> $@ @echo "Exec=$(prefix)/bin/gprofng-display-gui" >> $@ @echo "Icon=gprofng" >> $@ @echo "Categories=Profiling;" >> $@ @echo "Comment=Graphical tool to create and analyze gprofng experiments" >> $@ PHONY: install-exec-local install-exec-local-linux install-exec-local-windows \ install-exec-local-osx install-exec-local: $(INSTAL_EXEC_OS) install-exec-local-linux: $(DesktopLauncher) $(PNG_FILES) $(AM_V_GEN)for d in 32x32 48x48 64x64 128x128 256x256 ; do \ $(mkinstalldirs) $(CLR_DIR)/$$d/apps ; \ cp $(PNG_DIR)/gprofng-$$d.png $(CLR_DIR)/$$d/apps/gprofng.png ; \ chmod 644 $(CLR_DIR)/$$d/apps/gprofng.png ; \ done $(AM_V_at)$(mkinstalldirs) $(DESTDIR)$(datarootdir)/applications $(AM_V_at)cp $(DesktopLauncher) $(DESTDIR)$(datarootdir)/applications/ $(AM_V_at)chmod 644 $(DESTDIR)$(datarootdir)/applications/$(DesktopLauncher) $(AM_V_at)$(mkinstalldirs) $(DESTDIR)$(bindir) $(AM_V_at)rm -f $(DESTDIR)$(bindir)/gp-display-gui $(AM_V_at)ln -s gprofng-display-gui $(DESTDIR)$(bindir)/gp-display-gui install-exec-local-windows install-exec-local-osx: @echo "================= $@" uninstall-local: rm -f $(CLR_DIR)/*/apps/gprofng.png $(DESTDIR)$(bindir)/gp-display-gui \ $(DESTDIR)$(datarootdir)/applications/$(DesktopLauncher) include doc/local.mk gprofng-gui-2.1/COPYING0000644000175000017500000010451314517772113011570 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . gprofng-gui-2.1/gprofng-display-gui.10000644000175000017500000002167415044723207014510 00000000000000.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "GPROFNG-DISPLAY-GUI 1" .TH GPROFNG-DISPLAY-GUI 1 "2025-08-06" "gprofng-gui-2.1" "User Commands" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" gprofng\-display\-gui \- Graphical tool to analyze one or more gprofng experiments .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBgprofng display gui\fR [\fIoption(s)\fR] [[\fB\-c\fR] \&\fIexperiment(s)\fR | \fItarget\fR [\fItarget-options\fR]] .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fBgprofng display gui\fR tool starts the \s-1GUI,\s0 which is a Java based graphical tool that can be used to analyze performance data that has been collected with the \fBgprofng collect app\fR tool. .PP Multiple experiments may be specified on the command line. The data for all these experiments is loaded and ready for analysis. .PP Once the tool has started, it is also possible to drop or load other experiments. .PP By default, if multiple experiments are specified, the data is aggregated across the experiments. .PP If the \&\fB\-c\fR option is used, the tool starts in comparison mode. In this case, the data for the various experiments can be compared. If this option is used, at least two experiments must be specified on the command line. .PP Alternatively, the tool can be invoked without specifying experiments. In this case, a target program is expected to be specified. Optionally, there may be options for the target. .PP If started this way, a window with user settings will be opened. These may be used to specify the options and other preferences that define the data collection experiment. The user can then run the experiment from this window and upon successful completion, analyze the results. .PP If \fBgprofng display gui\fR is invoked without specifying one or more experiments, or a target, a welcome screen is shown. In this screen, the user can specify whether to analyze an existing experiment, or to create a new experiment by specifying the data collection settings to define and run a new performance experiment. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-\-version\fR" 4 .IX Item "--version" Print the version number and exit. .IP "\fB\-\-help\fR" 4 .IX Item "--help" Print usage information and exit. .IP "\fB\-v, \-\-verbose\fR" 4 .IX Item "-v, --verbose" By default, verbose mode is disabled. This option enables it. .IP "\fB\-j\fR \fIjvmpath\fR\fB, \-\-jdkhome\fR \fIjvmpath\fR" 4 .IX Item "-j jvmpath, --jdkhome jvmpath" Specify the path to the Java Virtual Machine (\s-1JVM\s0) to be used for running \fBgprofng display gui\fR. The default path is taken first by examining environment variables for a path to the \s-1JVM,\s0 in the order \fB\s-1JDK_HOME\s0\fR, and then \fB\s-1JAVA_PATH\s0\fR. .Sp If neither environment variable is set, the version found in the search path set with the \fB\s-1PATH\s0\fR environment variable is used. If none is found, \&\fB/usr/java/bin/java\fR is tried. .IP "\fB\-J\fR\fIjvm-setting\fR" 4 .IX Item "-Jjvm-setting" Use this option to pass on settings to the \s-1JVM.\s0 Multiple \fB\-J\fR options and corresponding settings may be supplied. Note that there is \fIno\fR space between the \fB\-J\fR option and the \&\fIjvm-setting\fR setting to the \s-1JVM.\s0 .IP "\fB\-c\fR \fIbase-group compare-group\fR" 4 .IX Item "-c base-group compare-group" By default, the results for multiple experiments are aggregated. With this option, the \s-1GUI\s0 starts in comparison mode. If this option is specified, two or more experiments must be provided as arguments. The first experiment is the base group. The results in the other experiment(s) are compared to this reference experiment. .Sp Note that the user can toggle between aggregation and comparison mode from within the \s-1GUI.\s0 .IP "\fB\-f\fR \fIsize\fR\fB, \-\-fontsize\fR \fIsize\fR" 4 .IX Item "-f size, --fontsize size" Specify the font size to be used in the \s-1GUI.\s0 .IP "\fB\-u\fR \fIdir-path\fR\fB, \-\-userdir\fR \fIdir-path\fR" 4 .IX Item "-u dir-path, --userdir dir-path" Specify the path to the user directory in which to store user settings. .SH "NOTES" .IX Header "NOTES" The \fBgprofng display gui\fR tool relies on other \fBgprofng\fR components. Therefore, it is necessary to also install the other components, either by using one of the available \s-1RPM\s0's, install from a tar file distribution, or to build and install \fBgprofng\fR directly from the source. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBgprofng\fR\|(1), \&\fBgp\-archive\fR\|(1), \&\fBgp\-collect\-app\fR\|(1), \&\fBgp\-display\-html\fR\|(1), \&\fBgp\-display\-src\fR\|(1), \&\fBgp\-display\-text\fR\|(1) .PP The user guide for gprofng is maintained as a Texinfo manual. If the \&\fBinfo\fR and \fBgprofng\fR programs are correctly installed, the command \fBinfo gprofng\fR should give access to this document. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2022\-2025 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". gprofng-gui-2.1/org/0000755000175000017500000000000015044723233011373 500000000000000gprofng-gui-2.1/org/gprofng/0000755000175000017500000000000015044723233013035 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/0000755000175000017500000000000015044723235014014 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/toolbar/0000755000175000017500000000000015044723234015455 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/toolbar/FindTextPanel.java0000644000175000017500000002470314744453367020770 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.toolbar; import org.gprofng.mpmt.AnIconButton; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.picklist.StringPickListElement; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public class FindTextPanel extends JPanel { private JLabel findLabel; private JComboBox findComboBox; private AnIconButton findUp; private AnIconButton findDown; private JCheckBox findCase; public static final int MAX_FIND_ITEMS = 10; private ActionListener findActionListener; private DocumentListener findDocumentListener; public FindTextPanel() { GridBagConstraints gridBagConstraints; int gridx = 0; setLayout(new GridBagLayout()); setOpaque(false); // Combobox findComboBox = new FindComboBox(); findComboBox.setToolTipText(AnLocale.getString("Find text in view...")); AnUtility.setAccessibleContext( findComboBox.getAccessibleContext(), findComboBox.getToolTipText()); findComboBox.setFont(findComboBox.getFont().deriveFont(Font.PLAIN)); findComboBox.setMaximumRowCount(MAX_FIND_ITEMS); // findComboBox.setEditable(true); // This causes the panel to 'jump' up/down. Moving to // setConrolsEnabled. Don't understand..... findComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxx"); initializeFindTexts(UserPref.getInstance().getFindPickList(), null); findComboBox.setSelectedItem(""); findComboBox.setPreferredSize(new Dimension(findComboBox.getPreferredSize().width, 20)); findComboBox.setEnabled(true); // Combobox Listeners findComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { find(getFindComboBoxText(), true, findCase.isSelected()); } @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); findComboBox .getEditor() .addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { if (event.getID() == ActionEvent.ACTION_PERFORMED) { find(getFindComboBoxText(), true, findCase.isSelected()); } } }); findDocumentListener = new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { resetComboBoxState(); } @Override public void removeUpdate(DocumentEvent e) { resetComboBoxState(); } @Override public void changedUpdate(DocumentEvent e) { resetComboBoxState(); } }; ((JTextField) findComboBox.getEditor().getEditorComponent()) .getDocument() .addDocumentListener(findDocumentListener); findComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { resetComboBoxState(); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); ((JTextField) findComboBox.getEditor().getEditorComponent()) .addKeyListener( new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER && e.getModifiers() == KeyEvent.SHIFT_MASK) { find(getFindComboBoxText(), false, findCase.isSelected()); } else { super.keyTyped(e); } } }); findLabel = new JLabel(); AnUtility.setTextAndAccessibleContext(findLabel, AnLocale.getString("Find:")); findLabel.setDisplayedMnemonic(AnLocale.getString('n', "MN_FindLabel")); findLabel.setLabelFor(findComboBox); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 4, 0, 0); add(findLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 4, 0, 0); add(findComboBox, gridBagConstraints); // Up findUp = new AnIconButton(AnUtility.prev_icon); findUp.setToolTipText(AnLocale.getString("Find Previous") + " (Shift+Enter)"); findUp.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { find(getFindComboBoxText(), false, findCase.isSelected()); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 2, 0, 0); add(findUp, gridBagConstraints); // Down findDown = new AnIconButton(AnUtility.next_icon); findDown.setToolTipText(AnLocale.getString("Find Next") + " (Enter)"); findDown.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { find(getFindComboBoxText(), true, findCase.isSelected()); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(findDown, gridBagConstraints); // Case findCase = new JCheckBox(AnLocale.getString("Match Case")); AnUtility.setAccessibleContext(findCase.getAccessibleContext(), findCase.getText()); findCase.setMnemonic(AnLocale.getString('C', "FindMatchCaseMN")); findCase.setFont(findCase.getFont().deriveFont(Font.PLAIN)); findCase.setOpaque(false); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 0, 0, 2); add(findCase, gridBagConstraints); } private class FindComboBox extends JComboBox { @Override public void paint(Graphics g) { super.paint(g); // To change body of generated methods, choose Tools | Templates. int yOffset = getSize().height - 6; String val = (String) findComboBox.getSelectedItem(); if (val == null || val.length() == 0) { String helpText = AnLocale.getString("Find text in view"); g.setColor(new Color(190, 190, 190)); g.drawString(helpText, 7, yOffset); } ((JTextField) getEditor().getEditorComponent()) .setToolTipText(AnLocale.getString("Find Text in View")); } } public void initializeFindTexts(StringPickList spl, String selected) { findComboBox.removeActionListener(findActionListener); ((JTextField) findComboBox.getEditor().getEditorComponent()) .getDocument() .removeDocumentListener(findDocumentListener); findComboBox.removeAllItems(); for (StringPickListElement elem : spl.getStringElements()) { findComboBox.addItem(elem.getString()); } if (selected != null) { findComboBox.setSelectedItem(selected); } findComboBox.addActionListener(findActionListener); ((JTextField) findComboBox.getEditor().getEditorComponent()) .getDocument() .addDocumentListener(findDocumentListener); } private void resetComboBoxState() { JTextField textField = (JTextField) findComboBox.getEditor().getEditorComponent(); textField.setForeground(Color.BLACK); findComboBox.setToolTipText(""); } public void setConrolsEnabled(boolean enabled) { findLabel.setEnabled(enabled); findComboBox.setEditable(enabled); findComboBox.setEnabled(enabled); findUp.setEnabled(enabled); findDown.setEnabled(enabled); findCase.setEnabled(enabled); } private String getFindComboBoxText() { JTextField textField = (JTextField) findComboBox.getEditor().getEditorComponent(); return textField.getText(); } private void updateFindComboBox(String str) { String selected = getFindComboBoxText(); UserPref.getInstance().getFindPickList().addElement(str); initializeFindTexts(UserPref.getInstance().getFindPickList(), selected); } private void find(final String str, final boolean next, boolean caseSensitive) { final int status; if ((str != null) && (str.length() == 0)) { return; } Object progressBarHandle = AnWindow.getInstance() .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Searching")); status = AnWindow.getInstance().getViews().getCurrentViewDisplay().find(str, next, caseSensitive); JTextField findTextField = (JTextField) findComboBox.getEditor().getEditorComponent(); if (status == -1) { findTextField.setForeground(Color.RED); findComboBox.setToolTipText(AnLocale.getString("Text not found")); } else { findTextField.setForeground(Color.BLACK); findComboBox.setToolTipText(AnLocale.getString("")); } updateFindComboBox(str); AnWindow.getInstance().getSystemProgressPanel().progressBarStop(progressBarHandle); } } gprofng-gui-2.1/org/gprofng/mpmt/toolbar/ToolBarSeparator.java0000644000175000017500000000270514744453367021504 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.toolbar; import org.gprofng.analyzer.AnEnvironment; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JPanel; import javax.swing.JSeparator; /** * @author tpreisle */ public class ToolBarSeparator extends JPanel { public ToolBarSeparator(int leftSpace, int rightSpace) { setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); setLayout(new GridBagLayout()); JSeparator separator = new JSeparator(JSeparator.VERTICAL); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(2, leftSpace, 2, rightSpace); add(separator, gridBagConstraints); } } gprofng-gui-2.1/org/gprofng/mpmt/toolbar/ToolBarFiller.java0000644000175000017500000000166314744453367020763 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.toolbar; import java.awt.Dimension; import javax.swing.Box.Filler; /** * @author tpreisle */ public class ToolBarFiller extends Filler { public ToolBarFiller(int i) { super(new Dimension(i, 0), new Dimension(i, 0), new Dimension(i, 0)); } } gprofng-gui-2.1/org/gprofng/mpmt/toolbar/ToolBarPanel.java0000644000175000017500000001073614744453367020606 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.toolbar; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.KeyboardShortcuts; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JToolBar; public class ToolBarPanel extends JPanel { private JPanel controlPanel; private JComponent separator; private JComponent currentControls = null; private FindTextPanel findTextPanel; public ToolBarPanel(JToolBar toolBar) { initToolBarPanel(toolBar); } // Initialize aux area private void initToolBarPanel(JToolBar toolBar) { GridBagConstraints gridBagConstraints; int gridx = 0; JPanel tbPanel = this; tbPanel.setBorder( BorderFactory.createMatteBorder(1, 0, 1, 0, AnEnvironment.TOOLBAR_BORDER_COLOR)); tbPanel.setLayout(new GridBagLayout()); tbPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); // Toolbar gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridx++; // gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(1, 0, 1, 0); tbPanel.add(toolBar, gridBagConstraints); separator = new ToolBarSeparator(3, 6); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridx++; gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.insets = new Insets(1, 0, 2, 0); tbPanel.add(separator, gridBagConstraints); // Control panel controlPanel = new JPanel(); controlPanel.setLayout(new BorderLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridx++; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(1, 0, 1, 0); tbPanel.add(controlPanel, gridBagConstraints); // Find panel findTextPanel = new FindTextPanel(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridx = gridx++; gridBagConstraints.weightx = 1.0; tbPanel.add(findTextPanel, gridBagConstraints); separator.setVisible(false); controlPanel.setVisible(false); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_FOCUSED) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getActionMap() .put( KeyboardShortcuts.helpActionShortcut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { // Analyzer.getInstance().showHelp(null); AnWindow.getInstance().getViews().getCurrentViewDisplay().showHelp(); } }); } public void setControls(JComponent component) { removeControls(); controlPanel.add(component); currentControls = component; separator.setVisible(true); controlPanel.setVisible(true); } public FindTextPanel getFindTextPanel() { return findTextPanel; } public JComponent getControls() { return currentControls; } public void removeControls() { controlPanel.removeAll(); currentControls = null; separator.setVisible(false); controlPanel.setVisible(false); } } gprofng-gui-2.1/org/gprofng/mpmt/AnLocale.java0000644000175000017500000000663014744453367016276 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.guitesting.GUITesting; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; public final class AnLocale { private static boolean addDebugInfo = false; private static Locale locale = Locale.getDefault(); private static ResourceBundle resource = null; static { try { if (!GUITesting.getInstance().isRunningUnderNB()) { ClassLoader loader = getLoader("org-gprofng-mpmt"); resource = ResourceBundle.getBundle("org.gprofng.mpmt.Bundle", locale, loader); } } catch (MissingResourceException e) { System.err.println("Cannot find resource bundle."); } } // Get the locale ClassLoader public static ClassLoader getLoader(String name) { String path; URL[] urls; if (name.equals("analyzer_help")) { path = "file:" + Analyzer.fdhome + "/modules/docs/"; } else { path = "file:" + Analyzer.fdhome + "/modules/autoload/"; } try { urls = new URL[] { new URL(path + "locale/" + name + "_" + locale.getLanguage() + ".jar"), new URL(path + "locale/" + name + "_" + locale.getLanguage() + "_" + locale.getCountry() + ".jar"), new URL(path + name + ".jar") }; } catch (MalformedURLException e) { return null; } return new URLClassLoader(urls); } private static String addDebugInfo(String ret) { ret = "XXX>" + ret + ". */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import javax.swing.JPanel; public final class LinesView extends FuncListDisp implements AnChangeListener { public LinesView() { super(AnWindow.getInstance(), AnDisplay.DSP_Lines, 0, AnVariable.HELP_TabsLines); setAccessibility(AnLocale.getString("Lines")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("LinesView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } } gprofng-gui-2.1/org/gprofng/mpmt/AnIconButton.java0000644000175000017500000000443114744453367017160 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import java.awt.Color; import java.awt.Insets; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Icon; import javax.swing.JButton; public class AnIconButton extends JButton implements MouseListener, FocusListener { private Insets insets = new Insets(2, 2, 2, 2); public AnIconButton(Icon icon) { super(icon); setBorder(javax.swing.BorderFactory.createLineBorder(new Color(115, 115, 115))); setOpaque(false); setContentAreaFilled(false); setBorderPainted(false); addMouseListener(this); addFocusListener(this); } @Override public Insets getInsets() { return insets; } @Override public void setMargin(Insets m) { super.setMargin(m); insets = m; } @Override public void mouseExited(MouseEvent e) { setBorderPainted(false); validate(); repaint(); } @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { setBorderPainted(true); validate(); repaint(); } @Override public void mousePressed(MouseEvent e) { if (isEnabled()) { setContentAreaFilled(true); validate(); repaint(); } } @Override public void mouseReleased(MouseEvent e) { setContentAreaFilled(false); validate(); repaint(); } @Override public void focusGained(FocusEvent e) { setBorderPainted(true); validate(); repaint(); } @Override public void focusLost(FocusEvent e) { setBorderPainted(false); validate(); repaint(); } } gprofng-gui-2.1/org/gprofng/mpmt/settings/0000755000175000017500000000000015044723235015654 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/settings/PathMapSetting.java0000644000175000017500000001223114744453367021342 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class PathMapSetting extends Setting { private String[][] pathMap = null; public PathMapSetting() { pathMap = new String[2][]; // Default pathMap[0] = new String[0]; pathMap[1] = new String[0]; } public void set(Object originalSource, String[][] newPathMap) { boolean changed = false; if (pathMap == null) { changed = true; } else { assert pathMap.length == 2 && newPathMap.length == 2; String[] oldTo = pathMap[0]; String[] oldFrom = pathMap[1]; String[] newTo = newPathMap[0]; String[] newFrom = newPathMap[1]; assert oldTo.length == oldFrom.length; assert newTo.length == newFrom.length; if (oldTo.length != newTo.length) { changed = true; } else { for (int i = 0; i < oldTo.length; i++) { if (!oldTo[i].equals(newTo[i])) { changed = true; break; } } for (int i = 0; i < oldFrom.length; i++) { if (!oldFrom[i].equals(newFrom[i])) { changed = true; break; } } } } if (changed) { setValueAndFireChangeEvent(originalSource, this, newPathMap); } } public void addPathMap(Object originalSource, String from, String to) { String[][] newPathMap = new String[pathMap.length][]; String fromPaths[] = new String[pathMap[0].length + 1]; String toPaths[] = new String[pathMap[1].length + 1]; for (int i = 0; i < pathMap[0].length; i++) { fromPaths[i] = pathMap[0][i]; toPaths[i] = pathMap[1][i]; } fromPaths[pathMap[0].length] = from; toPaths[pathMap[0].length] = to; newPathMap[0] = fromPaths; newPathMap[1] = toPaths; set(originalSource, newPathMap); } public void init(Object originalSource, String[][] pathMap) { setValue(pathMap); fireChangeEvent(originalSource, pathMap); } public static String[][] getDefaultPathmap() { String[][] pathMap = new String[2][]; // Default pathMap[0] = new String[0]; pathMap[1] = new String[0]; return pathMap; } public static boolean isDefault(String[][] pathmap) { String[][] def = getDefaultPathmap(); boolean ret = true; if (def.length != pathmap.length) { ret = false; } else { String[] deffrom = def[0]; String[] defto = def[1]; String[] pathmapfrom = pathmap[0]; String[] pathmapto = pathmap[1]; if (deffrom.length != pathmapfrom.length) { ret = false; } else if (defto.length != pathmapto.length) { ret = false; } else { for (int i = 0; i < deffrom.length; i++) { if (!deffrom[i].equals(pathmapfrom[i])) { ret = false; break; } } for (int i = 0; i < defto.length; i++) { if (!defto[i].equals(pathmapto[i])) { ret = false; break; } } } } return ret; } public String[][] get() { return pathMap; } public String[] getPathMapFrom() { return pathMap[0]; } public String[] getPathMapTo() { return pathMap[1]; } @Override Type getType() { return AnSettingChangeEvent.Type.PATH_MAP; } @Override Object getValue() { return pathMap; } @Override void setValue(Object newValue) { Object[] newPathMap = (Object[]) newValue; pathMap = (String[][]) newPathMap; setPathMapIPC(pathMap); // IPC } public static String[][] getPathMapsIPC() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getPathmaps"); Object[] ret = (Object[]) anWindow.IPC().recvObject(); String[][] retS = new String[2][]; retS[0] = (String[]) ret[0]; retS[1] = (String[]) ret[1]; return retS; } } private static String addPathMapIPC(String from, final String to) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("addPathmap"); anWindow.IPC().send(from); anWindow.IPC().send(to); return anWindow.IPC().recvString(); } } private static void setPathMapIPC(String[][] pathMap) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("setPathmaps"); anWindow.IPC().send(pathMap[0]); anWindow.IPC().send(pathMap[1]); anWindow.IPC().recvString(); // synchronize } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricType.java0000644000175000017500000000175314744453367020546 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; public class MetricType { private String command; private int subType; public MetricType(String command, int subType) { this.command = command; this.subType = subType; } public String getCommand() { return command; } public int getSubType() { return subType; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/CompareModeSetting.java0000644000175000017500000000735214744453367022213 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class CompareModeSetting extends Setting { private CompareMode compareMode = CompareMode.CMP_DISABLE; // Default public enum CompareMode { CMP_DISABLE(0, AnLocale.getString("Disable")), CMP_ENABLE(1, AnLocale.getString("Enable")), CMP_RATIO(2, AnLocale.getString("Ratio")), CMP_DELTA(4, AnLocale.getString("Delta")); private final int value; private final String name; private CompareMode(int value, String name) { this.value = value; this.name = name; } public int value() { return value; } public static CompareMode fromValue(int val) { for (CompareMode rt : CompareMode.values()) { if (rt.value() == val) { return rt; } } return null; } @Override public String toString() { return name; } }; public CompareModeSetting() {} public static CompareMode getDefaultCompareMode() { return CompareMode.CMP_DISABLE; } public void init(Object originalSource, CompareMode mode) { if (mode != compareMode) { this.compareMode = mode; fireChangeEvent(originalSource, mode); } } public void set(Object originalSource, CompareMode mode) { if (mode != compareMode) { setValueAndFireChangeEvent(originalSource, this, mode); } } public CompareMode get() { return compareMode; } public boolean comparingExperiments() { return compareMode != CompareMode.CMP_DISABLE; } @Override Type getType() { return AnSettingChangeEvent.Type.COMPARE_MODE; } @Override Object getValue() { return compareMode; } @Override void setValue(Object newValue) { CompareMode newMode = (CompareMode) newValue; this.compareMode = newMode; setCompareModeV2IPC(newMode); // IPC } private static void setCompareModeV2IPC(final CompareMode mode) { synchronized (IPC.lock) { final IPC ipc = AnWindow.getInstance().IPC(); ipc.send("setCompareModeV2"); ipc.send(0); ipc.send(mode.value()); ipc.recvVoid(); } } public static CompareMode getCompareModeV2IPC() { synchronized (IPC.lock) { final IPC ipc = AnWindow.getInstance().IPC(); ipc.send("getCompareModeV2"); ipc.send(0); int mode = ipc.recvInt(); CompareMode compareMode = CompareMode.fromValue(mode); return compareMode; } } /** * Send request to get Compare Mode. Non-blocking IPC call. Caller should call ipcResult.getInt() * to get the result * * @return IPCResult */ public static IPCResult getCompareModeV2IPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getCompareModeV2"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // CompareMode result = ipcResult.getInt() // blocking return ipcResult; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/SourceDisassemblySetting.java0000644000175000017500000001062414744453367023454 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class SourceDisassemblySetting extends Setting { private static final int settingsSource = 0x7ff; // 2147483647; private static final int settingsDisassembly = 0x7ff; // 2147483647; private static final int thresholdSource = 75; private static final int thresholdDisassembly = 75; private static final int sourceCode = 1; private static final int metricsForSourceLines = 0; private static final int hexadecimalInstructions = 0; private static final int onlyShowDataOfCurrentFunction = 0; private static final int showCompilerCommandLlineFlags = 0; private static final int showFunctionBeginningLine = 1; private static final int[] defaultSettings = new int[] { settingsSource, settingsDisassembly, thresholdSource, thresholdDisassembly, sourceCode, metricsForSourceLines, hexadecimalInstructions, showCompilerCommandLlineFlags, onlyShowDataOfCurrentFunction, showFunctionBeginningLine }; private int[] settings = defaultSettings; public SourceDisassemblySetting() {} public static int[] getDefaultSourceDisassemblySetting() { return defaultSettings; } public void init(Object originalSource, int[] newSettings) { newSettings[0] = 0x7ff & newSettings[0]; newSettings[1] = 0x7ff & newSettings[1]; boolean changed = changed(settings, newSettings); if (changed) { this.settings = newSettings; fireChangeEvent(originalSource, newSettings); } } public void set(Object originalSource, int[] newSettings) { newSettings[0] = 0x7ff & newSettings[0]; newSettings[1] = 0x7ff & newSettings[1]; boolean changed = changed(settings, newSettings); if (changed) { setValueAndFireChangeEvent(originalSource, this, newSettings); } } public static boolean changed(int[] oldSettings, int[] newSettings) { boolean changed = false; // check if any changes if (oldSettings.length != newSettings.length) { changed = true; } else { for (int i = 0; i < oldSettings.length; i++) { if (oldSettings[i] != newSettings[i]) { changed = true; break; } } } return changed; } public int[] get() { return settings; } @Override Type getType() { return AnSettingChangeEvent.Type.SRC_DIS; } @Override Object getValue() { return settings; } @Override void setValue(Object newValue) { int[] newSetting = (int[]) newValue; this.settings = newSetting; setAnoValueIPC(newSetting); // IPC } public static int[] getAnoValueIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getAnoValue"); window.IPC().send(0); return (int[]) window.IPC().recvObject(); } } /** * Send request to get AnoValue. Non-blocking IPC call. Caller should call ipcResult.getInts() to * get the result * * @return IPCResult */ public static IPCResult getAnoValueIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getAnoValue"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getInts() // blocking return ipcResult; } private static void setAnoValueIPC(final int[] set) { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("setAnoValue"); window.IPC().send(0); window.IPC().send(set); window.IPC().recvString(); // synchronize } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricNameSelected.java0000644000175000017500000000177114744453367022156 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; public class MetricNameSelected { private String name; private boolean selected; public MetricNameSelected(String name, boolean selected) { this.name = name; this.selected = selected; } public String getName() { return name; } public boolean isSelected() { return selected; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/CallTreePanel.java0000644000175000017500000001031014744453367021121 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** * @author tpreisle */ public class CallTreePanel extends JPanel { private final ChangeListener spinnerChangeListener; public CallTreePanel() { initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext( label, AnLocale.getString("Expand branches when percent of metric exceeds this threshold (%):")); JComponent editor = ((JSpinner.DefaultEditor) spinner.getEditor()); Dimension size = editor.getPreferredSize(); editor.setPreferredSize(new Dimension(20, size.height)); label.setLabelFor(spinner); label.setDisplayedMnemonic(AnLocale.getString('E', "MN_SETTINGS_CALLTREE_THRESHOLD")); AnUtility.setTTAndAccessibleContext(spinner, AnLocale.getString("Threshold")); spinner.setValue(UserPref.getInstance().getCallStackThreshold()); spinner.addChangeListener( spinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Integer val = (Integer) spinner.getValue(); if (val < 0) { spinner.setValue(0); } else if (val > 100) { spinner.setValue(100); } AnWindow.getInstance().getSettings().stateChanged(null); } }); } public void updateGUI() { int threshold = AnWindow.getInstance().getSettings().getCallTreeSetting().getThreshold(); spinner.removeChangeListener(spinnerChangeListener); spinner.setValue(threshold); spinner.addChangeListener(spinnerChangeListener); } public void checkChanges(Object originalSource) { Integer val = (Integer) spinner.getValue(); AnWindow.getInstance() .getSettings() .getCallTreeSetting() .setThreshold(originalSource, val.intValue()); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label = new javax.swing.JLabel(); spinner = new javax.swing.JSpinner(); setLayout(new java.awt.GridBagLayout()); label.setText(""); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(label, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(spinner, gridBagConstraints); } // //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel label; private javax.swing.JSpinner spinner; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricsPanel.form0000644000175000017500000004456214744453367021076 00000000000000

gprofng-gui-2.1/org/gprofng/mpmt/settings/Settings.java0000644000175000017500000033561615044710303020245 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnList; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.navigation.View; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.settings.ViewModeSetting.ViewMode; import org.gprofng.mpmt.util.gui.AnJPanel; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnTabbedPane; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.AnUtility.AnRadioButton; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JSlider; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.EtchedBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public final class Settings implements ActionListener, ItemListener, DocumentListener, ChangeListener { private Settings instance = null; private final Frame frame; private AnWindow anWindow; private SettingsDialog settingsDialog; private JTabbedPane tabbedPane; public int settingsviewsIndex = -1; public int settingsMetricsIndex = -1; public int settingsTimelineIndex = -1; public int settingsSourceDisassemblyIndex = -1; public int settingsCalltreeIndex = -1; // States private final ViewModeSetting viewModeSetting = new ViewModeSetting(); private final ViewModeEnabledSetting viewModeEnabledSetting = new ViewModeEnabledSetting(); private final FormatSetting formatSetting = new FormatSetting(); private final TableSettings tableSettings = new TableSettings(); private final CompareModeSetting compareModeSetting = new CompareModeSetting(); private final TimelineSetting timelineSetting = new TimelineSetting(); private final SourceDisassemblySetting sourceDisassemblySetting = new SourceDisassemblySetting(); private final MetricsSetting metricSetting = new MetricsSetting(); private final SearchPathSetting searchPathSetting = new SearchPathSetting(); private final PathMapSetting pathMapSetting = new PathMapSetting(); private final CallTreeSetting callTreeSetting = new CallTreeSetting(); private final ViewsSetting viewsSetting = new ViewsSetting(); private final LibraryVisibilitySetting libraryVisibilitySetting = new LibraryVisibilitySetting(); // Metrics Tab private MetricsPanel metricsPanel; // Source/Disassembly Tab private int vis_src; private int vis_dis; private static final int[] ccmv_type; private static final String[] ccmv_desc; private static final String[] ccmv_comd; private static final char[] ccmv_mnem; private int threshold_src; private int threshold_dis; private boolean src_visible; private boolean src_metric; private boolean hex_visible; private boolean cmp_visible; private boolean func_visible; private boolean scope_only; private JComponent[] src_chks; private JComponent[] dis_chks; private JComponent[] threshold; private JCheckBox dis_src; private JCheckBox dis_asrc; private JCheckBox dis_hex; private JCheckBox cmp_line; private JCheckBox func_line; private JCheckBox dis_scope; // Formats Tab private AnList tab_name_format; // Formats Tab: Function Name Style private JRadioButton short_fmt; private JRadioButton mangled_fmt; private JRadioButton long_fmt; private JCheckBox soname_chk; // Formats Tab: View Mode private JComponent viewModeLabel; private JRadioButton view_fmt; private JRadioButton view_expert_fmt; private JRadioButton view_machine_fmt; // Formats Tab: Compare private JLabel cmpModeLabel; private JRadioButton cmp_abs_value; private JRadioButton cmp_delta; private JRadioButton cmp_ratio; // Wrap long metric names in table headers private JCheckBox wrapNameCheckBox; // Timeline Tab public static final int PROP_NONE = 0; private ArrayList tldata_checkBoxes; // checkboxes private ArrayList tldata_check_unames; // names shown for checkboxes private int previous_tldata_names_version; private boolean tldata_show_states; // show per-DATA_* event states (mstates) private boolean tldata_show_counts; // show per-DATA_* event values private JCheckBox tldata_show_states_cb; // checkboxes private JCheckBox tldata_show_counts_cb; // checkboxes // TL options' components private JPanel tl_type_panel; private ArrayList tl_entity_button; // Entities == LWP, Thread, CPU, Experiments private JRadioButton[] tl_stack_align; private JSlider tl_slider; private int tldata_stack_depth; private boolean needsTimelineEvent = false; // Search Path private SearchPathPanel searchPathPanel; // Path Map private PathmapsPanel pathmapsPanel; // Views Tab private JPanel viewsPanel; private JPanel memchk_panel, indxchk_panel; private AnList memlist, indxlist; private CustomMemDialog tabs_custom_mem_dlg; private CustomIndxDialog tabs_custom_indx_dlg; private AnUtility.AnCheckBox[] staticViewCheckBoxes; private AnUtility.AnCheckBox[] standardObjectCheckBoxes; private AnUtility.AnCheckBox[] memoryObjectCheckBoxes; private AnUtility.AnCheckBox[] indexObjectCheckBoxes; // Call Tree private CallTreePanel callTreePanel; // Constructor public Settings(final AnWindow window, final Frame frame) { // name_col = -1; // tldata tldata_checkBoxes = new ArrayList<>(); tldata_check_unames = new ArrayList<>(); previous_tldata_names_version = 0; tldata_show_states = false; tldata_show_counts = false; tldata_stack_depth = 0; anWindow = window; this.frame = frame; instance = this; initComponents(); updateGUIViewModeVisible(); settingsDialog = new SettingsDialog(); // FIXUP: Settings dialog keeps some states!!!!!!! } private Settings getDefault() { return instance; } public SourceDisassemblySetting getSourceDisassemblySetting() { return sourceDisassemblySetting; } public ViewModeSetting getViewModeSetting() { return viewModeSetting; } public ViewModeEnabledSetting getViewModeEnabledSetting() { return viewModeEnabledSetting; } public FormatSetting getFormatSetting() { return formatSetting; } public CompareModeSetting getCompareModeSetting() { return compareModeSetting; } public MetricsSetting getMetricsSetting() { return metricSetting; } public TimelineSetting getTimelineSetting() { return timelineSetting; } public SearchPathSetting getSearchPathSetting() { return searchPathSetting; } public PathMapSetting getPathMapSetting() { return pathMapSetting; } public CallTreeSetting getCallTreeSetting() { return callTreeSetting; } public ViewsSetting getViewsSetting() { return viewsSetting; } public TableSettings getTableSettings() { return tableSettings; } public LibraryVisibilitySetting getLibraryVisibilitySetting() { return libraryVisibilitySetting; } // Initialize GUI components private void initComponents() { JPanel panel; Dimension psize; int tabCount = 0; tabbedPane = new AnTabbedPane(); String txt = AnLocale.getString("Presentation Tabs"); AnUtility.setAccessibleContext(tabbedPane.getAccessibleContext(), txt); // Views viewsPanel = new AnJPanel(new GridBagLayout()); txt = AnLocale.getString("Views"); tabbedPane.addTab(txt, new AnJScrollPane(viewsPanel)); tabCount++; txt = AnLocale.getString("Select Tabs"); AnUtility.setAccessibleContext(viewsPanel.getAccessibleContext(), txt); settingsviewsIndex = tabCount - 1; // Metrics txt = AnLocale.getString("Metrics"); metricsPanel = new MetricsPanel(); tabbedPane.addTab(txt, metricsPanel); tabCount++; settingsMetricsIndex = tabCount - 1; // Timeline panel = new AnJPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); edt_initTimeline(panel); // IPC! txt = AnLocale.getString("Timeline"); panel.setName(txt); panel.getAccessibleContext().setAccessibleName(txt); tabbedPane.addTab(txt, new AnJScrollPane(panel)); tabCount++; settingsTimelineIndex = tabCount - 1; // Source and Disassembly panel = new AnJPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); initSourceDisassembly(panel); tabbedPane.addTab(AnLocale.getString("Source/Disassembly"), new AnJScrollPane(panel)); tabCount++; settingsSourceDisassemblyIndex = tabCount - 1; // Call Tree callTreePanel = new CallTreePanel(); txt = AnLocale.getString("Call Tree"); tabbedPane.addTab(txt, new AnJScrollPane(callTreePanel)); tabCount++; txt = AnLocale.getString("Call Tree"); AnUtility.setAccessibleContext(callTreePanel.getAccessibleContext(), txt); settingsCalltreeIndex = tabCount - 1; // Formats tab_name_format = new AnList(false); initNameFormat(tab_name_format); AnUtility.setAccessibleContext(tab_name_format.getAccessibleContext(), FORMATS_STR); tabbedPane.addTab(FORMATS_STR, new AnJScrollPane(tab_name_format)); tabCount++; // Search Path searchPathPanel = new SearchPathPanel(this); txt = AnLocale.getString("Search Path"); tabbedPane.addTab(txt, searchPathPanel); tabCount++; // Path Mapping pathmapsPanel = new PathmapsPanel(this); txt = AnLocale.getString("Pathmaps"); tabbedPane.addTab(txt, pathmapsPanel); tabCount++; psize = tabbedPane.getPreferredSize(); if (psize.width < MIN_WIDTH) { psize.width = MIN_WIDTH; } tabbedPane.setPreferredSize(psize); } /** * Opens "Settings" dialog with the tab on top specified by parameter Available values: * presentation.timeline_index * * @param tabIndex */ public void showDialog(int tabIndex) { if (tabIndex >= 0) { if (tabIndex < tabbedPane.getComponentCount()) { tabbedPane.setSelectedIndex(tabIndex); } } showDialog(true); } public void showDialog(boolean show) { if (settingsDialog == null) { settingsDialog = new SettingsDialog(); } // Refresh the panel to get changes made in other views if (show) { settingsDialog.showDialog(true); } else { settingsDialog.showDialog(false); } } // Initialize components for the Source and Disassembly pane private void initSourceDisassembly(final JPanel annotate) { final JPanel panel; JPanel chk_panel, text_panel; final AnList list; JLabel label; int i; final String[] threshold_str; int[] defaultSettings = getSourceDisassemblySetting().getDefaultSourceDisassemblySetting(); vis_src = defaultSettings[0]; vis_dis = defaultSettings[1]; threshold_src = defaultSettings[2]; threshold_dis = defaultSettings[3]; src_visible = defaultSettings[4] == 0 ? false : true; src_metric = defaultSettings[5] == 0 ? false : true; hex_visible = defaultSettings[6] == 0 ? false : true; cmp_visible = defaultSettings[7] == 0 ? false : true; scope_only = defaultSettings[8] == 0 ? false : true; func_visible = defaultSettings[9] == 0 ? false : true; panel = new AnJPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // Compiler Commentary list = new AnList(false); chk_panel = new AnJPanel(new GridLayout(1, 2)); chk_panel.add(AnUtility.getHeader(AnLocale.getString("Source"))); chk_panel.add(AnUtility.getHeader(AnLocale.getString("Disassembly"))); String txt = AnLocale.getString("Compiler Commentary"); list.add(AnUtility.getItem(txt), chk_panel); txt = AnLocale.getString("Compiler Commentary"); AnUtility.setAccessibleContext(list.getAccessibleContext(), txt); // Space for adding selecting choice src_chks = new JComponent[size_ccmv]; dis_chks = new JComponent[size_ccmv]; threshold = new JComponent[2]; for (i = 0; i < size_ccmv; i++) { chk_panel = new AnJPanel(new GridLayout(1, 2)); chk_panel.add(src_chks[i] = new AnUtility.AnCheckBox(" ", (vis_src & ccmv_type[i]) != 0)); ((AnUtility.AnCheckBox) src_chks[i]).addItemListener(this); chk_panel.add(dis_chks[i] = new AnUtility.AnCheckBox(" ", (vis_dis & ccmv_type[i]) != 0)); ((AnUtility.AnCheckBox) dis_chks[i]).addItemListener(this); label = (JLabel) AnUtility.getItem(ccmv_desc[i]); label.setDisplayedMnemonic(ccmv_mnem[i]); label.setLabelFor(src_chks[i]); AnUtility.setAccessibleContext(label.getAccessibleContext(), ccmv_desc[i]); list.add(label, chk_panel); } // Syncing states with GUI vis_src = 0; vis_dis = 0; for (int ii = 0; ii < size_ccmv; ii++) { if (((JCheckBox) src_chks[ii]).isSelected()) { vis_src |= ccmv_type[ii]; } if (((JCheckBox) dis_chks[ii]).isSelected()) { vis_dis |= ccmv_type[ii]; } } // Highlighting Threshold chk_panel = new AnJPanel(new GridLayout(1, 2)); threshold_str = new String[2]; threshold_str[0] = Integer.toString(threshold_src); threshold_str[1] = Integer.toString(threshold_dis); for (i = 0; i < 2; i++) { threshold[i] = AnUtility.getNumber(threshold_str[i], 3); ((JTextField) threshold[i]).setEditable(true); ((JTextField) threshold[i]).getDocument().addDocumentListener(this); chk_panel.add(text_panel = new AnJPanel()); text_panel.add(threshold[i]); } txt = AnLocale.getString("Hot Lines highlighting Threshold (%):"); label = (JLabel) AnUtility.getItem(txt); // label.setDisplayedMnemonic(AnLocale.getString('T', // "MNEM_PRESENT_HIGHLIGHTING_THRESHOLD")); label.setLabelFor(threshold[0]); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); list.add(label, chk_panel); list.setAlignmentX(); list.setAlignmentY(); panel.add(list); // Disassembly Listing AnList list2 = new AnList(false); list2.add(AnUtility.getItem(AnLocale.getString("Show in Disassembly Listing:")), null); list2.setAlignmentX(); list2.setAlignmentY(); panel.add(list2); dis_src = new AnUtility.AnCheckBox(AnLocale.getString("Source Code"), src_visible); // dis_src.setMnemonic(AnLocale.getString('r', "MNEM_PRESENT_SOURCE_CODE")); dis_src.addItemListener(this); dis_asrc = new AnUtility.AnCheckBox(AnLocale.getString("Metrics for Source Lines"), src_metric); // dis_asrc.setMnemonic(AnLocale.getString('e', // "MNEM_PRESENT_METRICS_FOR_SOURCE_LINES")); dis_asrc.addItemListener(this); dis_hex = new AnUtility.AnCheckBox(AnLocale.getString("Hexadecimal Instructions"), hex_visible); // dis_hex.setMnemonic(AnLocale.getString('x', "MNEM_PRESENT_HEXADECIMAL_INSTRUCTIONS")); dis_hex.addItemListener(this); dis_scope = new AnUtility.AnCheckBox( AnLocale.getString("Only Show Data of Current Function"), scope_only); // dis_scope.setMnemonic(AnLocale.getString('u', // "MNEM_PRESENT_ONLY_SHOW_DATA_OF_CURRENT_FUNCTION")); dis_scope.addItemListener(this); chk_panel = new AnJPanel(); chk_panel.setLayout(new BoxLayout(chk_panel, BoxLayout.Y_AXIS)); chk_panel.add(dis_src); chk_panel.add(dis_asrc); chk_panel.add(dis_hex); chk_panel.add(dis_scope); panel.add(chk_panel); // Disassembly Listing AnJPanel chk_panel2 = new AnJPanel(new FlowLayout(FlowLayout.LEFT, 0, 5)); panel.add(chk_panel2); // just a separator AnList list3 = new AnList(false); list3.add( AnUtility.getItem(AnLocale.getString("Show in Source and Disassembly Listing:")), null); list3.setAlignmentX(); list3.setAlignmentY(); panel.add(list3); cmp_line = new AnUtility.AnCheckBox( AnLocale.getString("Show compiler command-line flags"), cmp_visible); // cmp_line.setMnemonic(AnLocale.getString('s', "MNEM_PRESENT_SHOW_COMMAND_LINE_FLAGS")); cmp_line.addItemListener(this); func_line = new AnUtility.AnCheckBox(AnLocale.getString("Show function beginning line"), func_visible); // func_line.setMnemonic(AnLocale.getString('f', // "MNEM_PRESENT_SHOW_FUNCTION_SEPARATOR_LINE")); func_line.addItemListener(this); AnJPanel chk_panel3 = new AnJPanel(); chk_panel3.setLayout(new BoxLayout(chk_panel3, BoxLayout.Y_AXIS)); chk_panel3.add(cmp_line); chk_panel3.add(func_line); panel.add(chk_panel3); annotate.add(panel); } /** Sets display mode without enabling OK/Apply Called (indirectly) from outside Presentation */ private void updateGUIViewMode() { view_fmt.removeItemListener(this); view_expert_fmt.removeItemListener(this); view_machine_fmt.removeItemListener(this); ViewMode mode = getViewModeSetting().get(); view_fmt.setSelected(mode == ViewModeSetting.ViewMode.USER); view_expert_fmt.setSelected(mode == ViewModeSetting.ViewMode.EXPERT); view_machine_fmt.setSelected(mode == ViewModeSetting.ViewMode.MACHINE); view_fmt.addItemListener(this); view_expert_fmt.addItemListener(this); view_machine_fmt.addItemListener(this); } private void updateGUIViewModeVisible() { boolean set = getViewModeEnabledSetting().isViewModeEnabled(); viewModeLabel.setEnabled(set); view_fmt.setEnabled(set); view_expert_fmt.setEnabled(set); view_machine_fmt.setEnabled(set); } /** * Updates Name Format mode without enabling OK/Apply Called from within Presentations (clicking * on radio buttons) */ private void updateGUINameFormat() { short_fmt.removeItemListener(this); long_fmt.removeItemListener(this); mangled_fmt.removeItemListener(this); FormatSetting.Style style = getFormatSetting().getStyle(); boolean soName = getFormatSetting().getAppendSoName(); short_fmt.setSelected(style == FormatSetting.Style.SHORT); long_fmt.setSelected(style == FormatSetting.Style.LONG); mangled_fmt.setSelected(style == FormatSetting.Style.MANGLED); soname_chk.setSelected(soName); short_fmt.addItemListener(this); long_fmt.addItemListener(this); mangled_fmt.addItemListener(this); } /** * Sets display compare mode without enabling OK/Apply Called (indirectly) from outside * Presentation */ private void updateGUIDisplayCompareMode() { cmp_abs_value.removeItemListener(this); cmp_delta.removeItemListener(this); cmp_ratio.removeItemListener(this); CompareMode mode = getCompareModeSetting().get(); boolean enbl = (mode != CompareMode.CMP_DISABLE); cmpModeLabel.setEnabled(enbl); cmp_abs_value.setEnabled(enbl); cmp_delta.setEnabled(enbl); cmp_ratio.setEnabled(enbl); cmp_abs_value.setSelected(!enbl || (mode == CompareMode.CMP_ENABLE)); cmp_delta.setSelected(mode == CompareMode.CMP_DELTA); cmp_ratio.setSelected(mode == CompareMode.CMP_RATIO); cmp_abs_value.addItemListener(this); cmp_delta.addItemListener(this); cmp_ratio.addItemListener(this); } /** * Updates Name Format mode without enabling OK/Apply Called from within Presentations (clicking * on radio buttons) */ private void updateGUITableFormat() { wrapNameCheckBox.setSelected(getTableSettings().wrapMetricNames()); } /** * Sets SourceDisassembly settings without enabling OK/Apply Called (indirectly) from outside * Presentation */ private void updateGUISourceDisassembly() { final int[] anno_set = getSourceDisassemblySetting().get(); vis_src = anno_set[0]; vis_dis = anno_set[1]; threshold_src = anno_set[2]; threshold_dis = anno_set[3]; src_visible = (anno_set[4] == 0) ? false : true; src_metric = (anno_set[5] == 0) ? false : true; hex_visible = (anno_set[6] == 0) ? false : true; cmp_visible = (anno_set[7] == 0) ? false : true; scope_only = (anno_set[8] == 0) ? false : true; func_visible = (anno_set[9] == 0) ? false : true; for (int i = 0; i < size_ccmv; i++) { ((JCheckBox) src_chks[i]).setSelected((vis_src & ccmv_type[i]) != 0); ((JCheckBox) dis_chks[i]).setSelected((vis_dis & ccmv_type[i]) != 0); } ((JTextField) threshold[0]).setText("" + threshold_src); ((JTextField) threshold[1]).setText("" + threshold_dis); dis_src.setSelected(src_visible); dis_asrc.setSelected(src_metric); dis_hex.setSelected(hex_visible); cmp_line.setSelected(cmp_visible); dis_scope.setSelected(scope_only); func_line.setSelected(func_visible); } /** * Sets Timeline settings without enabling OK/Apply Called (indirectly) from outside Presentation */ private void updateGUITimeline() { boolean buttonsEnabled = settingsDialog.areButtonsEnabled(); tl_entity_button.get(getTimelineSetting().getTl_entity_selected_btn()).setSelected(true); tl_slider.setValue( getTimelineSetting().getTLStackFramePixels() - TIMELINE_STACK_FRAME_MAGNIFY_OFFSET); // tl_slider.setValue(getTimelineSetting().getTLStackDepth()); tldata_stack_depth = getTimelineSetting().getTLStackDepth(); tl_stack_align[0].setSelected( getTimelineSetting().getStack_align() == TLStack_align.TLSTACK_ALIGN_ROOT); tl_stack_align[1].setSelected( getTimelineSetting().getStack_align() == TLStack_align.TLSTACK_ALIGN_LEAF); tldata_show_states_cb.setSelected(getTimelineSetting().getShowEventStates()); tldata_show_states = tldata_show_states_cb.isSelected(); tldata_show_counts_cb.setSelected(getTimelineSetting().getShowEventDensity()); tldata_show_counts = tldata_show_counts_cb.isSelected(); settingsDialog.setButtonsEnabled(buttonsEnabled); } public static String getErRcTLDataCmdName(TLData_type tldata_type, String auxName) { if (tldata_type == TLData_type.TL_UNKNOWN) { return null; } String cmd = tldata_type.getTLDataBaseCmd(); if (auxName == null) { return cmd; } String tlDataCmd = cmd + "(" + auxName + ")"; return tlDataCmd; } public static String getErRcTLDataLongUName(String dataUName, String auxUName) { if (auxUName == null) { return dataUName; } String baseUName = "HW Counter"; // uname is _too_ long String longUName = baseUName + " (" + auxUName + ")"; return longUName; } private void updateGUITimelineData() { // translate metric selections to timeline DATA checkbox mask MetricsSetting metricsSetting = getMetricsSetting(); AnMetric[] anMetrics = metricsSetting.getAvailableAnMetrics(); Set allList = new HashSet(); Set enabledList = new HashSet(); for (int ii = 0; ii < anMetrics.length; ii++) { String dataType = anMetrics[ii].getDataTypeName(); if (dataType == null) { continue; // for example, derived metrics } String tlDataCmd = getErRcTLDataCmdName(TLData_type.find(dataType), anMetrics[ii].aux); if (tlDataCmd == null) { continue; // weird } allList.add(tlDataCmd); // boolean selected = metricsSetting.isSelected(ii); boolean selected = metricsSetting.isSelected(anMetrics[ii].getComd()); // if (selected != selected2) { // System.out.println("ERROR******************** updateGUITimelineData"); // } if (selected) { enabledList.add(tlDataCmd); } } Set disabledList = new HashSet(allList); for (String enabled : enabledList) { disabledList.remove(enabled); } edt_TLData_disable_only(allList, disabledList); } private boolean edt_TLData_disable_only(Set allData, Set disabledData) { long tldata_check_hidden_bitmask = timelineSetting.getTLDataHiddenMask(); long new_mask = timelineSetting.setTLDataVisibility_edt(allData, disabledData); boolean changed = new_mask != tldata_check_hidden_bitmask; if (changed) { for (int i = 0; i < tldata_checkBoxes.size(); i++) { long hidden = ((1L << i) & new_mask); tldata_checkBoxes.get(i).setSelected(hidden == 0); } tl_type_panel.repaint(); needsTimelineEvent = true; // FIXUP, is this correct? checkTimelineChanged(this); } return changed; } private void updateGUISearchPath() { searchPathPanel.updateGUI(); } private void updateGUIPathMap() { // pathMapPanel.updateGUI(); pathmapsPanel.updateGUI(); } private void updateGUICallTree() { callTreePanel.updateGUI(); } private void updateGUIMetrics() { metricsPanel.updateGUIElements(); } private void updateGUIViews(ViewsSetting.Setting oldSetting, ViewsSetting.Setting newSetting) { AnUtility.checkIfOnAWTThread(true); if (ViewsSetting.viewsChanged(oldSetting, newSetting)) { setViewComponents(); } } private JPanel get_space_panel() { // Create blank space for better grouping JPanel pnl = new JPanel(); pnl.setOpaque(false); pnl.setSize(20, 40); return pnl; } private JLabel get_JLabel(final String txt) { final JLabel lbl = (JLabel) AnUtility.getItem(txt); AnUtility.setAccessibleContext(lbl.getAccessibleContext(), txt); return lbl; } // Initialize components for the Name Formats pane private void initNameFormat(final AnList format) { // formatSetting.initialize(getNameFormat(), getSoName()); // IPC!!!!! ButtonGroup group = new ButtonGroup(); long_fmt = new AnUtility.AnRadioButton( AnLocale.getString("Long"), formatSetting.getStyle() == FormatSetting.Style.LONG); long_fmt.setMnemonic(AnLocale.getString('L', "MNEM_PRESENT_LONG")); long_fmt.addItemListener(this); group.add(long_fmt); format.add(get_JLabel(AnLocale.getString("Function Name Style:")), long_fmt); short_fmt = new AnUtility.AnRadioButton( AnLocale.getString("Short"), formatSetting.getStyle() == FormatSetting.Style.SHORT); short_fmt.setMnemonic(AnLocale.getString('t', "MNEM_PRESENT_SHORT")); short_fmt.addItemListener(this); group.add(short_fmt); format.add((JComponent) null, short_fmt); mangled_fmt = new AnUtility.AnRadioButton( AnLocale.getString("Mangled"), formatSetting.getStyle() == FormatSetting.Style.MANGLED); mangled_fmt.setMnemonic(AnLocale.getString('M', "MNEM_PRESENT_MANGLED")); mangled_fmt.addItemListener(this); group.add(mangled_fmt); format.add((JComponent) null, mangled_fmt); format.add((JComponent) null, get_space_panel()); soname_chk = new AnUtility.AnCheckBox(Blank); soname_chk.setSelected(formatSetting.getAppendSoName()); soname_chk.addItemListener(this); final JLabel so_label = get_JLabel(AnLocale.getString("Append SO name to Function name:")); char ch_mnem = AnLocale.getString('p', "MNEM_PRESENT_SONAME"); so_label.setDisplayedMnemonic(ch_mnem); so_label.setLabelFor(soname_chk); format.add(so_label, soname_chk); format.add((JComponent) null, get_space_panel()); // Add View mode: User/Expert/Machine // view_mode = JMODE_USER; // Don't ask IPC. Just use User mode for now, it will get set // correcly after loading experiments group = new ButtonGroup(); view_fmt = new AnUtility.AnRadioButton(AnLocale.getString("User", "PRESENT_USER"), true); view_fmt.setMnemonic(AnLocale.getString('U', "MNEM_PRESENT_USER")); view_fmt.addItemListener(this); group.add(view_fmt); viewModeLabel = AnUtility.getItem(AnLocale.getString("View Mode:")); format.add(viewModeLabel, view_fmt); view_expert_fmt = new AnUtility.AnRadioButton(AnLocale.getString("Expert"), false); view_expert_fmt.setMnemonic(AnLocale.getString('x', "MNEM_PRESENT_EXPERT")); view_expert_fmt.addItemListener(this); group.add(view_expert_fmt); format.add((JComponent) null, view_expert_fmt); view_machine_fmt = new AnUtility.AnRadioButton(AnLocale.getString("Machine", "PRESENT_MACHINE"), false); view_machine_fmt.setMnemonic(AnLocale.getString('n', "MNEM_PRESENT_MACHINE")); group.add(view_machine_fmt); format.add((JComponent) null, view_machine_fmt); format.add((JComponent) null, get_space_panel()); // Add compare mode. Don't ask IPC. // Just use CMP_DISABLE for now, it will get set correctly after loading experiments boolean enbl = false; cmpModeLabel = get_JLabel(AnLocale.getString("Comparison Style:")); cmpModeLabel.setEnabled(enbl); group = new ButtonGroup(); cmp_abs_value = new AnUtility.AnRadioButton(AnLocale.getString("Absolute Values"), true); cmp_abs_value.setMnemonic(AnLocale.getString('B', "MNEM_PRESENT_ABS_VALUE")); cmp_abs_value.addItemListener(this); cmp_abs_value.setEnabled(enbl); group.add(cmp_abs_value); format.add(cmpModeLabel, cmp_abs_value); cmp_delta = new AnUtility.AnRadioButton(AnLocale.getString("Deltas"), false); cmp_delta.setMnemonic(AnLocale.getString('D', "MNEM_PRESENT_DELTAS")); cmp_delta.addItemListener(this); cmp_delta.setEnabled(enbl); group.add(cmp_delta); format.add((JComponent) null, cmp_delta); cmp_ratio = new AnUtility.AnRadioButton(AnLocale.getString("Ratios"), false); cmp_ratio.setMnemonic(AnLocale.getString('R', "MNEM_PRESENT_RATIOS")); cmp_ratio.addItemListener(this); cmp_ratio.setEnabled(enbl); group.add(cmp_ratio); format.add((JComponent) null, cmp_ratio); // Wrap long metric names in table headers format.add((JComponent) null, get_space_panel()); JLabel wrapNameLabel = get_JLabel(AnLocale.getString("Wrap Long Metric Names in Table Headers:")); char mnChar = AnLocale.getString('W', "MNEM_PRESENT_WRAP_NAME"); wrapNameLabel.setDisplayedMnemonic(mnChar); wrapNameCheckBox = new AnUtility.AnCheckBox(Blank); wrapNameLabel.setLabelFor(wrapNameCheckBox); wrapNameCheckBox.addItemListener(this); format.add(wrapNameLabel, wrapNameCheckBox); } // Initialize components for the Timeline pane private void edt_initTimeline(final JPanel timeline_panel) { final JPanel border_panel; final JPanel center_panel; final JPanel east_panel; JLabel label; ButtonGroup buttonGroup; String txt; // --- border_panel (has border) contains main_panel border_panel = new AnJPanel(new BorderLayout()); border_panel.setBorder(AnVariable.boxBorder); timeline_panel.add(border_panel); // --- Center center_panel = new AnJPanel(); center_panel.setLayout(new BoxLayout(center_panel, BoxLayout.Y_AXIS)); // --- Center: Data Types Panels txt = AnLocale.getString("Data Types:"); label = new JLabel(txt); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); label.setBorder(AnVariable.boxBorder); center_panel.add(label); tl_type_panel = new AnJPanel(); tl_type_panel.setLayout(new BoxLayout(tl_type_panel, BoxLayout.Y_AXIS)); tl_type_panel.setBorder(AnVariable.boxBorder); center_panel.add(tl_type_panel); // --- Center: Additional Graphs Panels txt = AnLocale.getString("For enabled Data Types, also show: "); label = new JLabel(txt); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); label.setBorder(AnVariable.boxBorder); center_panel.add(label); final JPanel center_additional_graph_panel = new AnJPanel(); center_additional_graph_panel.setLayout( new BoxLayout(center_additional_graph_panel, BoxLayout.Y_AXIS)); center_additional_graph_panel.setBorder(AnVariable.boxBorder); { JCheckBox check; txt = AnLocale.getString("Event States"); check = new AnUtility.AnCheckBox(txt, true); // YXXX add this to .er.rc check.addItemListener(this); center_additional_graph_panel.add(check); tldata_show_states_cb = check; tldata_show_states = tldata_show_states_cb.isSelected(); // Keep states in sync.... txt = AnLocale.getString("Event Density"); check = new AnUtility.AnCheckBox(txt, false); // YXXX add this to .er.rc check.addItemListener(this); center_additional_graph_panel.add(check); tldata_show_counts_cb = check; tldata_show_counts = tldata_show_counts_cb.isSelected(); // Keep states in sync.... } center_panel.add(center_additional_graph_panel); // --- East east_panel = new AnJPanel(); east_panel.setLayout(new BoxLayout(east_panel, BoxLayout.Y_AXIS)); east_panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); // --- East, 1st row: tl_entity final JPanel east_entity_panel = new AnJPanel(new BorderLayout(4, 4)); east_entity_panel.setBorder(AnVariable.boxBorder); txt = AnLocale.getString("Group Data by:"); label = new JLabel(txt); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); east_entity_panel.add(label, BorderLayout.NORTH); final JPanel entity_button_panel = new AnJPanel(new GridLayout(1, 3)); buttonGroup = new ButtonGroup(); tl_entity_button = new ArrayList<>(); int tl_entity_selected_btn = getTimelineSetting().getTl_entity_selected_btn(); TimelineSetting.EntityProp entProp; for (int i = 0; null != (entProp = getTimelineSetting().getTl_entity_prop(i)); i++) { String uname = entProp.prop_uname; JRadioButton thisButton = new AnRadioButton(uname, i == tl_entity_selected_btn); thisButton.setOpaque(false); thisButton.addItemListener(this); tl_entity_button.add(thisButton); buttonGroup.add(thisButton); entity_button_panel.add(thisButton); } east_entity_panel.add(entity_button_panel, BorderLayout.CENTER); east_panel.add(east_entity_panel); east_panel.add(new JSeparator(SwingConstants.HORIZONTAL)); // --- East, 2nd row: Stack alignment final JPanel east_stack_align_panel = new AnJPanel(new BorderLayout(4, 4)); east_stack_align_panel.setBorder(AnVariable.boxBorder); txt = AnLocale.getString("Stack Alignment:"); label = new JLabel(txt); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); east_stack_align_panel.add(label, BorderLayout.NORTH); final JPanel alignment_button_panel = new AnJPanel(new GridLayout(1, 2)); buttonGroup = new ButtonGroup(); tl_stack_align = new AnRadioButton[2]; tl_stack_align[0] = new AnRadioButton( TLStack_align.TLSTACK_ALIGN_ROOT.toString(), getTimelineSetting().getStack_align() == TLStack_align.TLSTACK_ALIGN_ROOT); tl_stack_align[0].setMnemonic(AnLocale.getString('R', "MNEM_PRESENT_ROOT")); tl_stack_align[0].addItemListener(this); tl_stack_align[0].setOpaque(false); buttonGroup.add(tl_stack_align[0]); alignment_button_panel.add(tl_stack_align[0]); tl_stack_align[1] = new AnRadioButton( TLStack_align.TLSTACK_ALIGN_LEAF.toString(), getTimelineSetting().getStack_align() == TLStack_align.TLSTACK_ALIGN_LEAF); tl_stack_align[1].setMnemonic(AnLocale.getString('f', "MNEM_PRESENT_LEAF")); tl_stack_align[1].addItemListener(this); tl_stack_align[1].setOpaque(false); buttonGroup.add(tl_stack_align[1]); alignment_button_panel.add(tl_stack_align[1]); east_stack_align_panel.add(alignment_button_panel, BorderLayout.CENTER); east_panel.add(east_stack_align_panel); east_panel.add(new JSeparator(SwingConstants.HORIZONTAL)); // --- East, 3nd row: tl_stack_depth final JPanel east_stack_depth_panel = new AnJPanel(new BorderLayout(4, 4)); east_stack_depth_panel.setBorder(AnVariable.boxBorder); txt = AnLocale.getString("Call Stack Magnification Level"); label = new JLabel( AnLocale.getString("Call Stack Magnification: ") + getTimelineSetting().getTLStackFramePixels()); AnUtility.setAccessibleContext(label.getAccessibleContext(), txt); label.setDisplayedMnemonic(AnLocale.getString('C', "MNEM_CallStackMagnification")); label.setAlignmentX(JDialog.LEFT_ALIGNMENT); east_stack_depth_panel.add(label, BorderLayout.NORTH); tl_slider = new JSlider(); tl_slider.setOpaque(false); // tl_slider.setMinimum(0); // tl_slider.setMaximum(TIMELINE_MAX_STACK_DEPTH); tl_slider.setMinimum(TIMELINE_STACK_FRAME_MAGNIFY_MIN); tl_slider.setMaximum(TIMELINE_STACK_FRAME_MAGNIFY_MAX); // tl_slider.setValue(getTimelineSetting().getTLStackDepth()); tl_slider.setValue(getTimelineSetting().getTLStackFramePixels()); tl_slider.setPaintLabels(true); tl_slider.setPaintTicks(true); tl_slider.setPaintTrack(true); tl_slider.setSnapToTicks(false); tl_slider.setMinorTickSpacing(1); // tl_slider.setMajorTickSpacing(9); tl_slider.addChangeListener(new SliderLabelListener(label)); east_stack_depth_panel.add(tl_slider, BorderLayout.CENTER); label.setLabelFor(tl_slider); east_panel.add(east_stack_depth_panel); // add components to top-level panel border_panel.add(center_panel, BorderLayout.CENTER); border_panel.add(east_panel, BorderLayout.EAST); } /** Called every time experiments are loaded */ private void setViewComponents() { createTabSelectionPanel(); settingsDialog.setButtonsEnabled(false); } // Set components in the Tab selection panel private void createTabSelectionPanel() { // System.out.println("Settings.createTabSelectionPanel"); viewsPanel.removeAll(); // Left Panel AnList viewsList = new AnList(false); buildViewsList(viewsList); GridBagConstraints gridBagConstraints; JPanel standardPanel = new AnJPanel(); standardPanel.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; JLabel standardLabel = new JLabel(AnLocale.getString("Standard Views")); standardLabel.getAccessibleContext().setAccessibleDescription(standardLabel.getText()); standardLabel.getAccessibleContext().setAccessibleName(standardLabel.getText()); standardLabel.setBackground(new Color(225, 220, 220)); standardLabel.setOpaque(true); standardLabel.setHorizontalAlignment(JLabel.CENTER); standardLabel.setFont(standardLabel.getFont().deriveFont(Font.BOLD)); standardLabel.setDisplayedMnemonic(AnLocale.getString('S', "SettingsViewsStandardLabelMN")); gridBagConstraints.insets = new Insets(3, 3, 0, 3); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; standardPanel.add(standardLabel, gridBagConstraints); standardPanel.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); AnList stdlist = new AnList(false); buildStdTabList(stdlist); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; standardPanel.add(stdlist, gridBagConstraints); if (standardObjectCheckBoxes.length > 0) { standardLabel.setLabelFor(standardObjectCheckBoxes[0]); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(6, 4, 6, 4); viewsPanel.add(standardPanel, gridBagConstraints); // Center Panel indxlist = new AnList(false); buildIndxTabList(); JPanel indexObjectPanel = new AnJPanel(); indexObjectPanel.setLayout(new GridBagLayout()); JLabel indexObjectLabel = new JLabel(AnLocale.getString("Index Object Views")); indexObjectLabel.getAccessibleContext().setAccessibleDescription(standardLabel.getText()); indexObjectLabel.getAccessibleContext().setAccessibleName(standardLabel.getText()); indexObjectLabel.setBackground(new Color(225, 225, 225)); indexObjectLabel.setOpaque(true); indexObjectLabel.setHorizontalAlignment(JLabel.CENTER); indexObjectLabel.setFont(indexObjectLabel.getFont().deriveFont(Font.BOLD)); indexObjectLabel.setDisplayedMnemonic(AnLocale.getString('w', "SettingsViewsIndexLabelMN")); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(3, 3, 0, 3); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; indexObjectPanel.add(indexObjectLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; indexObjectPanel.add(indxlist, gridBagConstraints); indexObjectPanel.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); if (indexObjectCheckBoxes.length > 0) { indexObjectLabel.setLabelFor(indexObjectCheckBoxes[0]); } // Custom button AnUtility.ResponseAction addCustomIViewButton = new AnUtility.ResponseAction( AnLocale.getString("Add Custom View"), null, AnLocale.getString('u', "MNEM_PRESENT_ADD_CUSTOM_INDXOBJECT"), this); addCustomIViewButton.setToolTipText(AnLocale.getString("Add Index Object Custom View")); // if (GUITesting.getInstance().isRunningUnderGUITesting()) { // addCustomIViewButton.setText("Add Custom Index Objects View"); // } addCustomIViewButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tabs_custom_indx_dlg == null) { tabs_custom_indx_dlg = new CustomIndxDialog(0, frame); } tabs_custom_indx_dlg.setVisible(true); } }); addCustomIViewButton.setMargin(new Insets(0, 4, 0, 4)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(4, 4, 4, 4); indexObjectPanel.add(addCustomIViewButton, gridBagConstraints); // Add the panel gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.insets = new Insets(6, 4, 6, 4); viewsPanel.add(indexObjectPanel, gridBagConstraints); // Right Panel memlist = new AnList(false); buildMemTabList(); JPanel memoryObjectPanel = new AnJPanel(); memoryObjectPanel.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); memoryObjectPanel.setLayout(new GridBagLayout()); JLabel memoryObjectLabel = new JLabel(AnLocale.getString("Memory Object Views")); memoryObjectLabel.getAccessibleContext().setAccessibleDescription(standardLabel.getText()); memoryObjectLabel.getAccessibleContext().setAccessibleName(standardLabel.getText()); memoryObjectLabel.setBackground(new Color(225, 225, 225)); memoryObjectLabel.setOpaque(true); memoryObjectLabel.setHorizontalAlignment(JLabel.CENTER); memoryObjectLabel.setFont(memoryObjectLabel.getFont().deriveFont(Font.BOLD)); memoryObjectLabel.setDisplayedMnemonic(AnLocale.getString('y', "SettingsViewsMemoryLabelMN")); if (memoryObjectCheckBoxes.length > 0) { memoryObjectLabel.setLabelFor(memoryObjectCheckBoxes[0]); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(3, 3, 0, 3); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; memoryObjectPanel.add(memoryObjectLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; memoryObjectPanel.add(memlist, gridBagConstraints); // Custom button AnUtility.ResponseAction customMemoryObjectButton = new AnUtility.ResponseAction( AnLocale.getString("Add Custom View"), null, AnLocale.getString('m', "MNEM_PRESENT_ADD_CUSTOM_MEMOBJECT"), this); customMemoryObjectButton.setToolTipText(AnLocale.getString("Add Memory Object Custom View")); // if (GUITesting.getInstance().isRunningUnderGUITesting()) { // customMemoryObjectButton.setText("Add Custom Memory Objects View"); // } customMemoryObjectButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tabs_custom_mem_dlg == null) { tabs_custom_mem_dlg = new CustomMemDialog(0, frame); } tabs_custom_mem_dlg.setVisible(true); } }); customMemoryObjectButton.setMargin(new Insets(0, 4, 0, 4)); customMemoryObjectButton.setAlignmentX(JButton.RIGHT_ALIGNMENT); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; // gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.insets = new Insets(4, 4, 0, 4); memoryObjectPanel.add(customMemoryObjectButton, gridBagConstraints); JLabel machineModelLabel = new JLabel(); AnUtility.setTextAndAccessibleContext(machineModelLabel, AnLocale.getString("Machine Model:")); machineModelLabel.setDisplayedMnemonic( AnLocale.getString('c', "MN_SETTINGS_VIEWS_Machine_Model")); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.insets = new Insets(4, 4, 0, 4); memoryObjectPanel.add(machineModelLabel, gridBagConstraints); final JComboBox machineModelComboBox = new JComboBox(); machineModelLabel.setLabelFor(machineModelComboBox); AnUtility.setAccessibleContext( machineModelComboBox.getAccessibleContext(), AnLocale.getString("Machine Models")); // add an emptry string machineModelComboBox.addItem(AnLocale.getString("(none)")); // loop over list from DBE String[] choices = getViewsSetting().getAvailableMachineMsodel(); for (int j = 0; j < choices.length; j++) { machineModelComboBox.addItem(choices[j]); } machineModelComboBox.setSelectedIndex(0); if (!((getViewsSetting().getMachineModel() == null) || (getViewsSetting().getMachineModel().equals("")))) { for (int i = 0; i < machineModelComboBox.getItemCount(); i++) { String mn = machineModelComboBox.getItemAt(i); if (mn.equalsIgnoreCase(getViewsSetting().getMachineModel())) { machineModelComboBox.setSelectedIndex(i); break; } } } machineModelComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { String machineModelName = (String) machineModelComboBox.getSelectedItem(); setMachineModel(machineModelComboBox, machineModelName); } @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; memoryObjectPanel.add(machineModelComboBox, gridBagConstraints); // Align button widths int maxWidth = customMemoryObjectButton.getPreferredSize().width; if (machineModelLabel.getPreferredSize().width > maxWidth) { maxWidth = machineModelLabel.getPreferredSize().width; } if (machineModelComboBox.getPreferredSize().width > maxWidth) { maxWidth = machineModelComboBox.getPreferredSize().width; } Dimension dim = new Dimension(maxWidth, customMemoryObjectButton.getPreferredSize().height); customMemoryObjectButton.setPreferredSize(dim); machineModelLabel.setPreferredSize(dim); machineModelComboBox.setPreferredSize(dim); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.insets = new Insets(6, 4, 6, 4); viewsPanel.add(memoryObjectPanel, gridBagConstraints); // Align section widths maxWidth = standardLabel.getPreferredSize().width; if (indexObjectLabel.getPreferredSize().width > maxWidth) { maxWidth = indexObjectLabel.getPreferredSize().width; } if (memoryObjectLabel.getPreferredSize().width > maxWidth) { maxWidth = memoryObjectLabel.getPreferredSize().width; } dim = new Dimension(maxWidth + 30, standardLabel.getPreferredSize().height); standardLabel.setPreferredSize(dim); indexObjectLabel.setPreferredSize(dim); memoryObjectLabel.setPreferredSize(dim); // Sidepanel viewsPanel.validate(); // FIXUP ? viewsPanel.repaint(); // FIXUP ? } private void setMachineModel(final JComboBox comboBox, String machineModelName) { if ((machineModelName == null) || (machineModelName.equals(AnLocale.getString("(none)")))) { machineModelName = ""; } if (machineModelName.equals(getViewsSetting().getMachineModel())) { return; } final String machineModelName2 = machineModelName; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { final String errorMessage = ViewsSetting.loadMachineModelIPC(machineModelName2); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (errorMessage == null) { // Successfully loaded machine model, update gui addCustomIndxMemTab(); // anWindow.getViewPanels().removeAllViews(); // if // loading new machine model, the old machine model views should be removed settingsDialog.setButtonsEnabled(true); getViewsSetting().setMachineModel(machineModelName2); } else { AnUtility.showMessage(viewsPanel, errorMessage, JOptionPane.ERROR_MESSAGE); String machineModelName3 = getViewsSetting().getMachineModel(); if ((machineModelName3 == null) || (machineModelName3.equals(""))) { machineModelName3 = AnLocale.getString("(none)"); } for (int i = 0; i < comboBox.getItemCount(); i++) { String mn = comboBox.getItemAt(i); if (mn.equalsIgnoreCase(machineModelName3)) { comboBox.setSelectedIndex(i); break; } } } } }); } }, "machinemodelcomboboxupdate"); } // Build the list of checkboxes for the Views private void buildViewsList(AnList list) { // System.out.println("Settings.buildViewsList"); JPanel chk_panel; String[] tab_names; char[] tab_mnems; // Add column header chk_panel = new AnJPanel(new GridLayout(1, 1)); list.add(AnUtility.getItem(AnLocale.getString("Views")), chk_panel); list.getAccessibleContext() .setAccessibleDescription(AnLocale.getString("List of views to choose from")); list.add((JComponent) null, new AnJPanel()); final JPanel sep_panel = new AnJPanel(new GridLayout(1, 1)); sep_panel.add(new JSeparator()); list.add((JComponent) null, sep_panel); List views_tablist = getViewsSetting().getStaticViews(); tab_names = new String[views_tablist.size()]; tab_mnems = new char[views_tablist.size()]; for (int i = 0; i < views_tablist.size(); i++) { tab_names[i] = views_tablist.get(i).getAnDispTab().getTName(); tab_mnems[i] = views_tablist.get(i).getAnDispTab().getTMnem(); } // Compose the list of checkboxes staticViewCheckBoxes = new AnUtility.AnCheckBox[tab_names.length]; // Compose standard tabs checklist for (int i = 0; i < staticViewCheckBoxes.length; i++) { chk_panel = new AnJPanel(new GridLayout(1, 2)); chk_panel.add(staticViewCheckBoxes[i] = new AnUtility.AnCheckBox(" ", true)); // <=== FIXUP staticViewCheckBoxes[i].addItemListener(this); JLabel itemlabel = (JLabel) AnUtility.getItem(tab_names[i]); // itemlabel.setDisplayedMnemonic(tab_mnems[i]); itemlabel.setLabelFor(staticViewCheckBoxes[i]); AnUtility.setAccessibleContext(itemlabel.getAccessibleContext(), tab_names[i]); list.add(itemlabel, chk_panel); } // Sidepanel if (views_tablist != null) { for (ViewsSetting.View view : views_tablist) { anWindow.getViewsPanel().createView(anWindow, view.getAnDispTab(), View.Type.STATIC_VIEW); } } } // Build the list of checkboxes for the standard tabs private void buildStdTabList(AnList list) { JPanel chk_panel; String[] tab_names; char[] tab_mnems; JLabel itemlabel; // Add column header chk_panel = new AnJPanel(); list.getAccessibleContext() .setAccessibleDescription(AnLocale.getString("List of Views to choose from")); List standard_tablist = getViewsSetting().getStandardViews(); tab_names = new String[standard_tablist.size()]; tab_mnems = new char[standard_tablist.size()]; for (int i = 0; i < standard_tablist.size(); i++) { tab_names[i] = standard_tablist.get(i).getAnDispTab().getTName(); tab_mnems[i] = standard_tablist.get(i).getAnDispTab().getTMnem(); } if (tab_names == null) { return; } // Compose the list of checkboxes standardObjectCheckBoxes = new AnUtility.AnCheckBox[tab_names.length]; // Compose standard tabs checklist for (int i = 0; i < standardObjectCheckBoxes.length; i++) { ViewsSetting.View view = standard_tablist.get(i); chk_panel = new AnJPanel(new GridLayout(1, 2)); chk_panel.add(standardObjectCheckBoxes[i] = new AnUtility.AnCheckBox(" ", view.isSelected())); standardObjectCheckBoxes[i].addItemListener(this); itemlabel = (JLabel) AnUtility.getItem(tab_names[i]); AnUtility.setAccessibleContext(itemlabel.getAccessibleContext(), tab_names[i]); AnUtility.setAccessibleContext( standardObjectCheckBoxes[i].getAccessibleContext(), tab_names[i]); list.add(itemlabel, chk_panel); } // Sidepanel if (standard_tablist != null) { for (ViewsSetting.View view : standard_tablist) { anWindow.getViewsPanel().createView(anWindow, view.getAnDispTab(), View.Type.STANDARD); } } } // Build the list of checkboxes for the memory object tabs private void buildMemTabList() { JLabel memlabel; memlist.removeAll(); // Add column header memchk_panel = new AnJPanel(new GridLayout(1, 1)); memlist .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("List of memory object Views to choose from")); List mem_tablist = getViewsSetting().getMemoryViews(); // Compose memory object tabs checklist memoryObjectCheckBoxes = new AnUtility.AnCheckBox[mem_tablist.size()]; for (int i = 0; i < memoryObjectCheckBoxes.length; i++) { ViewsSetting.View view = mem_tablist.get(i); memchk_panel = new AnJPanel(new GridLayout(1, 2)); memchk_panel.add( memoryObjectCheckBoxes[i] = new AnUtility.AnCheckBox(" ", view.isSelected())); memoryObjectCheckBoxes[i].addItemListener(this); memlabel = (JLabel) AnUtility.getItem(view.getAnDispTab().getTName()); AnUtility.setAccessibleContext( memlabel.getAccessibleContext(), view.getAnDispTab().getTName()); AnUtility.setAccessibleContext( memoryObjectCheckBoxes[i].getAccessibleContext(), view.getAnDispTab().getTName()); memlist.add(memlabel, memchk_panel); } memlist.revalidate(); // Sidepanel if (mem_tablist != null) { for (ViewsSetting.View view : mem_tablist) { anWindow.getViewsPanel().createView(anWindow, view.getAnDispTab(), View.Type.MEMORY); } } } // Build the list of checkboxes for the index object tabs private void buildIndxTabList() { JLabel indxlabel; indxlist.removeAll(); // Add column header indxchk_panel = new AnJPanel(new GridLayout(1, 1)); indxlist .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("List of index object Vews to choose from")); List indx_tablist = getViewsSetting().getIndexViews(); // Compose index object tabs checklist indexObjectCheckBoxes = new AnUtility.AnCheckBox[indx_tablist.size()]; for (int i = 0; i < indexObjectCheckBoxes.length; i++) { ViewsSetting.View view = indx_tablist.get(i); indxchk_panel = new AnJPanel(new GridLayout(1, 2)); indxchk_panel.add( indexObjectCheckBoxes[i] = new AnUtility.AnCheckBox(" ", view.isSelected())); indexObjectCheckBoxes[i].addItemListener(this); indxlabel = (JLabel) AnUtility.getItem(view.getAnDispTab().getTName()); AnUtility.setAccessibleContext( indxlabel.getAccessibleContext(), view.getAnDispTab().getTName()); AnUtility.setAccessibleContext( indexObjectCheckBoxes[i].getAccessibleContext(), view.getAnDispTab().getTName()); indxlist.add(indxlabel, indxchk_panel); } indxlist.revalidate(); // Sidepanel if (indx_tablist != null) { for (ViewsSetting.View view : indx_tablist) { anWindow.getViewsPanel().createView(anWindow, view.getAnDispTab(), View.Type.INDEX); } } } private void updateTLDataCheckBoxes() { tl_type_panel.removeAll(); tldata_checkBoxes = new ArrayList<>(); // Does listener result in leak? List tldata_unames = timelineSetting.getTLDataUNames(); long tldata_check_hidden_bitmask = timelineSetting.getTLDataHiddenMask(); for (int i = 0; i < tldata_unames.size(); i++) { long hidden = ((1L << i) & tldata_check_hidden_bitmask); JCheckBox check = new AnUtility.AnCheckBox(tldata_unames.get(i), (hidden == 0)); check.addItemListener(this); tl_type_panel.add(check); tldata_checkBoxes.add(check); } tl_type_panel.revalidate(); } // Update show source with/without metrics in disassembly display public void itemStateChanged(final ItemEvent event) { final Object source = event.getItemSelectable(); if (source == dis_src) { if (event.getStateChange() == ItemEvent.DESELECTED) { dis_asrc.setSelected(false); } } else if (source == dis_asrc) { if (event.getStateChange() == ItemEvent.SELECTED) { dis_src.setSelected(true); } } if (settingsDialog != null) { settingsDialog.setButtonsEnabled(true); } } // Action performed public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("OK")) || cmd.equals(AnLocale.getString("Apply"))) { apply(); } else if (cmd.equals(AnLocale.getString("Export..."))) { new ExportSettingsDialog(frame).setVisible(true); } else if (cmd.equals(AnLocale.getString("Import..."))) { new ImportSettingsDialog(frame).setVisible(true); } } private void updateMemTab() { Object[] memObjs = ViewsSetting.getMemObjectsIPC(); // IPC boolean[] memSelected = ViewsSetting.getMemTabSelectionStateIPC(); // IPC // Copy the check box states (may not yet be saved) for (int i = 0; i < memoryObjectCheckBoxes.length; i++) { JCheckBox checkBox = memoryObjectCheckBoxes[i]; if (i < memSelected.length) { memSelected[i] = checkBox.isSelected(); } } getViewsSetting().updateMemoryObjects(null, memObjs, memSelected); } private void addCustomMemTab() { // System.out.println("Settings.addCustomMemTab"); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { updateMemTab(); } }, "custommemtab"); } // Dialog to add custom memory object tab private class CustomMemDialog extends AnDialog { JTextField obj_name; AnUtility.AnTextArea formula_field; public CustomMemDialog(int win_id, final Frame frame) { super( anWindow, frame, AnLocale.getString("Add Memory Object"), false, null, null, AnVariable.HELP_CustomMemTab, true); initComponents(); } // Initialize GUI components private void initComponents() { setAccessory(setCustomPanel()); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); } // Action performed @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("OK")) || cmd.equals(AnLocale.getString("Apply"))) { String formula = formula_field.getText(); String formula_str = formula.replaceAll("\n", " "); AnUtility.checkIPCOnWrongThread(false); String sts = ViewsSetting.defineMemObjIPC( obj_name.getText(), formula_str, null, null); // IPC // CXXX add descriptions AnUtility.checkIPCOnWrongThread(true); if (sts == null) { // Successfully added new object, repaint mem checkboxes // Clear the text fields getViewsSetting() .addCustomMemoryObject( obj_name.getText(), formula_str, null, null); // CXXX add descriptions formula_field.setText(""); obj_name.setText(""); addCustomMemTab(); settingsDialog.setButtonsEnabled(true); } else { // Don't clear the text fields, so the user can correct an error AnUtility.showMessage(tabs_custom_mem_dlg, sts, JOptionPane.ERROR_MESSAGE); } } } private JPanel setCustomPanel() { JPanel basePanel, namePanel, formulaPanel; JLabel name_label, formula_label; basePanel = new AnJPanel(new GridBagLayout()); // basePanel.setBorder(AnVariable.fieldBorder); // Add name panel namePanel = new AnJPanel(); namePanel.setLayout(new BorderLayout()); namePanel.setBorder(AnVariable.fieldBorder); name_label = (JLabel) AnUtility.getTitle(AnLocale.getString("Object Name:")); name_label.setDisplayedMnemonic(AnLocale.getString('O', "MNEM_CUSTOMOBJ_NAME")); namePanel.add(name_label, BorderLayout.NORTH); obj_name = new JTextField(15); name_label.setLabelFor(obj_name); AnUtility.setAccessibleContext(obj_name.getAccessibleContext(), name_label.getText()); namePanel.add(obj_name, BorderLayout.CENTER); // Add formula panel formulaPanel = new AnJPanel(); formulaPanel.setLayout(new BorderLayout()); formulaPanel.setBorder(AnVariable.fieldBorder); formula_label = (JLabel) AnUtility.getTitle(AnLocale.getString("Formula:")); formula_label.setDisplayedMnemonic(AnLocale.getString('F', "MNEM_CUSTOMOBJ_FORMULA")); formulaPanel.add(formula_label, BorderLayout.NORTH); formula_field = new AnUtility.AnTextArea("", true); AnUtility.setAccessibleContext(formula_field.getAccessibleContext(), formula_label.getText()); formula_field.setLineWrap(true); formula_field.setWrapStyleWord(true); // formula_field.setFont(CollectUtility.text_font); JScrollPane form_scroll = new AnJScrollPane( formula_field, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); form_scroll.setPreferredSize(new Dimension(getPreferredSize().width, 120)); form_scroll.setBorder(BorderFactory.createLineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR)); formula_label.setLabelFor(formula_field); formulaPanel.add(form_scroll, BorderLayout.CENTER); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; // gridBagConstraints.insets = new Insets(8, 8, 0, 8); basePanel.add(namePanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; // gridBagConstraints.insets = new Insets(0, 8, 0, 8); basePanel.add(formulaPanel, gridBagConstraints); return basePanel; } } // class CustomMemDialog private void updateIndxTab() { Object[] indxObjs = ViewsSetting.getIndxObjDescriptionsIPC(); // IPC boolean[] indxSelected = ViewsSetting.getIndxTabSelectionStateIPC(); // IPC // Copy the check box states (may not yet be saved) for (int i = 0; i < indexObjectCheckBoxes.length; i++) { JCheckBox checkBox = indexObjectCheckBoxes[i]; if (i < indxSelected.length) { indxSelected[i] = checkBox.isSelected(); } } getViewsSetting().updateIndexObjects(null, indxObjs, indxSelected); // Will fire change event } private void addCustomIndxTab() { // System.out.println("Settings.addCustomIndxTab"); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { updateIndxTab(); } }, "customindxtab"); } private void updateIndxMemTab() { Object[] indxObjs = ViewsSetting.getIndxObjDescriptionsIPC(); // IPC boolean[] indxSelected = ViewsSetting.getIndxTabSelectionStateIPC(); // IPC // Copy the check box states (may not yet be saved) for (int i = 0; i < indexObjectCheckBoxes.length; i++) { JCheckBox checkBox = indexObjectCheckBoxes[i]; if (i < indxSelected.length) { indxSelected[i] = checkBox.isSelected(); } } Object[] memObjs = ViewsSetting.getMemObjectsIPC(); // IPC boolean[] memSelected = ViewsSetting.getMemTabSelectionStateIPC(); // IPC // Copy the check box states (may not yet be saved) for (int i = 0; i < memoryObjectCheckBoxes.length; i++) { JCheckBox checkBox = memoryObjectCheckBoxes[i]; if (i < memSelected.length) { memSelected[i] = checkBox.isSelected(); } } getViewsSetting().updateIndexMemoryObjects(null, indxObjs, indxSelected, memObjs, memSelected); } private void addCustomIndxMemTab() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { updateIndxMemTab(); } }, "customindxmemtab"); } // Dialog to add custom index object tab private class CustomIndxDialog extends AnDialog { JTextField obj_name; AnUtility.AnTextArea formula_field; public CustomIndxDialog(int win_id, final Frame frame) { super( anWindow, frame, AnLocale.getString("Add Index Object"), false, null, null, AnVariable.HELP_CustomIndxTab, true); initComponents(); } // Initialize GUI components private void initComponents() { setAccessory(setCustomPanel()); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); } // Action performed @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("OK")) || cmd.equals(AnLocale.getString("Apply"))) { String formula = formula_field.getText(); String formula_str = formula.replaceAll("\n", " "); AnUtility.checkIPCOnWrongThread(false); String sts = ViewsSetting.defineIndxObjIPC( obj_name.getText(), formula_str, null, null); // IPC // CXXX add descriptions AnUtility.checkIPCOnWrongThread(true); if (sts == null) { // Successfully added new object, repaint indx checkboxes getViewsSetting() .addCustomIndexObject( obj_name.getText(), formula_str, null, null); // CXXX add descriptions addCustomIndxTab(); // clear the fields for the next definition formula_field.setText(""); obj_name.setText(""); settingsDialog.setButtonsEnabled(true); } else { AnUtility.showMessage(tabs_custom_indx_dlg, sts, JOptionPane.ERROR_MESSAGE); } } } private JPanel setCustomPanel() { JPanel basePanel, namePanel, formulaPanel; JLabel name_label, formula_label; basePanel = new AnJPanel(new GridBagLayout()); // basePanel.setBorder(AnVariable.fieldBorder); // Add name panel namePanel = new AnJPanel(); namePanel.setLayout(new BorderLayout()); namePanel.setBorder(AnVariable.fieldBorder); name_label = (JLabel) AnUtility.getTitle(AnLocale.getString("Object Name:")); name_label.setDisplayedMnemonic(AnLocale.getString('O', "MNEM_CUSTOMOBJ_NAME")); namePanel.add(name_label, BorderLayout.NORTH); obj_name = new JTextField(15); name_label.setLabelFor(obj_name); AnUtility.setAccessibleContext(obj_name.getAccessibleContext(), name_label.getText()); namePanel.add(obj_name, BorderLayout.CENTER); // Add formula panel formulaPanel = new AnJPanel(); formulaPanel.setLayout(new BorderLayout()); formulaPanel.setBorder(AnVariable.fieldBorder); formula_label = (JLabel) AnUtility.getTitle(AnLocale.getString("Formula:")); formula_label.setDisplayedMnemonic(AnLocale.getString('F', "MNEM_CUSTOMOBJ_FORMULA")); formulaPanel.add(formula_label, BorderLayout.NORTH); formula_field = new AnUtility.AnTextArea("", true); AnUtility.setAccessibleContext(formula_field.getAccessibleContext(), formula_label.getText()); formula_field.setLineWrap(true); formula_field.setWrapStyleWord(true); // formula_field.setFont(CollectUtility.text_font); JScrollPane form_scroll = new AnJScrollPane( formula_field, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); form_scroll.setPreferredSize(new Dimension(getPreferredSize().width, 120)); form_scroll.setBorder(BorderFactory.createLineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR)); formula_label.setLabelFor(formula_field); formulaPanel.add(form_scroll, BorderLayout.CENTER); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; basePanel.add(namePanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; basePanel.add(formulaPanel, gridBagConstraints); return basePanel; } } private void checkTimelineChanged(Object originalSource) { Object newTm = getTimelineSettings(needsTimelineEvent); needsTimelineEvent = false; getTimelineSetting() .set( originalSource, (List) newTm, newTm != null); // Will fire AnChangeEvent if settings have changed } public Object edt_getTimelineOptions() { Object obj = getTimelineSettings(true); return obj; } private void checkSearchPathChanged(Object originalSource) { searchPathPanel.checkSearchPathChanged(originalSource); } private void checkPathMapChanged(Object originalSource) { // pathMapPanel.checkPathMapChanged(originalSource); pathmapsPanel.checkPathMapChanged(originalSource); } private void checkCallTreeChanges(Object originalSource) { callTreePanel.checkChanges(originalSource); } private void checkViewsChanges(Object originalSource) { boolean[] values = new boolean [staticViewCheckBoxes.length + standardObjectCheckBoxes.length + indexObjectCheckBoxes.length + memoryObjectCheckBoxes.length]; int index = 0; for (int i = 0; i < staticViewCheckBoxes.length; i++) { values[index++] = ((JCheckBox) staticViewCheckBoxes[i]).isSelected(); } for (int i = 0; i < standardObjectCheckBoxes.length; i++) { values[index++] = ((JCheckBox) standardObjectCheckBoxes[i]).isSelected(); } for (int i = 0; i < indexObjectCheckBoxes.length; i++) { values[index++] = ((JCheckBox) indexObjectCheckBoxes[i]).isSelected(); } for (int i = 0; i < memoryObjectCheckBoxes.length; i++) { values[index++] = ((JCheckBox) memoryObjectCheckBoxes[i]).isSelected(); } getViewsSetting().set(originalSource, values); } // Update display private void applyChanges() { // Keep this order is mandatory; setVisible -> setSort -> setOrder. checkMetricsChanged(this); // Will fire AnChangeEvent if changed checkSourceDisassemblyChanged(this); // Will fire AnChangeEvent if changed checkCompareModeChanged(this); // Will fire AnChangeEvent if changed checkViewModeChanged(this); // Will fire AnChangeEvent if changed checkFormatChanged(this); // Will fire AnChangeEvent if changed checkWrapNameChanged(this); // Will fire AnChangeEvent if changed checkTimelineChanged(this); // Will fire AnChangeEvent if changed checkSearchPathChanged(this); // Will fire AnChangeEvent if changed checkPathMapChanged(this); // Will fire AnChangeEvent if changed checkCallTreeChanges(this); // Will fire AnChangeEvent if changed checkViewsChanges(this); // Will fire AnChangeEvent if changed } // Set annotated visibility & check whether recompute is needed or not private void checkSourceDisassemblyChanged(Object originalsource) { final int[] anno_set; int new_vis_src; int new_vis_dis; final int new_threshold_src; final int new_threshold_dis; final boolean new_src_visible; final boolean new_src_metric; final boolean new_hex_visible; final boolean new_cmp_visible; final boolean new_scope_only; final boolean new_func_visible; // Get new Compiler Commentary visibility new_vis_src = new_vis_dis = 0; for (int i = 0; i < size_ccmv; i++) { if (((JCheckBox) src_chks[i]).isSelected()) { new_vis_src |= ccmv_type[i]; } if (((JCheckBox) dis_chks[i]).isSelected()) { new_vis_dis |= ccmv_type[i]; } } if (vis_src != new_vis_src) { vis_src = new_vis_src; } if (vis_dis != new_vis_dis) { vis_dis = new_vis_dis; } // Get new Highlighting Threshold new_threshold_src = Integer.parseInt(((JTextField) threshold[0]).getText()); if (threshold_src != new_threshold_src) { threshold_src = new_threshold_src; } new_threshold_dis = Integer.parseInt(((JTextField) threshold[1]).getText()); if (threshold_dis != new_threshold_dis) { threshold_dis = new_threshold_dis; } // Get new Disassembly Listing visibility new_src_visible = dis_src.isSelected(); if (src_visible != new_src_visible) { src_visible = new_src_visible; } new_src_metric = dis_asrc.isSelected(); if (src_metric != new_src_metric) { src_metric = new_src_metric; } new_hex_visible = dis_hex.isSelected(); if (hex_visible != new_hex_visible) { hex_visible = new_hex_visible; } new_cmp_visible = cmp_line.isSelected(); if (cmp_visible != new_cmp_visible) { cmp_visible = new_cmp_visible; } new_func_visible = func_line.isSelected(); if (func_visible != new_func_visible) { func_visible = new_func_visible; } new_scope_only = dis_scope.isSelected(); if (scope_only != new_scope_only) { scope_only = new_scope_only; } anno_set = new int[10]; anno_set[0] = vis_src; anno_set[1] = vis_dis; anno_set[2] = threshold_src; anno_set[3] = threshold_dis; anno_set[4] = src_visible ? 1 : 0; anno_set[5] = src_metric ? 1 : 0; anno_set[6] = hex_visible ? 1 : 0; anno_set[7] = cmp_visible ? 1 : 0; anno_set[8] = scope_only ? 1 : 0; anno_set[9] = func_visible ? 1 : 0; getSourceDisassemblySetting() .set(originalsource, anno_set); // Will fire AnChangeevent if changes } private void checkCompareModeChanged(Object originalsource) { CompareMode newMode = !cmpModeLabel.isEnabled() ? CompareMode.CMP_DISABLE : cmp_abs_value.isSelected() ? CompareMode.CMP_ENABLE : cmp_delta.isSelected() ? CompareMode.CMP_DELTA : CompareMode.CMP_RATIO; getCompareModeSetting().set(originalsource, newMode); // Will fire AnChangeevent if changes } private void checkFormatChanged(Object originalsource) { FormatSetting.Style newStyle = mangled_fmt.isSelected() ? FormatSetting.Style.MANGLED : long_fmt.isSelected() ? FormatSetting.Style.LONG : FormatSetting.Style.SHORT; boolean newAppendSoName = soname_chk.isSelected(); formatSetting.set( originalsource, newStyle, newAppendSoName); // Will fire AnChangeevent if changes } private void checkWrapNameChanged(Object originalsource) { getTableSettings() .setWrapMetricNames( originalsource, wrapNameCheckBox.isSelected()); // Will fire AnChangeevent if changes } private void checkViewModeChanged(Object originalsource) { ViewMode newViewMode; if (view_fmt.isSelected()) { newViewMode = ViewMode.USER; } else if (view_expert_fmt.isSelected()) { newViewMode = ViewMode.EXPERT; } else { newViewMode = ViewMode.MACHINE; } getViewModeSetting().set(originalsource, newViewMode); // Will fire AnChangeevent if changes } // Set timeline whether recompute is needed or not public Object getTimelineSettings(boolean forceReturnState) { AnUtility.checkIfOnAWTThread(true); boolean new_tm = false; // tl_entity (CPU,LWP, etc) String new_tl_entity_prop_name = UserPref.getInstance().getTimelineGroupDataByButtonName(); int new_tl_entity_button_num = 0; for (int ii = 0; ii < tl_entity_button.size(); ii++) { if (tl_entity_button.get(ii).isSelected()) { TimelineSetting.EntityProp entityProp = getTimelineSetting().getTl_entity_prop(ii); if (entityProp != null) { new_tl_entity_prop_name = entityProp.prop_name; new_tl_entity_button_num = ii; } else { int xx = 1; // weird, could not find matching string. } break; } } if (getTimelineSetting().getTl_entity_selected_btn() != new_tl_entity_button_num) { new_tm = true; } boolean doShow = tldata_show_states_cb.isSelected(); if (tldata_show_states != doShow) { tldata_show_states = doShow; new_tm = true; } doShow = tldata_show_counts_cb.isSelected(); if (tldata_show_counts != doShow) { tldata_show_counts = doShow; new_tm = true; } // Stack mode final TLStack_align new_stack_align = (tl_stack_align[0].isSelected() ? TLStack_align.TLSTACK_ALIGN_ROOT : TLStack_align.TLSTACK_ALIGN_LEAF); if (getTimelineSetting().getStack_align() != new_stack_align) { new_tm = true; } // Stack depth // final int new_stack_depth = tl_slider.getValue(); // if (getTimelineSetting().getTLStackDepth() != new_stack_depth) { final int new_stack_depth = getTimelineSetting().getTLStackDepth(); // YXXX not sure if this is right... THP? if (tldata_stack_depth != new_stack_depth) { new_tm = true; } // Stack magnify final int new_stack_frame_pixels = tl_slider.getValue() + TIMELINE_STACK_FRAME_MAGNIFY_OFFSET; if (getTimelineSetting().getTLStackFramePixels() != new_stack_frame_pixels) { new_tm = true; } // synchronized (tldata_sync) { { // Data type int tldata_names_version = timelineSetting.getTLDataNamesVersion(); if (previous_tldata_names_version != tldata_names_version) { previous_tldata_names_version = tldata_names_version; new_tm = true; } long new_disable_mask; long tldata_check_hidden_bitmask = timelineSetting.getTLDataHiddenMask(); if (tldata_checkBoxes.isEmpty()) { new_disable_mask = tldata_check_hidden_bitmask; } else { new_disable_mask = 0; for (int i = 0; i < tldata_checkBoxes.size(); i++) { JCheckBox check = tldata_checkBoxes.get(i); if (!check.isSelected()) { long mask = (1L << i); new_disable_mask |= mask; } } if (tldata_check_hidden_bitmask != new_disable_mask) { timelineSetting.setTLDataHiddenMask(new_disable_mask); new_tm = true; } } // TBR? // if (new_tm) { // String tldata_cmd = timelineSetting.edt_update_tldata_cmd(); //// setTLValue(tldata_cmd, //YXXX does DBE really need to know this?? //// new_tl_entity_prop_id, new_stack_align.getValue(), //// new_stack_depth);// IPC!! // } if (new_tm) { needsTimelineEvent = true; } if (!forceReturnState && !new_tm) { return null; } // return values final ArrayList newtm_evt = new ArrayList<>(); // AnSettingChangeEvent.Type.TIMELINE event newtm_evt.add(new_tl_entity_prop_name); // 0 newtm_evt.add(new_tl_entity_button_num); // 1 newtm_evt.add(new_stack_align); // 2 newtm_evt.add(Integer.valueOf(new_stack_depth)); // 3 newtm_evt.add(Long.valueOf(new_disable_mask)); // 4 newtm_evt.add(timelineSetting.getTLDataCNames()); // 5 newtm_evt.add(timelineSetting.getTLDataUNames()); // 6 newtm_evt.add(Integer.valueOf(previous_tldata_names_version)); // 7 newtm_evt.add(Boolean.valueOf(tldata_show_states)); // 8 newtm_evt.add(Boolean.valueOf(tldata_show_counts)); // 9 newtm_evt.add(Integer.valueOf(new_stack_frame_pixels)); // 10 newtm_evt.add(timelineSetting.getTLDataCmd()); // 11 return newtm_evt; } // synchronized (tldata_sync) { } // Set visibility & check whether recompute is needed or not private void checkMetricsChanged(Object originalSource) { List list = metricsPanel.getMetricNameSelections(); getMetricsSetting().set(originalSource, list); // will fire AnChangeEvent if changed } // Apply changes made in Preferences dialog private void apply() { applyChanges(); settingsDialog.setButtonsEnabled(false); } // Show dialog for Save preferences public void saveAsDotErRc() { String homeDir; String workingDir = Analyzer.getInstance().getWorkingDirectory(); if (Analyzer.getInstance().isRemote()) { homeDir = AnWindow.getInstance().getHomeDir(); // IPC } else { homeDir = Analyzer.home_dir; } final Object[] options = {currentDirStr + workingDir, homeDirStr + homeDir}; Object result = JOptionPane.showInputDialog( tabbedPane, AnLocale.getString("Save Settings in:"), AnLocale.getString("Save Settings"), JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); String resultString = (String) result; if (resultString == null) { // Nothing } else if (resultString.equals(options[0])) { save(workingDir); } else if (resultString.equals(options[1])) { save(homeDir); } } // Save preferences private void save(final String dir) { final String path = dir + "/.er.rc"; // apply changes before saving (CR 6387624) apply(); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { PrintWriter pw = null; // Check if file exists AnFile afile = anWindow.getAnFile(path); if (afile.exists()) { // Show confirmation dialog final String title = AnLocale.getString("Overwrite file?"); final String message = AnLocale.getString("File: ") + path + AnLocale.getString(" exists. Do you want to overwrite it?"); int res = JOptionPane.showConfirmDialog( tabbedPane, message, title, JOptionPane.YES_NO_OPTION); if (res != JOptionPane.YES_OPTION) { return; } } String localPath = path; if (Analyzer.getInstance().isRemote()) { localPath = AnWindow.tempFile().getAbsolutePath(); } try { pw = new PrintWriter(new BufferedWriter(new FileWriter(localPath))); write(pw); } catch (IOException e) { AnUtility.showMessage(tabbedPane, e.toString(), JOptionPane.ERROR_MESSAGE); } finally { if (pw != null) { pw.close(); } } if (Analyzer.getInstance().isRemote()) { int res = AnWindow.copyToRemote(localPath, path); if (res < 0) { System.err.println("Settings:copyToRemote failed: " + res); } } } }, "Presentation_thread"); } // Write preferences private void write(final PrintWriter pw) { AnMetric sortMetric; String abbr, comd, vstr; char stype, sort_stype; boolean visible, tvisible, pvisible, sort_visible; final List path; sortMetric = null; sort_stype = '\0'; sort_visible = true; // Write dmetrics pw.print("dmetrics "); // final AnMetric[] mlist = order_list.getMetrics(); final AnMetric[] mlist = getMetricsSetting().getMetricListByMType(0); int last = mlist.length - 1; String prevcmd = ""; int prevsubtype = -1; for (int i = 0; i < mlist.length; i++) { AnMetric mitem = mlist[i]; // YXXX quick/dirty workaround for adjacent duplicate items caused by comparison String thiscmd = mitem.getComd(); if (thiscmd.equalsIgnoreCase(prevcmd) && mitem.getSubType() == prevsubtype) { continue; } prevcmd = thiscmd; prevsubtype = mitem.getSubType(); // Subtype abbr = mitem.getAbbr(); // YXXX shouldn't we use getSubType() instead? if (mitem.getSubType() == AnMetric.EXCLUSIVE) { stype = 'e'; } else if (mitem.getSubType() == AnMetric.INCLUSIVE) { stype = 'i'; } else { stype = '\0'; } // Sort visible = mitem.isVVisible(); tvisible = mitem.isTVisible(); pvisible = mitem.isPVisible(); if (mitem.isSorted()) { sortMetric = mitem; sort_stype = stype; sort_visible = (visible || tvisible || pvisible); } // Visibility if (stype == '\0') { if (!visible) { pw.print('!'); } } else { pw.print(stype); vstr = ""; if (mitem.is_time_val()) { if (visible) { vstr += '+'; } if (tvisible) { vstr += '.'; } } else if (visible || tvisible) { vstr += '.'; } if (pvisible) { vstr += '%'; } if (vstr.equals("")) { pw.print('!'); } else { pw.print(vstr); } } // Type comd = mitem.getComd(); if (i == last) { pw.println(comd); } else { pw.print(comd + ":"); } } // Write dsort if (sortMetric != null) { pw.print("dsort "); if (sort_stype != '\0') { pw.print(sort_stype); pw.print(sort_visible ? '.' : '!'); } else if (!sort_visible) { pw.print('!'); } pw.println(sortMetric.getComd()); } // Write Compiler Commentary visibility pw.println("scc " + getCompComm(vis_src, false, false, false, false, false, false)); pw.println( "dcc " + getCompComm( vis_dis, !src_visible, src_visible, src_metric, hex_visible, cmp_visible, scope_only)); // Write the threshold pw.println("sthresh " + threshold_src); pw.println("dthresh " + threshold_dis); // Write name formats pw.println("name " + formatSetting.getStyle().name().toLowerCase()); // Write view mode pw.println("view " + getViewModeSetting().get().name().toLowerCase()); // TBR? // Write timeline mode // int btn = getTimelineSetting().getTl_entity_selected_btn(); // TimelineSetting.EntityProp entityProp = // getTimelineSetting().getTl_entity_prop(btn); // if(entityProp!=null){ // String modecmd = entityProp.prop_cmd; // pw.println("tlmode " + // modecmd // + ":" + getTimelineSetting().getStack_align().toString().toLowerCase() + // ":depth=" + getTimelineSetting().getTLStackDepth()); // } // synchronized (tldata_sync) { { // String tldata_cmd = timelineSetting.edt_update_tldata_cmd(); // pw.println("tldata all" + tldata_cmd); // tldata_unused_cnames.clear(); // dump unused baggage } // Write search path path = getSearchPathSetting().get(); last = path.size() - 1; if (last >= 0) { comd = "addpath "; for (int i = 0; i <= last; i++) { comd += path.get(i); if (i != last) { comd += ":"; } } pw.println(comd); } String[] from = AnWindow.getInstance().getSettings().getPathMapSetting().getPathMapFrom(); String[] to = AnWindow.getInstance().getSettings().getPathMapSetting().getPathMapTo(); if (from.length == to.length) { for (int i = 0; i < from.length; i++) { pw.println("pathmap " + from[i] + " " + to[i]); } } // Save the custom index object defines Object[] custom_list = ViewsSetting.getCustomIndxObjectsIPC(); if (custom_list != null) { String[] cnames = (String[]) custom_list[0]; // Names of custom index objects String[] expr = (String[]) custom_list[1]; // Formula for custom index object for (int i = 0; i < cnames.length; i++) { StringBuffer defineComd = new StringBuffer("indxobj_define "); defineComd.append(cnames[i] + " \"" + expr[i] + "\""); pw.println(defineComd); } } } // Get Compiler Commentary visibility command private static String getCompComm( final int vis_bits, final boolean no_src, final boolean show_src, final boolean show_asrc, final boolean show_hex, final boolean show_cmp, final boolean scope_only) { String str = ""; boolean first = true; for (int i = 0; i < size_ccmv; i++) { if ((vis_bits & ccmv_type[i]) != 0) { if (first) { first = false; } else { str += ":"; } str += ccmv_comd[i]; } } // Got nothing if (first) { str = "none"; } // Set source visibility for disasm if (no_src) { str += ":nosrc"; } if (show_src) { str += ":src"; } if (show_asrc) { str += ":asrc"; } // Set hexadecimal visibility of instruction if (show_hex) { str += ":hex"; } if (show_cmp) { str += ":cf"; } if (scope_only) { str += ":scope"; } return str; } // ---------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------- public void toggleDisFuncScope() { scope_only = !scope_only; dis_scope.setSelected(scope_only); checkSourceDisassemblyChanged(this); // Will fire AnChangeEvent if changed } @Override public void stateChanged(final ChangeEvent e) { settingsDialog.setButtonsEnabled(true); } @Override public void insertUpdate(final DocumentEvent e) { settingsDialog.setButtonsEnabled(true); } @Override public void removeUpdate(final DocumentEvent e) { settingsDialog.setButtonsEnabled(true); } @Override public void changedUpdate(final DocumentEvent e) { settingsDialog.setButtonsEnabled(true); } // Native methods from liber_dbe.so public static AnMetric[] getMetricList(final Object[] ref_data) { final int msize = ((int[]) ref_data[0]).length; AnMetric[] mlist = new AnMetric[msize]; final int[] type = (int[]) ref_data[0]; final int[] subtype = (int[]) ref_data[1]; final int[] clock = (int[]) ref_data[2]; final int[] flavors = (int[]) ref_data[3]; final int[] value_styles = (int[]) ref_data[4]; final String[] user_name = (String[]) ref_data[5]; final String[] expr_spec = (String[]) ref_data[6]; final String[] aux = (String[]) ref_data[7]; final String[] name = (String[]) ref_data[8]; final String[] abbr = (String[]) ref_data[9]; final String[] comd = (String[]) ref_data[10]; final String[] unit = (String[]) ref_data[11]; final int[] vis = (int[]) ref_data[12]; final boolean[] sorted = (boolean[]) ref_data[13]; final String[] legend = (String[]) ref_data[14]; final int[] valtype = (int[]) ref_data[15]; final String[] data_type_name = (String[]) ref_data[16]; final String[] data_type_uname = (String[]) ref_data[17]; final String[] short_desc = (String[]) ref_data[18]; for (int i = 0; i < msize; i++) { AnMetric m = new AnMetric( type[i], subtype[i], clock[i], flavors[i], value_styles[i], user_name[i], expr_spec[i], aux[i], name[i], abbr[i], comd[i], unit[i], legend[i], vis[i], sorted[i], valtype[i], data_type_name[i], data_type_uname[i], short_desc[i]); mlist[i] = m; } return mlist; } /* * ------------------------------------- INNER CLASSES ---------------------------------------------------- */ // Slider listener for updating the value label final class SliderLabelListener implements ChangeListener { final JLabel label; public SliderLabelListener(final JLabel label) { this.label = label; } public void stateChanged(final ChangeEvent e) { final JSlider slider = (JSlider) e.getSource(); label.setText(AnLocale.getString("Call Stack Magnification: ") + slider.getValue()); if (settingsDialog != null) { settingsDialog.setButtonsEnabled(true); } } } protected void setMessageAreaVisible(boolean visible) { settingsDialog.setMessageAreaVisible(visible); } public final class SettingsDialog extends AnDialog implements AnChangeListener { private JTextArea messageArea; public SettingsDialog() { super(anWindow, frame, title, false, aux, mnemonic, help_id); JPanel settingsPanel = new JPanel(new BorderLayout()); settingsPanel.add(tabbedPane, BorderLayout.CENTER); messageArea = new JTextArea(); messageArea.setForeground(Color.red); messageArea.setOpaque(false); messageArea.setBorder(null); messageArea.setWrapStyleWord(true); messageArea.setEditable(false); messageArea.setLineWrap(true); messageArea.setText( AnLocale.getString( "Some settings have been modified that may require the experiment(s) to be reloaded" + " in order for the changes to take effect. An experiment can easily be reloaded" + " from Welcome view.")); messageArea.setVisible(false); messageArea.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); settingsPanel.add(messageArea, BorderLayout.SOUTH); setAccessory(settingsPanel); setButtonsEnabled(false); // setModal(true); updateGUIViewMode(); updateGUIDisplayCompareMode(); updateGUINameFormat(); updateGUITableFormat(); AnEventManager.getInstance().addListener(this); setBackground(AnEnvironment.DEFAULT_DIALOG_BACKGROUND); } protected void setMessageAreaVisible(boolean visible) { if (messageArea != null) { messageArea.setVisible(visible); } } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a * different (worker) thread and not wait for it to finish. o It cannot spend significant time * handling the event. Significant work like doCompute needs to be dispatched to a worker * thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("Settings.SettingsDialog stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: break; case EXPERIMENTS_LOADED: updateTLDataCheckBoxes(); if (messageArea != null) { messageArea.setVisible(false); } break; case FILTER_CHANGED: case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); Object originalSource = anSettingChangeEvent.getOriginalSource(); // System.out.println("Settings getOriginalSource: " + originalSource); if (originalSource == Settings.this) { return; } // System.out.println("Settings getOriginalSource: // doIt..............."); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE) { updateGUIViewMode(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE_ENABLED) { updateGUIViewModeVisible(); } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE) { updateGUIDisplayCompareMode(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT) { updateGUINameFormat(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.TABLE_FORMATS) { updateGUITableFormat(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SRC_DIS) { updateGUISourceDisassembly(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.TIMELINE) { updateGUITimeline(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SEARCH_PATH) { updateGUISearchPath(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.PATH_MAP) { updateGUIPathMap(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.CALL_TREE) { updateGUICallTree(); // update GUI } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { updateGUIMetrics(); // update GUI updateGUITimelineData(); metricsPanel.updateGUIValues(); } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEWS) { ViewsSetting.Setting oldSetting = (ViewsSetting.Setting) anSettingChangeEvent.getOldValue(); ViewsSetting.Setting newSetting = (ViewsSetting.Setting) anSettingChangeEvent.getNewValue(); updateGUIViews(oldSetting, newSetting); // update GUI } break; case DEBUG: // debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void actionPerformed(final ActionEvent event) { getDefault().actionPerformed(event); } public void showDialog(boolean show) { setVisible(show); } public void setButtonsEnabled(boolean set) { apply.setEnabled(set); ok.setEnabled(set); aux_actions[0].setEnabled(!set); // Export... aux_actions[1].setEnabled(!set); // Import... } public boolean areButtonsEnabled() { return apply.isEnabled(); } } /* * ------------------------------------- CONSTANTS -------------------------------------------------------- */ private static final String[] aux = { AnLocale.getString("Export..."), AnLocale.getString("Import...") }; private static final char[] mnemonic = { AnLocale.getString('o', "MNEM_SETTINGS_EXPORT"), AnLocale.getString('i', "MNEM_SETTINGS_IMPORT") }; private static final String help_id = AnVariable.HELP_Settings; private static final String title = AnLocale.getString("Settings"); private static final String homeDirStr = AnLocale.getString("Home directory: "); private static final String currentDirStr = AnLocale.getString("Current directory: "); public enum TLData_type { // Note: the cmd strings are used for .er.rc TL_SAMPLE("PROFDATA_TYPE_SAMPLE", "sample", AnUtility.samp_icon), TL_GCEVENT( "PROFDATA_TYPE_GCEVENT", "gcevent", AnUtility.del_icon), // CXXX Bug 20801848 - change icon TL_HEAPSZ("PROFDATA_TYPE_HEAPSZ", "heapsize", AnUtility.heap_icon), TL_CLOCK("PROFDATA_TYPE_CLOCK", "clock", AnUtility.prof_icon), TL_HWC("PROFDATA_TYPE_HWC", "hwc", AnUtility.hwc_icon), TL_SYNC("PROFDATA_TYPE_SYNCH", "synctrace", AnUtility.sync_icon), TL_HEAP("PROFDATA_TYPE_HEAP", "heaptrace", AnUtility.heap_icon), TL_MPI("PROFDATA_TYPE_MPI", "mpitrace", AnUtility.mpi_icon), TL_RACES("PROFDATA_TYPE_RACE", "datarace", AnUtility.races_icon), TL_DLCK("PROFDATA_TYPE_DLCK", "deadlock", AnUtility.races_icon), TL_IOTRACE("PROFDATA_TYPE_IOTRACE", "iotrace", AnUtility.iotrace_icon), TL_UNKNOWN(null, "unknown", null), TL_ALL(null, "all", null); private TLData_type(String dataIdName, String cmd, ImageIcon icon) { data_id_name = dataIdName; this.cmd = cmd; this.icon = icon; } public final String getTLDataBaseCmd() { return cmd; } public final String getTLDataIdName() { return data_id_name; } ; public final ImageIcon getIcon() { return icon; } ; @Override public String toString() { return data_id_name; } private final String data_id_name; // DATA_ID name (not user name) private final String cmd; // .er.rc command name private final ImageIcon icon; private static final TLData_type values[] = { // Note: must match order above. // However, values do not have to match DBE DATA_* enums TL_SAMPLE, TL_GCEVENT, TL_HEAPSZ, TL_CLOCK, TL_HWC, TL_SYNC, TL_HEAP, TL_MPI, TL_RACES, TL_DLCK, TL_IOTRACE }; // CXXX Bug 20801848 // public static final List VALUES // = Collections.unmodifiableList(Arrays.asList(values)); public static final TLData_type find(String _dataIdName) { String dataIdName = _dataIdName.toUpperCase(); for (TLData_type tmp : values) { if (tmp.data_id_name.equals(dataIdName)) { return tmp; } } return TL_UNKNOWN; } } public enum TLStack_align { // Note: these strings are used for .er.rc TLSTACK_MODE_UNKNOWN(0, AnLocale.getString("Unknown")), TLSTACK_ALIGN_ROOT(1, AnLocale.getString("root")), TLSTACK_ALIGN_LEAF(2, AnLocale.getString("leaf")); private TLStack_align(int v, String n) { value = v; name = n; } public final int getValue() { return value; } ; @Override public String toString() { return name; } private final String name; private final int value; private static final TLStack_align values[] = {TLSTACK_ALIGN_ROOT, TLSTACK_ALIGN_LEAF}; public static final List VALUES = Collections.unmodifiableList(Arrays.asList(values)); public static final TLStack_align find(int intVal) { for (TLStack_align tmp : values) { if (tmp.value == intVal) { return tmp; } } return TLSTACK_MODE_UNKNOWN; } } private static final int size_ccmv = 11; private static final int CCMV_BASIC = 0x400; // for default messages private static final int CCMV_VER = 0x001; // Versioning messages private static final int CCMV_WARN = 0x002; // Warning messages private static final int CCMV_PAR = 0x004; // Parallelization messages private static final int CCMV_QUERY = 0x008; // Compiler queries private static final int CCMV_LOOP = 0x010; // Loop detail messages private static final int CCMV_PIPE = 0x020; // Pipelining messages private static final int CCMV_INLINE = 0x040; // Inlining information private static final int CCMV_MEMOPS = 0x080; // Messages concerning memory op private static final int CCMV_FE = 0x100; // Front-end messages private static final int CCMV_CG = 0x200; // Code-generator messages static { ccmv_type = new int[size_ccmv]; ccmv_desc = new String[size_ccmv]; ccmv_comd = new String[size_ccmv]; ccmv_mnem = new char[size_ccmv]; ccmv_type[0] = CCMV_BASIC; ccmv_desc[0] = AnLocale.getString("Default", "PRESENT_DEFAULT"); ccmv_comd[0] = "basic"; ccmv_mnem[0] = AnLocale.getString('D', "MNEM_PRESENT_DEFAULT"); ccmv_type[1] = CCMV_VER; ccmv_desc[1] = AnLocale.getString("Versioning"); ccmv_comd[1] = "version"; // ccmv_mnem[1] = AnLocale.getString('V', "MNEM_PRESENT_VERSIONING"); ccmv_type[2] = CCMV_WARN; ccmv_desc[2] = AnLocale.getString("Warning", "PRESENT_WARNING"); ccmv_comd[2] = "warn"; // ccmv_mnem[2] = AnLocale.getString('W', "MNEM_PRESENT_WARNING"); ccmv_type[3] = CCMV_PAR; ccmv_desc[3] = AnLocale.getString("Parallelization"); ccmv_comd[3] = "parallel"; // ccmv_mnem[3] = AnLocale.getString('P', "MNEM_PRESENT_PARALLELIZATION"); ccmv_type[4] = CCMV_QUERY; ccmv_desc[4] = AnLocale.getString("Compiler queries"); ccmv_comd[4] = "query"; // ccmv_mnem[4] = AnLocale.getString('q', "MNEM_PRESENT_COMPILER_QUERIES"); ccmv_type[5] = CCMV_LOOP; ccmv_desc[5] = AnLocale.getString("Loop detail"); ccmv_comd[5] = "loop"; // ccmv_mnem[5] = AnLocale.getString('L', "MNEM_PRESENT_LOOP_DETAIL"); ccmv_type[6] = CCMV_PIPE; ccmv_desc[6] = AnLocale.getString("Pipelining"); ccmv_comd[6] = "pipe"; // ccmv_mnem[6] = AnLocale.getString('n', "MNEM_PRESENT_PIPELINING"); ccmv_type[7] = CCMV_INLINE; ccmv_desc[7] = AnLocale.getString("Inlining information"); ccmv_comd[7] = "inline"; // ccmv_mnem[7] = AnLocale.getString('I', "MNEM_PRESENT_INLINE_INFORMATION"); ccmv_type[8] = CCMV_MEMOPS; ccmv_desc[8] = AnLocale.getString("Memory operations"); ccmv_comd[8] = "memops"; // ccmv_mnem[8] = AnLocale.getString('M', "MNEM_PRESENT_MEMORY_OPERATIONS"); ccmv_type[9] = CCMV_FE; ccmv_desc[9] = AnLocale.getString("Front-end"); ccmv_comd[9] = "fe"; // ccmv_mnem[9] = AnLocale.getString('F', "MNEM_PRESENT_FRONT_END"); ccmv_type[10] = CCMV_CG; ccmv_desc[10] = AnLocale.getString("Code-generator"); ccmv_comd[10] = "cg"; // ccmv_mnem[10] = AnLocale.getString('g', "MNEM_PRESENT_CODE_GENERATOR"); } private static final int MIN_WIDTH = 800; private static final int TIMELINE_STACK_FRAME_MAGNIFY_MIN = 1; private static final int TIMELINE_STACK_FRAME_MAGNIFY_MAX = 7; private static final int TIMELINE_STACK_FRAME_MAGNIFY_OFFSET = 1 - TIMELINE_STACK_FRAME_MAGNIFY_MIN; public static final int TIMELINE_MAX_STACK_FRAME_PIXELS = TIMELINE_STACK_FRAME_MAGNIFY_MAX - TIMELINE_STACK_FRAME_MAGNIFY_MIN + 1; public static final int TIMELINE_DEFAULT_STACK_FRAME_PIXELS = 4; // private final static String excl_abbr = AnLocale.getString("Excl. "); // private final static String incl_abbr = AnLocale.getString("Incl. "); // private final static String attr_abbr = AnLocale.getString("Attr. "); // private final static String data_abbr = AnLocale.getString("Data. "); // private final static String indx_abbr = AnLocale.getString("Index. "); public static final String excl_name = AnLocale.getString("Exclusive "); public static final String incl_name = AnLocale.getString("Inclusive "); public static final String attr_name = AnLocale.getString("Attributed "); public static final String data_name = AnLocale.getString("Data-derived "); public static final String time_str = AnLocale.getString(" Time"); private static final String FORMATS_STR = AnLocale.getString("Formats"); private static final String SORT_STR = AnLocale.getString("Sort"); private static final String Blank = " "; } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricSelection.java0000644000175000017500000000371414744453367021551 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; public class MetricSelection { private boolean selected; private MetricAttributes attributes; public MetricSelection(boolean selected, MetricAttributes attributes) { this.selected = selected; this.attributes = attributes; } public void set(MetricSelection metricSelection) { selected = metricSelection.isSelected(); attributes = metricSelection.getAttributes(); } /** * @return deep copy */ public MetricSelection copy() { return new MetricSelection(isSelected(), getAttributes().copy()); } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } public void setAttributes(MetricAttributes attributes) { this.attributes = attributes; } public MetricAttributes getAttributes() { return attributes; } @Override public boolean equals(Object obj) { if (obj instanceof MetricSelection) { MetricSelection metricSelection = (MetricSelection) obj; if (selected != metricSelection.isSelected()) { return false; } else { return attributes.equals(metricSelection.getAttributes()); } } else { return super.equals(obj); // To change body of generated methods, choose Tools | Templates. } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricsSetting.java0000644000175000017500000020617415044710303021405 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnDouble; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnObject; import org.gprofng.mpmt.AnString; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.metrics.MetricAttr; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.metrics.SelectableMetricNode; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JRadioButtonMenuItem; import javax.swing.JSeparator; import javax.swing.SwingConstants; public class MetricsSetting extends Setting { private AnMetric[] availableAnMetrics; // Static once experiment has been loaded private MetricStates metricStates; // the states public static final int MET_NORMAL = 0; public static final int MET_CALL = 1; public static final int MET_DATA = 2; public static final int MET_INDEX = 3; public static final int MET_CALL_AGR = 4; public static final int MET_COMMON = 5; public static final int MET_IO = 6; public static final int MET_SRCDIS = 7; public static final int MET_HEAP = 8; public static final int MET_LAST = 9; // Count of metrics; + 1 public MetricsSetting() {} public void setHotMetric(String name, boolean hot) { for (AnMetric anMetric : availableAnMetrics) { if (anMetric.getComd().equals(name)) { anMetric.setHot(hot); break; } } } /** Called from loadExperimentGroupsInternal when experiment has been loaded */ public synchronized void initMetricListsByMType() { metricStates = new MetricStates(); metricStates.resetMetricListsByMType(); } /** Called from loadExperimentGroupsInternal when experiment has been loaded */ public synchronized void init( Object originalSource, List metricsSelectionList, Object[] ref_data, MetricNode metricsRootNode, boolean metricsReversedSort, MetricType[] metricSortByMType, List[] metricOrderLists) { availableAnMetrics = Settings.getMetricList(ref_data); List metricStateList = constructMetricStates(metricsRootNode); metricStates.updateStates(metricsRootNode, metricStateList); init( originalSource, metricsSelectionList, metricsReversedSort, metricSortByMType, metricOrderLists); } private List constructMetricStates(MetricNode metricsRootNode) { List list = new ArrayList<>(); constructMetricStates(metricsRootNode, null, -1, list); // Add Name metric to the end AnMetric nameMetric = availableAnMetrics[availableAnMetrics.length - 1]; // Always last ? if (nameMetric.isNameMetric()) { MetricAttributes capableAttributes = new MetricAttributes(false, false, false, false, false, false); MetricAttributes factoryAttributes = new MetricAttributes(false, false, false, false, false, false); MetricSelection factorySelection = new MetricSelection(true, factoryAttributes); MetricSelection selection = factorySelection.copy(); list.add( new MetricState("Name", -1, nameMetric, capableAttributes, factorySelection, selection)); } else { System.err.println("METRICERROR: constructMetricStates: name metric is not last!"); } return list; } private void constructMetricStates( MetricNode node, String listDisplayName, int listId, List list) { if (node.getMetricType() == MetricNode.MetricType.PLAIN_LIST_CATEGORY) { listDisplayName = node.getMetricBasic().getDisplayName(); String listName = node.getMetricBasic().getName(); if (listName.contains("PROFDATA_TYPE_HEAP")) { // heap listId = MetricNode.HEAP_LIST_ID; } else if (listName.contains("PROFDATA_TYPE_IOTRACE")) { // io listId = MetricNode.IO_LIST_ID; } else if (listName.contains("Dataspace")) { // old name ??? listId = MetricNode.DATASPACE_HWC_LIST_ID; } else if (listName.contains("PROFDATA_TYPE_HWC_DSPACE")) { // memoryspace listId = MetricNode.DATASPACE_HWC_LIST_ID; } else { listId = MetricNode.ALL_LIST_ID; } } if (node instanceof SelectableMetricNode) { SelectableMetricNode selectableMetricNode = (SelectableMetricNode) node; String name = selectableMetricNode.getMetricBasic().getName(); AnMetric anMetric = null; for (AnMetric am : availableAnMetrics) { if (am.getComd().equals(name)) { anMetric = am; } } if (anMetric == null) { System.err.println("METRICERROR: constructMetricStates: can't find metric " + name); } // Capable MetricAttr exclusiveCapable = selectableMetricNode.getExclusive().getCapable(); MetricAttr inclusiveCapable = selectableMetricNode.getInclusive().getCapable(); MetricAttributes capableAttributes = new MetricAttributes( exclusiveCapable.isTime(), exclusiveCapable.isValue(), exclusiveCapable.isPercent(), inclusiveCapable.isTime(), inclusiveCapable.isValue(), inclusiveCapable.isPercent()); // Factory MetricAttr exclusiveDefault = selectableMetricNode.getExclusive().getDefaultAttrs(); MetricAttr inclusiveDefault = selectableMetricNode.getInclusive().getDefaultAttrs(); boolean defaultSelected = exclusiveDefault.hasVisibleAttrs() || inclusiveDefault.hasVisibleAttrs(); MetricAttributes factoryAttributes = new MetricAttributes( exclusiveDefault.isTime(), exclusiveDefault.isValue(), exclusiveDefault.isPercent(), inclusiveDefault.isTime(), inclusiveDefault.isValue(), inclusiveDefault.isPercent()); MetricSelection factorySelection = new MetricSelection(defaultSelected, factoryAttributes); // Selection MetricSelection selection = factorySelection.copy(); list.add( new MetricState( listDisplayName, listId, anMetric, capableAttributes, factorySelection, selection)); } for (MetricNode child : node.getChildren()) { constructMetricStates(child, listDisplayName, listId, list); } } /* * Called from Settings, Overview, ... */ public synchronized void set(Object originalSource, String metricName, boolean selected) { MetricStates metricStatesCopy = metricStates.copy(); metricStatesCopy.setSelection(metricName, selected); set(originalSource, metricStatesCopy); } /* * Called from Overview, ... */ public synchronized void setList( Object originalSource, List metricNameSelectedList) { MetricStates metricStatesCopy = metricStates.copy(); for (MetricNameSelected mns : metricNameSelectedList) { metricStatesCopy.setSelection(mns.getName(), mns.isSelected()); } set(originalSource, metricStatesCopy); } private void set(Object originalSource, MetricStates newMetricStates) { setValueAndFireChangeEvent(originalSource, this, newMetricStates); } private synchronized void set( Object originalSource, String metricName, MetricAttributes metricAttributes) { MetricStates metricStatesCopy = metricStates.copy(); MetricState metricState = metricStatesCopy.findMetricStateByName(metricName); if (metricState != null) { metricState.getSelection().setAttributes(metricAttributes.copy()); metricState.getSelection().setSelected(metricAttributes.anySelections()); set(originalSource, metricStatesCopy); } } /* * Not used in Dodona */ public synchronized void setExclusive( Object originalSource, String metricName, boolean eTimeSelected, boolean eValueSelected, boolean ePercentSelected) { MetricState metricState = metricStates.findMetricStateByName(metricName); if (metricState != null) { MetricAttributes metricAttributesCopy = metricState.getSelection().getAttributes().copy(); metricAttributesCopy.setETime(eTimeSelected); metricAttributesCopy.setEValue(eValueSelected); metricAttributesCopy.setEPercent(ePercentSelected); set(originalSource, metricName, metricAttributesCopy); } } /* * Not used in Dodona */ public synchronized void setInclusive( Object originalSource, String metricName, boolean iTimeSelected, boolean iValueSelected, boolean iPercentSelected) { MetricState metricState = metricStates.findMetricStateByName(metricName); if (metricState != null) { MetricAttributes metricAttributesCopy = metricState.getSelection().getAttributes().copy(); metricAttributesCopy.setITime(iTimeSelected); metricAttributesCopy.setIValue(iValueSelected); metricAttributesCopy.setIPercent(iPercentSelected); set(originalSource, metricName, metricAttributesCopy); } } /** Called from Settings */ public synchronized void set(Object originalSource, List list) { boolean changed = true; // for (int i = 0; i < metricStates.getSelections().length; i++) { // OK // if (metricStates.getSelections()[i] != newChksBoxValue[i]) { // OK // changed = true; // break; // } // } if (changed) { MetricStates metricStatesCopy = metricStates.copy(); // metricStatesCopy.setSelections(newChksBoxValue); metricStatesCopy.setSelection(list); setValueAndFireChangeEvent(originalSource, this, metricStatesCopy); } } /** Called when changing column order (old headers) */ private synchronized void setMetricOrder(Object originalSource, int from, int to, int mtype) { MetricStates metricStatesCopy = metricStates.copy(); metricStatesCopy.updateMetricOrder(from, to, mtype); setValueAndFireChangeEvent(originalSource, this, metricStatesCopy); } /** Called when changing column order (new headers) */ public synchronized void setMetricOrder( Object originalSource, String metricName, String metricRefName, boolean before) { setMetricOrder(originalSource, metricName, metricRefName, before, MET_NORMAL); } private synchronized void setMetricOrder( Object originalSource, String metricName, String metricRefName, boolean before, int mtype) { MetricStates metricStatesCopy = metricStates.copy(); metricStatesCopy.updateMetricOrder(metricName, metricRefName, before, mtype); setValueAndFireChangeEvent(originalSource, this, metricStatesCopy); } private synchronized void setSortMetric(Object originalSource, int index, int mtype) { MetricStates metricStatesCopy = metricStates.copy(); metricStatesCopy.updateSortMetric(index, mtype); setValueAndFireChangeEvent(originalSource, this, metricStatesCopy); } private void overrideMetricStates( MetricStates metricStates, List metricsSelectionList, boolean metricsReversedSort, MetricType[] metricSortByMType, List[] metricOrderLists) { // Override selection with saved metrics settings // if (metricsSelectionList != null) { // for (MetricNameSelection ms : metricsSelectionList) { // int baseIndex = findBaseIndex(ms.getName()); // if (baseIndex >= 0) { // for (int i = 0; i < 6; i++) { // metricStates.getSelections()[6 * baseIndex + i] = // ms.getExclusiveInclusive()[i]; // OK // } // } // } // } metricStates.setSelection(metricsSelectionList); // Override sort direction metricStates.setNewReverseSortDirection(metricsReversedSort); // Override sort metric (restore only MET_NORMAL) if (metricSortByMType != null) { metricStates.setNewSortMetric(metricSortByMType[MET_NORMAL]); } // Override metric order (restore only MET_NORMAL) if (metricOrderLists != null) { List newMetricOrderList = metricOrderLists[MET_NORMAL]; // MetricType[] newMetricOrderList = normalListOrder.toArray(new // MetricType[normalListOrder.size()]); metricStates.setNewMetricOrder(newMetricOrderList); } } /** Called from Import Settings */ public synchronized void set( Object originalSource, List metricsSelectionList, boolean metricsReversedSort, MetricType[] metricSortByMType, List[] metricOrderLists) { MetricStates metricStatesCopy = metricStates.copy(); overrideMetricStates( metricStatesCopy, metricsSelectionList, metricsReversedSort, metricSortByMType, metricOrderLists); setValueAndFireChangeEvent(originalSource, this, metricStatesCopy); } private void init( Object originalSource, List metricsSelectionList, boolean metricsReversedSort, MetricType[] metricSortByMType, List[] metricOrderLists) { overrideMetricStates( metricStates, metricsSelectionList, metricsReversedSort, metricSortByMType, metricOrderLists); updateBackend(); // IPC fireChangeEvent(originalSource, metricStates); } public AnMetric[] getAvailableAnMetrics() { return availableAnMetrics; } public AnMetric getAvailableAnMetric(String cmd) { for (AnMetric anMetric : availableAnMetrics) { if (anMetric.getComd().equals(cmd)) { return anMetric; } } return null; } @Override Type getType() { return AnSettingChangeEvent.Type.METRICS; } public synchronized MetricStates getMetricStates() { return metricStates; } public synchronized AnMetric[] getMetricListByMType(int mtype) { if (getMetricStates() == null) { return null; } return getMetricStates().getMetricListByMType(mtype); } public synchronized AnMetric[] getMetricListByDType(int dtype) { return getMetricListByMType(dtype2mtype(dtype)); } // Get index of sorting metric public static synchronized int getSortIndex(final AnMetric[] mlist) { for (int i = 0; i < mlist.length; i++) { if (mlist[i].isSorted()) { return i; } } return 0; } public synchronized int getSortColumnByDType(int dtype) { int mtype = dtype2mtype(dtype); return getSortIndex(mtype); } // Get index of sorting metric private int getSortIndex(final int mtype) { final AnMetric[] mlist = getMetricListByMType(mtype); return getSortIndex(mlist); } @Override Object getValue() { return metricStates; } @Override synchronized void setValue(Object newValue) { MetricStates newMetricStates = (MetricStates) newValue; metricStates = newMetricStates; updateBackend(); // IPC } public synchronized boolean isSelected(String metricName) { return getMetricStates().isSelected(metricName); } public synchronized List getMetricOrder() { List list = new ArrayList<>(); if (availableAnMetrics != null) { for (AnMetric anMetric : availableAnMetrics) { String name = anMetric.getComd(); MetricState metricState = metricStates.findMetricStateByName(name); if (metricState != null) { MetricNameSelection metricSetting = new MetricNameSelection(name, metricState.getSelection().copy()); list.add(metricSetting); } } } return list; } public static synchronized int getNameColumnIndex(final AnMetric[] mlist) { for (int i = 0; i < mlist.length; i++) { if (mlist[i].isNameMetric()) { return i; } } return -1; } public synchronized int getNameColumnIndexByDType(int dtype) { AnMetric[] list = getMetricListByDType(dtype); return getNameColumnIndex(list); } private int str_cmp(final String s1, final String s2) { if (s1 == null) { return s2 == null ? 0 : 1; } if (s2 == null) { return -1; } return s1.compareTo(s2); } private AnMetric[] reorder(List metricOrderTemplate, AnMetric[] mMetricList) { AnMetric[] newMMetricList = new AnMetric[mMetricList.length]; // If last entry in metricOrderTemplate is Name, remove this entry so all unmatched metrics get // added to the end of list but also to the left of Name (23332712) int lastEntryIndex = metricOrderTemplate.size() - 1; if (lastEntryIndex >= 0) { if (metricOrderTemplate.get(lastEntryIndex).getCommand().equals("name")) { metricOrderTemplate.remove(lastEntryIndex); } } int newIndex = 0; for (MetricType metricType : metricOrderTemplate) { for (int index = 0; index < mMetricList.length; index++) { if (mMetricList[index] != null) { if (mMetricList[index].getComd().equals(metricType.getCommand()) && mMetricList[index].getSubType() == metricType.getSubType()) { newMMetricList[newIndex++] = mMetricList[index]; mMetricList[index] = null; break; } } } } for (AnMetric anMetric : mMetricList) { if (anMetric != null) { newMMetricList[newIndex++] = anMetric; } } return newMMetricList; } private synchronized void updateBackend() { List sortColumnListChanged = metricStates.getChangedMetricSortColumns(); if (sortColumnListChanged.size() > 0) { metricStates.transferSortChangesToMetricStates(sortColumnListChanged); } List metricsWithSelections = new ArrayList<>(); List metricStatesList = getMetricStates().getMetricStateList(); if (metricStatesList != null) { for (MetricState metricState : metricStatesList) { AnMetric bm = metricState.getAnMetric(); MetricAttributes metricAttributes = metricState.getSelection().getAttributes(); if (bm.isNameMetric()) { AnMetric m = new AnMetric(bm); metricsWithSelections.add(m); m.setSubType(AnMetric.STATIC); m.set_vis_bits(false, true, false); continue; } if (bm.isStatic() && metricState.getSelection().isSelected()) { AnMetric m = new AnMetric(bm); metricsWithSelections.add(m); m.setSubType(AnMetric.STATIC); m.set_vis_bits(false, true, false); continue; } if (metricState.getSelection().isSelected() && (metricAttributes.isETime() || metricAttributes.isEValue() || metricAttributes.isEPercent())) { AnMetric m = new AnMetric(bm); metricsWithSelections.add(m); m.setSubType(AnMetric.EXCLUSIVE); m.set_vis_bits( metricAttributes.isETime(), metricAttributes.isEValue(), metricAttributes.isEPercent()); } if (metricState.getSelection().isSelected() && (metricAttributes.isITime() || metricAttributes.isIValue() || metricAttributes.isIPercent())) { AnMetric m = new AnMetric(bm); metricsWithSelections.add(m); m.setSubType(AnMetric.INCLUSIVE); m.set_vis_bits( metricAttributes.isITime(), metricAttributes.isIValue(), metricAttributes.isIPercent()); } } } boolean set_sort = false; List metricsWithSelectionsSorted = new ArrayList<>(); // populate sorted_mlist - start with items in the previous list AnMetric[] metrics; if (getMetricStates().getMetricListsByMType() != null) { metrics = getMetricStates().getMetricListsByMType()[MetricsSetting.MET_NORMAL].getmMetricList(); } else { metrics = getMetricListByMType(MetricsSetting.MET_NORMAL); } for (AnMetric m : metrics) { String expr_spec = m.expr_spec; m.expr_spec = null; int ind = m.indexIn(metricsWithSelections); m.expr_spec = expr_spec; if (ind >= 0) { metricsWithSelectionsSorted.add(metricsWithSelections.get(ind)); if (m.isSorted()) { metricsWithSelections.get(ind).setSorted(true); set_sort = true; } metricsWithSelections.remove(ind); } } // if the last metric in old was "name", save it for last in new if (!metricsWithSelectionsSorted.isEmpty()) { AnMetric last = metricsWithSelectionsSorted.get(metricsWithSelectionsSorted.size() - 1); if (last.isNameMetric()) { metricsWithSelections.add(last); metricsWithSelectionsSorted.remove(last); } } // add remaning items, they are newly enabled metrics metricsWithSelectionsSorted.addAll(metricsWithSelections); if (!set_sort) { metricsWithSelectionsSorted.get(0).setSorted(true); } AnMetric[] metricsWithSelectionsSortedArray = new AnMetric[metricsWithSelectionsSorted.size()]; metricsWithSelectionsSorted.toArray(metricsWithSelectionsSortedArray); // Override MET_NORMAL metric order (from init) List metricOrderTemplate = metricStates.getNewMetricOrder(); if (metricOrderTemplate != null) { metricsWithSelectionsSortedArray = reorder(metricOrderTemplate, metricsWithSelectionsSortedArray); metricStates.setNewMetricOrder(null); } // Override MET_NORMAL sort metric (from init) MetricType newSortmetric = metricStates.getNewSortMetric(); if (newSortmetric != null) { AnMetric sortMetric = null; for (AnMetric anMetric : metricsWithSelectionsSortedArray) { if (anMetric.getComd().equals(newSortmetric.getCommand()) && anMetric.getSubType() == newSortmetric.getSubType()) { sortMetric = anMetric; break; } } if (sortMetric != null) { for (AnMetric anMetric : metricsWithSelectionsSortedArray) { anMetric.setSorted(false); } sortMetric.setSorted(true); } metricStates.setNewSortMetric(null); } // Sort the metric list so excluded/included for the same metric are next to each other and // excluded is before included. // System.out.println("-----------------------------------------------"); // for (AnMetric anMetric : metricsWithSelectionsSortedArray) { // System.out.println(anMetric.getUserName() + " " + anMetric.getSubType()); // } // Sort so excluded/included for the same metric are next to each other List pairedList = new ArrayList<>(); int index1 = 0; while (index1 < metricsWithSelectionsSortedArray.length) { AnMetric anMetric = metricsWithSelectionsSortedArray[index1]; if (anMetric != null) { pairedList.add(anMetric); metricsWithSelectionsSortedArray[index1] = null; int index2 = index1; while (index2 < metricsWithSelectionsSortedArray.length) { if (metricsWithSelectionsSortedArray[index2] != null && metricsWithSelectionsSortedArray[index2].getComd().equals(anMetric.getComd())) { pairedList.add(metricsWithSelectionsSortedArray[index2]); metricsWithSelectionsSortedArray[index2] = null; break; } index2++; } } index1++; } pairedList.toArray(metricsWithSelectionsSortedArray); // System.out.println("----------"); // for (AnMetric anMetric : metricsWithSelectionsSortedArray) { // System.out.println(anMetric.getUserName() + " " + anMetric.getSubType()); // } // Sort so excluded is before included for (int index = 0; index < metricsWithSelectionsSortedArray.length; index++) { if (index + 1 < metricsWithSelectionsSortedArray.length) { AnMetric anMetric1 = metricsWithSelectionsSortedArray[index]; AnMetric anMetric2 = metricsWithSelectionsSortedArray[index + 1]; if (anMetric1.getComd().equals(anMetric2.getComd())) { if (anMetric1.getSubType() == 4 && anMetric2.getSubType() == 2) { metricsWithSelectionsSortedArray[index] = anMetric2; metricsWithSelectionsSortedArray[index + 1] = anMetric1; } } } } // System.out.println("----------"); // for (AnMetric anMetric : metricsWithSelectionsSortedArray) { // System.out.println(anMetric.getUserName() + " " + anMetric.getSubType()); // } // Set visible metrics and order setCurMetricsV2IPC( MET_NORMAL, metricsWithSelectionsSortedArray, AnWindow.getInstance().getSettings().getCompareModeSetting().get().value()); // IPC // Override sort direction (from init) Boolean newReverseSortDirection = metricStates.getNewReverseSortDirection(); if (newReverseSortDirection != null && newReverseSortDirection) { for (int index = 0; index < metricsWithSelectionsSortedArray.length; index++) { if (metricsWithSelectionsSortedArray[index].isSorted()) { setSort(index, MET_NORMAL, newReverseSortDirection); // IPC // System.out.println("SORT (new): " + index + " " + MET_NORMAL + " " + // metricStates.isReverseDirectionSorting()); break; } } } // Update sort column and sort direction (from clicking) if (sortColumnListChanged.size() > 0) { for (int[] sortColumnChanged : sortColumnListChanged) { setSort( sortColumnChanged[0], sortColumnChanged[1], metricStates.isReverseDirectionSorting()); // IPC // System.out.println("SORT: " + sortColumnChanged[0] + " " + // sortColumnChanged[1] + " " + metricStates.isReverseDirectionSorting()); } } // Reset and fill the cach metricStates.resetMetricListsByMType(); // IPC } public synchronized void setMetricOrderByDType( Object originalSource, int from, int to, int dtype) { int mtype = dtype2mtype(dtype); int functionsFrom = mapToFunctionsSortColumn(from, mtype); int functionsTo = mapToFunctionsSortColumn(to, mtype); setMetricOrder(originalSource, functionsFrom, functionsTo, MetricsSetting.MET_NORMAL); } private int mapToFunctionsSortColumn(int index, int mtype) { int ret = -1; if (mtype == MetricsSetting.MET_NORMAL) { return index; } AnMetric[] functionsMetricList = getMetricListByMType(MetricsSetting.MET_NORMAL); AnMetric[] metricList = getMetricListByMType(mtype); if (index < 0 || index >= metricList.length) { return -1; } String metricUserName = metricList[index].getUserName(); for (int ind = 0; ind < functionsMetricList.length; ind++) { if (metricUserName.equals(functionsMetricList[ind].getUserName())) { ret = ind; break; } } if (ret == -1) { ret = getSortColumnByDType(AnDisplay.DSP_Functions); } return ret; } public synchronized void setSortMetricByDType(Object originalSource, int index, int dtype) { int mtype = dtype2mtype(dtype); setSortMetric(this, index, mtype); } public synchronized void dumpMetricsByDType(int dtype) { int mtype = dtype2mtype(dtype); getMetricStates().dumpMetricListsByMType(mtype); } public synchronized void dump() { getMetricStates().dump(); } public static int dtype2mtype(final int dtype) { switch (dtype) { case AnDisplay.DSP_Callers: return MetricsSetting.MET_CALL; case AnDisplay.DSP_CallTree: case AnDisplay.DSP_CallFlame: return MetricsSetting.MET_CALL_AGR; case AnDisplay.DSP_SourceV2: case AnDisplay.DSP_DisassemblyV2: return MetricsSetting.MET_SRCDIS; case AnDisplay.DSP_Source: case AnDisplay.DSP_Disassembly: return MetricsSetting.MET_SRCDIS; case AnDisplay.DSP_IndexObject: return MetricsSetting.MET_INDEX; case AnDisplay.DSP_DataObjects: case AnDisplay.DSP_DataLayout: case AnDisplay.DSP_MemoryObject: return MetricsSetting.MET_DATA; case AnDisplay.DSP_IO: case AnDisplay.DSP_IOFileDescriptors: case AnDisplay.DSP_IOCallStacks: return MetricsSetting.MET_IO; case AnDisplay.DSP_Heap: return MetricsSetting.MET_HEAP; default: return MetricsSetting.MET_NORMAL; } } // Get metric label array for function list table title public synchronized MetricLabel[] getLabel( Object[][] data, Object[] total_max, int dtype, AnTable table) { final int mtype = dtype2mtype(dtype); final AnMetric[] mlist = getMetricListByMType(mtype); if (total_max == null) { total_max = AnObject.updateMaxValues(data, null); } return getLabel(data, total_max, mlist, dtype, table); } public synchronized MetricLabel[] getLabel( Object[][] data, Object[] total_max, AnMetric[] mlist, int dtype, AnTable table) { ImageIcon so_icon; AnObject max_obj = null; String name, unit; double pclock, ptotal; if ((data == null) || (total_max == null) || (mlist == null)) { return null; } // total and max are already sorted to show visible columns in order final Object[] total = (Object[]) total_max[0]; Object[] maximum = (Object[]) total_max[1]; final MetricLabel[] metricLabels = new MetricLabel[mlist.length]; try { // This loop is not reliable - it can cause different exceptions for (int i = 0; i < mlist.length; i++) { AnMetric m = mlist[i]; so_icon = (getMetricStates().isReverseDirectionSorting()) ? AnUtility.smallArrowUpIcon : AnUtility.smallArrowDownIcon; // so_icon = // (getMetricsSetting().getMetricStates().isReverseDirectionSorting()) ? // AnUtility.hollowArrowUpIcon : AnUtility.hollowArrowDownIcon; Object obj = maximum[i]; if (obj == null) { max_obj = null; so_icon = AnUtility.blankIcon; } else if (obj instanceof String) { String s = (String) obj; max_obj = new AnString(s); } else { max_obj = (AnObject) obj; } name = m.getName(); if (m.expr_spec != null) { name = name + "; (" + m.expr_spec + ")"; } // XXX Need to rewrite this code. unit = null; pclock = -1.0; if (m.is_time_val()) { if (m.isVVisible()) { unit = m.getUnit(); } if (m.isTVisible()) { int clock = m.getClock(); pclock = (clock != 0) ? 1.e-6 / clock : 0.0; } } else if (m.isTVisible() || m.isVVisible()) { unit = m.getUnit(); } // if (GUITesting.getInstance().isRunningUnderGUITesting()) { // FIXUP: to be // removed when headers are done. Causing golden files diffs... // if (unit != null && unit.length() > 0) { // unit = "(" + unit + ")"; // } // } if (m.isPVisible()) { if (total[i] == null) { ptotal = 0.0; } else if (!(total[i] instanceof AnDouble) && !(total[i] instanceof AnLong)) { // XXXX Why total[i] is AnLong for Cycles in Source/Disasm // in compare mode and AnDouble in the other cases ? ptotal = 0.0; } else { double d = ((AnObject) total[i]).doubleValue(); if (d == 0.0) { // Try to update the total value if necessary try { Object[][] tm = (Object[][]) AnWindow.getInstance().getFunctionsView().getTotalMax(); double t = ((AnObject) tm[0][i]).doubleValue(); final int mtype = dtype2mtype(dtype); if (mtype == MetricsSetting.MET_SRCDIS) { final AnMetric[] func_mlist = getMetricListByMType(dtype2mtype(AnDisplay.DSP_Functions)); for (int func_mlist_num = 0; func_mlist_num < func_mlist.length; func_mlist_num++) { int func_type = func_mlist[func_mlist_num].getType(); int srcdis_type = mlist[i].getType(); if (func_type == srcdis_type) { t = ((AnObject) tm[0][func_mlist_num]).doubleValue(); break; } } } if (d < t) { d = t; } } catch (Exception e) { // ignore it } } ptotal = (d != 0.0) ? 100.0 / d : 0.0; } } else { ptotal = -1.0; } metricLabels[i] = new MetricLabel(m, name, unit, pclock, ptotal, max_obj, so_icon); } // for (int i = 0; i < mlist.length; i++) { // if (mlist[i].isNameMetric()) { // name_col = i; // break; // } // } } catch (Exception internalErrorException) { // An internal error happened StackTraceElement[] se = internalErrorException.getStackTrace(); StringBuilder s = new StringBuilder(); s.append("*** internalErrorException ***\n"); s.append("Thread: " + Thread.currentThread().getName() + "\n"); for (int i = 0; i < se.length; i++) { s.append(se[i].toString() + "\n"); } AnLog.log(s.toString()); return null; } return metricLabels; } // Get index of sorting metric public synchronized String getSortColumnMetricDisplayName(final int mtype) { final AnMetric[] mlist = getMetricListByMType(mtype); if (mlist != null) { for (int i = 0; i < mlist.length; i++) { if (mlist[i].isSorted()) { return mlist[i].getName(); } } } return null; } // Get index of sorting metric public synchronized AnMetric getSortColumnMetric(final int mtype) { final AnMetric[] mlist = getMetricListByMType(mtype); if (mlist != null) { for (int i = 0; i < mlist.length; i++) { if (mlist[i].isSorted()) { return mlist[i]; } } } return null; } // Get index of sorting metric public synchronized void setSortColumnName(String name, final int mtype) { final AnMetric[] mlist = getMetricListByMType(mtype); for (int i = 0; i < mlist.length; i++) { if (mlist[i].getName().equals(name)) { setSortMetricByDType(this, i, mtype); } } } public static Object[] getRefMetricsV2() { synchronized (IPC.lock) { final IPC ipc = AnWindow.getInstance().IPC(); ipc.send("getRefMetricsV2"); return (Object[]) ipc.recvObject(); } } private static void sendMetricListV2(final int mtype, final AnMetric[] mlist) { final IPC ipc = AnWindow.getInstance().IPC(); final int msize = mlist.length; final int[] type = new int[msize]; final int[] subtype = new int[msize]; final boolean[] sort = new boolean[msize]; final int[] vis = new int[msize]; final String[] cmd = new String[msize]; final String[] expr_spec = new String[msize]; final String[] legend = new String[msize]; ipc.send(mtype); for (int i = 0; i < msize; i++) { AnMetric m = mlist[i]; type[i] = m.getType(); subtype[i] = m.getSubType(); sort[i] = m.isSorted(); vis[i] = m.get_vis_bits(); cmd[i] = m.getComd(); expr_spec[i] = m.expr_spec; legend[i] = m.legend; } ipc.send(type); ipc.send(subtype); ipc.send(sort); ipc.send(vis); ipc.send(cmd); ipc.send(expr_spec); ipc.send(legend); } public static void setCurMetricsV2IPC( final int mtype, final AnMetric[] mlist, final int cmp_mode) { synchronized (IPC.lock) { final IPC ipc = AnWindow.getInstance().IPC(); ipc.send("setCurMetricsV2"); ipc.send(0); ipc.send(cmp_mode); sendMetricListV2(mtype, mlist); ipc.recvVoid(); } } public static Object[] getCurMetricsV2IPC(final int mtype) { synchronized (IPC.lock) { final IPC ipc = AnWindow.getInstance().IPC(); ipc.send("getCurMetricsV2"); ipc.send(0); ipc.send(mtype); return (Object[]) ipc.recvObject(); } } /** * Send request to get Current Metrics. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result @Parameters: mtype - metric type * * @return IPCResult */ public static IPCResult SendRequest_getCurMetricsV2IPC(final int mtype) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getCurMetricsV2"); ipcHandle.append(0); ipcHandle.append(mtype); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } private static void setSort(final int sort_ind, final int mtype, final boolean direction) { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("setSort"); m_window.IPC().send(0); m_window.IPC().send(sort_ind); m_window.IPC().send(mtype); m_window.IPC().send(direction); m_window.IPC().recvString(); // synchronize } } public synchronized void hotAction() { MetricStates metricStatesCopy = metricStates.copy(); List list = metricStatesCopy.getMetricStateList(); for (MetricState metricState : list) { metricState.getSelection().setSelected(metricState.getAnMetric().isHot()); // Make sure something is selected if (metricState.getSelection().isSelected()) { if (!metricState.getSelection().getAttributes().anySelections()) { metricState.getSelection().setAttributes(metricState.getFactory().getAttributes().copy()); } } } set(this, metricStatesCopy); } public synchronized void resetAction() { MetricStates metricStatesCopy = metricStates.copy(); List list = metricStatesCopy.getMetricStateList(); for (MetricState metricState : list) { metricState.getSelection().setSelected(metricState.getFactory().isSelected()); metricState.getSelection().setAttributes(metricState.getFactory().getAttributes().copy()); } set(this, metricStatesCopy); } public synchronized void clearAction() { MetricStates metricStatesCopy = metricStates.copy(); List list = metricStatesCopy.getMetricStateList(); for (MetricState metricState : list) { if (!metricState.getAnMetric().isNameMetric()) { metricState.getSelection().setSelected(false); } } set(this, metricStatesCopy); } public synchronized JPopupMenu addMetricsPopupMenus( JPopupMenu popup, final AnMetric anMetric, final AnTable anTable, JMenu sortByMenu) { // System.out.println(anTable.getType()); // Metric Options JLabel metricNameLabel = new JLabel(); metricNameLabel.setText(" " + AnLocale.getString("Options for " + anMetric.getUserName())); metricNameLabel.setFont(metricNameLabel.getFont().deriveFont(Font.BOLD)); metricNameLabel.setForeground(AnEnvironment.METRIC_MENU_SECTION_COLOR); popup.add(metricNameLabel); for (Component component : getMetricOptionsItems(anMetric, anTable, sortByMenu)) { popup.add(component); } // Other popup.add(new JSeparator(SwingConstants.HORIZONTAL)); JLabel otherLabel = new JLabel(" " + AnLocale.getString("Other Metric Options")); otherLabel.setFont(otherLabel.getFont().deriveFont(Font.BOLD)); otherLabel.setForeground(AnEnvironment.METRIC_MENU_SECTION_COLOR); popup.add(otherLabel); for (Component component : getOtherMetricItems(anTable)) { popup.add(component); } return popup; } private List getMetricOptionsItems( final AnMetric anMetric, final AnTable anTable, JMenu sortByMenu) { List componentList = new ArrayList<>(); final MetricState metricState = getMetricStates().findMetricStateByName(anMetric.getComd()); if (metricState != null) { if (!anMetric.isNameMetric() && !anMetric.isStatic()) { final MetricAttributes capableAttributes = metricState.getCapable(); final MetricSelection metricSelection = metricState.getSelection(); final MetricSelection factoryMetricSelection = metricState.getFactory(); final MetricAttributes selectedAttributes = metricSelection.getAttributes(); final JCheckBoxMenuItem exclusiveCheckBox = new IndentCheckBox(AnLocale.getString("Exclusive"), 1); final JCheckBoxMenuItem eTimeCheckBox = new IndentCheckBox(AnLocale.getString("Time"), 2); final JCheckBoxMenuItem eValueCheckBox = new IndentCheckBox(AnLocale.getString("Value"), 2); final JCheckBoxMenuItem ePercentCheckBox = new IndentCheckBox(AnLocale.getString("Percent"), 2); final JCheckBoxMenuItem inclusiveCheckBox = new IndentCheckBox(AnLocale.getString("Inclusive"), 1); final JCheckBoxMenuItem iTimeCheckBox = new IndentCheckBox(AnLocale.getString("Time"), 2); final JCheckBoxMenuItem iValueCheckBox = new IndentCheckBox(AnLocale.getString("Value"), 2); final JCheckBoxMenuItem iPercentCheckBox = new IndentCheckBox(AnLocale.getString("Percent"), 2); final JCheckBoxMenuItem timeCheckBox = new IndentCheckBox(AnLocale.getString("Time"), 1); final JCheckBoxMenuItem valueCheckBox = new IndentCheckBox(AnLocale.getString("Value"), 1); final JCheckBoxMenuItem percentCheckBox = new IndentCheckBox(AnLocale.getString("Percent"), 1); if (anTable.getAnParent().showOnlyValuesInTables() || anTable.getAnParent().showOnlyIncludedInTables() || anTable.getAnParent().showOnlyAttributedInTables()) { timeCheckBox.setSelected(selectedAttributes.isVTime()); timeCheckBox.setEnabled(capableAttributes.isVTime()); timeCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setVTime(timeCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); valueCheckBox.setSelected(selectedAttributes.isVValue()); valueCheckBox.setEnabled(capableAttributes.isVValue()); valueCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setVValue(valueCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); percentCheckBox.setSelected(selectedAttributes.isVPercent()); percentCheckBox.setEnabled(capableAttributes.isVPercent()); percentCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setVPercent(percentCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); componentList.add(timeCheckBox); componentList.add(valueCheckBox); componentList.add(percentCheckBox); } else { exclusiveCheckBox.setSelected(selectedAttributes.anyExclusiveSelections()); exclusiveCheckBox.setEnabled(capableAttributes.anyExclusiveSelections()); exclusiveCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); if (exclusiveCheckBox.isSelected()) { // Try factory first copySelectedAttributes.setETime( factoryMetricSelection.getAttributes().isETime()); copySelectedAttributes.setEValue( factoryMetricSelection.getAttributes().isEValue()); copySelectedAttributes.setEPercent( factoryMetricSelection.getAttributes().isEPercent()); if (!copySelectedAttributes.anyExclusiveSelections()) { // Set first capable if (capableAttributes.isETime()) { copySelectedAttributes.setETime(true); } else if (capableAttributes.isEValue()) { copySelectedAttributes.setEValue(true); } else if (capableAttributes.isEPercent()) { copySelectedAttributes.setEPercent(true); } } } else { // Clear all... copySelectedAttributes.setETime(false); copySelectedAttributes.setEValue(false); copySelectedAttributes.setEPercent(false); } set(this, anMetric.getComd(), copySelectedAttributes); } }); eTimeCheckBox.setSelected(selectedAttributes.isETime()); eTimeCheckBox.setEnabled(capableAttributes.isETime()); eTimeCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setETime(eTimeCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); eValueCheckBox.setSelected(selectedAttributes.isEValue()); eValueCheckBox.setEnabled(capableAttributes.isEValue()); eValueCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setEValue(eValueCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); ePercentCheckBox.setSelected(selectedAttributes.isEPercent()); ePercentCheckBox.setEnabled(capableAttributes.isEPercent()); ePercentCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setEPercent(ePercentCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); inclusiveCheckBox.setSelected(selectedAttributes.anyInclusiveSelections()); inclusiveCheckBox.setEnabled(capableAttributes.anyInclusiveSelections()); inclusiveCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); if (inclusiveCheckBox.isSelected()) { // Try factory first copySelectedAttributes.setITime( factoryMetricSelection.getAttributes().isITime()); copySelectedAttributes.setIValue( factoryMetricSelection.getAttributes().isIValue()); copySelectedAttributes.setIPercent( factoryMetricSelection.getAttributes().isIPercent()); if (!copySelectedAttributes.anyInclusiveSelections()) { // Set first capable if (capableAttributes.isITime()) { copySelectedAttributes.setITime(true); } else if (capableAttributes.isIValue()) { copySelectedAttributes.setIValue(true); } else if (capableAttributes.isIPercent()) { copySelectedAttributes.setIPercent(true); } } } else { // Clear all... copySelectedAttributes.setITime(false); copySelectedAttributes.setIValue(false); copySelectedAttributes.setIPercent(false); } set(this, anMetric.getComd(), copySelectedAttributes); } }); iTimeCheckBox.setSelected(selectedAttributes.isITime()); iTimeCheckBox.setEnabled(capableAttributes.isITime()); iTimeCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setITime(iTimeCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); iValueCheckBox.setSelected(selectedAttributes.isIValue()); iValueCheckBox.setEnabled(capableAttributes.isIValue()); iValueCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setIValue(iValueCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); iPercentCheckBox.setSelected(selectedAttributes.isIPercent()); iPercentCheckBox.setEnabled(capableAttributes.isIPercent()); iPercentCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MetricAttributes copySelectedAttributes = selectedAttributes.copy(); copySelectedAttributes.setIPercent(iPercentCheckBox.isSelected()); set(this, anMetric.getComd(), copySelectedAttributes); } }); componentList.add(exclusiveCheckBox); componentList.add(eTimeCheckBox); componentList.add(eValueCheckBox); componentList.add(ePercentCheckBox); componentList.add(inclusiveCheckBox); componentList.add(iTimeCheckBox); componentList.add(iValueCheckBox); componentList.add(iPercentCheckBox); } AnMetric auxMetric = null; String aux = anMetric.getAux(); if (aux != null && anMetric.getComd().equals(aux)) { for (AnMetric am : availableAnMetrics) { // Look for metrcis with aux equal comd if (am.getAux() != null && am.getAux().equals(anMetric.getComd()) && !am.getComd().equals(am.getAux())) { auxMetric = am; break; } } } else if (aux != null && !anMetric.getComd().equals(aux)) { for (AnMetric am : availableAnMetrics) { // Look for metrcis with aux equal comd if (am.getComd().equals(aux)) { auxMetric = am; break; } } } if (auxMetric != null) { MetricState auxMetricState = getMetricStates().findMetricStateByName(auxMetric.getComd()); if (auxMetricState != null) { JLabel filler = new JLabel(); Dimension dim = new Dimension(5, 5); filler.setPreferredSize(dim); componentList.add(filler); final JCheckBoxMenuItem auxCheckBox = new IndentCheckBox(auxMetric.getUserName(), 1); auxCheckBox.setSelected(auxMetricState.getSelection().isSelected()); componentList.add(auxCheckBox); final AnMetric finalAuxMetric = auxMetric; auxCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set(this, finalAuxMetric.getComd(), auxCheckBox.isSelected()); } }); } } JMenuItem removeMemyItem = new JMenuItem(AnLocale.getString("Remove This Metric")); removeMemyItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set(this, metricState.getAnMetric().getComd(), false); } }); componentList.add(removeMemyItem); } if (sortByMenu != null) { componentList.add(sortByMenu); } List list = getMetricStates().getSelectedMetricsByMType(dtype2mtype(anTable.getType())); JMenu reorderMenu = new JMenu(AnLocale.getString("Move This Metric To")); // Before... JMenu beforeMenu = new JMenu(AnLocale.getString("Before Metric")); for (AnMetric s : list) { final AnMetric refMetric = s; JMenuItem menuItem = new JMenuItem(refMetric.getUserName()); if (s.getComd().equals(anMetric.getComd())) { menuItem.setEnabled(false); } menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMetricOrder(this, anMetric.getComd(), refMetric.getComd(), true, MET_NORMAL); } }); beforeMenu.add(menuItem); } reorderMenu.add(beforeMenu); // After... JMenu toAfterMenu = new JMenu(AnLocale.getString("After Metric")); for (AnMetric s : list) { final AnMetric refMetric = s; JMenuItem menuItem = new JMenuItem(refMetric.getUserName()); if (s.getComd().equals(anMetric.getComd())) { menuItem.setEnabled(false); } menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMetricOrder(this, anMetric.getComd(), refMetric.getComd(), false, MET_NORMAL); } }); toAfterMenu.add(menuItem); } reorderMenu.add(toAfterMenu); componentList.add(reorderMenu); } return componentList; } public synchronized List getOtherMetricItems(AnTable anTable) { List list = new ArrayList<>(); // Table format JMenu formatMenuItem = new JMenu(AnLocale.getString("Format")); final JCheckBoxMenuItem wrapCheckBoxMenuItem = new JCheckBoxMenuItem(AnLocale.getString("Wrap Long Metric Names in Table Headers")); wrapCheckBoxMenuItem.setSelected( AnWindow.getInstance().getSettings().getTableSettings().wrapMetricNames()); wrapCheckBoxMenuItem.setEnabled(anTable.wrapMetricNames()); wrapCheckBoxMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getTableSettings() .setWrapMetricNames(MetricsSetting.this, wrapCheckBoxMenuItem.isSelected()); } }); formatMenuItem.add(wrapCheckBoxMenuItem); list.add(formatMenuItem); // Compare mode CompareModeSetting.CompareMode mode = AnWindow.getInstance().getSettings().getCompareModeSetting().get(); JMenu compareMenuItem = new JMenu(AnLocale.getString("Compare Mode")); if (mode != CompareModeSetting.CompareMode.CMP_DISABLE) { JRadioButtonMenuItem absoluteRadioButtonMenuItem = new JRadioButtonMenuItem(AnLocale.getString("Absolute")); JRadioButtonMenuItem deltaRadioButtonMenuItem = new JRadioButtonMenuItem(AnLocale.getString("Delta")); JRadioButtonMenuItem ratioRadioButtonMenuItem = new JRadioButtonMenuItem(AnLocale.getString("Ratio")); absoluteRadioButtonMenuItem.setSelected(mode == CompareModeSetting.CompareMode.CMP_ENABLE); deltaRadioButtonMenuItem.setSelected(mode == CompareModeSetting.CompareMode.CMP_DELTA); ratioRadioButtonMenuItem.setSelected(mode == CompareModeSetting.CompareMode.CMP_RATIO); absoluteRadioButtonMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getCompareModeSetting() .set(this, CompareModeSetting.CompareMode.CMP_ENABLE); } }); deltaRadioButtonMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getCompareModeSetting() .set(this, CompareModeSetting.CompareMode.CMP_DELTA); } }); ratioRadioButtonMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getCompareModeSetting() .set(this, CompareModeSetting.CompareMode.CMP_RATIO); } }); compareMenuItem.add(absoluteRadioButtonMenuItem); compareMenuItem.add(deltaRadioButtonMenuItem); compareMenuItem.add(ratioRadioButtonMenuItem); formatMenuItem.add(compareMenuItem); } // More metrics JMenu moreMetricsMenuItem = new JMenu(AnLocale.getString("More Metrics")); addMetricMenuSelector(moreMetricsMenuItem, anTable.getType(), true); list.add(moreMetricsMenuItem); // Settings for (JComponent component : createMetricSettingsSelector()) { list.add(component); } return list; } public synchronized JPopupMenu addMetricsPopupSelector( JPopupMenu popup, int dtype, boolean addMetricActions) { List list = createMetricsSelector(dtype, addMetricActions); for (JComponent component : list) { popup.add(component); } // popup.add(new JSeparator(SwingConstants.HORIZONTAL)); // for (JComponent component : createMetricSettingsSelector()) { // popup.add(component); // } return popup; } public synchronized JMenu addMetricMenuSelector(JMenu menu, int dtype, boolean addMetricActions) { for (JComponent component : createMetricsSelector(dtype, addMetricActions)) { menu.add(component); } return menu; } public synchronized List createMetricSettingsSelector() { List componentList = new ArrayList<>(); componentList.add(AnWindow.getInstance().getMetricsSettingsAction().getMenuItem()); return componentList; } private List createMetricsSelector(int dtype, boolean addMetricActions) { List componentList = new ArrayList<>(); List metricStateList = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .getMetricStateList(); boolean anyHot = false; String listName = null; int numberAdded = 0; int metricListID = AnWindow.getInstance().getSettings().getViewsSetting().getViewMetricListIdMapping(dtype); // System.out.println("------------------------- " + dtype + " " + metricListID); for (MetricState metricState : metricStateList) { if (metricState.getAnMetric().isNameMetric()) { continue; } if (metricState.getAnMetric().isStatic() && dtype2mtype(dtype) != MET_NORMAL) { continue; } if (metricListID != MetricNode.ALL_LIST_ID && metricListID != metricState.getListId()) { continue; } String ln = metricState.getListName(); if (ln != null && !ln.equals(listName)) { // System.out.println(ln); if (listName != null) { JLabel filler = new JLabel(" "); filler.setPreferredSize(new Dimension(4, 4)); componentList.add(filler); // JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); // // separator.setForeground(AnEnvironment.METRIC_SELCTOR_MENU_SEPARATOR_COLOR); // separator.setBorder(null); // separator.setPreferredSize(new // Dimension(separator.getPreferredSize().width, 1)); // componentList.add(separator); } JLabel label = new JLabel(" " + ln); label = new JLabel(" " + ln); label.setFont(label.getFont().deriveFont(Font.BOLD)); label.setForeground(AnEnvironment.METRIC_MENU_SECTION_COLOR); componentList.add(label); listName = ln; } MetricCheckBox checkBox = new MetricCheckBox( metricState.getAnMetric(), metricState.getSelection().isSelected(), metricState.getAnMetric().isHot() ? AnUtility.hot_icon : null); componentList.add(checkBox); if (metricState.getAnMetric().isHot()) { anyHot = true; } numberAdded++; } if (numberAdded > 0) { if (addMetricActions) { componentList.add(new JSeparator(SwingConstants.HORIZONTAL)); JMenuItem settingsItem; settingsItem = new MetricMenuItem(AnLocale.getString("Select Hot Metrics"), AnUtility.hot_icon); settingsItem.setEnabled(anyHot); settingsItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().hotAction(); } }); componentList.add(settingsItem); settingsItem = new JMenuItem(AnLocale.getString("Reset All Metrics")); settingsItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().resetAction(); } }); componentList.add(settingsItem); settingsItem = new JMenuItem(AnLocale.getString("Remove All Metrics")); settingsItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().clearAction(); } }); componentList.add(settingsItem); } } else { JLabel label = new JLabel(" " + AnLocale.getString("No metrics available for this view")); // label.setIcon(AnUtility.blankIcon); // label.setFont(label.getFont().deriveFont(Font.BOLD)); // label.setForeground(AnEnvironment.METRIC_SELCTOR_MENU_GROUP_COLOR); componentList.add(label); } return componentList; } public synchronized List createTableColumnMenuItems(AnTable table) { int dtype = table.getType(); int mtype = dtype2mtype(dtype); List anMetricList = metricStates.getAnMetricsByMTypeTrimmed(mtype); List componentList = new ArrayList<>(); for (AnMetric anMetric : anMetricList) { JMenu metricMenu = new JMenu(anMetric.getUserName()); JPopupMenu popupMenu = new JPopupMenu(); addMetricsPopupMenus(popupMenu, anMetric, table, null); List metricOptionList = getMetricOptionsItems(anMetric, table, null); for (Component comp : metricOptionList) { metricMenu.add(comp); } componentList.add(metricMenu); } return componentList; } private static class IndentCheckBox extends JCheckBoxMenuItem { public IndentCheckBox(String text, int indent) { this.setText(text); setBorder(BorderFactory.createMatteBorder(1, 1 + 16 * indent, 1, 1, getBackground())); } } public static class MetricCheckBox extends JCheckBoxMenuItem { private ImageIcon icon; private AnMetric anMetric; public MetricCheckBox(final AnMetric anMetric, boolean selected, ImageIcon icon) { this.setText(anMetric.getUserName()); this.anMetric = anMetric; this.icon = icon; setBorder(BorderFactory.createMatteBorder(1, 16, 1, 1, getBackground())); setSelected(selected); addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .set(MetricCheckBox.this, anMetric.getComd(), isSelected()); } }); } @Override public void paint(Graphics g) { super.paint(g); // To change body of generated methods, choose Tools | Templates. if (icon != null) { g.drawImage(icon.getImage(), 4, 3, this); } } /** * @return the anMetric */ public AnMetric getAnMetric() { return anMetric; } } private static class MetricMenuItem extends JMenuItem { private ImageIcon icon; public MetricMenuItem(String text, ImageIcon icon) { this.setText(text); this.icon = icon; setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, getBackground())); } @Override public void paint(Graphics g) { super.paint(g); // To change body of generated methods, choose Tools | Templates. if (icon != null) { g.drawImage(icon.getImage(), 4, 4, this); } } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MMetric.java0000644000175000017500000000600514744453367020014 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnMetric; public class MMetric { private AnMetric[] mMetricList; private int sortIndex; private boolean reverseSortDirection; public MMetric(AnMetric[] mMetricList, boolean reverseSortDirection) { this.mMetricList = mMetricList; this.reverseSortDirection = reverseSortDirection; refreshStates(); } private void refreshStates() { int index = 0; for (AnMetric anMetric : mMetricList) { if (anMetric.isSorted()) { sortIndex = index; break; } index++; if (index >= mMetricList.length) { mMetricList[0].setSorted(true); sortIndex = 0; } } } public MMetric copy() { AnMetric[] copyMMetricList = new AnMetric[getmMetricList().length]; int i = 0; for (AnMetric anMetric : getmMetricList()) { copyMMetricList[i++] = anMetric; } MMetric copyMMetric = new MMetric(copyMMetricList, isReverseSortDirection()); return copyMMetric; } public AnMetric[] getmMetricList() { return mMetricList; } public void setmMetricList(AnMetric[] mMetricList) { this.mMetricList = mMetricList; } public int getIndex(AnMetric am) { int index = 0; for (AnMetric anMetric : mMetricList) { if (anMetric == am) { return index; } index++; } return -1; } public int getSortIndex() { return sortIndex; } public AnMetric getSortMetric() { return mMetricList[sortIndex]; } public boolean isReverseSortDirection() { return reverseSortDirection; } public void setSortIndex(int sortIndex) { if (sortIndex >= 0 && sortIndex < mMetricList.length) { this.sortIndex = sortIndex; } } /** * @param reverseSortDirection the reverseSortDirection to set */ public void setReverseSortDirection(boolean reverseSortDirection) { this.reverseSortDirection = reverseSortDirection; } protected void dump() { if (mMetricList != null) { int n = 0; for (AnMetric anMetric : mMetricList) { System.out.print(" " + n++ + ": " + anMetric.getName()); if (anMetric.isSorted()) { System.out.print(" <== " + "SORT"); } System.out.println(); } } System.out.println(" sortIndex: " + sortIndex); System.out.println(" reverseSortDirection: " + reverseSortDirection); } } gprofng-gui-2.1/org/gprofng/mpmt/settings/TimelineSetting.java0000644000175000017500000005265615044710303021551 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.experiment_props.DataDescriptor; import org.gprofng.mpmt.experiment_props.ExperimentProperties; import org.gprofng.mpmt.experiment_props.Experiments; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import org.gprofng.mpmt.settings.Settings.TLStack_align; import org.gprofng.mpmt.timeline2.TimelineDraw; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class TimelineSetting extends Setting { public class EntityProp { public final int prop_id; // PROP_* value public final String prop_name; // PROP_* name public final String prop_uname; // user name public final String prop_cmd; // .er.rc command public EntityProp(int id, String name, String uname, String cmd) { prop_id = id; prop_name = name; prop_uname = uname; prop_cmd = cmd; } } private static final String default_prop_name = "THRID"; // Default // FIXUP: UGLY!!!! private List tl_entity_props = new ArrayList<>(); private List settings; private long tldata_hidden_bitmask; // states of checkboxes private List tldata_unames; // names shown for checkboxes private List tldata_cnames; // .er.rc tldata cmds for checkboxes private Set tldata_unused_hidden; // not-yet-used .er.rc fields private int tldata_names_version; // tracks changes to timeline Data option updates private String tldata_cmd; // .er.rc command line, not including "tldata" private static String tldata_cmd_default = "all"; public TimelineSetting() { // XXX: why are PROP_* values hard coded here? // tl_entity_prop_* should be set only // once per gp-display-text connect List tl_entity_prop_ids = Arrays.asList( Settings.PROP_NONE, Settings.PROP_NONE, Settings.PROP_NONE, Settings.PROP_NONE); // dbe property ID for above entities List tl_entity_prop_names = Arrays.asList("LWPID", "THRID", "CPUID", "EXPID"); // names for above entities (???) List tl_entity_prop_unames = Arrays.asList("LWP", "Thread", "CPU", "Process"); // user-visible names for above entities List tl_entity_prop_cmd_names = Arrays.asList( "lwp", "thread", "cpu", "experiment"); // .er.rc command name for above entities for (int ii = 0; ii < tl_entity_prop_ids.size(); ii++) { tl_entity_props.add( new EntityProp( tl_entity_prop_ids.get(ii), tl_entity_prop_names.get(ii), tl_entity_prop_unames.get(ii), tl_entity_prop_cmd_names.get(ii))); } tldata_hidden_bitmask = 0; tldata_unames = new ArrayList<>(); tldata_cnames = new ArrayList<>(); tldata_unused_hidden = new HashSet<>(); tldata_names_version = 0; tldata_cmd = tldata_cmd_default; } private void init(Object originalSource, List settings) { // if called externally, add code to update tldata_* state this.settings = settings; fireChangeEvent(originalSource, settings); } /** Called from Settings Save */ public void set(Object originalSource, List newSettings, boolean changed) { if (changed) { setValueAndFireChangeEvent(originalSource, this, newSettings); } } /* * Called from import settings */ public void set( Object originalSource, String groupDataByButtonName, int stackAlignNo, int stackDepth, int stackFramePixels, boolean showEventStates, boolean showEventDensity) { List settingsCopy = (List) AnWindow.getInstance().getSettings().getTimelineSettings(true); // setProps(tl_entprops); // tldata_unused_hidden = parseTLDataCmd(in_tldata_cmd); // resetTLDataNames(); // relies on tldata_unused_hidden // Find the button number int groupDataByButtonNum = 1; // FIXUP: why 1? for (int i = 0; i < tl_entity_props.size(); i++) { if (tl_entity_props.get(i).prop_name.equalsIgnoreCase(groupDataByButtonName)) { groupDataByButtonNum = i; break; } } // Construct the StackAlign Settings.TLStack_align stackAlign = Settings.TLStack_align.find(stackAlignNo); settingsCopy.set(0, groupDataByButtonName); settingsCopy.set(1, groupDataByButtonNum); settingsCopy.set(2, stackAlign); settingsCopy.set(3, stackDepth); settingsCopy.set(4, Long.valueOf(getTLDataHiddenMask())); settingsCopy.set(5, getTLDataCNames()); settingsCopy.set(6, getTLDataUNames()); settingsCopy.set(7, Integer.valueOf(getTLDataNamesVersion())); settingsCopy.set(8, showEventStates); settingsCopy.set(9, showEventDensity); settingsCopy.set(10, stackFramePixels); settingsCopy.set(11, tldata_cmd); set(originalSource, settingsCopy, true); } /** Called when new experiment has been loaded (after processing .er.rc) */ private void setProps(Object[] tl_entprops) { int[] tl_entprop_ids; String[] tl_entprop_names; String[] tl_entprop_unames; String[] tl_entprop_cnames; tl_entprop_ids = (int[]) tl_entprops[0]; tl_entprop_names = (String[]) tl_entprops[1]; tl_entprop_unames = (String[]) tl_entprops[2]; tl_entprop_cnames = (String[]) tl_entprops[3]; // first item in list is "unknown" propId==0; skip it tl_entity_props = new ArrayList<>(); for (int i = 1; tl_entprop_ids != null && i < tl_entprop_ids.length; i++) { int thisId = tl_entprop_ids[i]; String thisName = tl_entprop_names[i]; String thisUname = tl_entprop_unames[i]; String thisCname = tl_entprop_cnames[i]; tl_entity_props.add(new EntityProp(thisId, thisName, thisUname, thisCname)); } } /** Called once right after new experiment has been loaded (after processing .er.rc) */ private boolean resetTLDataNames() { Experiments experiments = AnWindow.getInstance().getExperimentProperties(); // determine unique "data types" shown in Presentation Timeline Tab final HashSet uniqueNames = new HashSet<>(); final ArrayList dataCNames = new ArrayList<>(); final ArrayList dataUNames = new ArrayList<>(); for (ExperimentProperties exp : experiments.getAllExperimentProperties()) { for (DataDescriptor dataD : exp.getTstampDataDescriptors()) { int auxmax = dataD.getAuxCount(); if (auxmax == 0) { auxmax = 1; // loop only once } for (int aux = 0; aux < auxmax; aux++) { String cname_tmp = dataD.getErRcTLDataCmdName(aux); String uname_tmp = dataD.getLongUName(aux); if (cname_tmp == null || cname_tmp.isEmpty()) { continue; } if (uname_tmp == null || uname_tmp.isEmpty()) { continue; } if (uniqueNames.add(uname_tmp)) { dataCNames.add(cname_tmp); dataUNames.add(uname_tmp); } } } } boolean names_changed = resetTLDataNames(dataCNames, dataUNames); return names_changed; } private boolean resetTLDataNames( final ArrayList newCmdNames, final ArrayList newUserNames) { boolean namesUpdated = false; { if (tldata_cnames.size() != newCmdNames.size()) { namesUpdated = true; } else { // old and new sizes are the same, maybe we have a perfect match for (int ii = 0; ii < newCmdNames.size(); ii++) { String newname = newCmdNames.get(ii); String oldname = tldata_cnames.get(ii); if (!newname.equals(oldname)) { // something changed namesUpdated = true; break; } } } final boolean bitmaskNeedsUpdate; if (tldata_hidden_bitmask == 0 && tldata_unused_hidden.isEmpty()) { bitmaskNeedsUpdate = false; } else if (!namesUpdated) { bitmaskNeedsUpdate = false; } else { bitmaskNeedsUpdate = true; } if (bitmaskNeedsUpdate) { // update tldata_unused_cnames in include all disabled items for (int jj = 0; jj < tldata_cnames.size(); jj++) { String currCmd = tldata_cnames.get(jj); long currBit = (tldata_hidden_bitmask & (1L << jj)); if (currBit != 0) { tldata_unused_hidden.add(currCmd); } } // scan new names to see which should be disabled long new_hidden_mask = 0; for (int ii = 0; ii < newCmdNames.size(); ii++) { String newCname = newCmdNames.get(ii); for (String disabledName : tldata_unused_hidden) { if (newCname.equals(disabledName)) { new_hidden_mask |= (1L << ii); tldata_unused_hidden.remove(disabledName); break; } } } tldata_hidden_bitmask = new_hidden_mask; } if (namesUpdated) { tldata_cnames = Collections.unmodifiableList(newCmdNames); tldata_unames = Collections.unmodifiableList(newUserNames); tldata_names_version++; } if (namesUpdated || bitmaskNeedsUpdate) { updateTLDataCmd(tldata_hidden_bitmask); } } return namesUpdated; } private static Set parseTLDataCmd(String new_tldata_cmd) { // == text that follows the .er.rc "tldata" command Set cnamesToHide = new HashSet(); { if (new_tldata_cmd == null || new_tldata_cmd.length() == 0) { return cnamesToHide; } new_tldata_cmd = new_tldata_cmd.toLowerCase(); String mcmds[] = new_tldata_cmd.split(":"); if (mcmds == null) { return cnamesToHide; } for (int ii = 0; ii < mcmds.length; ii++) { String this_cmd = mcmds[ii]; if (this_cmd.equals(Settings.TLData_type.TL_ALL.getTLDataBaseCmd())) { // nothing to do (only saving "!" items in list) } else if (this_cmd.startsWith("!")) { this_cmd = this_cmd.substring(1); // remove ! if (this_cmd.length() > 0) { cnamesToHide.add(this_cmd); } } } } return cnamesToHide; } public long setTLDataVisibility_edt(Set allCmds, Set disabledCmds) { long specified_mask = 0; long new_mask = 0; int num_disabled = 0; for (int jj = 0; jj < tldata_cnames.size(); jj++) { String currCmd = tldata_cnames.get(jj); if (allCmds.contains(currCmd)) { specified_mask |= (1L << jj); } } for (int jj = 0; jj < tldata_cnames.size(); jj++) { String currCmd = tldata_cnames.get(jj); if (disabledCmds.contains(currCmd)) { new_mask |= (1L << jj); num_disabled++; } } if (num_disabled != disabledCmds.size()) { int ii = 0; // weird! } long original_bitmask = tldata_hidden_bitmask; tldata_hidden_bitmask &= ~specified_mask; tldata_hidden_bitmask |= new_mask; if (original_bitmask != tldata_hidden_bitmask) { updateTLDataCmd(tldata_hidden_bitmask); } return tldata_hidden_bitmask; } public long getTLDataHiddenMask() { return tldata_hidden_bitmask; } public void setTLDataHiddenMask(long newMask) { long old_mask = tldata_hidden_bitmask; tldata_hidden_bitmask = newMask; if (old_mask != newMask) { updateTLDataCmd(tldata_hidden_bitmask); } } public int getTLDataNamesVersion() { return tldata_names_version; } public List getTLDataUNames() { return tldata_unames; } public List getTLDataCNames() { return tldata_cnames; } // only called when there is a change: private String updateTLDataCmd(long hidden_mask) { // update tldata_cmd String new_tldata_cmd = tldata_cmd_default; for (int ii = 0; ii < tldata_cnames.size(); ii++) { long disable = ((1L << ii) & hidden_mask); if (disable != 0) { new_tldata_cmd += ":!" + tldata_cnames.get(ii); } } tldata_cmd = new_tldata_cmd; return tldata_cmd; } /* * Called when new experiment has been loaded (after processing .er.rc) */ public void init( Object originalSource, Object[] tl_entprops, String in_tldata_cmd, String groupDataByButtonName, int stackAlignNo, int stackDepth, int stackFramePixels, boolean showEventStates, boolean showEventDensity) { List settingsCopy = (List) AnWindow.getInstance().getSettings().getTimelineSettings(true); setProps(tl_entprops); tldata_unused_hidden = parseTLDataCmd(in_tldata_cmd); resetTLDataNames(); // relies on tldata_unused_hidden // Find the button number int groupDataByButtonNum = 1; // FIXUP: why 1? for (int i = 0; i < tl_entity_props.size(); i++) { if (tl_entity_props.get(i).prop_name.equalsIgnoreCase(groupDataByButtonName)) { groupDataByButtonNum = i; break; } } // Construct the StackAlign Settings.TLStack_align stackAlign = Settings.TLStack_align.find(stackAlignNo); settingsCopy.set(0, groupDataByButtonName); settingsCopy.set(1, groupDataByButtonNum); settingsCopy.set(2, stackAlign); settingsCopy.set(3, stackDepth); settingsCopy.set(4, Long.valueOf(getTLDataHiddenMask())); settingsCopy.set(5, getTLDataCNames()); settingsCopy.set(6, getTLDataUNames()); settingsCopy.set(7, Integer.valueOf(getTLDataNamesVersion())); settingsCopy.set(8, showEventStates); settingsCopy.set(9, showEventDensity); settingsCopy.set(10, stackFramePixels); settingsCopy.set(11, tldata_cmd); init(originalSource, settingsCopy); } private List getSettings() { return settings; } @Override Type getType() { return AnSettingChangeEvent.Type.TIMELINE; } @Override Object getValue() { return settings; } @Override void setValue(Object newValue) { // might not be EDT!! this.settings = (List) newValue; } public TLStack_align getStack_align() { if (settings != null) { return (TLStack_align) settings.get(2); } else { return getDefaultStack_align(); } } public int getTLStackDepth() { if (settings != null) { int stackDepth = (Integer) settings.get(3); return stackDepth; } else { return getDefaultStackDepth(); } } public int getTLStackFramePixels() { if (settings != null) { int stackDepth = (Integer) settings.get(10); return stackDepth; } else { return getDefaultStackFramePixels(); } } public int getStackAlign() { int value = getStack_align().getValue(); return value; } public boolean getShowEventStates() { if (settings != null) { Boolean show = (Boolean) settings.get(8); return show; } else { return getTimelineShowEventStatesDefault(); } } public boolean getShowEventDensity() { if (settings != null) { Boolean show = (Boolean) settings.get(9); return show; } else { return getTimelineShowEventDensityDefault(); } } public static int getDefaultStackDepth() { return TimelineDraw.TIMELINE_DEFAULT_VZOOM_LEVEL; // Default } public static int getDefaultStackFramePixels() { return Settings.TIMELINE_DEFAULT_STACK_FRAME_PIXELS; // Default } public static boolean getTimelineShowEventStatesDefault() { return true; // Default } public static boolean getTimelineShowEventDensityDefault() { return false; // Default } public void setTLStackDepth(Object originalSource, int stackDepth) { List settingsCopy = (List) AnWindow.getInstance().getSettings().getTimelineSettings(true); if (stackDepth > TimelineDraw.TIMELINE_MAX_VZOOM_LEVEL) { stackDepth = TimelineDraw.TIMELINE_MAX_VZOOM_LEVEL; } boolean changed = false; if ((Integer) (settingsCopy.get(3)) != stackDepth) { changed = true; } settingsCopy.set(3, stackDepth); set(originalSource, settingsCopy, changed); } public void setTLStackFramePixels(Object originalSource, int stackFramePixels) { List settingsCopy = (List) AnWindow.getInstance().getSettings().getTimelineSettings(true); boolean changed = false; if ((Integer) (settingsCopy.get(10)) != stackFramePixels) { changed = true; } settingsCopy.set(10, stackFramePixels); set(originalSource, settingsCopy, changed); } public void setTLGroupDataBySelectedButtonIndex( Object originalSource, int new_tl_entity_button_num) { List settingsCopy = (List) AnWindow.getInstance().getSettings().getTimelineSettings(true); if (new_tl_entity_button_num < 0 || new_tl_entity_button_num >= tl_entity_props.size()) { return; // weird } String tl_entity_prop_name = tl_entity_props.get(new_tl_entity_button_num).prop_name; boolean changed = false; String oldName = (String) (settingsCopy.get(0)); if (!(tl_entity_prop_name.equalsIgnoreCase(oldName))) { changed = true; } else if ((Integer) (settingsCopy.get(1)) != new_tl_entity_button_num) { changed = true; } settingsCopy.set(0, tl_entity_prop_name); settingsCopy.set(1, new_tl_entity_button_num); set(originalSource, settingsCopy, changed); } public static String getDefaultGroupDataByButtonName() { return default_prop_name; } public static String getDefaultTLDataCmd() { return tldata_cmd_default; } public static int getDefaultStackAlign() { return getDefaultStack_align().getValue(); } private static TLStack_align getDefaultStack_align() { return TLStack_align.TLSTACK_ALIGN_ROOT; } public String getGroupDataByButtonName() { if (settings != null) { return (String) (settings.get(0)); } else { return getDefaultGroupDataByButtonName(); } } public String getTLDataCmd() { if (settings != null) { return tldata_cmd; // tldata_cmd gets updated dynamically... // YXXX FIXUP, not sure what to do - should we update tldata_cmd whenever an TL event updates // settings.get(11)? // String tmp_tldata_cmd = (String)settings.get(11); // return tmp_tldata_cmd; } else { return getDefaultTLDataCmd(); } } public String getFullTLDataCmd() { // include old settings previously seen, but not applicable to this experiment String fullCmd = tldata_cmd; for (String unused_cname : tldata_unused_hidden) { fullCmd += ":!" + unused_cname; } return fullCmd; } public int getTl_entity_selected_btn() { if (settings != null) { return (Integer) (settings.get(1)); } else { return 1; // Default // FIXUP: UGLY!!!! } } public EntityProp getTl_entity_prop(int buttonIdx) { if (buttonIdx < 0 || buttonIdx >= tl_entity_props.size()) { return null; // weird } return tl_entity_props.get(buttonIdx); } public static Object[] ipcGetTLValue() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getTLValue"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } /** * Send request to get TLValue. Non-blocking IPC call. Caller should call ipcResult.getObjects() * to get the result * * @return IPCResult */ public static IPCResult ipcGetTLValueRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getTLValue"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } // YXXX TBR? Remember to clean back-end. private static void ipcSetTLValue( final String tldata_cmd, int entity_prop_id, int align, int depth) { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("setTLValue"); window.IPC().send(0); window.IPC().send(tldata_cmd); window.IPC().send(entity_prop_id); window.IPC().send(align); window.IPC().send(depth); window.IPC().recvString(); // synchronize } } public static Object[] ipcGetEntityProps() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getEntityProps"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } /** * Send request to get EntityProps. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result * * @return IPCResult */ public static IPCResult ipcGetEntityPropsRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getEntityProps"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ImportSettingsDialog.java0000644000175000017500000001327114744453367022572 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; import java.util.List; public class ImportSettingsDialog extends AnDialog2 { ImportSettingsPanel importSettingsPanel; public ImportSettingsDialog(Frame owner) { super(owner, owner, AnLocale.getString("Import Settings")); importSettingsPanel = new ImportSettingsPanel(this); setCustomPanel(importSettingsPanel); // setHelpTag(AnVariable.HELP_ImportSettings); getOKButton().setText(AnLocale.getString("Import")); getOKButton().setToolTipText(AnLocale.getString("Import selected settings")); } @Override protected void setStatus(Status status) { super.setStatus(status); if (status == Status.OK) { UserPref existingUserpref = UserPref.getInstance(); UserPref userPref = importSettingsPanel.getUserPref(); Settings settings = AnWindow.getInstance().getSettings(); List whatList = importSettingsPanel.getWhat(); if (whatList.contains(UserPref.What.VIEWS)) { AnWindow.getInstance() .getSettings() .getViewsSetting() .set( this, userPref.getViewPanelOrder(), userPref.getMachineModel(), userPref.getCustomIndexObjects(), userPref.getCustomMemoryObjects()); } if (whatList.contains(UserPref.What.METRICS)) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .set( this, userPref.getMetricSelectionList(), userPref.getMetricReversedSort(), userPref.getMetricSortByMTypeList(), userPref.getMetricOrderLists()); } if (whatList.contains(UserPref.What.TIMELINE)) { AnWindow.getInstance() .getSettings() .getTimelineSetting() .set( this, userPref.getTimelineGroupDataByButtonName(), userPref.getTimelineStackAlign(), userPref.getTimelineStackDepth(), userPref.getTimelineStackFramePixels(), userPref.getTimelineShowEventStates(), userPref.getTimelineShowEventDensity()); } if (whatList.contains(UserPref.What.SOURCEDISASSEMBLY)) { settings.getSourceDisassemblySetting().set(this, userPref.getSourceDisassemblySettings()); } if (whatList.contains(UserPref.What.CALLTREE)) { settings.getCallTreeSetting().setThreshold(this, userPref.getCallStackThreshold()); } if (whatList.contains(UserPref.What.FORMATS)) { settings .getViewModeSetting() .set(this, ViewModeSetting.ViewMode.fromValue(userPref.getFormatsViewMode())); settings .getFormatSetting() .set( this, FormatSetting.Style.fromValue(userPref.getFormatsStyle()), userPref.getFormatsAppendSoName()); settings .getCompareModeSetting() .set(this, CompareModeSetting.CompareMode.fromValue(userPref.getFormatsCompareMode())); settings.getTableSettings().setWrapMetricNames(this, userPref.wrapMetricNamesInTables()); } if (whatList.contains(UserPref.What.SEARCHPATH)) { settings .getSearchPathSetting() .set( this, userPref.getSearchPath().toArray(new String[userPref.getSearchPath().size()])); } if (whatList.contains(UserPref.What.PATHMAP)) { settings.getPathMapSetting().set(this, userPref.getPathmap()); } if (whatList.contains(UserPref.What.FUNCTIONCOLORS)) { AnWindow.getInstance() .getColorChooser() .getColorMap() .initRules(userPref.getActiveColorRules(), true); } if (whatList.contains(UserPref.What.LIBRARYVISIBILITY)) { settings .getLibraryVisibilitySetting() .setFromStrings(this, userPref.getLibraryVisibilitySettings()); AnWindow.getInstance() .getLibraryVisibilityDialog() .initStates( userPref.getLibraryVisibilityJava(), userPref.getLibraryVisibilitySettings(), userPref.getLibraryVisibilityIncludePickList(), userPref.getLibraryVisibilityIncludeFilter(), userPref.getLibraryVisibilityExcludePickList(), userPref.getCurrenLibraryVisibilityExcludeFilter()); } if (whatList.contains(UserPref.What.MISC)) { existingUserpref.setFindPickList(userPref.getFindPickList()); AnWindow.getInstance() .getToolBarPanel() .getFindTextPanel() .initializeFindTexts(userPref.getFindPickList(), null); // Find text } // Save configuration file path existingUserpref.setLastExportImportConfPath(importSettingsPanel.getConfigurationPath()); } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricAttributes.java0000644000175000017500000000740114744453367021747 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; public class MetricAttributes { private boolean eTime; private boolean eValue; private boolean ePercent; private boolean iTime; private boolean iValue; private boolean iPercent; public MetricAttributes( boolean eTime, boolean eValue, boolean ePercent, boolean iTime, boolean iValue, boolean iPercent) { this.eTime = eTime; this.eValue = eValue; this.ePercent = ePercent; this.iTime = iTime; this.iValue = iValue; this.iPercent = iPercent; } public boolean isETime() { return eTime; } public void setETime(boolean eTime) { this.eTime = eTime; } public boolean isEValue() { return eValue; } /** * @param eValue the eValue to set */ public void setEValue(boolean eValue) { this.eValue = eValue; } public boolean isEPercent() { return ePercent; } public void setEPercent(boolean ePercent) { this.ePercent = ePercent; } public boolean isITime() { return iTime; } public void setITime(boolean iTime) { this.iTime = iTime; } public boolean isIValue() { return iValue; } public void setIValue(boolean iValue) { this.iValue = iValue; } public boolean isIPercent() { return iPercent; } public void setIPercent(boolean iPercent) { this.iPercent = iPercent; } public boolean isVTime() { if (eTime || eValue || ePercent) { return eTime; } else { return iTime; } } public void setVTime(boolean time) { if (eTime || eValue || ePercent) { eTime = time; } else { iTime = time; } } public boolean isVValue() { if (eTime || eValue || ePercent) { return eValue; } else { return iValue; } } public void setVValue(boolean value) { if (eTime || eValue || ePercent) { eValue = value; } else { iValue = value; } } public boolean isVPercent() { if (eTime || eValue || ePercent) { return ePercent; } else { return iPercent; } } public void setVPercent(boolean percent) { if (eTime || eValue || ePercent) { ePercent = percent; } else { iPercent = percent; } } /** * @return deep copy */ public MetricAttributes copy() { return new MetricAttributes(eTime, eValue, ePercent, iTime, iValue, iPercent); } @Override public boolean equals(Object obj) { if (obj instanceof MetricAttributes) { MetricAttributes ma = (MetricAttributes) obj; return ma.isETime() == eTime && ma.isEValue() == eValue && ma.isEPercent() == ePercent && ma.isITime() == iTime && ma.isIValue() == iValue && ma.isIPercent() == iPercent; } else { return super.equals(obj); // To change body of generated methods, choose Tools | Templates. } } public boolean anyExclusiveSelections() { return eTime || eValue || ePercent; } public boolean anyInclusiveSelections() { return iTime || iValue || iPercent; } public boolean anySelections() { return anyExclusiveSelections() || anyInclusiveSelections(); } } gprofng-gui-2.1/org/gprofng/mpmt/settings/TableSettings.java0000644000175000017500000000306014744453367021222 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class TableSettings extends Setting { private Boolean wrapMetricNames = wrapMetricNamesDefault(); public TableSettings() {} public void setWrapMetricNames(Object originalSource, boolean wrap) { if (wrap != wrapMetricNames) { setValueAndFireChangeEvent(originalSource, this, wrap); } } public void initWrapMetricNames(boolean wrap) { wrapMetricNames = wrap; } public Boolean wrapMetricNames() { return wrapMetricNames; } public static Boolean wrapMetricNamesDefault() { return true; } @Override Type getType() { return AnSettingChangeEvent.Type.TABLE_FORMATS; } @Override Object getValue() { return wrapMetricNames; } @Override void setValue(Object newValue) { Boolean wrap = (Boolean) newValue; wrapMetricNames = wrap; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ViewModeEnabledSetting.java0000644000175000017500000000446414744453367023013 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class ViewModeEnabledSetting extends Setting { private boolean enabled = false; // Default public ViewModeEnabledSetting() {} public void init(Object originalSource, boolean newValue) { if (enabled != newValue) { this.enabled = newValue; fireChangeEvent(originalSource, newValue); } } public void init(boolean newValue) { enabled = newValue; } public boolean isViewModeEnabled() { return enabled; } @Override Type getType() { return AnSettingChangeEvent.Type.VIEW_MODE_ENABLED; } @Override Object getValue() { return enabled; } @Override void setValue(Object newValue) { enabled = (Boolean) newValue; } public static boolean getViewModeEnabledIPC() { boolean viewModeEnabled; synchronized (IPC.lock) { AnWindow.getInstance().IPC().send("getViewModeEnable"); viewModeEnabled = AnWindow.getInstance().IPC().recvBoolean(); } return viewModeEnabled; } /** * Send request to get View Mode Enabled. Non-blocking IPC call. Caller should call * ipcResult.getBoolean() to get the result * * @return IPCResult */ public static IPCResult getViewModeEnabledIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getViewModeEnable"); IPCResult ipcResult = ipcHandle.sendRequest(); // boolean result = ipcResult.getBoolean() // blocking return ipcResult; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricStates.java0000644000175000017500000004036615044710303021047 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import static org.gprofng.mpmt.settings.Settings.getMetricList; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.metrics.MetricNode; import java.util.ArrayList; import java.util.List; public class MetricStates { private List metricStateList; // Current selection. Capable and factory settings. private MMetric[] metricListsByMType; // Selected and ordered private boolean reverseSortDirection = false; private MetricNode metricsRootNode; private List newMetricOrder = null; private MetricType newSortMetric = null; private Boolean newReverseSortDirection = null; public MetricStates() {} public MetricStates(boolean reverseSortDirection) { this.reverseSortDirection = reverseSortDirection; } public MetricState findMetricStateByName(String name) { for (MetricState metricState : metricStateList) { if (metricState.getAnMetric().getComd().equals(name)) { return metricState; } } // System.err.println("METRICERROR: MetricStates.findMetricStateByName Can't find " + // name); return null; } public void setSelection(String name, boolean selected) { MetricState metricState = findMetricStateByName(name); if (metricState != null) { metricState.getSelection().setSelected(selected); // make sure something is selected if (!metricState.getSelection().getAttributes().anySelections()) { metricState.getSelection().setAttributes(metricState.getFactory().getAttributes().copy()); } } } public void setSelection(List metricNameSelectionList) { if (metricNameSelectionList != null) { for (MetricNameSelection metricNameSelection : metricNameSelectionList) { setSelection(metricNameSelection); } } } public void setSelection(MetricNameSelection metricNameSelection) { MetricState metricState = findMetricStateByName(metricNameSelection.getName()); if (metricState != null) { metricState.getSelection().set(metricNameSelection.getMetricSelection()); } } public boolean isSelected(String metricName) { MetricState metricState = findMetricStateByName(metricName); if (metricState != null) { return metricState.getSelection().isSelected(); } return false; } public void updateStates(MetricNode metricsRootNode, List metricStateList) { this.metricsRootNode = metricsRootNode; this.metricStateList = metricStateList; } public List getMetricStateList() { return metricStateList; } public void resetMetricListsByMType() { // System.out.println("resetMetricListsByMType"); metricListsByMType = new MMetric[MetricsSetting.MET_LAST]; // Use "async" IPC calls to minimize the "high latency" effect IPCResult[] ipcrs = new IPCResult[MetricsSetting.MET_LAST + 1]; for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { ipcrs[mtype] = MetricsSetting.SendRequest_getCurMetricsV2IPC(mtype); // ASYNC IPC } for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { Object[] ref_data = ipcrs[mtype].getObjects(); // Get IPC result if (ref_data != null && ref_data.length > 0) { metricListsByMType[mtype] = new MMetric(getMetricList(ref_data), reverseSortDirection); } else { metricListsByMType[mtype] = null; } } // Old code used "sync" IPC calls // for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { // Object[] ref_data = MetricsSetting.getCurMetricsV2IPC(mtype); // IPC // if (ref_data != null && ref_data.length > 0) { // metricListsByMType[mtype] = new MMetric(getMetricList(ref_data), // reverseSortDirection); // } else { // metricListsByMType[mtype] = null; // } // } } /** * @return Returns a deep copy */ protected MetricStates copy() { MetricStates copy = new MetricStates(reverseSortDirection); MMetric[] copyMetricListsByMType = new MMetric[metricListsByMType.length]; int index = 0; for (MMetric mMetric : metricListsByMType) { copyMetricListsByMType[index++] = mMetric.copy(); } copy.setMetricListsByMType(copyMetricListsByMType); List copyMetricStateList = new ArrayList<>(); for (MetricState metricState : metricStateList) { copyMetricStateList.add(metricState.copy()); } copy.updateStates(metricsRootNode, copyMetricStateList); return copy; } /** * @return list of changed metrics. Assume old and new lists contains same metrics in same order. */ public static List getChangedMetrics( MetricStates oldMetricsStates, MetricStates newMetricsStates) { if (oldMetricsStates == null) { // Just copy the 'new' list List changes = new ArrayList<>(); for (MetricState metricState : newMetricsStates.getMetricStateList()) { changes.add( new MetricNameSelection( metricState.getAnMetric().getComd(), metricState.getSelection().copy())); // FIXUP: copy necessary? } return changes; } List oldMetricStateList = oldMetricsStates.getMetricStateList(); List newMetricStateList = newMetricsStates.getMetricStateList(); boolean okToCheck = true; if (oldMetricStateList.size() != newMetricStateList.size()) { okToCheck = false; } if (okToCheck) { for (int i = 0; i < oldMetricStateList.size(); i++) { AnMetric oldAnMetric = oldMetricStateList.get(i).getAnMetric(); AnMetric newAnMetric = newMetricStateList.get(i).getAnMetric(); if (oldAnMetric != newAnMetric) { okToCheck = false; } } } if (!okToCheck) { System.err.println( "METRICERROR: MetricStates.getChangedMetrics: old and new lists are different"); } List changes = new ArrayList<>(); for (int i = 0; i < oldMetricStateList.size(); i++) { MetricState oldMetricState = oldMetricStateList.get(i); MetricState newMetricState = newMetricStateList.get(i); if (!oldMetricState.getSelection().equals(newMetricState.getSelection())) { changes.add( new MetricNameSelection( newMetricState.getAnMetric().getComd(), newMetricState.getSelection().copy())); // FIXUP: copy necessary? } } return changes; } public List getChangedMetricSortColumns() { List list = new ArrayList<>(); // Check change in sort column index for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { MMetric mMetric = metricListsByMType[mtype]; // Sort column changed? AnMetric[] anMetricList = mMetric.getmMetricList(); int oldSortIndex = -1; int index = 0; for (AnMetric anMetric : anMetricList) { if (anMetric.isSorted()) { oldSortIndex = index; break; } index++; } int newSortIndex = metricListsByMType[mtype].getSortIndex(); if (oldSortIndex != newSortIndex) { list.add(new int[] {mMetric.getSortIndex(), mtype}); } } // Check change to sort direction for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { MMetric mMetric = metricListsByMType[mtype]; boolean newReverseSortDirection = mMetric.isReverseSortDirection(); if (reverseSortDirection != newReverseSortDirection) { list.add(new int[] {mMetric.getSortIndex(), mtype}); } } return list; } public void transferSortChangesToMetricStates(List list) { for (int[] l : list) { int index = l[0]; int mtype = l[1]; MMetric mMetric = metricListsByMType[mtype]; for (int i = 0; i < mMetric.getmMetricList().length; i++) { mMetric.getmMetricList()[i].setSorted(false); } mMetric.getmMetricList()[index].setSorted(true); reverseSortDirection = mMetric.isReverseSortDirection(); } } public void updateSortMetric(int index, int mtype) { if (mtype < 0 || mtype >= metricListsByMType.length) { return; } MMetric mMetric = metricListsByMType[mtype]; int currentIndex = mMetric.getSortIndex(); if (index != currentIndex) { mMetric.setSortIndex(index); mMetric.setReverseSortDirection(false); } else { mMetric.setReverseSortDirection(!mMetric.isReverseSortDirection()); } } public void updateMetricOrder(int from, int to, int mtype) { if (from == to) { return; } if (mtype < 0 || mtype >= metricListsByMType.length) { return; } MMetric mMetric = metricListsByMType[mtype]; AnMetric[] mlist = mMetric.getmMetricList(); if (from < 0 || from >= mlist.length || to < 0 || to >= mlist.length) { return; } AnMetric m = mlist[from]; mlist[from] = mlist[to]; mlist[to] = m; // update sort index if (mMetric.getSortIndex() == from) { mMetric.setSortIndex(to); } else if (mMetric.getSortIndex() == to) { mMetric.setSortIndex(from); } // updateMetricOrder(mlist[from].getComd(), mlist[to].getComd(), from > to, mtype); } public void updateMetricOrder( String metricName, String metricRefName, boolean before, int mtype) { if (mtype < 0 || mtype >= metricListsByMType.length) { return; } MMetric mMetric = metricListsByMType[mtype]; AnMetric sortMetric = mMetric.getSortMetric(); AnMetric[] mlist = mMetric.getmMetricList(); List metricsToMove = new ArrayList<>(); List metricsNotToMove = new ArrayList<>(); for (int i = 0; i < mlist.length; i++) { if (mlist[i].getComd().equals(metricName)) { metricsToMove.add(mlist[i]); } else { metricsNotToMove.add(mlist[i]); } } int insertionIndex = -1; for (int i = 0; i < metricsNotToMove.size(); i++) { if (metricsNotToMove.get(i).getComd().equals(metricRefName)) { insertionIndex = i; if (before) { break; } } } if (insertionIndex != -1) { List newList = new ArrayList<>(); if (before) { for (int i = 0; i <= insertionIndex - 1; i++) { newList.add(metricsNotToMove.get(i)); } newList.addAll(metricsToMove); for (int i = insertionIndex; i < metricsNotToMove.size(); i++) { newList.add(metricsNotToMove.get(i)); } } else { for (int i = 0; i <= insertionIndex; i++) { newList.add(metricsNotToMove.get(i)); } newList.addAll(metricsToMove); for (int i = insertionIndex + 1; i < metricsNotToMove.size(); i++) { newList.add(metricsNotToMove.get(i)); } } if (newList.size() != mlist.length) { System.err.println("ERROR: MetricStates.UpdateMetricOrder newList.size() != mlist.length"); } else { newList.toArray(mlist); } int newSortIndex = mMetric.getIndex(sortMetric); mMetric.setSortIndex(newSortIndex); // // update sort index // if (mMetric.getSortIndex() == from) { // mMetric.setSortIndex(to); // } else if (mMetric.getSortIndex() == to) { // mMetric.setSortIndex(from); // } } } public List getSelectedMetricsByMType(int mType) { List list = new ArrayList<>(); String lastName = null; MMetric mList = metricListsByMType[mType]; for (AnMetric m : mList.getmMetricList()) { if (lastName == null || !lastName.equals(m.getComd())) { list.add(m); lastName = m.getComd(); } } return list; } public int getSortIndex(int mtype) { int sortIndex = -1; if (metricListsByMType != null && mtype >= 0 && mtype < metricListsByMType.length) { AnMetric[] mlist = metricListsByMType[mtype].getmMetricList(); for (int index = 0; index < mlist.length; index++) { if (mlist[index].isSorted()) { sortIndex = index; break; } } } return sortIndex; } public void dump() { System.out.println("--------------------------metricStates"); for (MetricState metricState : metricStateList) { metricState.dump(); } } protected void dumpMetricStates() { if (metricListsByMType != null) { for (int mtype = 0; mtype < metricListsByMType.length; mtype++) { dumpMetricListsByMType(mtype); } } System.out.println("reverseSortDirection: " + reverseSortDirection); } protected void dumpMetricListsByMType(int mtype) { System.out.println("State mtype: " + mtype); metricListsByMType[mtype].dump(); } public boolean isReverseDirectionSorting() { return reverseSortDirection; } public void setReverseDirectionSorting(boolean reverseDirectionSorting) { this.reverseSortDirection = reverseDirectionSorting; for (MMetric mMetric : metricListsByMType) { mMetric.setReverseSortDirection(reverseSortDirection); } } public MetricType[] getMetricSortByMType() { MetricType[] metricSortByMType = new MetricType[MetricsSetting.MET_LAST]; int index = 0; for (MMetric mMetric : metricListsByMType) { AnMetric sortMetric = mMetric.getSortMetric(); metricSortByMType[index] = new MetricType(sortMetric.getComd(), sortMetric.getSubType()); index++; } return metricSortByMType; } public List[] getMetricOrderLists() { List[] lists = (ArrayList[]) new ArrayList[MetricsSetting.MET_LAST]; for (int mtype = 0; mtype < MetricsSetting.MET_LAST; mtype++) { List orderList = new ArrayList<>(); MMetric metricList = metricListsByMType[mtype]; for (AnMetric anMetric : metricList.getmMetricList()) { orderList.add(new MetricType(anMetric.getComd(), anMetric.getSubType())); } lists[mtype] = orderList; } return lists; } public MMetric[] getMetricListsByMType() { return metricListsByMType; } public AnMetric[] getMetricListByMType(int mtype) { if (metricListsByMType == null) { return null; } if (mtype < 0 || mtype >= metricListsByMType.length) { return null; } return metricListsByMType[mtype].getmMetricList(); } public List getAnMetricsByMTypeTrimmed(int mtype) { AnMetric[] anMetricList = getMetricListByMType(mtype); List list = new ArrayList<>(); if (anMetricList != null) { String last = null; for (AnMetric anMetric : anMetricList) { if (!anMetric.getComd().equals(last)) { list.add(anMetric); last = anMetric.getComd(); } } } return list; } public void setMetricListsByMType(MMetric[] metricListsByMType) { this.metricListsByMType = metricListsByMType; } public List getNewMetricOrder() { return newMetricOrder; } public void setNewMetricOrder(List newMetricOrder) { this.newMetricOrder = newMetricOrder; } public MetricType getNewSortMetric() { return newSortMetric; } public void setNewSortMetric(MetricType newSortMetric) { this.newSortMetric = newSortMetric; } public Boolean getNewReverseSortDirection() { return newReverseSortDirection; } public void setNewReverseSortDirection(Boolean newReverseSortDirection) { this.newReverseSortDirection = newReverseSortDirection; setReverseDirectionSorting(newReverseSortDirection); } /** * @return the metricsRootNode */ public MetricNode getMetricsRootNode() { return metricsRootNode; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/AnSettingChangeEvent.java0000644000175000017500000000510714744453367022462 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import java.util.EventObject; public class AnSettingChangeEvent extends EventObject { public enum Type { VIEW_MODE, // fired when there is a change to "View Mode" setting VIEW_MODE_ENABLED, // fired when there is a change to "View Mode" visibility FORMAT, // fired when there are a changes to "Function Name Style" or "Append SO name to // Function name" settings COMPARE_MODE, // fired when there is a change to "Compare Mode" setting METRICS, // fired when there is a change to "Metrics" (visibility) settings TIMELINE, // fired when there is a change to "Timeline" settings SRC_DIS, // fired when there is a change to "Source/Disassembly" settings SEARCH_PATH, // fired when there is a change to "Search Path" settings PATH_MAP, // fired when there is a change to "Path Map" settings CALL_TREE, // fired when there is a change to "Call Tree" settings VIEWS, // fired when there is a change to "Views" settings LIBRARY_VISIBILITY, // fired when there is a change to "Library Visibility" settings TABLE_FORMATS, // fired when there is a change to Table Formats } private final Object originalSource; private final Type type; private final Object oldValue; private final Object newValue; public AnSettingChangeEvent( Object originalSource, Object source, Type type, Object oldValue, Object newValue) { super(source); this.type = type; this.originalSource = originalSource; this.oldValue = oldValue; this.newValue = newValue; } /** * @return the originalSource */ public Object getOriginalSource() { return originalSource; } /** * @return the type */ public Type getType() { return type; } /** * @return the oldValue */ public Object getOldValue() { return oldValue; } /** * @return the newValue */ public Object getNewValue() { return newValue; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ViewModeSetting.java0000644000175000017500000000760214744453367021535 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class ViewModeSetting extends Setting { private static final ViewMode defaultViewMode = ViewMode.USER; public enum ViewMode { MACHINE(0, AnLocale.getString("Machine")), USER(1, AnLocale.getString("User")), EXPERT(2, AnLocale.getString("Expert")); private final int value; private final String name; private ViewMode(int value, String name) { this.value = value; this.name = name; } public int value() { return value; } public static ViewMode fromValue(int val) { for (ViewMode rt : ViewMode.values()) { if (rt.value() == val) { return rt; } } return null; } @Override public String toString() { return name; } }; private ViewMode viewMode = ViewMode.USER; // Default public ViewModeSetting() {} public void init(Object originalSource, ViewMode newViewMode) { viewMode = newViewMode; fireChangeEvent(originalSource, newViewMode); } public void set(Object originalSource, ViewMode newViewMode) { if (newViewMode != viewMode) { setValueAndFireChangeEvent(originalSource, this, newViewMode); } } // View Mode public ViewMode get() { return viewMode; } public String getStackName() { if (get() == ViewMode.MACHINE) { return "MSTACK"; } if (get() == ViewMode.EXPERT) { return "XSTACK"; } return "USTACK"; } public static ViewMode getDefaultViewMode() { return defaultViewMode; } @Override Type getType() { return AnSettingChangeEvent.Type.VIEW_MODE; } @Override Object getValue() { return viewMode; } @Override void setValue(Object newValue) { ViewMode newViewMode = (ViewMode) newValue; this.viewMode = newViewMode; setViewModeIPC(newViewMode.value()); // IPC } public static int getViewModeIPC() { synchronized (IPC.lock) { int viewMode; AnWindow.getInstance().IPC().send("getViewMode"); AnWindow.getInstance().IPC().send(0); viewMode = AnWindow.getInstance().IPC().recvInt(); return viewMode; } } /** * Send request to get View Mode. Non-blocking IPC call. Caller should call ipcResult.getInt() to * get the result * * @return IPCResult */ public static IPCResult getViewModeIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getViewMode"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // int result = ipcResult.getInt() // blocking return ipcResult; } /** * Set View Mode * * @param set 0 = Machine, 1 = User, 2 = Expert */ private static void setViewModeIPC(final int set) { synchronized (IPC.lock) { // System.out.println("setViewModeIPC: " + set); AnWindow.getInstance().IPC().send("setViewMode"); AnWindow.getInstance().IPC().send(0); AnWindow.getInstance().IPC().send(set); AnWindow.getInstance().IPC().recvString(); } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ExportSettingsPanel.form0000644000175000017500000005755514744453367022500 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/settings/PathmapsPanel.java0000644000175000017500000006246015044710303021174 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; public class PathmapsPanel extends javax.swing.JPanel { private static final Color shadedBackground = new Color(249, 249, 249); private static final Color listLabelBackground = new Color(241, 241, 241); private List dataFrom; private List dataTo; private final PMListSelectionListener fromListSelectionListener; private final PMDocumentListener pmDocumentListener; private final Settings settings; public PathmapsPanel(Settings settings) { this.settings = settings; initComponents(); setBorder(BorderFactory.createMatteBorder(12, 12, 12, 10, (Color) null)); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext(topLabel, AnLocale.getString("Map the following path:")); AnUtility.setTextAndAccessibleContext(fromLabel, AnLocale.getString("From Path:")); fromLabel.setDisplayedMnemonic(AnLocale.getString('F', "PathmapFromPathLabelMnemonic")); fromLabel.setLabelFor(fromTextField); AnUtility.setTextAndAccessibleContext(toLabel, AnLocale.getString("To Path:")); toLabel.setDisplayedMnemonic(AnLocale.getString('T', "PathmapToPathLabelMnemonic")); toLabel.setLabelFor(toTextField); appendButton.setText(AnLocale.getString("Append")); appendButton.setToolTipText(AnLocale.getString("Append the mapping to the pathmap list")); appendButton.setMnemonic(AnLocale.getString('P', "PathMapPanelBrowseAppend_MN")); updateButton.setText(AnLocale.getString("Update")); updateButton.setMnemonic(AnLocale.getString('e', "PathMapPanelBrowseUpdate_MN")); updateButton.setToolTipText(AnLocale.getString("Update the selected pathmap with the changes")); upButton.setText(AnLocale.getString("Up")); upButton.setMnemonic(AnLocale.getString('u', "PathMapPanelBrowseUp_MN")); upButton.setToolTipText(AnLocale.getString("Move the selected pathmap up")); downButton.setText(AnLocale.getString("Down")); downButton.setMnemonic(AnLocale.getString('d', "PathMapPanelBrowseDown_MN")); downButton.setToolTipText(AnLocale.getString("Move theselected pathmap down")); removeButton.setText(AnLocale.getString("Remove")); removeButton.setMnemonic(AnLocale.getString('r', "PathMapPanelBrowseRemove_MN")); removeButton.setToolTipText(AnLocale.getString("Remove the selected pathmap")); fromButton.setToolTipText(AnLocale.getString("Browse for From Path (ALT B)")); fromButton.setMnemonic(AnLocale.getString('B', "PathMapPanelBrowseFromPathButtonMN")); toButton.setToolTipText(AnLocale.getString("Browse for To Path (ALT W)")); toButton.setMnemonic(AnLocale.getString('W', "PathMapPanelBrowsToPathButtonMN")); AnUtility.setTextAndAccessibleContext(listLabel, AnLocale.getString("Pathmaps:")); listLabel.setDisplayedMnemonic(AnLocale.getString('m', "PathmapPathmapsLabelMnemonic")); listLabel.setLabelFor(listTo); AnUtility.setTextAndAccessibleContext(fromListLabel, AnLocale.getString("From Path")); fromListLabel.setHorizontalAlignment(JLabel.CENTER); AnUtility.setTextAndAccessibleContext(toListLabel, AnLocale.getString("To Path")); toListLabel.setHorizontalAlignment(JLabel.CENTER); listPanelInner.setBackground(listLabelBackground); listPanel.setBorder( BorderFactory.createLineBorder(AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR, 1)); fromListLabel.setBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); listFromScrollPane.setBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); listFrom.setCellRenderer(new LCR()); AnUtility.setTTAndAccessibleContext(listFrom, AnLocale.getString("Pathmap list")); listTo.setCellRenderer(new LCR()); fromListSelectionListener = new PMListSelectionListener(); pmDocumentListener = new PMDocumentListener(); listFrom.addListSelectionListener(fromListSelectionListener); listTo.addListSelectionListener(fromListSelectionListener); fromTextField.getDocument().addDocumentListener(pmDocumentListener); toTextField.getDocument().addDocumentListener(pmDocumentListener); updateStates(); } private class LCR extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); // To change body of generated methods, choose Tools | Templates. label.setText(" " + label.getText()); if (index % 2 == 1 && !isSelected) { label.setBackground(shadedBackground); } return label; } } private void refreshPanel(int selectedIndex) { listFrom.setListData(dataFrom.toArray()); listTo.setListData(dataTo.toArray()); if (dataFrom.size() == 0) { return; } if (selectedIndex >= 0 && selectedIndex <= dataFrom.size()) { listFrom.setSelectedIndex(selectedIndex); listFrom.ensureIndexIsVisible(selectedIndex); listTo.setSelectedIndex(selectedIndex); listTo.ensureIndexIsVisible(selectedIndex); } } /** Called when there are changes to pathmaps settings */ public void updateGUI() { String[] from = AnWindow.getInstance().getSettings().getPathMapSetting().getPathMapFrom(); String[] to = AnWindow.getInstance().getSettings().getPathMapSetting().getPathMapTo(); dataFrom = new ArrayList<>(Arrays.asList(from)); dataTo = new ArrayList<>(Arrays.asList(to)); refreshPanel(0); } private void madeChanges() { settings.setMessageAreaVisible(true); settings.stateChanged(null); } /** Called from Save button in Settings panel */ public void checkPathMapChanged(Object originalSource) { String[] from = dataFrom.toArray(new String[dataFrom.size()]); String[] to = dataTo.toArray(new String[dataTo.size()]); String[][] pathMap = new String[2][]; pathMap[0] = from; pathMap[1] = to; AnWindow.getInstance().getSettings().getPathMapSetting().set(originalSource, pathMap); } class PMDocumentListener implements DocumentListener { @Override public void removeUpdate(DocumentEvent e) { updateStates(); } @Override public void insertUpdate(DocumentEvent e) { updateStates(); } @Override public void changedUpdate(DocumentEvent e) { updateStates(); } } class PMListSelectionListener implements javax.swing.event.ListSelectionListener { @Override public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } // Synchronize selection listFrom.removeListSelectionListener(this); listTo.removeListSelectionListener(this); if (event.getSource() == listFrom) { listTo.setSelectedIndex(listFrom.getSelectedIndex()); } else { listFrom.setSelectedIndex(listTo.getSelectedIndex()); } listFrom.addListSelectionListener(this); listTo.addListSelectionListener(this); fromTextField.setText((String) listFrom.getSelectedValue()); toTextField.setText((String) listTo.getSelectedValue()); updateStates(); } } private void updateStates() { appendButton.setEnabled(false); updateButton.setEnabled(false); upButton.setEnabled(false); downButton.setEnabled(false); removeButton.setEnabled(false); if (dataFrom != null && dataFrom.size() > 0) { if (listFrom.getSelectedIndex() >= 0) { removeButton.setEnabled(true); } if (listFrom.getSelectedIndex() > 0) { upButton.setEnabled(true); } if (listFrom.getSelectedIndex() < dataFrom.size() - 1) { downButton.setEnabled(true); } } if (fromTextField.getText().length() > 0 && toTextField.getText().length() > 0) { appendButton.setEnabled(true); if (dataFrom != null && dataFrom.size() > 0) { int index = listFrom.getSelectedIndex(); if (index >= 0) { String from = dataFrom.get(index); String to = dataTo.get(index); if (!from.equals(fromTextField.getText()) || !to.equals(toTextField.getText())) { updateButton.setEnabled(true); } } } } } private String browse(String feed, String title) { String filePath = null; if (!Analyzer.getInstance().isRemote()) { // Local File feedFile = new File(feed); if (!feedFile.exists()) { feedFile = null; } JFileChooser fileChooser = new JFileChooser(); // Always local file chooser fileChooser.setDialogTitle(title); if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { filePath = fileChooser.getSelectedFile().getAbsolutePath(); } } else { // Remote AnFile feedFile = new AnFile(feed); if (!feedFile.exists()) { feedFile = null; } AnChooser fileChooser = AnWindow.getInstance() .getAnChooser(AnLocale.getString("To path"), AnChooser.DIR_FILE_CHOOSER, feed); // JFileChooser fileChooser = new JFileChooser(); // Always local file chooser if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { filePath = fileChooser.getSelectedFile().getAbsolutePath(); } } return filePath; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; topLabel = new javax.swing.JLabel(); fromLabel = new javax.swing.JLabel(); fromTextField = new javax.swing.JTextField(); fromButton = new javax.swing.JButton(); toLabel = new javax.swing.JLabel(); toTextField = new javax.swing.JTextField(); toButton = new javax.swing.JButton(); listLabel = new javax.swing.JLabel(); listPanel = new javax.swing.JPanel(); listPanelInner = new javax.swing.JPanel(); fromListLabel = new javax.swing.JLabel(); listFromScrollPane = new javax.swing.JScrollPane(); listFrom = new javax.swing.JList(); toListLabel = new javax.swing.JLabel(); listToScrollPane = new javax.swing.JScrollPane(); listTo = new javax.swing.JList(); topButtonPanel = new javax.swing.JPanel(); appendButton = new javax.swing.JButton(); updateButton = new javax.swing.JButton(); buttomButtonPanel = new javax.swing.JPanel(); upButton = new javax.swing.JButton(); downButton = new javax.swing.JButton(); removeButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); topLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; add(topLabel, gridBagConstraints); fromLabel.setText("From:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(fromLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(fromTextField, gridBagConstraints); fromButton.setText("..."); fromButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fromButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(fromButton, gridBagConstraints); toLabel.setText("To:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; add(toLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(toTextField, gridBagConstraints); toButton.setText("..."); toButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(toButton, gridBagConstraints); listLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(listLabel, gridBagConstraints); listPanel.setLayout(new java.awt.GridBagLayout()); listPanelInner.setLayout(new java.awt.GridBagLayout()); fromListLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; listPanelInner.add(fromListLabel, gridBagConstraints); listFromScrollPane.setBorder(null); listFromScrollPane.setViewportView(listFrom); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; listPanelInner.add(listFromScrollPane, gridBagConstraints); toListLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; listPanelInner.add(toListLabel, gridBagConstraints); listToScrollPane.setBorder(null); listToScrollPane.setViewportView(listTo); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; listPanelInner.add(listToScrollPane, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; listPanel.add(listPanelInner, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(listPanel, gridBagConstraints); topButtonPanel.setLayout(new java.awt.GridBagLayout()); appendButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { appendButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; topButtonPanel.add(appendButton, gridBagConstraints); updateButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); topButtonPanel.add(updateButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0); add(topButtonPanel, gridBagConstraints); buttomButtonPanel.setLayout(new java.awt.GridBagLayout()); upButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; buttomButtonPanel.add(upButton, gridBagConstraints); downButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); buttomButtonPanel.add(downButton, gridBagConstraints); removeButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); buttomButtonPanel.add(removeButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(buttomButtonPanel, gridBagConstraints); } // //GEN-END:initComponents private void appendButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_appendButtonActionPerformed dataFrom.add(fromTextField.getText()); dataTo.add(toTextField.getText()); refreshPanel(dataFrom.size() - 1); madeChanges(); } // GEN-LAST:event_appendButtonActionPerformed private void updateButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_updateButtonActionPerformed int index = listFrom.getSelectedIndex(); if (index >= 0) { dataFrom.remove(index); dataTo.remove(index); dataFrom.add(index, fromTextField.getText()); dataTo.add(index, toTextField.getText()); refreshPanel(index); madeChanges(); } } // GEN-LAST:event_updateButtonActionPerformed private void removeButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_removeButtonActionPerformed int index = listFrom.getSelectedIndex(); if (index >= 0) { dataFrom.remove(index); dataTo.remove(index); if (index < dataFrom.size()) { refreshPanel(index); } else { refreshPanel(index - 1); } madeChanges(); } } // GEN-LAST:event_removeButtonActionPerformed private void upButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_upButtonActionPerformed int index = listFrom.getSelectedIndex(); if (index > 0) { String from = dataFrom.get(index); String to = dataTo.get(index); dataFrom.remove(index); dataTo.remove(index); dataFrom.add(index - 1, from); dataTo.add(index - 1, to); refreshPanel(index - 1); madeChanges(); } } // GEN-LAST:event_upButtonActionPerformed private void downButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_downButtonActionPerformed int index = listFrom.getSelectedIndex(); if (index < dataFrom.size()) { String from = dataFrom.get(index); String to = dataTo.get(index); dataFrom.remove(index); dataTo.remove(index); dataFrom.add(index + 1, from); dataTo.add(index + 1, to); refreshPanel(index + 1); madeChanges(); } } // GEN-LAST:event_downButtonActionPerformed private void fromButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_fromButtonActionPerformed String feed = fromTextField.getText(); String res = browse(feed, AnLocale.getString("From Path")); fromTextField.setText(res); } // GEN-LAST:event_fromButtonActionPerformed private void toButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_toButtonActionPerformed String feed = toTextField.getText(); String res = browse(feed, AnLocale.getString("To Path")); toTextField.setText(res); } // GEN-LAST:event_toButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton appendButton; private javax.swing.JPanel buttomButtonPanel; private javax.swing.JButton downButton; private javax.swing.JButton fromButton; private javax.swing.JLabel fromLabel; private javax.swing.JLabel fromListLabel; private javax.swing.JTextField fromTextField; private javax.swing.JList listFrom; private javax.swing.JScrollPane listFromScrollPane; private javax.swing.JLabel listLabel; private javax.swing.JPanel listPanel; private javax.swing.JPanel listPanelInner; private javax.swing.JList listTo; private javax.swing.JScrollPane listToScrollPane; private javax.swing.JButton removeButton; private javax.swing.JButton toButton; private javax.swing.JLabel toLabel; private javax.swing.JLabel toListLabel; private javax.swing.JTextField toTextField; private javax.swing.JPanel topButtonPanel; private javax.swing.JLabel topLabel; private javax.swing.JButton upButton; private javax.swing.JButton updateButton; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/ViewsSetting.java0000644000175000017500000010364515044710303021073 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.AnWindow.AnDispTab; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.MemoryIndexObjectView; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.ArrayList; import java.util.List; import javax.swing.JComponent; public class ViewsSetting extends Setting { public class View { private AnDispTab anDispTab; private boolean selected; private View(AnDispTab anDispTab, boolean selected) { this.anDispTab = anDispTab; this.selected = selected; } /** * @return the anDispTab */ public AnDispTab getAnDispTab() { return anDispTab; } /** * @return the selected */ public boolean isSelected() { return selected; } /** * @param selected the selected to set */ private void setSelected(boolean selected) { this.selected = selected; } } public class Setting { private List viewList; private String preferredViewName; private Setting() { reset(); } private void reset() { viewList = new ArrayList<>(); preferredViewName = null; } private void addView(AnDispTab anDispTab, boolean selected) { View view = new View(anDispTab, selected); getViewList().add(view); } private void addViews(List list, boolean[] selected) { for (int i = 0; i < list.size(); i++) { addView(list.get(i), selected[i]); } } private void addViews(List list) { viewList.addAll(list); } private void setPreferredViewName(String selectedView) { this.preferredViewName = selectedView; } public String getPreferredViewName() { return preferredViewName; } private List getViewList() { return viewList; } private void setSelected(String name, boolean selected) { View view = findView(name); if (view != null) { view.setSelected(selected); } } private View findView(String name) { for (View view : viewList) { if (view.getAnDispTab().getTCmd().equals(name)) { return view; } } return null; } private View findView(int type) { for (View view : viewList) { if (view.getAnDispTab().getTType() == type) { return view; } } return null; } private void toggleTab(String cmd) { View view = findView(cmd); if (view != null) { view.setSelected(!view.isSelected()); } } private Setting copy() { Setting settingCopy = new Setting(); for (View view : viewList) { settingCopy.addView(view.getAnDispTab(), view.isSelected()); } settingCopy.setPreferredViewName(getPreferredViewName()); return settingCopy; } private List getSelectedViews() { List list = new ArrayList<>(); for (View view : viewList) { if (view.isSelected()) { list.add(view); } } return list; } private List getStaticViews() { List list = new ArrayList<>(); for (View view : viewList) { if (view.getAnDispTab().getTType() == AnDisplay.DSP_Welcome || view.getAnDispTab().getTType() == AnDisplay.DSP_Overview) { list.add(view); } } return list; } private List getStandardViews() { List list = new ArrayList<>(); for (View view : viewList) { if (view.getAnDispTab().getTType() != AnDisplay.DSP_Welcome && view.getAnDispTab().getTType() != AnDisplay.DSP_Overview && view.getAnDispTab().getTType() != AnDisplay.DSP_IndexObject && view.getAnDispTab().getTType() != AnDisplay.DSP_MemoryObject) { list.add(view); } } return list; } private List getIndexViews() { List list = new ArrayList<>(); for (View view : viewList) { if (view.getAnDispTab().getTType() == AnDisplay.DSP_IndexObject) { list.add(view); } } return list; } private List getMemoryViews() { List list = new ArrayList<>(); for (View view : viewList) { if (view.getAnDispTab().getTType() == AnDisplay.DSP_MemoryObject) { list.add(view); } } return list; } public View getFirstDataView() { View dataView = null; for (View view : viewList) { if (view.getAnDispTab().getTComp().getType() > 0 && view.getAnDispTab().getTComp().getType() != AnDisplay.DSP_Overview) { // <==== FIXUP: Is this the best check if (view.isSelected()) { dataView = view; break; } } } return dataView; } public void debug() { System.out.println("\nViewsSetting:"); System.out.println("PreferredViewName: " + getPreferredViewName()); int c = 0; for (View view : viewList) { System.out.println( c++ + ": " + view.getAnDispTab().getTName() + " " + view.getAnDispTab().getTType() + " " + view.isSelected()); } } } public static class CustomObject { private String name; private String formula; private String shortDesc; private String longDesc; public CustomObject(String name, String formula, String shortDesc, String longDesc) { this.name = name; this.formula = formula; this.shortDesc = shortDesc; this.longDesc = longDesc; } public String getName() { return name; } public String getFormula() { return formula; } public String getShortDesc() { return shortDesc; } public String getLongDesc() { return longDesc; } } private Setting setting = new Setting(); private List savedViewOrderList; private String[] availableMachineModels = null; private String machineModel = null; private List customIndexObjects = null; private List customMemoryObjects = null; private int[] viewMetricListIdMap; public ViewsSetting() { // FIXUP: hardcode the table for now. Should come from backend viewMetricListIdMap = new int[AnDisplay.DSP_MAX + 1]; for (int i = 0; i < viewMetricListIdMap.length; i++) { viewMetricListIdMap[i] = MetricNode.ALL_LIST_ID; } viewMetricListIdMap[AnDisplay.DSP_MemoryObject] = MetricNode.DATASPACE_HWC_LIST_ID; viewMetricListIdMap[AnDisplay.DSP_DataObjects] = MetricNode.DATASPACE_HWC_LIST_ID; viewMetricListIdMap[AnDisplay.DSP_DataLayout] = MetricNode.DATASPACE_HWC_LIST_ID; viewMetricListIdMap[AnDisplay.DSP_IO] = MetricNode.IO_LIST_ID; viewMetricListIdMap[AnDisplay.DSP_Heap] = MetricNode.HEAP_LIST_ID; } public int getViewMetricListIdMapping(int dtype) { if (dtype >= 0 && dtype <= AnDisplay.DSP_MAX) { return viewMetricListIdMap[dtype]; } else { return MetricNode.ALL_LIST_ID; } } public void debug() { setting.debug(); } private void set(Object originalSource, Setting newSetting) { boolean changed = false; List oldList = setting.getViewList(); List newList = newSetting.getViewList(); if (oldList.size() != newList.size()) { changed = true; } else { for (int i = 0; i < oldList.size(); i++) { if (oldList.get(i).isSelected() != newList.get(i).isSelected()) { changed = true; } } } if (changed) { setValueAndFireChangeEvent(originalSource, this, newSetting); } } /* * Called when custom index/memory objects added */ public void init( Object originalSource, List list, boolean[] selected, String preferredViewName) { Setting newSetting = new Setting(); newSetting.addViews(list, selected); newSetting.setPreferredViewName(preferredViewName); setting = newSetting; } /* * Called when experiment(s) loaded */ public void init( Object originalSource, List viewOrderList, String[][] groups, Object[] standardViews, boolean[] standardViewsSelected, Object[] indexViews, boolean[] indexViewsSelected, Object[] memoryViews, boolean[] memoryViewsSelected, String[] availableMachineModels, String machineModel, List customIndexObjects, List customMemoryObjects) { AnWindow window = AnWindow.getInstance(); this.savedViewOrderList = viewOrderList; this.availableMachineModels = availableMachineModels; this.machineModel = machineModel; this.customIndexObjects = customIndexObjects; this.customMemoryObjects = customMemoryObjects; String preferredViewName; AnDispTab[] staticObjs; boolean[] staticSelected; List listStatic; List listStandard; List listIndex; List listMemory; if (groups.length == 0) { staticObjs = new AnDispTab[] {window.new AnDispTab(AnDisplay.DSP_Welcome, "welcome", null, null)}; staticSelected = new boolean[] {true}; listStatic = addStaticObjects(staticObjs); listStandard = new ArrayList<>(); standardViewsSelected = new boolean[0]; listIndex = new ArrayList<>(); indexViewsSelected = new boolean[0]; listMemory = new ArrayList<>(); memoryViewsSelected = new boolean[0]; preferredViewName = staticObjs[0].getTCmd(); } else { staticObjs = new AnDispTab[] { window.new AnDispTab(AnDisplay.DSP_Welcome, "welcome", null, null), window.new AnDispTab(AnDisplay.DSP_Overview, "overview", null, null) }; staticSelected = new boolean[] {true, true}; listStatic = addStaticObjects(staticObjs); listStandard = addStandardObjects(standardViews); listIndex = addIndexObjects(indexViews); listMemory = addMemoryObjects(memoryViews); preferredViewName = staticObjs[1].getTCmd(); } // Hack to enable Heap view if available. Should be done in the backend. int index = 0; for (AnDispTab adt : listStandard) { if (adt.getTType() == AnDisplay.DSP_Heap) { if (!standardViewsSelected[index]) { standardViewsSelected[index] = true; } break; } index++; } // Hack end Setting newSetting = new Setting(); newSetting.addViews(listStatic, staticSelected); newSetting.addViews(listStandard, standardViewsSelected); newSetting.addViews(listIndex, indexViewsSelected); newSetting.addViews(listMemory, memoryViewsSelected); newSetting.setPreferredViewName(preferredViewName); if (viewOrderList != null) { for (UserPref.ViewPanelOrder viewPanelOrder : viewOrderList) { newSetting.setSelected(viewPanelOrder.getName(), viewPanelOrder.isShown()); } } setting = newSetting; fireChangeEvent(originalSource, setting); // for (AnDispTab adt : listStandard) { // int dtype = adt.getTType(); // int mtype = MetricsSetting.dtype2mtype(dtype); // System.out.println(String.format("%2d", dtype) + " " + mtype + " " + // adt.getTName() + " " + adt.getTCmd()); // } } /** Called from import settings... */ public void set( final Object originalSource, final List viewOrderList, final String machineModel, final List customIndexObjects, final List customMemoryObjects) { AnUtility.checkIfOnAWTThread(true); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { if (machineModel == null) { if (ViewsSetting.this.machineModel != null) { ViewsSetting.loadMachineModelIPC(""); } } else if (!machineModel.equals(ViewsSetting.this.machineModel)) { ViewsSetting.this.machineModel = machineModel; ViewsSetting.loadMachineModelIPC(machineModel); } if (customIndexObjects != null) { for (CustomObject customObject : customIndexObjects) { ViewsSetting.defineIndxObjIPC( customObject.getName(), customObject.getFormula(), customObject.getShortDesc(), customObject.getLongDesc()); } } if (customMemoryObjects != null) { for (CustomObject customObject : customMemoryObjects) { ViewsSetting.defineMemObjIPC( customObject.getName(), customObject.getFormula(), customObject.getShortDesc(), customObject.getLongDesc()); } } final Object[] standardViews = getTabListInfoIPC(); final boolean[] standardViewsSelected = ViewsSetting.getTabSelectionStateIPC(); final Object[] indexViews = ViewsSetting.getIndxObjDescriptionsIPC(); final boolean[] indexViewsSelected = ViewsSetting.getIndxTabSelectionStateIPC(); final Object[] memoryViews = ViewsSetting.getMemObjectsIPC(); final boolean[] memoryViewsSelected = ViewsSetting.getMemTabSelectionStateIPC(); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { init( originalSource, viewOrderList, AnWindow.getInstance().getExperimentGroups(), standardViews, standardViewsSelected, indexViews, indexViewsSelected, memoryViews, memoryViewsSelected, availableMachineModels, machineModel, customIndexObjects, customMemoryObjects); } }); } } }, "Set Views Thread"); } public void set(Object originalSource, boolean[] selected) { Setting settingCopy = setting.copy(); List list = settingCopy.getViewList(); assert selected.length == list.size(); for (int i = 0; i < list.size(); i++) { list.get(i).setSelected(selected[i]); } settingCopy.setPreferredViewName(AnWindow.getInstance().getViews().getCurrentViewName()); set(originalSource, settingCopy); } public void toggleTab(String cmd, String preferredViewName) { Setting settingCopy = setting.copy(); settingCopy.toggleTab(cmd); settingCopy.setPreferredViewName(preferredViewName); set(this, settingCopy); } public String getPreferredViewName() { return setting.getPreferredViewName(); } public List getSavedViewOrderList() { return savedViewOrderList; } public String[] getAvailableMachineMsodel() { return availableMachineModels; } public String getMachineModel() { return machineModel; } public void setMachineModel(String loadedMachineModel) { this.machineModel = loadedMachineModel; } public void addCustomIndexObject(String name, String command, String shortDesc, String ldesc) { if (customIndexObjects == null) { customIndexObjects = new ArrayList<>(); } customIndexObjects.add(new CustomObject(name, command, shortDesc, ldesc)); } public List getCustomIndexObjects() { return customIndexObjects; } public void addCustomMemoryObject( String name, String command, String shortDesc, String longDesc) { if (customMemoryObjects == null) { customMemoryObjects = new ArrayList<>(); } customMemoryObjects.add(new CustomObject(name, command, shortDesc, longDesc)); } public List getCustomMemoryObjects() { return customMemoryObjects; } private List addStaticObjects(AnDispTab[] staticObjs) { List list = new ArrayList<>(); for (int i = 0; i < staticObjs.length; i++) { AnDispTab anDispTab = staticObjs[i]; list.add(anDispTab); } return list; } private List addStandardObjects(Object[] tabObjs) { List list = new ArrayList<>(); AnWindow window = AnWindow.getInstance(); int[] ids = (int[]) tabObjs[0]; String[] cmds = (String[]) tabObjs[1]; String[] shortDescs = null; // FIXUP: need short/long descr from gp-display-text String[] longDescs = null; // FIXUP: need short/long descr from gp-display-text for (int i = 0; i < ids.length; i++) { AnDispTab anDispTab = window .new AnDispTab(ids[i], cmds[i], null, null); // FIXUP: need short/long descr from gp-display-text list.add(anDispTab); } return list; } private List addIndexObjects(Object[] indxObjs) { List list = new ArrayList<>(); AnWindow window = AnWindow.getInstance(); int[] ids = (int[]) indxObjs[0]; String[] cmds = (String[]) indxObjs[1]; char[] mnemonics = (char[]) indxObjs[2]; String[] i18nids = (String[]) indxObjs[3]; String[] shortDescs = (String[]) indxObjs[6]; String[] longDescs = (String[]) indxObjs[7]; for (int i = 0; i < ids.length; i++) { String s = (i18nids[i] == null) ? cmds[i] : i18nids[i]; String shortDesc = shortDescs[i]; String longDesc = longDescs[i]; AnDispTab anDispTab = window .new AnDispTab( AnDisplay.DSP_IndexObject, ids[i], s, mnemonics[i], cmds[i], shortDesc, longDesc); list.add(anDispTab); } return list; } private List addMemoryObjects(Object[] memObjs) { List list = new ArrayList<>(); AnWindow window = AnWindow.getInstance(); int[] ids = (int[]) memObjs[0]; String[] cmds = (String[]) memObjs[1]; char[] mnemonics = (char[]) memObjs[2]; String[] i18nids = (String[]) memObjs[3]; String[] shortDescs = (String[]) memObjs[6]; String[] longDescs = (String[]) memObjs[7]; for (int i = 0; i < ids.length; i++) { String shortDesc = shortDescs[i]; String longDesc = longDescs[i]; AnDispTab anDispTab = window .new AnDispTab( AnDisplay.DSP_MemoryObject, ids[i], cmds[i], mnemonics[i], cmds[i], shortDesc, longDesc); list.add(anDispTab); } return list; } public void updateIndexObjects(Object originalSource, Object[] indxObjs, boolean[] indxSelected) { List staticList2 = setting.getStaticViews(); List standardList2 = setting.getStandardViews(); List indexList2 = setting.getIndexViews(); List memoryList2 = setting.getMemoryViews(); cleanUpOldObjects2(indexList2); List indxList = addIndexObjects(indxObjs); Setting settingCopy = new Setting(); settingCopy.addViews(staticList2); settingCopy.addViews(standardList2); settingCopy.addViews(indxList, indxSelected); settingCopy.addViews(memoryList2); settingCopy.setPreferredViewName(AnWindow.getInstance().getViews().getCurrentViewName()); set(originalSource, settingCopy); } public void updateMemoryObjects(Object originalSource, Object[] memObjs, boolean[] memSelected) { List staticList2 = setting.getStaticViews(); List standardList2 = setting.getStandardViews(); List indexList2 = setting.getIndexViews(); List memoryList2 = setting.getMemoryViews(); cleanUpOldObjects2(memoryList2); List memList = addMemoryObjects(memObjs); Setting settingCopy = new Setting(); settingCopy.addViews(staticList2); settingCopy.addViews(standardList2); settingCopy.addViews(indexList2); settingCopy.addViews(memList, memSelected); settingCopy.setPreferredViewName(AnWindow.getInstance().getViews().getCurrentViewName()); set(originalSource, settingCopy); } public void updateIndexMemoryObjects( Object originalSource, Object[] indxObjs, boolean[] indxSelected, Object[] memObjs, boolean[] memSelected) { List staticList2 = setting.getStaticViews(); List standardList2 = setting.getStandardViews(); List indexList2 = setting.getIndexViews(); List memoryList2 = setting.getMemoryViews(); cleanUpOldObjects2(indexList2); List indxList = addIndexObjects(indxObjs); cleanUpOldObjects2(memoryList2); List memList = addMemoryObjects(memObjs); Setting settingCopy = new Setting(); settingCopy.addViews(staticList2); settingCopy.addViews(standardList2); settingCopy.addViews(indxList, indxSelected); settingCopy.addViews(memList, memSelected); settingCopy.setPreferredViewName(AnWindow.getInstance().getViews().getCurrentViewName()); set(originalSource, settingCopy); } public List getStaticViews() { List list = new ArrayList<>(); for (View view : setting.getStaticViews()) { list.add(view); } return list; } public List getStandardViews() { List list = new ArrayList<>(); for (View view : setting.getStandardViews()) { list.add(view); } return list; } public List getIndexViews() { List list = new ArrayList<>(); for (View view : setting.getIndexViews()) { list.add(view); } return list; } public List getMemoryViews() { List list = new ArrayList<>(); for (View view : setting.getMemoryViews()) { list.add(view); } return list; } public List getSelectedViews() { List list = new ArrayList<>(); for (View view : setting.getSelectedViews()) { list.add(view.getAnDispTab()); } return list; } public View findView(String cmd) { return setting.findView(cmd); } public View findView(int type) { return setting.findView(type); } public boolean isViewAvailable(String cmd) { return findView(cmd) != null; } public boolean isAvailableAndShowing(String cmd) { View view = setting.findView(cmd); if (view == null) { return false; } else { return view.isSelected(); } } public View getFirstDataView() { View dataView = setting.getFirstDataView(); return dataView; } @Override Type getType() { return AnSettingChangeEvent.Type.VIEWS; } @Override Object getValue() { return setting; } @Override void setValue(Object newValue) { Setting newSetting = (Setting) newValue; setting = newSetting; // setting.debug(); } private void cleanUpOldObjects2(List list) { if (list != null) { for (int i = 0; i < list.size(); i++) { View view = list.get(i); AnDisplay anDisplay = view.getAnDispTab().getTComp(); if (anDisplay instanceof MemoryIndexObjectView) { ((MemoryIndexObjectView) anDisplay).toBeRemoved(); } } } } public static boolean viewNameChanged( ViewsSetting.Setting oldSetting, ViewsSetting.Setting newSetting) { boolean changed = false; String oldViewName = oldSetting.getPreferredViewName(); String newViewName = newSetting.getPreferredViewName(); if (newViewName != null) { if (oldViewName == null) { changed = true; } else { changed = !newViewName.equals(oldViewName); } } return changed; } public static boolean viewsChanged( ViewsSetting.Setting oldSetting, ViewsSetting.Setting newSetting) { boolean changed = false; if (oldSetting == null) { changed = true; } else { List oldList = oldSetting.getSelectedViews(); List newList = newSetting.getSelectedViews(); if (oldList.size() != newList.size()) { changed = true; } else { for (int i = 0; i < oldList.size(); i++) { View oldView = oldList.get(i); View newView = newList.get(i); if (oldView.isSelected() != newView.isSelected() || oldView.getAnDispTab() != newView.getAnDispTab()) { changed = true; break; } } } } return changed; } public List createViewsSettingsSelector() { List componentList = new ArrayList<>(); componentList.add(AnWindow.getInstance().getViewsSettingsAction().getMenuItem()); return componentList; } // IPC Calls // ------------------------------------------------------------------------------------------------------------ public static Object[] getTabListInfoIPC() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getTabListInfo"); anWindow.IPC().send(0); return (Object[]) anWindow.IPC().recvObject(); } } /** * Send request to get Tab List Info. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result * * @return IPCResult */ public static IPCResult getTabListInfoIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getTabListInfo"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } public static boolean[] getTabSelectionStateIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getTabSelectionState"); window.IPC().send(0); return (boolean[]) window.IPC().recvObject(); } } /** * Send request to get Tab Selection State. Non-blocking IPC call. Caller should call * ipcResult.getBooleans() to get the result * * @return IPCResult */ public static IPCResult getTabSelectionStateIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getTabSelectionState"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // boolean[] result = ipcResult.getBooleans() // blocking return ipcResult; } // private void setTabSelectionState(final boolean[] selected) { // synchronized (IPC.lock) { // m_window.IPC().send("setTabSelectionState"); // m_window.IPC().send(m_window.getWindowID()); // m_window.IPC().send(selected); // m_window.IPC().recvString(); //synchronize // } // } public static boolean[] getMemTabSelectionStateIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getMemTabSelectionState"); window.IPC().send(0); return (boolean[]) window.IPC().recvObject(); } } /** * Send request to get Mem Tab Selection State. Non-blocking IPC call. Caller should call * ipcResult.getBooleans() to get the result * * @return IPCResult */ public static IPCResult getMemTabSelectionStateIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getMemTabSelectionState"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // boolean[] result = ipcResult.getBooleans() // blocking return ipcResult; } // private void setMemTabSelectionState(final boolean[] selected) { // synchronized (IPC.lock) { // m_window.IPC().send("setMemTabSelectionState"); // m_window.IPC().send(m_window.getWindowID()); // m_window.IPC().send(selected); // m_window.IPC().recvString(); //synchronize // } // } public static Object[] getMemObjectsIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getMemObjects"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } /** * Send request to get Mem Objects. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result * * @return IPCResult */ public static IPCResult getMemObjectsIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getMemObjects"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } // private String[] getCPUVerMachineModel() { // synchronized (IPC.lock) { // m_window.IPC().send("getCPUVerMachineModel"); // m_window.IPC().send(m_window.getWindowID()); // return (String[]) m_window.IPC().recvObject(); // } // } public static String getMachineModelIPC() { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("getMachineModel"); return m_window.IPC().recvString(); } } /** * Send request to get Machine Model. Non-blocking IPC call. Caller should call * ipcResult.getString() to get the result * * @return IPCResult */ public static IPCResult getMachineModelIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getMachineModel"); IPCResult ipcResult = ipcHandle.sendRequest(); // String result = ipcResult.getString() // blocking return ipcResult; } public static String loadMachineModelIPC(final String name) { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("loadMachineModel"); m_window.IPC().send(name); return m_window.IPC().recvString(); } } public static String[] listMachineModelsIPC() { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("listMachineModels"); return (String[]) m_window.IPC().recvObject(); } } public static String defineMemObjIPC( final String name, final String formula, final String sdesc, final String ldesc) { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("defineMemObj"); m_window.IPC().send(name); m_window.IPC().send(formula); m_window.IPC().send(sdesc); m_window.IPC().send(ldesc); return m_window.IPC().recvString(); } } public static boolean[] getIndxTabSelectionStateIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getIndxTabSelectionState"); window.IPC().send(0); return (boolean[]) window.IPC().recvObject(); } } /** * Send request to get Index Tab Selection State. Non-blocking IPC call. Caller should call * ipcResult.getBooleans() to get the result * * @return IPCResult */ public static IPCResult getIndxTabSelectionStateIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getIndxTabSelectionState"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // boolean[] result = ipcResult.getBooleans() // blocking return ipcResult; } // private void setIndxTabSelectionState(final boolean[] selected) { // synchronized (IPC.lock) { // m_window.IPC().send("setIndxTabSelectionState"); // m_window.IPC().send(m_window.getWindowID()); // m_window.IPC().send(selected); // m_window.IPC().recvString(); //synchronize // } // } public static Object[] getIndxObjDescriptionsIPC() { synchronized (IPC.lock) { AnWindow window = AnWindow.getInstance(); window.IPC().send("getIndxObjDescriptions"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } /** * Send request to get Index Object Descriptions. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result * * @return IPCResult */ public static IPCResult getIndxObjDescriptionsIPCRequest() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getIndxObjDescriptions"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } public static String defineIndxObjIPC( final String name, final String formula, final String sdesc, final String ldesc) { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("defineIndxObj"); m_window.IPC().send(name); m_window.IPC().send(formula); m_window.IPC().send(sdesc); m_window.IPC().send(ldesc); return m_window.IPC().recvString(); } } public static Object[] getCustomIndxObjectsIPC() { synchronized (IPC.lock) { AnWindow m_window = AnWindow.getInstance(); m_window.IPC().send("getCustomIndxObjects"); m_window.IPC().send(0); return (Object[]) m_window.IPC().recvObject(); } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/SearchPathPanel.form0000644000175000017500000003200314744453367021475 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricState.java0000644000175000017500000000605214744453367020702 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnMetric; public class MetricState { private String listName; private int listId; private AnMetric anMetric; private MetricAttributes capable; private MetricSelection factory; private MetricSelection selection; public MetricState( String listName, int listId, AnMetric anMetric, MetricAttributes capable, MetricSelection factory, MetricSelection selection) { this.listName = listName; this.listId = listId; this.anMetric = anMetric; this.capable = capable; this.factory = factory; this.selection = selection; } public void dump() { System.out.print(String.format("%-20s", anMetric.getComd())); dumpMetricAttributes(capable); System.out.print(" "); dumpMetricAttributes(factory); System.out.print(" "); dumpMetricAttributes(getSelection()); System.out.println(); } private void dumpMetricAttributes(MetricSelection metricSelection) { System.out.print(metricSelection.isSelected() ? "X" : " "); dumpMetricAttributes(metricSelection.getAttributes()); } private void dumpMetricAttributes(MetricAttributes metricAttributes) { System.out.print(metricAttributes.isETime() ? "+" : "-"); System.out.print(metricAttributes.isEValue() ? "+" : "-"); System.out.print(metricAttributes.isEPercent() ? "+" : "-"); System.out.print(" "); System.out.print(metricAttributes.isITime() ? "+" : "-"); System.out.print(metricAttributes.isIValue() ? "+" : "-"); System.out.print(metricAttributes.isIPercent() ? "+" : "-"); } /** * @return the listName */ public String getListName() { return listName; } /** * @return the anMetric */ public AnMetric getAnMetric() { return anMetric; } /** * @return the selection */ public MetricSelection getSelection() { return selection; } /** * @return a deep copy (except for static states */ public MetricState copy() { MetricState copy = new MetricState(listName, listId, anMetric, capable, factory, selection.copy()); return copy; } /** * @return the factory */ public MetricSelection getFactory() { return factory; } /** * @return the capable */ public MetricAttributes getCapable() { return capable; } /** * @return the listId */ public int getListId() { return listId; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ExportSettingsPanel.java0000644000175000017500000010501015044710303022406 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; /** * @author tpreisle */ public class ExportSettingsPanel extends javax.swing.JPanel { private static final Color errorColor = Color.red; private static final Color warningColor = new Color(255, 150, 0); ExportSettingsDialog dialog = null; DocListener docListener = new DocListener(); private List checkBoxes = new ArrayList<>(); /** Creates new form SaveSettingsPanel */ public ExportSettingsPanel(ExportSettingsDialog dialog) { this.dialog = dialog; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); ActionListener checkBoxActionListener = new CheckBoxActionListener(); checkBoxes.add(metricsCheckBox); checkBoxes.add(viewsCheckBox); checkBoxes.add(formatsCheckBox); checkBoxes.add(callTreeCheckBox); checkBoxes.add(sourceDisassemblyCheckBox); checkBoxes.add(functionColorsCheckBox); checkBoxes.add(timelineCheckBox); checkBoxes.add(searchPathCheckBox); checkBoxes.add(pathmapCheckBox); checkBoxes.add(libraryClassVisibilityCheckBox); checkBoxes.add(miscCheckBox); AnUtility.setTTAndAccessibleContext(allCheckBox, AnLocale.getString("Select all")); AnUtility.setTextAndAccessibleContext( infoLabel, AnLocale.getString( "Export settings to a configuration file. Select which options to save and where to" + " save them. Saved configuration files can be imported and also selected when" + " opening an experiment.")); AnUtility.setTextAndAccessibleContext(whatLabel, AnLocale.getString("Options to export:")); whatLabel.setDisplayedMnemonic( AnLocale.getString('O', "ExportSettingsOptionsToExportLabelMnemonics")); whatLabel.setLabelFor(viewsCheckBox); metricsCheckBox.setText(AnLocale.getString("Metrics")); viewsCheckBox.setText(AnLocale.getString("Views")); formatsCheckBox.setText(AnLocale.getString("Formats")); callTreeCheckBox.setText(AnLocale.getString("Call Tree")); sourceDisassemblyCheckBox.setText(AnLocale.getString("Source/Disassembly")); functionColorsCheckBox.setText(AnLocale.getString("Function Colors")); timelineCheckBox.setText(AnLocale.getString("Timeline")); searchPathCheckBox.setText(AnLocale.getString("Search Path")); pathmapCheckBox.setText(AnLocale.getString("Pathmaps")); libraryClassVisibilityCheckBox.setText(AnLocale.getString("Library and Class Visibility")); miscCheckBox.setText(AnLocale.getString("Miscellaneous")); metricsCheckBox.setToolTipText( AnLocale.getString( "Selected metrics")); // getString("Selected metrics, order, and sort metric")); viewsCheckBox.setToolTipText(AnLocale.getString("Selected views and order")); formatsCheckBox.setToolTipText(AnLocale.getString("Formats settings")); callTreeCheckBox.setToolTipText(AnLocale.getString("Call Tree settings")); sourceDisassemblyCheckBox.setToolTipText(AnLocale.getString("Source/Disassembly settings")); functionColorsCheckBox.setToolTipText(AnLocale.getString("Function color settings")); timelineCheckBox.setToolTipText(AnLocale.getString("Timeline settings")); searchPathCheckBox.setToolTipText(AnLocale.getString("Search Path settings")); pathmapCheckBox.setToolTipText(AnLocale.getString("Pathmap settings")); libraryClassVisibilityCheckBox.setToolTipText( AnLocale.getString("Library and Class Visibility settings")); miscCheckBox.setToolTipText(AnLocale.getString("Find history, ...")); allCheckBox.addActionListener(new AllCheckBoxActionListener()); for (JCheckBox checkBox : checkBoxes) { checkBox.addActionListener(checkBoxActionListener); } metricsCheckBox.setSelected(true); viewsCheckBox.setSelected(true); formatsCheckBox.setSelected(true); callTreeCheckBox.setSelected(true); sourceDisassemblyCheckBox.setSelected(true); functionColorsCheckBox.setSelected(true); timelineCheckBox.setSelected(true); searchPathCheckBox.setSelected(true); pathmapCheckBox.setSelected(true); libraryClassVisibilityCheckBox.setSelected(true); miscCheckBox.setSelected(true); fullPathTextField.setEditable(false); AnUtility.setTextAndAccessibleContext( locationOptionsLabel, AnLocale.getString("Where to save the configuration file:")); locationOptionsLabel.setDisplayedMnemonic( AnLocale.getString('W', "ExportSettingsWhereToLabelMnemonics")); locationOptionsLabel.setLabelFor(experimentFolderRadioButton); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(experimentFolderRadioButton); buttonGroup.add(experimetParentRadioButton); buttonGroup.add(homeRadioButton); buttonGroup.add(otherRadioButton); experimentFolderRadioButton.setText(AnLocale.getString("Experiment")); experimentFolderRadioButton.setToolTipText( AnLocale.getString("Save settings inside the experiment (private to this experiment)")); experimetParentRadioButton.setText(AnLocale.getString("Experiment's parent folder")); experimetParentRadioButton.setToolTipText( AnLocale.getString( "Save settings in the parent folder of the experiment (shared between experiments in" + " this folder)")); homeRadioButton.setText(AnLocale.getString("User Directory")); homeRadioButton.setToolTipText( AnLocale.getString( "Save settings in the user directory " + UserPref.getAnalyzerDirPath() + " (shared between all experiments)")); otherRadioButton.setText(AnLocale.getString("Other")); otherRadioButton.setToolTipText(AnLocale.getString("Save settings in another location...")); RadioButtonActionListener radioButtonActionListener = new RadioButtonActionListener(); experimentFolderRadioButton.addActionListener(radioButtonActionListener); experimetParentRadioButton.addActionListener(radioButtonActionListener); homeRadioButton.addActionListener(radioButtonActionListener); otherRadioButton.addActionListener(radioButtonActionListener); // AnUtility.setTextAndAccessibleContext(locationLabel, AnLocale.getString("Location:")); locationLabel.setDisplayedMnemonic( AnLocale.getString('L', "ExportSettingsLocationLabelMnemonic")); locationLabel.setLabelFor(pathTextField); // AnUtility.setTTAndAccessibleContext(pathTextField, locationLabel.getText()); browseButton.setToolTipText(AnLocale.getString("Browse for Location (ALT B)")); browseButton.setMnemonic(AnLocale.getString('B', "ExportBrowseButtonMnemonic")); experimentFolderRadioButton.setSelected(true); // radioButtonActionListener.actionPerformed(null); // pathTextField.getDocument().addDocumentListener(docListener); AnUtility.setTextAndAccessibleContext( configurationNameLabel, AnLocale.getString("Configuration Name:")); configurationNameLabel.setDisplayedMnemonic( AnLocale.getString('g', "ExportSettingsConfigurationNameLabelMnemonic")); configurationNameLabel.setLabelFor(configurationNameTextField); AnUtility.setTTAndAccessibleContext( configurationNameTextField, configurationNameLabel.getText()); AnUtility.setTextAndAccessibleContext( defaultNameCheckBox, AnLocale.getString("Save as Default configuration")); defaultNameCheckBox.setMnemonic(AnLocale.getString('S', "ExportSettingsSaveCheckboxMN")); defaultNameCheckBox.setSelected(false); defaultNameCheckBoxActionPerformed(null); configurationNameTextField.getDocument().addDocumentListener(docListener); // AnUtility.setTextAndAccessibleContext(fullPathLabel1, AnLocale.getString("Full // Path:")); // AnUtility.setTTAndAccessibleContext(fullPathTextField, fullPathLabel1.getText()); linePanel.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, AnEnvironment.ABOUT_BOX_BORDER_COLOR)); updateRadioButtons(); updateStates(); } public String getConfigurationPath() { return fullPathTextField.getText(); } public List getWhat() { List what = new ArrayList<>(); if (viewsCheckBox.isSelected()) { what.add(UserPref.What.VIEWS); } if (metricsCheckBox.isSelected()) { what.add(UserPref.What.METRICS); } if (timelineCheckBox.isSelected()) { what.add(UserPref.What.TIMELINE); } if (sourceDisassemblyCheckBox.isSelected()) { what.add(UserPref.What.SOURCEDISASSEMBLY); } if (callTreeCheckBox.isSelected()) { what.add(UserPref.What.CALLTREE); } if (formatsCheckBox.isSelected()) { what.add(UserPref.What.FORMATS); } if (searchPathCheckBox.isSelected()) { what.add(UserPref.What.SEARCHPATH); } if (pathmapCheckBox.isSelected()) { what.add(UserPref.What.PATHMAP); } if (functionColorsCheckBox.isSelected()) { what.add(UserPref.What.FUNCTIONCOLORS); } if (libraryClassVisibilityCheckBox.isSelected()) { what.add(UserPref.What.LIBRARYVISIBILITY); } if (miscCheckBox.isSelected()) { what.add(UserPref.What.MISC); } return what; } private class RadioButtonActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { updateRadioButtons(); updateStates(); } } private class AllCheckBoxActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { boolean sel = allCheckBox.isSelected(); for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled()) { checkBox.setSelected(sel); } } String errorText = checkCkeckBoxesStates(); handleErrorWarning(errorText, null); } } private class CheckBoxActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { updateStates(); } } class DocListener implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) { updateStates(); } @Override public void insertUpdate(DocumentEvent e) { updateStates(); } @Override public void removeUpdate(DocumentEvent e) { updateStates(); } } private void updateRadioButtons() { String FS = ""; String remoteFS = ""; String localFS = ""; if (Analyzer.getInstance().isRemote()) { remoteFS = " (" + AnLocale.getString("remote") + ")"; localFS = " (" + AnLocale.getString("local") + ")"; } if (experimentFolderRadioButton.isSelected()) { String experiment = AnUtility.toFullPath(AnWindow.getInstance().getExperimentGroups()[0][0]); pathTextField.setText(UserPref.getConfigurationDirPath(experiment)); FS = remoteFS; } else if (experimetParentRadioButton.isSelected()) { String experiment = AnUtility.toFullPath(AnWindow.getInstance().getExperimentGroups()[0][0]); String parentDir = AnUtility.dirname(experiment); pathTextField.setText(parentDir); FS = remoteFS; } else if (homeRadioButton.isSelected()) { pathTextField.setText(UserPref.getHomeConfigurationDirPath()); FS = localFS; } else if (otherRadioButton.isSelected()) { String last = UserPref.getInstance().getLastExportImportConfPath(); if (last != null) { pathTextField.setText(AnUtility.dirname(last)); } FS = remoteFS; } AnUtility.setTextAndAccessibleContext(locationLabel, AnLocale.getString("Location") + FS + ":"); AnUtility.setTTAndAccessibleContext(pathTextField, locationLabel.getText()); AnUtility.setTextAndAccessibleContext( fullPathLabel1, AnLocale.getString("Full Path") + FS + ":"); AnUtility.setTTAndAccessibleContext(fullPathTextField, fullPathLabel1.getText()); } private void updateStates() { pathTextField.getDocument().removeDocumentListener(docListener); pathTextField.setEnabled(otherRadioButton.isSelected()); browseButton.setEnabled(otherRadioButton.isSelected()); configurationNameTextField.setEnabled(!defaultNameCheckBox.isSelected()); if (pathTextField.isEnabled()) { pathTextField.getDocument().addDocumentListener(docListener); } fullPathTextField.setText( pathTextField.getText() + "/" + configurationNameTextField.getText() + UserPref.configurationSuffix); String errorText = null; String warningText = null; if (configurationNameTextField.getText().length() == 0) { errorText = AnLocale.getString("A configuration must have a name"); } else { errorText = checkCkeckBoxesStates(); if (errorText == null) { String confPath = fullPathTextField.getText(); boolean homeDefaultConfiguration = confPath.startsWith(UserPref.getAnalyzerDirPath()); File confFile = homeDefaultConfiguration ? new File(confPath) : new AnFile(confPath); if (confFile.exists()) { warningText = AnLocale.getString("Configuration already exists"); } } } allCheckBox.setSelected(false); if (errorText == null) { boolean allCheckBoxSelectedState = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled() && !checkBox.isSelected()) { allCheckBoxSelectedState = false; break; } } allCheckBox.setSelected(allCheckBoxSelectedState); } else { allCheckBox.setSelected(false); } handleErrorWarning(errorText, warningText); } private void handleErrorWarning(String errorText, String warningText) { if (errorText != null) { dialog.getOKButton().setEnabled(false); setError(errorText); } else if (warningText != null) { dialog.getOKButton().setEnabled(true); setWarning(warningText); } else { dialog.getOKButton().setEnabled(true); resetErrorWarning(); } } private String checkCkeckBoxesStates() { String errorText = null; if (errorText == null) { if (!anyCheckBoxesSelected()) { errorText = AnLocale.getString("At least one option needs to be selected"); } } if (errorText == null) { boolean allCheckBoxSelectedState = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled() && !checkBox.isSelected()) { allCheckBoxSelectedState = false; break; } } allCheckBox.setSelected(allCheckBoxSelectedState); } else { allCheckBox.setSelected(false); } return errorText; } private boolean anyCheckBoxesSelected() { boolean ret = false; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isSelected()) { ret = true; break; } } return ret; } private void setError(String text) { errorLabel.setForeground(errorColor); errorLabel.setText(AnLocale.getString("Error: ") + text); } private void setWarning(String text) { errorLabel.setForeground(warningColor); errorLabel.setText(AnLocale.getString("Warning: ") + text); } private void resetErrorWarning() { errorLabel.setText(" "); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoLabel = new javax.swing.JLabel(); whatLabel = new javax.swing.JLabel(); viewsCheckBox = new javax.swing.JCheckBox(); metricsCheckBox = new javax.swing.JCheckBox(); timelineCheckBox = new javax.swing.JCheckBox(); sourceDisassemblyCheckBox = new javax.swing.JCheckBox(); callTreeCheckBox = new javax.swing.JCheckBox(); formatsCheckBox = new javax.swing.JCheckBox(); searchPathCheckBox = new javax.swing.JCheckBox(); pathmapCheckBox = new javax.swing.JCheckBox(); functionColorsCheckBox = new javax.swing.JCheckBox(); libraryClassVisibilityCheckBox = new javax.swing.JCheckBox(); miscCheckBox = new javax.swing.JCheckBox(); locationOptionsLabel = new javax.swing.JLabel(); experimentFolderRadioButton = new javax.swing.JRadioButton(); experimetParentRadioButton = new javax.swing.JRadioButton(); homeRadioButton = new javax.swing.JRadioButton(); otherRadioButton = new javax.swing.JRadioButton(); pathTextField = new javax.swing.JTextField(); browseButton = new javax.swing.JButton(); locationLabel = new javax.swing.JLabel(); namePanel = new javax.swing.JPanel(); configurationNameLabel = new javax.swing.JLabel(); configurationNameTextField = new javax.swing.JTextField(); defaultNameCheckBox = new javax.swing.JCheckBox(); fullPathPanel = new javax.swing.JPanel(); fullPathLabel1 = new javax.swing.JLabel(); fullPathTextField = new javax.swing.JTextField(); errorLabel = new javax.swing.JLabel(); allCheckBox = new javax.swing.JCheckBox(); linePanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); infoLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(infoLabel, gridBagConstraints); whatLabel.setText("Options...:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(whatLabel, gridBagConstraints); viewsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(viewsCheckBox, gridBagConstraints); metricsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(metricsCheckBox, gridBagConstraints); timelineCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(timelineCheckBox, gridBagConstraints); sourceDisassemblyCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(sourceDisassemblyCheckBox, gridBagConstraints); callTreeCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(callTreeCheckBox, gridBagConstraints); formatsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(formatsCheckBox, gridBagConstraints); searchPathCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 11; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(searchPathCheckBox, gridBagConstraints); pathmapCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 12; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(pathmapCheckBox, gridBagConstraints); functionColorsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 13; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(functionColorsCheckBox, gridBagConstraints); libraryClassVisibilityCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 14; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(libraryClassVisibilityCheckBox, gridBagConstraints); miscCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 15; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(miscCheckBox, gridBagConstraints); locationOptionsLabel.setText("Where...:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 16; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(locationOptionsLabel, gridBagConstraints); experimentFolderRadioButton.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 17; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(experimentFolderRadioButton, gridBagConstraints); experimetParentRadioButton.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 18; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(experimetParentRadioButton, gridBagConstraints); homeRadioButton.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 19; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(homeRadioButton, gridBagConstraints); otherRadioButton.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 20; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(otherRadioButton, gridBagConstraints); pathTextField.setColumns(70); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 22; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; add(pathTextField, gridBagConstraints); browseButton.setText("..."); browseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 22; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(browseButton, gridBagConstraints); locationLabel.setText("Location:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 21; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; add(locationLabel, gridBagConstraints); namePanel.setOpaque(false); namePanel.setLayout(new java.awt.GridBagLayout()); configurationNameLabel.setText("Configuration Name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 13; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; namePanel.add(configurationNameLabel, gridBagConstraints); configurationNameTextField.setColumns(30); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 13; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); namePanel.add(configurationNameTextField, gridBagConstraints); defaultNameCheckBox.setText("Save as..."); defaultNameCheckBox.setOpaque(false); defaultNameCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { defaultNameCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 14; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; namePanel.add(defaultNameCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 23; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(namePanel, gridBagConstraints); fullPathPanel.setOpaque(false); fullPathPanel.setLayout(new java.awt.GridBagLayout()); fullPathLabel1.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; fullPathPanel.add(fullPathLabel1, gridBagConstraints); fullPathTextField.setEditable(false); fullPathTextField.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; fullPathPanel.add(fullPathTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 24; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(fullPathPanel, gridBagConstraints); errorLabel.setForeground(new java.awt.Color(255, 0, 51)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 25; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(errorLabel, gridBagConstraints); allCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(allCheckBox, gridBagConstraints); linePanel.setMaximumSize(new java.awt.Dimension(20, 20)); linePanel.setMinimumSize(new java.awt.Dimension(10, 30)); linePanel.setOpaque(false); linePanel.setPreferredSize(new java.awt.Dimension(200, 2)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 0); add(linePanel, gridBagConstraints); } // //GEN-END:initComponents private void browseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_browseButtonActionPerformed String feed = pathTextField.getText(); File feedFile = new File(feed); if (!feedFile.exists() || !feedFile.isDirectory()) { feedFile = null; } JFileChooser fileChooser = AnWindow.getInstance().getAnChooser("", AnChooser.DIR_CHOOSER, null); if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { String filePath = fileChooser.getSelectedFile().getAbsolutePath(); pathTextField.setText(filePath); } updateStates(); } // GEN-LAST:event_browseButtonActionPerformed private void defaultNameCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_defaultNameCheckBoxActionPerformed if (defaultNameCheckBox.isSelected()) { configurationNameTextField.setText(UserPref.configDefaultName); } else { configurationNameTextField.setText("name"); } updateStates(); } // GEN-LAST:event_defaultNameCheckBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox allCheckBox; private javax.swing.JButton browseButton; private javax.swing.JCheckBox callTreeCheckBox; private javax.swing.JLabel configurationNameLabel; private javax.swing.JTextField configurationNameTextField; private javax.swing.JCheckBox defaultNameCheckBox; private javax.swing.JLabel errorLabel; private javax.swing.JRadioButton experimentFolderRadioButton; private javax.swing.JRadioButton experimetParentRadioButton; private javax.swing.JCheckBox formatsCheckBox; private javax.swing.JLabel fullPathLabel1; private javax.swing.JPanel fullPathPanel; private javax.swing.JTextField fullPathTextField; private javax.swing.JCheckBox functionColorsCheckBox; private javax.swing.JRadioButton homeRadioButton; private javax.swing.JLabel infoLabel; private javax.swing.JCheckBox libraryClassVisibilityCheckBox; private javax.swing.JPanel linePanel; private javax.swing.JLabel locationLabel; private javax.swing.JLabel locationOptionsLabel; private javax.swing.JCheckBox metricsCheckBox; private javax.swing.JCheckBox miscCheckBox; private javax.swing.JPanel namePanel; private javax.swing.JRadioButton otherRadioButton; private javax.swing.JTextField pathTextField; private javax.swing.JCheckBox pathmapCheckBox; private javax.swing.JCheckBox searchPathCheckBox; private javax.swing.JCheckBox sourceDisassemblyCheckBox; private javax.swing.JCheckBox timelineCheckBox; private javax.swing.JCheckBox viewsCheckBox; private javax.swing.JLabel whatLabel; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/CallTreePanel.form0000644000175000017500000000631614744453367021156 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/settings/FormatSetting.java0000644000175000017500000001240614744453367021244 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class FormatSetting extends Setting { private static final Style defaultStyle = Style.LONG; private static final boolean defaultAppendSoName = false; public enum Style { LONG(1, AnLocale.getString("Long")), SHORT(2, AnLocale.getString("Short")), MANGLED(3, AnLocale.getString("Mangled")); private final int value; private final String name; private Style(int value, String name) { this.value = value; this.name = name; } public int value() { return value; } public static Style fromValue(int val) { for (Style rt : Style.values()) { if (rt.value() == val) { return rt; } } return null; } @Override public String toString() { return name; } }; public class Format { public Style style = defaultStyle; public boolean appendSOName = defaultAppendSoName; } private Format format = new Format(); public static Style getDefaultStyle() { return defaultStyle; } public static boolean getDefaultAppendSoName() { return defaultAppendSoName; } public FormatSetting() {} public FormatSetting(Style style, boolean appendSOName) { format.style = style; format.appendSOName = appendSOName; } public void init(Object originalSource, Style style, boolean appendSoName) { format.style = style; format.appendSOName = appendSoName; setNameFormatIPC(format.style.value(), format.appendSOName); // IPC fireChangeEvent(originalSource, this); } public void set(Object originalSource, Style style, boolean appendSoName) { if (style != format.style || appendSoName != format.appendSOName) { FormatSetting newFormatSetting = new FormatSetting(style, appendSoName); setValueAndFireChangeEvent(originalSource, this, newFormatSetting); } } public Style getStyle() { return format.style; } public boolean getAppendSoName() { return format.appendSOName; } public void setAppendSoNames(Object originalSource, boolean appendSoName) { if (appendSoName != format.appendSOName) { setValueAndFireChangeEvent(originalSource, this, format); } } @Override Type getType() { return AnSettingChangeEvent.Type.FORMAT; } @Override Object getValue() { return format; } @Override void setValue(Object newValue) { FormatSetting newFormatSetting = (FormatSetting) newValue; format.style = newFormatSetting.format.style; format.appendSOName = newFormatSetting.format.appendSOName; setNameFormatIPC(format.style.value(), format.appendSOName); // IPC } public static int getNameFormatIPC() { synchronized (IPC.lock) { AnWindow.getInstance().IPC().send("getNameFormat"); AnWindow.getInstance().IPC().send(0); return AnWindow.getInstance().IPC().recvInt(); } } /** * Send request to get Name Format. Non-blocking IPC call. Caller should call ipcResult.getInt() * to get the result * * @return IPCResult */ public static IPCResult SendRequest_getNameFormatIPC() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getNameFormat"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // int result = ipcResult.getInt() // blocking return ipcResult; } public static boolean getSoNameIPC() { synchronized (IPC.lock) { AnWindow.getInstance().IPC().send("getSoName"); AnWindow.getInstance().IPC().send(0); return AnWindow.getInstance().IPC().recvBoolean(); } } /** * Send request to get SoName. Non-blocking IPC call. Caller should call ipcResult.getBoolean() to * get the result * * @return IPCResult */ public static IPCResult SendRequest_getSoNameIPC() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getSoName"); ipcHandle.append(0); IPCResult ipcResult = ipcHandle.sendRequest(); // boolean result = ipcResult.getBoolean() // blocking return ipcResult; } private static void setNameFormatIPC(final int set, final boolean so_name) { synchronized (IPC.lock) { AnWindow.getInstance().IPC().send("setNameFormat"); AnWindow.getInstance().IPC().send(0); AnWindow.getInstance().IPC().send(set); AnWindow.getInstance().IPC().send(so_name); AnWindow.getInstance().IPC().recvString(); // synchronize } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ImportSettingsPanel.java0000644000175000017500000006207415044710303022413 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.persistence.UserPrefPersistence; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.filechooser.FileFilter; /** * @author tpreisle */ public class ImportSettingsPanel extends javax.swing.JPanel { private static final Color errorColor = Color.red; private static final Color warningColor = new Color(255, 150, 0); private final ImportSettingsDialog dialog; private final DocListener docListener = new DocListener(); private UserPref userPref; private List checkBoxes = new ArrayList<>(); /** Creates new form SaveSettingsPanel */ public ImportSettingsPanel(ImportSettingsDialog dialog) { this.dialog = dialog; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); ActionListener checkBoxActionListener = new CheckBoxActionListener(); AnUtility.setTextAndAccessibleContext( infoLabel, AnLocale.getString("Import settings from a saved configuration file.")); AnUtility.setTextAndAccessibleContext(whatLabel, AnLocale.getString("Options to import:")); whatLabel.setDisplayedMnemonic( AnLocale.getString('O', "ExportSettingsOptionsToExportLabelMnemonics")); whatLabel.setLabelFor(viewsCheckBox); checkBoxes.add(metricsCheckBox); checkBoxes.add(viewsCheckBox); checkBoxes.add(formatsCheckBox); checkBoxes.add(callTreeCheckBox); checkBoxes.add(sourceDisassemblyCheckBox); checkBoxes.add(functionColorsCheckBox); checkBoxes.add(timelineCheckBox); checkBoxes.add(searchPathCheckBox); checkBoxes.add(pathmapCheckBox); checkBoxes.add(libraryClassVisibilityCheckBox); checkBoxes.add(miscCheckBox); metricsCheckBox.setText(AnLocale.getString("Metrics")); viewsCheckBox.setText(AnLocale.getString("Views")); formatsCheckBox.setText(AnLocale.getString("Formats")); callTreeCheckBox.setText(AnLocale.getString("Call Tree")); sourceDisassemblyCheckBox.setText(AnLocale.getString("Source/Disassembly")); functionColorsCheckBox.setText(AnLocale.getString("Function Colors")); timelineCheckBox.setText(AnLocale.getString("Timeline")); searchPathCheckBox.setText(AnLocale.getString("Search Path")); pathmapCheckBox.setText(AnLocale.getString("Pathmaps")); libraryClassVisibilityCheckBox.setText(AnLocale.getString("Library and Class Visibility")); miscCheckBox.setText(AnLocale.getString("Miscellaneous")); metricsCheckBox.setToolTipText( AnLocale.getString( "Selected metrics")); // getString("Selected metrics, order, and sort metric")); viewsCheckBox.setToolTipText(AnLocale.getString("Selected views and order")); formatsCheckBox.setToolTipText(AnLocale.getString("Formats settings")); callTreeCheckBox.setToolTipText(AnLocale.getString("Call Tree settings")); sourceDisassemblyCheckBox.setToolTipText(AnLocale.getString("Source/Disassembly settings")); functionColorsCheckBox.setToolTipText(AnLocale.getString("Function color settings")); timelineCheckBox.setToolTipText(AnLocale.getString("Timeline settings")); searchPathCheckBox.setToolTipText(AnLocale.getString("Search Path settings")); pathmapCheckBox.setToolTipText(AnLocale.getString("Pathmap settings")); libraryClassVisibilityCheckBox.setToolTipText( AnLocale.getString("Library and Class Visibility settings")); miscCheckBox.setToolTipText(AnLocale.getString("Find history, ...")); AnUtility.setTTAndAccessibleContext(allCheckBox, AnLocale.getString("Select all")); allCheckBox.addActionListener(new AllCheckBoxActionListener()); for (JCheckBox checkBox : checkBoxes) { checkBox.addActionListener(checkBoxActionListener); } AnUtility.setTextAndAccessibleContext(locationLabel, AnLocale.getString("Configuration File:")); locationLabel.setDisplayedMnemonic( AnLocale.getString('C', "ImportSettingsConfigurationFileMnemonic")); locationLabel.setLabelFor(pathTextField); browseButton.setToolTipText(AnLocale.getString("Browse for Location (ALT B)")); browseButton.setMnemonic(AnLocale.getString('B', "ExportBrowseButtonMnemonic")); if (UserPref.getInstance().getLastExportImportConfPath() != null) { pathTextField.setText(UserPref.getInstance().getLastExportImportConfPath()); } pathTextField.getDocument().addDocumentListener(docListener); linePanel.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, AnEnvironment.ABOUT_BOX_BORDER_COLOR)); updateStates(); } public String getConfigurationPath() { return pathTextField.getText(); } public List getWhat() { List what = new ArrayList<>(); if (metricsCheckBox.isSelected()) { what.add(UserPref.What.METRICS); } if (formatsCheckBox.isSelected()) { what.add(UserPref.What.FORMATS); } if (viewsCheckBox.isSelected()) { what.add(UserPref.What.VIEWS); } if (callTreeCheckBox.isSelected()) { what.add(UserPref.What.CALLTREE); } if (sourceDisassemblyCheckBox.isSelected()) { what.add(UserPref.What.SOURCEDISASSEMBLY); } if (functionColorsCheckBox.isSelected()) { what.add(UserPref.What.FUNCTIONCOLORS); } if (miscCheckBox.isSelected()) { what.add(UserPref.What.MISC); } if (timelineCheckBox.isSelected()) { what.add(UserPref.What.TIMELINE); } if (libraryClassVisibilityCheckBox.isSelected()) { what.add(UserPref.What.LIBRARYVISIBILITY); } if (searchPathCheckBox.isSelected()) { what.add(UserPref.What.SEARCHPATH); } if (pathmapCheckBox.isSelected()) { what.add(UserPref.What.PATHMAP); } return what; } private class CheckBoxActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { String errorText = checkCkeckBoxesStates(); handleErrorWarning(errorText, null); } } private class AllCheckBoxActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { boolean sel = allCheckBox.isSelected(); for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled()) { checkBox.setSelected(sel); } } String errorText = checkCkeckBoxesStates(); handleErrorWarning(errorText, null); } } class DocListener implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) { updateStates(); } @Override public void insertUpdate(DocumentEvent e) { updateStates(); } @Override public void removeUpdate(DocumentEvent e) { updateStates(); } } private void updateStates() { String errorText = null; String warningText = null; allCheckBox.setEnabled(false); allCheckBox.setSelected(false); for (JCheckBox checkBox : checkBoxes) { checkBox.setEnabled(false); checkBox.setSelected(false); } if (pathTextField.getText().length() == 0) { errorText = AnLocale.getString("Specify a configuration file to import settings from"); } else if (!pathTextField.getText().endsWith(UserPref.configurationSuffix)) { errorText = AnLocale.getString("File is not a configuration file"); } else if (!new AnFile(pathTextField.getText()).exists()) { errorText = AnLocale.getString("Configuration file doesn't exixts"); } if (errorText == null) { // Process config file and enable only available options. userPref = new UserPref(); String configFilePath = getConfigurationPath(); if (Analyzer.getInstance().isRemote()) { configFilePath = AnWindow.copyFromRemote(configFilePath); } new UserPrefPersistence().restoreSettings(configFilePath, userPref); if (userPref.getVersion() >= 10) { List whatList = userPref.getWhatList(); if (whatList.contains(UserPref.What.METRICS)) { metricsCheckBox.setEnabled(true); metricsCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.VIEWS)) { viewsCheckBox.setEnabled(true); viewsCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.FORMATS)) { formatsCheckBox.setEnabled(true); formatsCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.CALLTREE)) { callTreeCheckBox.setEnabled(true); callTreeCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.SOURCEDISASSEMBLY)) { sourceDisassemblyCheckBox.setEnabled(true); sourceDisassemblyCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.TIMELINE)) { timelineCheckBox.setEnabled(true); timelineCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.SEARCHPATH)) { searchPathCheckBox.setEnabled(true); searchPathCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.PATHMAP)) { pathmapCheckBox.setEnabled(true); pathmapCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.MISC)) { miscCheckBox.setEnabled(true); miscCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.LIBRARYVISIBILITY)) { libraryClassVisibilityCheckBox.setEnabled(true); libraryClassVisibilityCheckBox.setSelected(true); } if (whatList.contains(UserPref.What.FUNCTIONCOLORS)) { functionColorsCheckBox.setEnabled(true); functionColorsCheckBox.setSelected(true); } } else { userPref = null; errorText = AnLocale.getString( "Configuration file is an older version. Import from older version configuration" + " files is not supported."); } } if (errorText == null) { errorText = checkCkeckBoxesStates(); } handleErrorWarning(errorText, warningText); } private String checkCkeckBoxesStates() { String errorText = null; if (errorText == null) { if (!anyCheckBoxesSelected()) { errorText = AnLocale.getString("At least one option needs to be selected"); } } if (errorText == null) { boolean allCheckBoxSelectedState = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled() && !checkBox.isSelected()) { allCheckBoxSelectedState = false; break; } } allCheckBox.setEnabled(true); allCheckBox.setSelected(allCheckBoxSelectedState); } else { allCheckBox.setSelected(false); } return errorText; } private void handleErrorWarning(String errorText, String warningText) { if (errorText == null) { boolean allCheckBoxSelectedState = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled() && !checkBox.isSelected()) { allCheckBoxSelectedState = false; break; } } allCheckBox.setEnabled(true); allCheckBox.setSelected(allCheckBoxSelectedState); } else { allCheckBox.setSelected(false); } if (errorText != null) { dialog.getOKButton().setEnabled(false); setError(errorText); } else if (warningText != null) { dialog.getOKButton().setEnabled(true); setWarning(warningText); } else { dialog.getOKButton().setEnabled(true); resetErrorWarning(); } } private boolean anyCheckBoxesSelected() { boolean ret = false; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isSelected()) { ret = true; break; } } return ret; } private void setError(String text) { errorLabel.setForeground(errorColor); errorLabel.setText(AnLocale.getString("Error: ") + text); } private void setWarning(String text) { errorLabel.setForeground(warningColor); errorLabel.setText(AnLocale.getString("Warning: ") + text); } private void resetErrorWarning() { errorLabel.setText(" "); } public UserPref getUserPref() { return userPref; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoLabel = new javax.swing.JLabel(); whatLabel = new javax.swing.JLabel(); allCheckBox = new javax.swing.JCheckBox(); linePanel = new javax.swing.JPanel(); viewsCheckBox = new javax.swing.JCheckBox(); metricsCheckBox = new javax.swing.JCheckBox(); timelineCheckBox = new javax.swing.JCheckBox(); sourceDisassemblyCheckBox = new javax.swing.JCheckBox(); callTreeCheckBox = new javax.swing.JCheckBox(); formatsCheckBox = new javax.swing.JCheckBox(); searchPathCheckBox = new javax.swing.JCheckBox(); pathmapCheckBox = new javax.swing.JCheckBox(); functionColorsCheckBox = new javax.swing.JCheckBox(); libraryClassVisibilityCheckBox = new javax.swing.JCheckBox(); miscCheckBox = new javax.swing.JCheckBox(); pathTextField = new javax.swing.JTextField(); browseButton = new javax.swing.JButton(); locationLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); infoLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(infoLabel, gridBagConstraints); whatLabel.setText("Options...:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(whatLabel, gridBagConstraints); allCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(allCheckBox, gridBagConstraints); linePanel.setMaximumSize(new java.awt.Dimension(20, 20)); linePanel.setMinimumSize(new java.awt.Dimension(10, 30)); linePanel.setOpaque(false); linePanel.setPreferredSize(new java.awt.Dimension(200, 2)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(3, 0, 0, 0); add(linePanel, gridBagConstraints); viewsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(viewsCheckBox, gridBagConstraints); metricsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(metricsCheckBox, gridBagConstraints); timelineCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 11; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(timelineCheckBox, gridBagConstraints); sourceDisassemblyCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 12; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(sourceDisassemblyCheckBox, gridBagConstraints); callTreeCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 13; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(callTreeCheckBox, gridBagConstraints); formatsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 14; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(formatsCheckBox, gridBagConstraints); searchPathCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 15; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(searchPathCheckBox, gridBagConstraints); pathmapCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 16; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(pathmapCheckBox, gridBagConstraints); functionColorsCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 17; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(functionColorsCheckBox, gridBagConstraints); libraryClassVisibilityCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 18; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(libraryClassVisibilityCheckBox, gridBagConstraints); miscCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 19; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(miscCheckBox, gridBagConstraints); pathTextField.setColumns(70); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; add(pathTextField, gridBagConstraints); browseButton.setText("..."); browseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(browseButton, gridBagConstraints); locationLabel.setText("Location:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(locationLabel, gridBagConstraints); errorLabel.setForeground(new java.awt.Color(255, 0, 51)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 22; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(16, 0, 0, 0); add(errorLabel, gridBagConstraints); } // //GEN-END:initComponents private void browseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_browseButtonActionPerformed String feed = pathTextField.getText(); File feedFile = null; if (feed.length() > 0) { feedFile = new File(feed).getParentFile(); if (feedFile != null && (!feedFile.exists() || !feedFile.isDirectory())) { feedFile = null; } } JFileChooser fileChooser = AnWindow.getInstance().getAnChooser("", AnChooser.DIR_FILE_CHOOSER, null); if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileFilter(new ConfFileFileFilter()); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { String filePath = fileChooser.getSelectedFile().getAbsolutePath(); pathTextField.setText(filePath); } updateStates(); } // GEN-LAST:event_browseButtonActionPerformed private class ConfFileFileFilter extends FileFilter { @Override public String getDescription() { return UserPref.configurationSuffix; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } else if (f.getName().endsWith(UserPref.configurationSuffix)) { return true; } else { return false; } } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox allCheckBox; private javax.swing.JButton browseButton; private javax.swing.JCheckBox callTreeCheckBox; private javax.swing.JLabel errorLabel; private javax.swing.JCheckBox formatsCheckBox; private javax.swing.JCheckBox functionColorsCheckBox; private javax.swing.JLabel infoLabel; private javax.swing.JCheckBox libraryClassVisibilityCheckBox; private javax.swing.JPanel linePanel; private javax.swing.JLabel locationLabel; private javax.swing.JCheckBox metricsCheckBox; private javax.swing.JCheckBox miscCheckBox; private javax.swing.JTextField pathTextField; private javax.swing.JCheckBox pathmapCheckBox; private javax.swing.JCheckBox searchPathCheckBox; private javax.swing.JCheckBox sourceDisassemblyCheckBox; private javax.swing.JCheckBox timelineCheckBox; private javax.swing.JCheckBox viewsCheckBox; private javax.swing.JLabel whatLabel; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/CallTreeSetting.java0000644000175000017500000000342014744453367021503 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; public class CallTreeSetting extends Setting { private static final int defaultThreshold = 1; private int threshold; public CallTreeSetting() { threshold = UserPref.getInstance().getCallStackThreshold(); } public boolean validValue(int value) { return value >= 0 && value <= 100; } public boolean setThreshold(Object originalSource, int newThreshold) { if (!validValue(newThreshold)) { return false; } if (newThreshold != threshold) { setValueAndFireChangeEvent(originalSource, this, newThreshold); } return true; } public int getThreshold() { return threshold; } public static int getDefaultThreshold() { return defaultThreshold; } @Override Type getType() { return AnSettingChangeEvent.Type.CALL_TREE; } @Override Object getValue() { return threshold; } @Override void setValue(Object newValue) { int newThreshold = ((Integer) newValue).intValue(); threshold = newThreshold; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/LibraryVisibilitySetting.java0000644000175000017500000001531415044710303023445 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import java.util.ArrayList; import java.util.List; public class LibraryVisibilitySetting extends Setting { private List settings; // Complete list in original order public LibraryVisibilitySetting() {} public void set(Object originalSource, List newSettings) { boolean changed = false; for (int i = 0; i < settings.size(); i++) { Entry oldEntry = settings.get(i); Entry newEntry = newSettings.get(i); if (oldEntry.getState() != newEntry.getState()) { changed = true; break; } } if (changed) { setValueAndFireChangeEvent(originalSource, this, newSettings); } } public void setFromStrings(Object originalSource, List initStates) { List newSettings = new ArrayList<>(); for (Entry entry : settings) { newSettings.add(entry.copy()); } if (initStates != null && !initStates.isEmpty()) { for (String s : initStates) { int stateValue = Integer.valueOf(s.substring(0, 1)); String path = s.substring(2); for (Entry entry : newSettings) { if (entry.getPath().equals(path)) { entry.setState(stateValue); } } } } else { for (Entry entry : newSettings) { entry.setState(0); } } set(originalSource, newSettings); } public void init(Object originalSource, Object[] custom_object, List initStates) { if (custom_object == null) { return; } String[] names = (String[]) custom_object[0]; int[] states = (int[]) custom_object[1]; int[] indices = (int[]) custom_object[2]; String[] paths = (String[]) custom_object[3]; int[] java = (int[]) custom_object[4]; if (initStates != null && !initStates.isEmpty()) { for (String s : initStates) { int stateValue = Integer.valueOf(s.substring(0, 1)); String path = s.substring(2); for (int i = 0; i < paths.length; i++) { if (paths[i].equals(path)) { states[i] = stateValue; break; } } } setLoadObjectStateIPC(0, states); // IPC } settings = new ArrayList<>(); for (int i = 0; i < names.length; i++) { Entry entry = new Entry(names[i], paths[i], states[i], indices[i], java[i] == 1); settings.add(entry); } } public List get() { return settings; } @Override Type getType() { return AnSettingChangeEvent.Type.LIBRARY_VISIBILITY; } @Override Object getValue() { return settings; } @Override void setValue(Object newValue) { List newSettings = (List) newValue; settings = newSettings; int[] newStates = new int[settings.size()]; int i = 0; for (Entry entry : settings) { newStates[i++] = entry.getState(); } setLoadObjectStateIPC(0, newStates); // IPC } // For persistance public List getStates() { List list = new ArrayList<>(); for (Entry entry : settings) { if (entry.getState() != 0) { list.add("" + entry.getState() + ":" + entry.getPath()); } } return list; } public static class Entry { private String name; private String path; private int state; private int index; private boolean java; public Entry(String name, String path, int state, int index, boolean java) { this.name = name; this.path = path; this.state = state; this.index = index; this.java = java; } /** * @return the name */ public String getName() { return name; } /** * @return the path */ public String getPath() { return path; } /** * @return the state */ public int getState() { return state; } /** * @return the index */ public int getIndex() { return index; } /** * @param state the state to set */ public void setState(int state) { this.state = state; } public Entry copy() { return new Entry(name, path, state, index, isJava()); } /** * @return the java */ public boolean isJava() { return java; } } // Native methods from liber_dbe.so public static Object[] getLoadObjectListIPC(int w_id) { AnWindow m_window = AnWindow.getInstance(); synchronized (IPC.lock) { m_window.IPC().send("getLoadObjectList"); m_window.IPC().send(w_id); return (Object[]) m_window.IPC().recvObject(); } } /** * Send request to get Load Object List. Non-blocking IPC call. Caller should call * ipcResult.getObjects() to get the result * * @return IPCResult */ public static IPCResult getLoadObjectListIPCRequest(int w_id) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getLoadObjectList"); ipcHandle.append(w_id); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getObjects() // blocking return ipcResult; } public static int[] getLoadObjectStateIPC(int w_id) { AnWindow m_window = AnWindow.getInstance(); synchronized (IPC.lock) { m_window.IPC().send("getLoadObjectState"); m_window.IPC().send(w_id); return (int[]) m_window.IPC().recvObject(); } } public static void setLoadObjectStateIPC(final int w_id, final int[] state) { AnWindow m_window = AnWindow.getInstance(); synchronized (IPC.lock) { m_window.IPC().send("setLoadObjectState"); m_window.IPC().send(w_id); m_window.IPC().send(state); m_window.IPC().recvString(); // synchronize } } public static void setLoadObjectDefaultsIPC(final int w_id) { AnWindow m_window = AnWindow.getInstance(); synchronized (IPC.lock) { m_window.IPC().send("setLoadObjectDefaults"); m_window.IPC().send(w_id); m_window.IPC().recvString(); // synchronize } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/PathmapsPanel.form0000644000175000017500000004312714744453367021241 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/settings/SearchPathSetting.java0000644000175000017500000000667615044710303022026 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import java.util.ArrayList; import java.util.List; public class SearchPathSetting extends Setting { private String[] searchPath = new String[0]; // Default public SearchPathSetting() {} public void set(Object originalSource, String[] newSearch_path) { boolean changed = false; if (searchPath.length != newSearch_path.length) { changed = true; } else { for (int i = 0; i < searchPath.length; i++) { if (!searchPath[i].equals(newSearch_path[i])) { changed = true; break; } } } if (changed) { setValueAndFireChangeEvent(originalSource, this, newSearch_path); } } public void add(Object originalSource, String path) { String[] newSearchPath = new String[searchPath.length + 1]; for (int i = 0; i < searchPath.length; i++) { newSearchPath[i] = searchPath[i]; } newSearchPath[searchPath.length] = path; set(originalSource, newSearchPath); } public void init(Object originalSource, List searchPath) { String[] arr = searchPath.toArray(new String[searchPath.size()]); setValue(arr); fireChangeEvent(originalSource, searchPath); } public static List getDefaultSearchPath() { List list = new ArrayList<>(); list.add("$expts"); list.add("."); return list; } public static boolean isDefault(List list) { List def = getDefaultSearchPath(); boolean ret = true; if (def.size() != list.size()) { ret = false; } else { for (int i = 0; i < def.size(); i++) { if (!def.get(i).equals(list.get(i))) { ret = false; break; } } } return ret; } public List get() { List list = new ArrayList<>(); for (String s : searchPath) { list.add(s); } return list; } @Override Type getType() { return AnSettingChangeEvent.Type.SEARCH_PATH; } @Override Object getValue() { return searchPath; } @Override void setValue(Object newValue) { String[] newSearchPath = (String[]) newValue; searchPath = newSearchPath; setSearchPathIPC(searchPath); // IPC } public static String[] getSearchPathIPC() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getSearchPath"); return (String[]) anWindow.IPC().recvObject(); } } private static void setSearchPathIPC(String[] path) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("setSearchPath"); anWindow.IPC().send(path); anWindow.IPC().recvString(); // synchronize } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/SearchPathPanel.java0000644000175000017500000005026515044710303021441 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; public class SearchPathPanel extends javax.swing.JPanel { private static Color shadedBackground = new Color(246, 246, 246); private List data = new ArrayList<>(); private PMListSelectionListener fromListSelectionListener; private PMDocumentListener pmDocumentListener; private Settings settings; public SearchPathPanel(Settings settings) { this.settings = settings; initComponents(); setBorder(BorderFactory.createMatteBorder(12, 12, 12, 10, (Color) null)); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext(topLabel, AnLocale.getString("Search Path:")); AnUtility.setTextAndAccessibleContext(pathLabel, AnLocale.getString("Path:")); pathLabel.setDisplayedMnemonic(AnLocale.getString('P', "SearchPathPathLabelMnemonic")); pathLabel.setLabelFor(pathTextField); AnUtility.setTTAndAccessibleContext(pathTextField, AnLocale.getString("Search path")); appendButton.setText(AnLocale.getString("Append")); appendButton.setToolTipText(AnLocale.getString("Append the Search Path to the list")); appendButton.setMnemonic(AnLocale.getString('e', "SearchPathPanelAppend_MN")); updateButton.setText(AnLocale.getString("Update")); updateButton.setMnemonic(AnLocale.getString('t', "SearchPathPanelUpdate_MN")); updateButton.setToolTipText( AnLocale.getString("Update the selected search path with the changes")); upButton.setText(AnLocale.getString("Up")); upButton.setMnemonic(AnLocale.getString('u', "SearchPathPanelUp_MN")); upButton.setToolTipText(AnLocale.getString("Move the selected search path up")); downButton.setText(AnLocale.getString("Down")); downButton.setMnemonic(AnLocale.getString('d', "SearchPathPanelDown_MN")); downButton.setToolTipText(AnLocale.getString("Move theselected search path down")); removeButton.setText(AnLocale.getString("Remove")); removeButton.setMnemonic(AnLocale.getString('r', "SearchPathPanelRemove_MN")); removeButton.setToolTipText(AnLocale.getString("Remove the selected search path")); browseButton.setToolTipText(AnLocale.getString("Browse for Path (ALT B)")); browseButton.setMnemonic(AnLocale.getString('B', "SearchPathPanelBrowseButtonMN")); AnUtility.setTextAndAccessibleContext(listLabel, AnLocale.getString("Search Paths:")); listLabel.setDisplayedMnemonic(AnLocale.getString('S', "SearchPathSearchPathsLabelMnemonic")); listLabel.setLabelFor(list); listPanel.setBorder( BorderFactory.createLineBorder(AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR, 1)); // scrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, // AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); list.setCellRenderer(new LCR()); AnUtility.setTTAndAccessibleContext(list, AnLocale.getString("Search path list")); fromListSelectionListener = new PMListSelectionListener(); pmDocumentListener = new PMDocumentListener(); list.addListSelectionListener(fromListSelectionListener); pathTextField.getDocument().addDocumentListener(pmDocumentListener); updateStates(); } private class LCR extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); // To change body of generated methods, choose Tools | Templates. label.setText(" " + label.getText()); if (index % 2 == 1 && !isSelected) { label.setBackground(shadedBackground); } return label; } } private void refreshPanel(int selectedIndex) { list.setListData(data.toArray()); // appendButton.setText("dsa"); // appendButton.validate(); // appendButton.repaint(); if (data.size() == 0) { return; } if (selectedIndex >= 0 && selectedIndex <= data.size()) { list.setSelectedIndex(selectedIndex); list.ensureIndexIsVisible(selectedIndex); } } private void madeChanges() { settings.setMessageAreaVisible(true); settings.stateChanged(null); } /** Called when there are changes to pathmaps settings */ public void updateGUI() { final int size; int i; data.clear(); List searchPath = AnWindow.getInstance().getSettings().getSearchPathSetting().get(); size = searchPath.size(); for (i = 0; i < size; i++) { data.add(searchPath.get(i)); } list.setListData(data.toArray()); if (size == 0) { return; } list.setSelectedIndex(0); list.ensureIndexIsVisible(0); refreshPanel(0); } public void checkSearchPathChanged(Object originalSource) { String[] searchPath = data.toArray(new String[data.size()]); AnWindow.getInstance().getSettings().getSearchPathSetting().set(originalSource, searchPath); } class PMDocumentListener implements DocumentListener { @Override public void removeUpdate(DocumentEvent e) { updateStates(); } @Override public void insertUpdate(DocumentEvent e) { updateStates(); } @Override public void changedUpdate(DocumentEvent e) { updateStates(); } } class PMListSelectionListener implements javax.swing.event.ListSelectionListener { @Override public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } pathTextField.setText((String) list.getSelectedValue()); updateStates(); } } private void updateStates() { appendButton.setEnabled(false); updateButton.setEnabled(false); upButton.setEnabled(false); downButton.setEnabled(false); removeButton.setEnabled(false); if (data != null && data.size() > 0) { if (list.getSelectedIndex() >= 0) { removeButton.setEnabled(true); } if (list.getSelectedIndex() > 0) { upButton.setEnabled(true); } if (list.getSelectedIndex() < data.size() - 1) { downButton.setEnabled(true); } } if (pathTextField.getText().length() > 0) { appendButton.setEnabled(true); if (data != null && data.size() > 0) { int index = list.getSelectedIndex(); if (index >= 0) { String from = data.get(index); if (!from.equals(pathTextField.getText())) { updateButton.setEnabled(true); } } } } } private String browse(String feed) { String filePath = null; if (!Analyzer.getInstance().isRemote()) { // Local File feedFile = new File(feed); if (!feedFile.exists()) { feedFile = null; } JFileChooser fileChooser = new JFileChooser(); // Always local file chooser fileChooser.setDialogTitle(AnLocale.getString("From path")); if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { filePath = fileChooser.getSelectedFile().getAbsolutePath(); } } else { // Remote AnFile feedFile = new AnFile(feed); if (!feedFile.exists()) { feedFile = null; } AnChooser fileChooser = AnWindow.getInstance() .getAnChooser(AnLocale.getString("To path"), AnChooser.DIR_FILE_CHOOSER, feed); // JFileChooser fileChooser = new JFileChooser(); // Always local file chooser if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { filePath = fileChooser.getSelectedFile().getAbsolutePath(); } } return filePath; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; topLabel = new javax.swing.JLabel(); pathLabel = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); browseButton = new javax.swing.JButton(); listLabel = new javax.swing.JLabel(); listPanel = new javax.swing.JPanel(); listPanelInner = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); list = new javax.swing.JList(); topButtonPanel = new javax.swing.JPanel(); appendButton = new javax.swing.JButton(); updateButton = new javax.swing.JButton(); buttomButtonPanel = new javax.swing.JPanel(); upButton = new javax.swing.JButton(); downButton = new javax.swing.JButton(); removeButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); topLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; add(topLabel, gridBagConstraints); pathLabel.setText("From:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(pathLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(pathTextField, gridBagConstraints); browseButton.setText("..."); browseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(browseButton, gridBagConstraints); listLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(listLabel, gridBagConstraints); listPanel.setLayout(new java.awt.GridBagLayout()); listPanelInner.setLayout(new java.awt.GridBagLayout()); scrollPane.setBorder(null); scrollPane.setViewportView(list); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.5; gridBagConstraints.weighty = 1.0; listPanelInner.add(scrollPane, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; listPanel.add(listPanelInner, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(listPanel, gridBagConstraints); topButtonPanel.setLayout(new java.awt.GridBagLayout()); appendButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { appendButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; topButtonPanel.add(appendButton, gridBagConstraints); updateButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); topButtonPanel.add(updateButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0); add(topButtonPanel, gridBagConstraints); buttomButtonPanel.setLayout(new java.awt.GridBagLayout()); upButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; buttomButtonPanel.add(upButton, gridBagConstraints); downButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); buttomButtonPanel.add(downButton, gridBagConstraints); removeButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); buttomButtonPanel.add(removeButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0); add(buttomButtonPanel, gridBagConstraints); } // //GEN-END:initComponents private void appendButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_appendButtonActionPerformed data.add(pathTextField.getText()); refreshPanel(data.size() - 1); madeChanges(); } // GEN-LAST:event_appendButtonActionPerformed private void updateButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_updateButtonActionPerformed int index = list.getSelectedIndex(); if (index >= 0) { data.remove(index); data.add(index, pathTextField.getText()); refreshPanel(index); madeChanges(); } } // GEN-LAST:event_updateButtonActionPerformed private void removeButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_removeButtonActionPerformed int index = list.getSelectedIndex(); if (index >= 0) { data.remove(index); if (index < data.size()) { refreshPanel(index); } else { refreshPanel(index - 1); } madeChanges(); } } // GEN-LAST:event_removeButtonActionPerformed private void upButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_upButtonActionPerformed int index = list.getSelectedIndex(); if (index > 0) { String from = data.get(index); data.remove(index); data.add(index - 1, from); refreshPanel(index - 1); madeChanges(); } } // GEN-LAST:event_upButtonActionPerformed private void downButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_downButtonActionPerformed int index = list.getSelectedIndex(); if (index < data.size()) { String from = data.get(index); data.remove(index); data.add(index + 1, from); refreshPanel(index + 1); madeChanges(); } } // GEN-LAST:event_downButtonActionPerformed private void browseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_browseButtonActionPerformed String feed = pathTextField.getText(); String res = browse(feed); pathTextField.setText(res); } // GEN-LAST:event_browseButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton appendButton; private javax.swing.JButton browseButton; private javax.swing.JPanel buttomButtonPanel; private javax.swing.JButton downButton; private javax.swing.JList list; private javax.swing.JLabel listLabel; private javax.swing.JPanel listPanel; private javax.swing.JPanel listPanelInner; private javax.swing.JLabel pathLabel; private javax.swing.JTextField pathTextField; private javax.swing.JButton removeButton; private javax.swing.JScrollPane scrollPane; private javax.swing.JPanel topButtonPanel; private javax.swing.JLabel topLabel; private javax.swing.JButton upButton; private javax.swing.JButton updateButton; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/ExportSettingsDialog.java0000644000175000017500000000511514744453367022577 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import static org.gprofng.mpmt.AnWindow.copyToRemote; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; import java.util.List; public class ExportSettingsDialog extends AnDialog2 { private ExportSettingsPanel saveSettingsPanel; public ExportSettingsDialog(Frame owner) { super(owner, owner, AnLocale.getString("Export Settings")); saveSettingsPanel = new ExportSettingsPanel(this); setCustomPanel(saveSettingsPanel); setHelpTag(AnVariable.HELP_ExportSettings); getOKButton().setText(AnLocale.getString("Export")); // getOKButton().setMnemonic(AnLocale.getString('x', "EXPORT_SETTINGS_DIALOG_SAVE_MN")); getOKButton().setToolTipText(AnLocale.getString("Export selected settings")); // getHelpButton().setEnabled(false); } @Override protected void setStatus(Status status) { super.setStatus(status); if (status == Status.OK) { String configurationPath = saveSettingsPanel.getConfigurationPath(); List what = saveSettingsPanel.getWhat(); String localPath = configurationPath; boolean homeDefaultConfiguration = configurationPath.startsWith(UserPref.getAnalyzerDirPath()); if (Analyzer.getInstance().isRemote() && !homeDefaultConfiguration) { localPath = AnWindow.tempFile().getAbsolutePath(); } UserPref.getInstance().save(localPath, what); if (Analyzer.getInstance().isRemote() && !homeDefaultConfiguration) { int res = copyToRemote(localPath, configurationPath); if (res < 0) { System.err.println("SaveSettingsDialog:copyToRemote failed: " + res); } } UserPref.getInstance().setLastExportImportConfPath(configurationPath); } } } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricsPanel.java0000644000175000017500000012264215044710303021024 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnCheckBox; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; /** * @author tpreisle */ public class MetricsPanel extends javax.swing.JPanel { private int gridY = 0; private int maxMetricNameLengthInPixels = 0; private HashMap metricHashMap = new HashMap(); private List showCheckBoxes; private List eTimeCheckBoxes; private List eValueCheckBoxes; private List ePercentCheckBoxes; private List iTimeCheckBoxes; private List iValueCheckBoxes; private List iPercentCheckBoxes; private JCheckBox allShowCheckBox; private JCheckBox eAllPercentCheckBox; private JCheckBox eAllTimeCheckBox; private JCheckBox eAllValueCheckBox; private JCheckBox iAllPercentCheckBox; private JCheckBox iAllTimeCheckBox; private JCheckBox iAllValueCheckBox; /** Creates new form MetricsPanel */ public MetricsPanel() { initComponents(); setPreferredSize(new Dimension(850, 550)); } private void setTopLabelAttr(JLabel label) { label.setFont(showLabel1.getFont().deriveFont(Font.BOLD)); label.setOpaque(true); label.setBackground(new Color(225, 225, 225)); label.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 6)); } private void initComponents2() { setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); innerPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); scrollPane.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.SCROLLBAR_BORDER_COLOR)); setTopLabelAttr(showLabel1); setTopLabelAttr(exclusiveLabel); setTopLabelAttr(inclusiveLabel); // showLabel1.setOpaque(true); AnUtility.setTextAndAccessibleContext(showLabel1, AnLocale.getString("Show in Views")); AnUtility.setTextAndAccessibleContext(exclusiveLabel, AnLocale.getString("EXCLUSIVE")); AnUtility.setTextAndAccessibleContext(inclusiveLabel, AnLocale.getString("INCLUSIVE")); eTimeLabel.setText(null); eTimeLabel.setIcon(AnUtility.timeIcon); AnUtility.setTTAndAccessibleContext(eTimeLabel, AnLocale.getString("Time")); eValueLabel.setText(null); eValueLabel.setIcon(AnUtility.numberIcon); AnUtility.setTTAndAccessibleContext(eValueLabel, AnLocale.getString("Value")); ePercentLabel.setText(null); ePercentLabel.setIcon(AnUtility.percentIcon); AnUtility.setTTAndAccessibleContext(ePercentLabel, AnLocale.getString("Percent")); iTimeLabel.setText(null); iTimeLabel.setIcon(AnUtility.timeIcon); AnUtility.setTTAndAccessibleContext(iTimeLabel, AnLocale.getString("Time")); iValueLabel.setText(null); iValueLabel.setIcon(AnUtility.numberIcon); AnUtility.setTTAndAccessibleContext(iValueLabel, AnLocale.getString("Value")); iPercentLabel.setText(null); iPercentLabel.setIcon(AnUtility.percentIcon); AnUtility.setTTAndAccessibleContext(iPercentLabel, AnLocale.getString("Percent")); hotButton.setText(AnLocale.getString("Hot")); hotButton.setToolTipText( AnLocale.getString( "Select only metrics with the highest activity levels (marked check boxes)")); hotButton.setMnemonic(AnLocale.getString('t', "SettingsMetricsHotButtonMN")); hotButton.setMargin(new Insets(0, 4, 0, 4)); resetButton.setText(AnLocale.getString("Reset")); resetButton.setToolTipText(AnLocale.getString("Select the default set of metrics")); resetButton.setMnemonic(AnLocale.getString('R', "SettingsMetricsResetButtonMN")); resetButton.setMargin(new Insets(0, 4, 0, 4)); clearAllButton.setText(AnLocale.getString("Clear All")); clearAllButton.setToolTipText(AnLocale.getString("Deselect all metrics")); clearAllButton.setMnemonic(AnLocale.getString('c', "SettingsMetricsClearAllButtonMN")); clearAllButton.setMargin(new Insets(0, 4, 0, 4)); allShowCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext(allShowCheckBox, AnLocale.getString("Show all metrics")); eAllTimeCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext(eAllTimeCheckBox, AnLocale.getString("All EXCLUSIVE time")); eAllValueCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext( eAllValueCheckBox, AnLocale.getString("All EXCLUSIVE value")); eAllPercentCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext( eAllPercentCheckBox, AnLocale.getString("All EXCLUSIVE percent")); iAllTimeCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext(iAllTimeCheckBox, AnLocale.getString("All INCLUSIVE time")); iAllValueCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext( iAllValueCheckBox, AnLocale.getString("All INCLUSIVE value")); iAllPercentCheckBox = new AnCheckBox(); AnUtility.setTTAndAccessibleContext( iAllPercentCheckBox, AnLocale.getString("All INCLUSIVE percent")); GridBagConstraints gridBagConstraints; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; gridBagConstraints.insets = new Insets(0, 12, 0, 0); innerPanel.add(allShowCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 3; innerPanel.add(eAllTimeCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 3; innerPanel.add(eAllValueCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 3; innerPanel.add(eAllPercentCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 3; innerPanel.add(iAllTimeCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 3; innerPanel.add(iAllValueCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 11; gridBagConstraints.gridy = 3; innerPanel.add(iAllPercentCheckBox, gridBagConstraints); filler0.setPreferredSize(new Dimension(0, 3)); filler1.setPreferredSize(new Dimension(16, 3)); filler2.setPreferredSize(new Dimension(16, 3)); hotButton.setIcon(AnUtility.hot_icon); hotButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection collection = metricHashMap.values(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { MetricGUIEntry metricGUIEntry = iterator.next(); metricGUIEntry.hot(); } refreshAllCheckBoxes(); markChanged(); } }); resetButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection collection = metricHashMap.values(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { MetricGUIEntry metricGUIEntry = iterator.next(); metricGUIEntry.factorySetting(); } refreshAllCheckBoxes(); markChanged(); } }); clearAllButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection collection = metricHashMap.values(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { MetricGUIEntry metricGUIEntry = iterator.next(); metricGUIEntry.clear(); } refreshAllCheckBoxes(); markChanged(); } }); exclusiveLabel.setIcon(AnUtility.excl_icon); inclusiveLabel.setIcon(AnUtility.incl_icon); int checkBoxWidth = 14; int iconLabelWidth = (exclusiveLabel.getPreferredSize().width - checkBoxWidth) / 2; Dimension labelDim1 = new Dimension(iconLabelWidth, 13); Dimension labelDim2 = new Dimension(16, 13); eTimeLabel.setPreferredSize(labelDim1); eValueLabel.setPreferredSize(labelDim2); ePercentLabel.setPreferredSize(labelDim1); iTimeLabel.setPreferredSize(labelDim1); iValueLabel.setPreferredSize(labelDim2); iPercentLabel.setPreferredSize(labelDim1); } private void markChanged() { AnWindow.getInstance().getSettings().stateChanged(null); // Will enable Apply/OK } private class AllAttributeActionListener implements ActionListener { private JCheckBox allCheckBox; private List checkBoxes; public AllAttributeActionListener(JCheckBox allCheckBox, List checkBoxes) { this.checkBoxes = checkBoxes; this.allCheckBox = allCheckBox; } @Override public void actionPerformed(ActionEvent e) { boolean on = allCheckBox.isSelected(); for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled()) { checkBox.setSelected(on); } } Collection collection = metricHashMap.values(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { MetricGUIEntry metricGUIEntry = iterator.next(); metricGUIEntry.updateViewCheckBoxes(); } markChanged(); } } private class AllShowActionListener implements ActionListener { private JCheckBox allCheckBox; private List checkBoxes; public AllShowActionListener(JCheckBox allCheckBox, List checkBoxes) { this.checkBoxes = checkBoxes; this.allCheckBox = allCheckBox; } @Override public void actionPerformed(ActionEvent e) { boolean on = allCheckBox.isSelected(); for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled()) { checkBox.setSelected(on); } } Collection collection = metricHashMap.values(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { MetricGUIEntry metricGUIEntry = iterator.next(); metricGUIEntry.updateAttributes(); } markChanged(); } } protected void updateGUIValues() { List metricStateList = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .getMetricStateList(); updateGUIValues(metricStateList); } protected void updateGUIValues(List metricStateList) { for (MetricState metricState : metricStateList) { AnMetric anMetric = metricState.getAnMetric(); MetricGUIEntry metricsGUIEntry = metricHashMap.get(anMetric.getComd().hashCode()); if (metricsGUIEntry != null) { metricsGUIEntry.showCheckBox.setSelected(metricState.getSelection().isSelected()); if (!metricState.getAnMetric().isStatic()) { metricsGUIEntry.eTimeCheckBox.setSelected(false); metricsGUIEntry.eValueCheckBox.setSelected(false); metricsGUIEntry.ePercentCheckBox.setSelected(false); metricsGUIEntry.iTimeCheckBox.setSelected(false); metricsGUIEntry.iValueCheckBox.setSelected(false); metricsGUIEntry.iPercentCheckBox.setSelected(false); if (metricState.getSelection().isSelected()) { if (metricState.getCapable().isETime()) { metricsGUIEntry.eTimeCheckBox.setSelected( metricState.getSelection().getAttributes().isETime()); } if (metricState.getCapable().isEValue()) { metricsGUIEntry.eValueCheckBox.setSelected( metricState.getSelection().getAttributes().isEValue()); } if (metricState.getCapable().isEPercent()) { metricsGUIEntry.ePercentCheckBox.setSelected( metricState.getSelection().getAttributes().isEPercent()); } if (metricState.getCapable().isITime()) { metricsGUIEntry.iTimeCheckBox.setSelected( metricState.getSelection().getAttributes().isITime()); } if (metricState.getCapable().isIValue()) { metricsGUIEntry.iValueCheckBox.setSelected( metricState.getSelection().getAttributes().isIValue()); } if (metricState.getCapable().isIPercent()) { metricsGUIEntry.iPercentCheckBox.setSelected( metricState.getSelection().getAttributes().isIPercent()); } } } } } refreshAllCheckBoxes(); } private void refreshAllCheckBoxes() { refreshAllCheckBox(allShowCheckBox, showCheckBoxes); refreshAllCheckBox(eAllTimeCheckBox, eTimeCheckBoxes); refreshAllCheckBox(eAllValueCheckBox, eValueCheckBoxes); refreshAllCheckBox(eAllPercentCheckBox, ePercentCheckBoxes); refreshAllCheckBox(iAllTimeCheckBox, iTimeCheckBoxes); refreshAllCheckBox(iAllValueCheckBox, iValueCheckBoxes); refreshAllCheckBox(iAllPercentCheckBox, iPercentCheckBoxes); } private void refreshAllCheckBox(JCheckBox checkBox, List checkBoxes) { if (!allDisabled(checkBoxes)) { checkBox.setEnabled(true); checkBox.setSelected(allSelected(checkBoxes)); } else { checkBox.setEnabled(false); } } private boolean allSelected(List checkBoxes) { boolean ret = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled() && !checkBox.isSelected()) { ret = false; break; } } return ret; } private boolean allDisabled(List checkBoxes) { boolean ret = true; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isEnabled()) { ret = false; break; } } return ret; } protected void updateGUIElements() { removeAll(); gridY = 4; initComponents(); initComponents2(); showCheckBoxes = new ArrayList<>(); allShowCheckBox.addActionListener(new AllShowActionListener(allShowCheckBox, showCheckBoxes)); eTimeCheckBoxes = new ArrayList<>(); eAllTimeCheckBox.addActionListener( new AllAttributeActionListener(eAllTimeCheckBox, eTimeCheckBoxes)); eValueCheckBoxes = new ArrayList<>(); eAllValueCheckBox.addActionListener( new AllAttributeActionListener(eAllValueCheckBox, eValueCheckBoxes)); ePercentCheckBoxes = new ArrayList<>(); eAllPercentCheckBox.addActionListener( new AllAttributeActionListener(eAllPercentCheckBox, ePercentCheckBoxes)); iTimeCheckBoxes = new ArrayList<>(); iAllTimeCheckBox.addActionListener( new AllAttributeActionListener(iAllTimeCheckBox, iTimeCheckBoxes)); iValueCheckBoxes = new ArrayList<>(); iAllValueCheckBox.addActionListener( new AllAttributeActionListener(iAllValueCheckBox, iValueCheckBoxes)); iPercentCheckBoxes = new ArrayList<>(); iAllPercentCheckBox.addActionListener( new AllAttributeActionListener(iAllPercentCheckBox, iPercentCheckBoxes)); List metricStateList = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .getMetricStateList(); String listName = null; // Find longest metric name int longestLabelLengthInPixels = 0; for (MetricState metricState : metricStateList) { AnMetric anMetric = metricState.getAnMetric(); JLabel label = new JLabel(anMetric.getUserName()); int labelLengthInPixels = label.getPreferredSize().width; if (labelLengthInPixels > longestLabelLengthInPixels) { longestLabelLengthInPixels = labelLengthInPixels; } } if (longestLabelLengthInPixels < 200) { maxMetricNameLengthInPixels = 200; } else if (longestLabelLengthInPixels > 600) { maxMetricNameLengthInPixels = 600; } else { maxMetricNameLengthInPixels = longestLabelLengthInPixels + 20; } for (MetricState metricState : metricStateList) { AnMetric anMetric = metricState.getAnMetric(); if (anMetric.isNameMetric()) { continue; } String ln = metricState.getListName(); if (ln != null && !ln.equals(listName)) { // System.out.println(ln); listName = ln; addGroupEntry(listName); } addMetricEntry(metricState); } addLastEntry(); // Update the values updateGUIValues(metricStateList); } private void addMetricEntry(MetricState metricState) { AnMetric anMetric = metricState.getAnMetric(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridY; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 16, 0, 0); JLabel label = new JLabel(getMetricName(anMetric)); // if (anMetric.isHot()) { // label.setIcon(AnUtility.hot_icon); // gridBagConstraints.insets = new Insets(0, 0, 0, 0); // } else { // gridBagConstraints.insets = new Insets(0, 16, 0, 0); // } label.setToolTipText(anMetric.getUserName()); label.setPreferredSize( new Dimension(maxMetricNameLengthInPixels + 17, label.getPreferredSize().height)); innerPanel.add(label, gridBagConstraints); // if (anMetric.isHot()) { // gridBagConstraints = new GridBagConstraints(); // gridBagConstraints.gridx = 2; // gridBagConstraints.gridy = gridY; // JLabel hotLabel = new JLabel(); // hotLabel.setIcon(AnUtility.hot_icon); // innerPanel.add(hotLabel, gridBagConstraints); // } MetricGUIEntry metricGUIEntry = new MetricGUIEntry(metricState); metricHashMap.put(metricState.getAnMetric().getComd().hashCode(), metricGUIEntry); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = gridY; JPanel showPanel = new JPanel(new GridBagLayout()); showPanel.setOpaque(false); Insets insets; if (anMetric.isHot()) { gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; JLabel hotLabel = new JLabel(); hotLabel.setOpaque(false); hotLabel.setIcon(AnUtility.hot_icon); showPanel.add(hotLabel, gridBagConstraints); insets = new Insets(0, 0, 0, 0); } else { insets = new Insets(0, 12, 0, 0); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; showPanel.add(metricGUIEntry.showCheckBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.insets = insets; // gridBagConstraints.anchor = GridBagConstraints.WEST; innerPanel.add(showPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridY; if (!anMetric.isStatic()) { gridBagConstraints.gridx = 5; metricGUIEntry.eTimeCheckBox.setEnabled(metricState.getCapable().isETime()); innerPanel.add(metricGUIEntry.eTimeCheckBox, gridBagConstraints); gridBagConstraints.gridx = 6; metricGUIEntry.eValueCheckBox.setEnabled(metricState.getCapable().isEValue()); innerPanel.add(metricGUIEntry.eValueCheckBox, gridBagConstraints); gridBagConstraints.gridx = 7; metricGUIEntry.ePercentCheckBox.setEnabled(metricState.getCapable().isEPercent()); innerPanel.add(metricGUIEntry.ePercentCheckBox, gridBagConstraints); gridBagConstraints.gridx = 9; metricGUIEntry.iTimeCheckBox.setEnabled(metricState.getCapable().isITime()); innerPanel.add(metricGUIEntry.iTimeCheckBox, gridBagConstraints); gridBagConstraints.gridx = 10; metricGUIEntry.iValueCheckBox.setEnabled(metricState.getCapable().isIValue()); innerPanel.add(metricGUIEntry.iValueCheckBox, gridBagConstraints); gridBagConstraints.gridx = 11; metricGUIEntry.iPercentCheckBox.setEnabled(metricState.getCapable().isIPercent()); innerPanel.add(metricGUIEntry.iPercentCheckBox, gridBagConstraints); } gridY++; } private class MetricGUIEntry { AnMetric anMetric; AnCheckBox showCheckBox; AnCheckBox eTimeCheckBox; AnCheckBox eValueCheckBox; AnCheckBox ePercentCheckBox; AnCheckBox iTimeCheckBox; AnCheckBox iValueCheckBox; AnCheckBox iPercentCheckBox; public MetricGUIEntry(MetricState metricState) { this.anMetric = metricState.getAnMetric(); ActionListener showActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateAttributes(); refreshAllCheckBoxes(); markChanged(); } }; showCheckBox = new AnCheckBox(); String txt = AnLocale.getString("Show this metric in views"); showCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(showCheckBox.getAccessibleContext(), txt); showCheckBox.addActionListener(showActionListener); showCheckBoxes.add(showCheckBox); if (!metricState.getAnMetric().isStatic()) { ActionListener attributeActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showCheckBox.setSelected(anySelected()); refreshAllCheckBoxes(); markChanged(); } }; eTimeCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show EXCLUSIVE Time in views"); eTimeCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(eTimeCheckBox.getAccessibleContext(), txt); eTimeCheckBox.addActionListener(attributeActionListener); eTimeCheckBoxes.add(eTimeCheckBox); eValueCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show EXCLUSIVE Value in views"); eValueCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(eValueCheckBox.getAccessibleContext(), txt); eValueCheckBox.addActionListener(attributeActionListener); eValueCheckBoxes.add(eValueCheckBox); ePercentCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show EXCLUSIVE Percent in views"); ePercentCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(ePercentCheckBox.getAccessibleContext(), txt); ePercentCheckBox.addActionListener(attributeActionListener); ePercentCheckBoxes.add(ePercentCheckBox); iTimeCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show INCLUSIVE Time in views"); iTimeCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(iTimeCheckBox.getAccessibleContext(), txt); iTimeCheckBox.addActionListener(attributeActionListener); iTimeCheckBoxes.add(iTimeCheckBox); iValueCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show INCLUSIVE Value in views"); iValueCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(iValueCheckBox.getAccessibleContext(), txt); iValueCheckBox.addActionListener(attributeActionListener); iValueCheckBoxes.add(iValueCheckBox); iPercentCheckBox = new AnCheckBox(); txt = AnLocale.getString("Show INCLUSIVE Percent in views"); iPercentCheckBox.setToolTipText(txt); AnUtility.setAccessibleContext(iPercentCheckBox.getAccessibleContext(), txt); iPercentCheckBox.addActionListener(attributeActionListener); iPercentCheckBoxes.add(iPercentCheckBox); } } public void updateAttributes() { MetricState metricState = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .findMetricStateByName(anMetric.getComd()); if (!metricState.getAnMetric().isStatic()) { if (showCheckBox.isSelected()) { eTimeCheckBox.setSelected(metricState.getSelection().getAttributes().isETime()); eValueCheckBox.setSelected(metricState.getSelection().getAttributes().isEValue()); ePercentCheckBox.setSelected(metricState.getSelection().getAttributes().isEPercent()); iTimeCheckBox.setSelected(metricState.getSelection().getAttributes().isITime()); iValueCheckBox.setSelected(metricState.getSelection().getAttributes().isIValue()); iPercentCheckBox.setSelected(metricState.getSelection().getAttributes().isIPercent()); if (!anySelected()) { eTimeCheckBox.setSelected(metricState.getFactory().getAttributes().isETime()); eValueCheckBox.setSelected(metricState.getFactory().getAttributes().isEValue()); ePercentCheckBox.setSelected(metricState.getFactory().getAttributes().isEPercent()); iTimeCheckBox.setSelected(metricState.getFactory().getAttributes().isITime()); iValueCheckBox.setSelected(metricState.getFactory().getAttributes().isIValue()); iPercentCheckBox.setSelected(metricState.getFactory().getAttributes().isIPercent()); } if (!anySelected()) { // FIXUP: need to do anything here? System.out.println("MetricsPanel:showCheckBox: no attributes selected"); } } else { eTimeCheckBox.setSelected(false); eValueCheckBox.setSelected(false); ePercentCheckBox.setSelected(false); iTimeCheckBox.setSelected(false); iValueCheckBox.setSelected(false); iPercentCheckBox.setSelected(false); } } } public void updateViewCheckBoxes() { if (!anMetric.isStatic()) { showCheckBox.setSelected(anySelected()); } } public void hot() { showCheckBox.setSelected(anMetric.isHot()); updateAttributes(); } public void clear() { showCheckBox.setSelected(false); updateAttributes(); } public void factorySetting() { MetricState metricState = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .findMetricStateByName(anMetric.getComd()); showCheckBox.setSelected(metricState.getFactory().isSelected()); if (!metricState.getAnMetric().isStatic()) { if (showCheckBox.isSelected()) { eTimeCheckBox.setSelected(metricState.getFactory().getAttributes().isETime()); eValueCheckBox.setSelected(metricState.getFactory().getAttributes().isEValue()); ePercentCheckBox.setSelected(metricState.getFactory().getAttributes().isEPercent()); iTimeCheckBox.setSelected(metricState.getFactory().getAttributes().isITime()); iValueCheckBox.setSelected(metricState.getFactory().getAttributes().isIValue()); iPercentCheckBox.setSelected(metricState.getFactory().getAttributes().isIPercent()); } else { eTimeCheckBox.setSelected(false); eValueCheckBox.setSelected(false); ePercentCheckBox.setSelected(false); iTimeCheckBox.setSelected(false); iValueCheckBox.setSelected(false); iPercentCheckBox.setSelected(false); } } } public boolean anySelected() { return eTimeCheckBox.isSelected() || eValueCheckBox.isSelected() || ePercentCheckBox.isSelected() || iTimeCheckBox.isSelected() || iValueCheckBox.isSelected() || iPercentCheckBox.isSelected(); } } private String getMetricName(AnMetric anMetric) { StringBuilder buf = new StringBuilder(); buf.append(anMetric.getUserName()); JLabel label = new JLabel(buf.toString()); if (label.getPreferredSize().width < maxMetricNameLengthInPixels) { while (label.getPreferredSize().width < maxMetricNameLengthInPixels) { buf.append(" ."); label.setText(buf.toString()); } } return buf.toString(); } private void addGroupEntry(String groupName) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridY++; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(2, 0, 0, 0); JLabel label = new JLabel(); AnUtility.setTextAndAccessibleContext(label, groupName); label.setFont(label.getFont().deriveFont(Font.BOLD)); label.setForeground(AnEnvironment.METRIC_MENU_SECTION_COLOR); innerPanel.add(label, gridBagConstraints); } private void addLastEntry() { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridY++; gridBagConstraints.weighty = 1.0; innerPanel.add(new JLabel(""), gridBagConstraints); } public List getMetricNameSelections() { AnMetric[] availableMetrics = AnWindow.getInstance().getSettings().getMetricsSetting().getAvailableAnMetrics(); List list = new ArrayList<>(); for (int index = 0; index < availableMetrics.length; index++) { AnMetric anMetric = availableMetrics[index]; MetricGUIEntry metricGUIEntry = metricHashMap.get(anMetric.getComd().hashCode()); if (anMetric.isNameMetric()) { MetricAttributes metricAttributes = new MetricAttributes( false, false, false, false, false, false); // compatible with previous version MetricSelection metricSelection = new MetricSelection(false, metricAttributes); // compatible with previous version MetricNameSelection metricNameSelection = new MetricNameSelection(anMetric.getComd(), metricSelection); list.add(metricNameSelection); } else { if (metricGUIEntry != null) { MetricAttributes metricAttributes; if (!anMetric.isStatic()) { metricAttributes = new MetricAttributes( metricGUIEntry.eTimeCheckBox.isSelected(), metricGUIEntry.eValueCheckBox.isSelected(), metricGUIEntry.ePercentCheckBox.isSelected(), metricGUIEntry.iTimeCheckBox.isSelected(), metricGUIEntry.iValueCheckBox.isSelected(), metricGUIEntry.iPercentCheckBox.isSelected()); } else { metricAttributes = new MetricAttributes(false, true, false, false, false, false); } MetricSelection metricSelection = new MetricSelection(metricGUIEntry.showCheckBox.isSelected(), metricAttributes); MetricNameSelection metricNameSelection = new MetricNameSelection(anMetric.getComd(), metricSelection); list.add(metricNameSelection); } else { System.err.println( "MetricsPanel.getMetricValues: Error: cannot find: " + anMetric.getComd()); } } } return list; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; scrollPane = new javax.swing.JScrollPane(); innerPanel = new javax.swing.JPanel(); showLabel1 = new javax.swing.JLabel(); exclusiveLabel = new javax.swing.JLabel(); inclusiveLabel = new javax.swing.JLabel(); showLabel2 = new javax.swing.JLabel(); eTimeLabel = new javax.swing.JLabel(); eValueLabel = new javax.swing.JLabel(); ePercentLabel = new javax.swing.JLabel(); iTimeLabel = new javax.swing.JLabel(); iValueLabel = new javax.swing.JLabel(); iPercentLabel = new javax.swing.JLabel(); separator = new javax.swing.JSeparator(); filler0 = new javax.swing.Box.Filler( new java.awt.Dimension(12, 12), new java.awt.Dimension(12, 12), new java.awt.Dimension(12, 12)); filler1 = new javax.swing.Box.Filler( new java.awt.Dimension(16, 12), new java.awt.Dimension(16, 12), new java.awt.Dimension(16, 12)); filler2 = new javax.swing.Box.Filler( new java.awt.Dimension(12, 12), new java.awt.Dimension(12, 12), new java.awt.Dimension(12, 12)); buttonPanel = new javax.swing.JPanel(); hotButton = new javax.swing.JButton(); resetButton = new javax.swing.JButton(); clearAllButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); scrollPane.setBorder(null); scrollPane.setOpaque(false); innerPanel.setLayout(new java.awt.GridBagLayout()); showLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); showLabel1.setText("Show in Views"); showLabel1.setToolTipText(""); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; innerPanel.add(showLabel1, gridBagConstraints); exclusiveLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); exclusiveLabel.setText("EXCLUSIVE"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; innerPanel.add(exclusiveLabel, gridBagConstraints); inclusiveLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); inclusiveLabel.setText("INCLUSIVE"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; innerPanel.add(inclusiveLabel, gridBagConstraints); showLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); showLabel2.setToolTipText(""); showLabel2.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 12; innerPanel.add(showLabel2, gridBagConstraints); eTimeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); eTimeLabel.setText("xx"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(eTimeLabel, gridBagConstraints); eValueLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); eValueLabel.setText("yy"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(eValueLabel, gridBagConstraints); ePercentLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); ePercentLabel.setText("zz"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(ePercentLabel, gridBagConstraints); iTimeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); iTimeLabel.setText("xx"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(iTimeLabel, gridBagConstraints); iValueLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); iValueLabel.setText("yy"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(iValueLabel, gridBagConstraints); iPercentLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); iPercentLabel.setText("zz"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 11; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(1, 0, 0, 0); innerPanel.add(iPercentLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; innerPanel.add(separator, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; innerPanel.add(filler0, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; innerPanel.add(filler1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 8; gridBagConstraints.gridy = 0; innerPanel.add(filler2, gridBagConstraints); scrollPane.setViewportView(innerPanel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6); add(scrollPane, gridBagConstraints); buttonPanel.setLayout(new java.awt.GridBagLayout()); hotButton.setText("Hot"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; buttonPanel.add(hotButton, gridBagConstraints); resetButton.setText("Reset"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); buttonPanel.add(resetButton, gridBagConstraints); clearAllButton.setText("Clear All"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); buttonPanel.add(clearAllButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 0); add(buttonPanel, gridBagConstraints); } // //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel buttonPanel; private javax.swing.JButton clearAllButton; private javax.swing.JLabel ePercentLabel; private javax.swing.JLabel eTimeLabel; private javax.swing.JLabel eValueLabel; private javax.swing.JLabel exclusiveLabel; private javax.swing.Box.Filler filler0; private javax.swing.Box.Filler filler1; private javax.swing.Box.Filler filler2; private javax.swing.JButton hotButton; private javax.swing.JLabel iPercentLabel; private javax.swing.JLabel iTimeLabel; private javax.swing.JLabel iValueLabel; private javax.swing.JLabel inclusiveLabel; private javax.swing.JPanel innerPanel; private javax.swing.JButton resetButton; private javax.swing.JScrollPane scrollPane; private javax.swing.JSeparator separator; private javax.swing.JLabel showLabel1; private javax.swing.JLabel showLabel2; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/settings/MetricNameSelection.java0000644000175000017500000000337614744453367022356 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; /** * @author tpreisle */ public class MetricNameSelection { private String name; private MetricSelection metricSelection; public MetricNameSelection(String name, boolean selected, boolean[] exclusiveInclusive) { this.name = name; MetricAttributes metricAttributes = new MetricAttributes( exclusiveInclusive[0], exclusiveInclusive[1], exclusiveInclusive[2], exclusiveInclusive[3], exclusiveInclusive[4], exclusiveInclusive[5]); this.metricSelection = new MetricSelection(selected, metricAttributes); } public MetricNameSelection(String name, MetricSelection metricSelection) { this.name = name; this.metricSelection = metricSelection; } /** * @return the name */ public String getName() { return name; } /** * @return the selected */ public boolean isSelected() { return getMetricSelection().isSelected(); } /** * @return the metricSelection */ public MetricSelection getMetricSelection() { return metricSelection; } } gprofng-gui-2.1/org/gprofng/mpmt/settings/ImportSettingsPanel.form0000644000175000017500000003634314744453367022461 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/settings/Setting.java0000644000175000017500000001121414744453367020067 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.settings; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.settings.AnSettingChangeEvent.Type; import org.gprofng.mpmt.util.gui.AnUtility; public abstract class Setting { abstract void setValue(Object newValue); abstract Object getValue(); abstract Type getType(); public void setValueAndFireChangeEvent( final Object originalSource, final Setting setting, final Object newValue) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { // System.out.println("Setting.setValueAndFireChangeEvent: " + // getType() + " " + originalSource + " " + Setting.this); IPCContext.newCurrentContext( AnLocale.getString("Changing settings..."), IPCContext.Scope.SESSION, false, AnWindow.getInstance()); Object progressBarHandle = AnWindow.getInstance() .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Changing Settings")); final Object oldValue = setting.getValue(); final AnSettingChangeEvent anPropertyChangeEvent = new AnSettingChangeEvent( originalSource, Setting.this, getType(), oldValue, newValue); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent( anPropertyChangeEvent, AnChangeEvent.Type.SETTING_CHANGING)); setValue(newValue); // possible IPC AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(anPropertyChangeEvent, AnChangeEvent.Type.SETTING_CHANGED)); AnWindow.getInstance().getSystemProgressPanel().progressBarStop(progressBarHandle); IPCContext.newCurrentContext( null, IPCContext.Scope.SESSION, false, AnWindow.getInstance()); } } }, "Setting Thread"); } public void fireChangeEvent(final Object originalSource, final Object newValue) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { // System.out.println("Setting.fireChangeEvent: " + getType() + " " // + originalSource + " " + Setting.this); IPCContext.newCurrentContext( AnLocale.getString("Changing settings..."), IPCContext.Scope.SESSION, false, AnWindow.getInstance()); Object progressBarHandle = AnWindow.getInstance() .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Changing Settings")); final AnSettingChangeEvent anPropertyChangeEvent = new AnSettingChangeEvent(originalSource, Setting.this, getType(), null, newValue); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent( anPropertyChangeEvent, AnChangeEvent.Type.SETTING_CHANGING)); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(anPropertyChangeEvent, AnChangeEvent.Type.SETTING_CHANGED)); AnWindow.getInstance().getSystemProgressPanel().progressBarStop(progressBarHandle); IPCContext.newCurrentContext( null, IPCContext.Scope.SESSION, false, AnWindow.getInstance()); } } }, "Setting Thread"); } } gprofng-gui-2.1/org/gprofng/mpmt/AboutPanel.java0000644000175000017500000002303214744453367016645 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.ipc.IPCProtocol; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.HeadlessException; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import javax.swing.text.StyledDocument; public class AboutPanel extends JPanel { private static final String GUI_VERSION = "gui_version"; private static final String REGULAR = "regular"; private static final String BOLD = "bold"; private static final String ITALIC = "italic"; private static final String strLegalNotice = "Copyright (C) 2022-2025 Free Software Foundation\n\n" + "This program is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or\n" + "(at your option) any later version.\n\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program. If not, see .\n"; public AboutPanel() { initComponents(); iconLabel.setBorder(BorderFactory.createLineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR)); copyrightScrollPane.setBorder( BorderFactory.createLineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR)); infoScrollPane.setBorder(BorderFactory.createLineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR)); iconLabel.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/gprofng/mpmt/icons/performanceAnalyzerSplash.gif"))); copyrightTextArea.setWrapStyleWord(true); copyrightTextArea.setLineWrap(true); copyrightTextArea.setText(strLegalNotice); copyrightTextArea.setCaretPosition(0); copyrightTextArea.setBackground(new Color(254, 254, 254)); // copyrightTextArea.setOpaque(false); String cn = AnLocale.getString("Copyright Notice"); copyrightTextArea.getAccessibleContext().setAccessibleName(cn); copyrightTextArea.getAccessibleContext().setAccessibleDescription(cn); copyrightTextArea.setFont( copyrightTextArea.getFont().deriveFont((float) copyrightTextArea.getFont().getSize() - 1)); StyledDocument doc = infoTextPane.getStyledDocument(); Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); Style regularStyle = doc.addStyle(REGULAR, def); Style italicStyle = doc.addStyle(ITALIC, regularStyle); StyleConstants.setItalic(italicStyle, true); Style boldStyle = doc.addStyle(BOLD, regularStyle); StyleConstants.setBold(boldStyle, true); String gui_version = AnLocale.getString(GUI_VERSION); if (gui_version.compareTo(GUI_VERSION) == 0) // Did not find gui_version = ""; try { doc.insertString(doc.getLength(), AnLocale.getString("gprofng-display-gui version: "), boldStyle); doc.insertString(doc.getLength(), gui_version + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("GUI protocol version: "), boldStyle); doc.insertString(doc.getLength(), IPCProtocol.version + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("Install: "), boldStyle); doc.insertString(doc.getLength(), AnUtility.clearPath( Analyzer.fdhome) + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("Working directory: "), boldStyle); doc.insertString(doc.getLength(), AnUtility.clearPath( Analyzer.getInstance().getWorkingDirectory()) + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("Java: "), boldStyle); doc.insertString(doc.getLength(), Analyzer.jvm_ver + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("Java home: "), boldStyle); doc.insertString(doc.getLength(), AnUtility.clearPath( Analyzer.jvm_home) + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("User directory: "), boldStyle); doc.insertString(doc.getLength(), AnUtility.clearPath( UserPref.getAnalyzerDirPath()) + "\n", regularStyle); doc.insertString(doc.getLength(), "gprofng-display-text: ", boldStyle); doc.insertString(doc.getLength(), AnUtility.clearPath( Analyzer.getInstance().er_print) + "\n", regularStyle); doc.insertString(doc.getLength(), AnLocale.getString("gprofng-display-text version: "), boldStyle); doc.insertString(doc.getLength(), Analyzer.fdversion + "\n", regularStyle); } catch (BadLocationException ble) { } AnUtility.setAccessibleContext( infoTextPane.getAccessibleContext(), AnLocale.getString("Info Pane")); } /** Show Version and Copyright Notice */ public static void showDialog() throws HeadlessException { String aTitle = AnLocale.getString("About gprofng GUI"); AnDialog2 dialog2 = new AnDialog2(AnWindow.getInstance().getFrame(), AnWindow.getInstance().getFrame(), aTitle); dialog2.setCustomPanel(new AboutPanel()); dialog2.setModal(false); dialog2.setAlwaysOnTop(true); dialog2.getAccessibleContext().setAccessibleName(aTitle); dialog2.getAccessibleContext().setAccessibleDescription(aTitle); dialog2.getCancelButton().setVisible(false); dialog2.pack(); dialog2.setVisible(true); dialog2.getOKButton().requestFocus(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; innerPanel = new javax.swing.JPanel(); iconLabel = new javax.swing.JLabel(); infoScrollPane = new javax.swing.JScrollPane(); infoTextPane = new javax.swing.JTextPane(); copyrightScrollPane = new javax.swing.JScrollPane(); copyrightTextArea = new javax.swing.JTextArea(); setLayout(new java.awt.GridBagLayout()); innerPanel.setLayout(new java.awt.GridBagLayout()); iconLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/gprofng/mpmt/icons/performanceAnalyzerSplash.gif"))); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; innerPanel.add(iconLabel, gridBagConstraints); infoScrollPane.setPreferredSize(new java.awt.Dimension(300, 180)); infoTextPane.setEditable(false); infoScrollPane.setViewportView(infoTextPane); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); innerPanel.add(infoScrollPane, gridBagConstraints); copyrightTextArea.setEditable(false); copyrightTextArea.setColumns(20); copyrightTextArea.setLineWrap(true); copyrightTextArea.setRows(8); copyrightTextArea.setMargin(new java.awt.Insets(4, 4, 4, 4)); copyrightScrollPane.setViewportView(copyrightTextArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); innerPanel.add(copyrightScrollPane, gridBagConstraints); add(innerPanel, new java.awt.GridBagConstraints()); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane copyrightScrollPane; private javax.swing.JTextArea copyrightTextArea; private javax.swing.JLabel iconLabel; private javax.swing.JScrollPane infoScrollPane; private javax.swing.JTextPane infoTextPane; private javax.swing.JPanel innerPanel; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/IPCProcess.java0000644000175000017500000001542214744453367016571 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.swing.JOptionPane; /** Process which delegates Runtime.exec process for gp-display-text -IPC */ public final class IPCProcess extends Process { private OutputStream stdin; private InputStream stdout, stderr; public ExitMonitor monitor; private final Process delegate; private final Analyzer parent_Analyzer; public ProcListener a_Proc_Listener; public IPCProcess( final Analyzer parent, final Process delegate, final OutputStream stdin, final InputStream stdout, final InputStream stderr) { this.delegate = delegate; this.stdin = stdin; this.stdout = stdout; this.stderr = stderr; this.parent_Analyzer = parent; } @Override public InputStream getErrorStream() { return stderr; } @Override public OutputStream getOutputStream() { return stdin; } @Override public InputStream getInputStream() { return stdout; } @Override public int waitFor() throws InterruptedException { try { return delegate.waitFor(); } catch (InterruptedException x) { return -1; } } @Override public int exitValue() throws IllegalThreadStateException { return delegate.exitValue(); } @Override public void destroy() { delegate.destroy(); } public synchronized void setExitListener() { a_Proc_Listener = new ProcListener(); if (monitor != null) { monitor.interrupt(); monitor = null; } monitor = new ExitMonitor(this, a_Proc_Listener); monitor.start(); } public synchronized void removeExitListener() { a_Proc_Listener = null; if (monitor != null) { monitor.interrupt(); monitor = null; } } /*------------------------------------- INNER CLASSES ----------------------------------------------------*/ /** * Class for catching process exit. * * @see ExitListener */ public final class ProcListener implements ExitListener { public ProcListener() {} /** * Implements method processExited of ExitListener interface * * @param p - external process Method prints error message and cleanups analyzer (standalone) or * close TopComponent (netbeans module). * @see ExitListener */ @Override public void processExited(final Process p) { String msg; int exit_value = -1; try { exit_value = p.exitValue(); } catch (IllegalThreadStateException ex) { } // process has already exited switch (exit_value) { case -1: msg = null; // process has not yet terminated, default exit value break; case 0: msg = AnLocale.getString("Communication channel will be closed"); break; case 2: // SIGINT msg = AnLocale.getString("gp-display-text has been interrupted."); break; case 3: // SIGQUIT msg = AnLocale.getString("gp-display-text has quit."); break; case 4: // SIGILL msg = AnLocale.getString("Illegal instruction in gp-display-text."); break; case 5: // SIGTRAP msg = AnLocale.getString("Trace/Breakpoint trap in gp-display-text."); break; case 6: // SIGABRT msg = AnLocale.getString("gp-display-text has been aborted."); break; case 7: // SIGEMT msg = AnLocale.getString("Emulation trap in gp-display-text."); break; case 8: // SIGFPE msg = AnLocale.getString("Floating point exception in gp-display-text."); break; case 9: // SIGKILL msg = AnLocale.getString("gp-display-text has been killed."); break; case 10: // SIGBUS msg = AnLocale.getString("Bus Error in gp-display-text."); break; case 11: // SIGSEGV msg = AnLocale.getString("Segmentation Fault in gp-display-text."); break; case 15: // SIGTERM msg = AnLocale.getString("gp-display-text has been terminated."); break; case 16: // SIGUSR1 msg = AnLocale.getString("Out of memory Error in gp-display-text."); break; default: // All other signals msg = AnLocale.getString("gp-display-text has exited unexpectedly."); break; } if (exit_value != -1) { msg += AnLocale.getString(" Exit status is ") + exit_value; } try { stdin.close(); stdout.close(); stderr.close(); } catch (IOException ex) { // ex.printStackTrace(); // No need - we are going to exit } if (parent_Analyzer.isConnected() && (!parent_Analyzer.isRemote())) { if (!parent_Analyzer.connectingToRemoteHost) { // not connecting? if (msg != null) { // Show error message and save it in the log file AnWindow.getInstance().getExperimentsView() .appendLog(AnLocale.getString("Error: ") + msg); System.err.println(AnLocale.getString("Error: ") + msg); JOptionPane.showMessageDialog((AnWindow.getInstance()).getFrame(), msg, AnLocale.getString("Error"), JOptionPane.ERROR_MESSAGE); } System.exit(1); } } } } /** Monitor class for listening external process to catch process exit. */ public final class ExitMonitor extends Thread { private final Process proc; private final ExitListener listener; /** * Monitor constructor * * @param proc - external process for listening * @param listener - listener interface * @see ExitListener */ ExitMonitor(final Process proc, final ExitListener listener) { this.proc = proc; this.listener = listener; } @Override public final void run() { try { proc.waitFor(); } catch (InterruptedException ex) { // ignore monitor interruption } // Show error dialog - user may want to reestablish connection listener.processExited(proc); monitor = null; } } public interface ExitListener { public void processExited(Process p); } } gprofng-gui-2.1/org/gprofng/mpmt/persistence/0000755000175000017500000000000015044723234016337 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/persistence/UserPrefPersistence.java0000644000175000017500000020041215044710303023052 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.persistence; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.ExperimentPickList; import org.gprofng.mpmt.ExperimentPickListElement; import org.gprofng.mpmt.metrics.MetricColors.MetricColor; import org.gprofng.mpmt.persistence.UserPref.ConnectionProperties; import org.gprofng.mpmt.persistence.UserPref.ViewPanelOrder; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.picklist.StringPickListElement; import org.gprofng.mpmt.remote.Authentication; import org.gprofng.mpmt.settings.MetricNameSelection; import org.gprofng.mpmt.settings.MetricType; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.PathMapSetting; import org.gprofng.mpmt.settings.SearchPathSetting; import org.gprofng.mpmt.settings.SourceDisassemblySetting; import org.gprofng.mpmt.settings.ViewsSetting.CustomObject; import org.gprofng.mpmt.statecolors.ColorRule; import org.gprofng.mpmt.toolbar.FindTextPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import javax.swing.JOptionPane; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; public class UserPrefPersistence { /** * V16: HOSTNAME_CONNECT_COMMAND_ATTR * V15: HOSTNAME_AUTH_ATTR V14: LIBRARY_VISIBILITY_JAVA V13: FULL_METRIC_NAME_IN_TABLES_ELEM V12: * Metric sorting, direction, and order V11: changed order and added sections V10: call stack * threshold V9 : working directory V8 : find history V7 : splitpane(123) size V6 : navigation * panel splitpane position V5 : recent experiments per host V4 : added userName attr to host V3 : * added hostNamePath maps V2 : added most recent experiments V1 : initial version */ private static final int version = 16; private static final String spaces = " "; // Elements private static final String VERSION_ELEM = "version"; private static final String ANALYZER_ELEM = "analyzer"; private static final String USER_ELEM = "user"; private static final String FRAME_ELEM = "frame"; private static final String FRAME_WIDTH_ATTR = "width"; private static final String FRAME_HEIGHT_ATTR = "height"; private static final String FRAME_X_ATTR = "x"; private static final String FRAME_Y_ATTR = "y"; private static final String SPLITPANE1_ELEM = "splitpane1"; private static final String SPLITPANE2_ELEM = "splitpane2"; private static final String SPLITPANE3_ELEM = "splitpane3"; private static final String NAV_SPLITPANE_ELEM = "navsplitpane"; private static final String NAV_FILTER_SPLITPANE_ELEM = "navfiltersplitpane"; private static final String SPLITPANE_POS_ATTR = "pos"; private static final String SPLITPANE_LAST_POS_ATTR = "lastpos"; private static final String SPLITPANE_RIGHT_SIZE_ATTR = "rightsize"; private static final String VIEWS_ELEM = "views"; private static final String VIEW_ORDER_LIST_ELEM = "vieworderlist"; private static final String VIEW_ORDER_ELEM = "viewelem"; private static final String VIEW_ORDER_NAME_ATTR = "name"; private static final String VIEW_ORDER_SHOWN_ATTR = "shown"; private static final String EXPERIMENT_LIST_ELEM = "recentExperimentsList"; private static final String EXPERIMENT_PATH_ELEM = "experimentPath"; private static final String EXPERIMENT_ELEM = "experiment"; private static final String HOSTNAME_LIST_ELEM = "hostNameList"; private static final String HOSTNAME_ELEM = "host"; private static final String HOSTNAME_NAME_ATTR = "name"; private static final String HOSTNAME_PATH_ATTR = "path"; private static final String HOSTNAME_CONNECT_COMMAND_ATTR = "connectCommand"; private static final String HOSTNAME_AUTH_ATTR = "auth"; private static final String HOSTNAME_USERNAME_ATTR = "username"; private static final String HOST_NAME_ATTR = "host"; private static final String PATH_ATTR = "path"; private static final String WD_ATTR = "wd"; private static final String LAST_CLOSED_EXP_CONF_PATH_ELEM = "lceconfpath"; private static final String LAST_EXPORT_IMPORT_EXP_CONF_PATH_ELEM = "leiconfpath"; private static final String SHOW_COMPARE_WARNING_ELEM = "comparewarning"; private static final String CONF_ATTR = "conf"; private static final String MISC_ELEM = "misc"; private static final String FIND_LIST_ELEM = "findlist"; private static final String FIND_ELEM = "text"; private static final String WHAT_LIST_ELEM = "whatlist"; private static final String WHAT_ELEM = "what"; private static final String LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM = "hidefuncsincludefilterlist"; private static final String LIBRARY_VISIBILITY_INCLUDE_FILTER_ELEM = "hidefuncsincludefiltertext"; private static final String LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM = "hidefuncsexcludefilterlist"; private static final String LIBRARY_VISIBILITY_EXCLUDE_FILTER_ELEM = "hidefuncsexcludefiltertext"; private static final String LIBRARY_VISIBILITY_CURRENT_FILTER_ATTR = "current"; private static final String LIBRARY_VISIBILITY_JAVA = "libraryvisibilityjava"; private static final String CALL_TREE_PROP = "calltree"; private static final String CALL_TREE_THRESHOLD = "calltreethreshold"; private static final String FORMATS_ELEM = "formats"; private static final String FORMATS_VIEW_MODE = "viewmode"; private static final String FORMATS_STYLE = "style"; private static final String FORMATS_APPEND_SO_NAME = "appendsoname"; private static final String FORMATS_COMPARE_MODE = "comparemode"; private static final String FORMATS_WRAP_METRIC_NAMES_IN_TABLES_ELEM = "wrapmetricnamesintables"; private static final String SOURCE_DISASSEMBLY_ELEM = "sourceanddisassembly"; private static final String SOURCE_DISASSEMBLY = "sourcedisassembly"; private static final String VALUE_ELEM = "value"; private static final String MACHINE_MODEL_ELEM = "machinemodel"; private static final String INDEX_OBJECT_LIST_ELEM = "indexobjectlist"; private static final String MEMORY_OBJECT_LIST_ELEM = "memoryobjectlist"; private static final String CUSTOM_OBJECT_LIST_ELEM = "customobject"; private static final String CUSTOM_OBJECT_NAME_ATTR = "name"; private static final String CUSTOM_OBJECT_FORMULA_ATTR = "formula"; private static final String CALL_STACK_FUNCTION_COLORS_ELEM = "callstackfunctioncolors"; private static final String FUNCTION_COLORS_LIST_ELEM = "functioncolors"; private static final String FUNCTION_COLORS_COLOR_RULE_ELEM = "colorrule"; private static final String FUNCTION_COLORS_COLOR_RULE_TYPE_ATTR = "type"; private static final String FUNCTION_COLORS_COLOR_RULE_TEXT_ATTR = "text"; private static final String FUNCTION_COLORS_COLOR_RULE_COLOR_ATTR = "color"; private static final String METRICS_ELEM = "metrics"; private static final String METRIC_SELECTION_LIST_ELEM_V12 = "metricorderlist"; private static final String METRIC_SELECTION_LIST_ELEM = "metricselectionlist"; private static final String METRIC_SELECTION_ELEM = "metricelem"; private static final String METRIC_NAME_ATTR = "name"; private static final String METRIC_ORDER_SELECTED_ATTR = "selected"; private static final String METRIC_ORDER_EXCLINCL_ATTR = "x"; private static final String METRIC_REVERSED_SORT = "metricreversedsort"; private static final String METRIC_SORT_LIST_ELEM = "metricsortlist"; private static final String METRIC_SORT_ELEM = "metricsortbymtype"; private static final String METRIC_MTYPE_ATTR = "mtype"; private static final String METRIC_SUBTYPE_ATTR = "subtype"; private static final String METRIC_ORDER_LIST_ELEM = "metricorderlists"; private static final String METRIC_ORDER_MTYPE_LIST_ELEM = "metricordermtypelist"; private static final String METRIC_ORDER_ELEM = "metricorderelem"; private static final String TIMELINE_ELEM = "timeline"; private static final String TIMELINE_STACK_DEPTH_ELEM = "verticalzoom"; private static final String TIMELINE_STACK_FRAME_PIXELS_ELEM = "stackframepixels"; private static final String TIMELINE_GROUP_DATA_BY_BUTTON_NAME_ELEM = "groupdatabybuttonname"; private static final String TIMELINE_TLDATA_CMD_ELEM = "tldatacmd"; private static final String TIMELINE_STACK_ALIGN_ELEM = "stackalign"; private static final String TIMELINE_SHOW_STATES_ELEM = "showstates"; private static final String TIMELINE_SHOW_DENSITY_ELEM = "showdensity"; private static final String LIBRARY_VISIBILITY_ELEM = "libraryvisibility"; private static final String LOADOBJECT_LIST_ELEM = "loadobjects"; private static final String LOADOBJECT_ITEM_ELEM = "loitem"; private static final String SEARCHPATH_ELEM = "searchpath"; private static final String SEARCHPATH_LIST_ELEM = "searchpathlist"; private static final String SEARCHPATH_ITEM_ELEM = "searchpathitem"; private static final String PATHMAP_ELEM = "pathmap"; private static final String PATHMAP_LIST_ELEM = "pathmaplist"; private static final String PATHMAP_ITEM_ELEM = "pathmapitem"; private static final String PATHMAP_FROM_ATTR = "from"; private static final String PATHMAP_TO_ATTR = "to"; private static final String METRIC_COLOR_LIST_ELEM = "customMetricColors"; private static final String METRIC_COLOR_ITEM_ELEM = "metric"; private static final String METRIC_COLOR_NAME_ATTR = "name"; private static final String METRIC_COLOR_COLOR_ATTR = "color"; private UserPref userPref; private static HashSet experimentErrorHashSet = new HashSet<>(); public UserPrefPersistence() {} public void saveSettings(String path, UserPref userPref, List what) { PrintWriter out = null; String dirPath = AnUtility.dirname(path); try { if (!new File(dirPath).exists()) { new File(dirPath).mkdirs(); } out = new PrintWriter(new BufferedWriter(new FileWriter(path))); } catch (Exception e) { saveErrorDialog(path, e); return; } writeInitFile(out, userPref, what); out.flush(); out.close(); } private void saveErrorDialog(String path, Exception e) { if (experimentErrorHashSet.contains(path)) { return; } experimentErrorHashSet.add(path); StringBuilder sb = new StringBuilder(); sb.append(AnLocale.getString("Cannot access persistence file:")); sb.append("\n"); sb.append(path); sb.append("\n"); sb.append(AnLocale.getString("Because:")); sb.append("\n"); sb.append(e); String errmsg = sb.toString(); AnUtility.showMessage(AnWindow.getInstance().getFrame(), errmsg, JOptionPane.ERROR_MESSAGE); } public void restoreSettings(String path, UserPref userPref) { this.userPref = userPref; if (new File(path).exists()) { // System.out.println("Configuration file processed: " + path); AnLog.log("Configuration file processed: " + path); parseInitFile(path); } } private void writeInitFile(PrintWriter out, UserPref userPref, List what) { out.println(""); writeEntry(out, 0, ANALYZER_ELEM, false); writeUserPref(out, 2, userPref, what); writeEntry(out, 0, ANALYZER_ELEM, true); } private void writeUserPref( PrintWriter out, int indent, UserPref userPref, List whatList) { writeEntry(out, indent, VERSION_ELEM, "" + version); writeWhatList(out, indent, whatList); if (whatList.contains(UserPref.What.USER)) { writeEntry(out, indent, USER_ELEM, false); if (userPref.getFrameSize() != null && userPref.getFrameLocation() != null) { AttrValuePair[] attrValues = new AttrValuePair[4]; attrValues[0] = new AttrValuePair( FRAME_WIDTH_ATTR, "" + (userPref.getFrameSize() .width)); // FIXUP: loosing 10 pixels when ssh from a Mac attrValues[1] = new AttrValuePair( FRAME_HEIGHT_ATTR, "" + (userPref.getFrameSize() .height)); // FIXUP: loosing 8 pixels when ssh from a Mac attrValues[2] = new AttrValuePair(FRAME_X_ATTR, "" + userPref.getFrameLocation().x); attrValues[3] = new AttrValuePair(FRAME_Y_ATTR, "" + userPref.getFrameLocation().y); writeEntry(out, indent + 2, FRAME_ELEM, attrValues, true); } if (userPref.getSplitPane1().getSize() >= 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair(SPLITPANE_RIGHT_SIZE_ATTR, "" + userPref.getSplitPane1().getSize()); writeEntry(out, indent + 2, SPLITPANE1_ELEM, attrValues, true); } if (userPref.getSplitPane2().getSize() >= 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair(SPLITPANE_RIGHT_SIZE_ATTR, "" + userPref.getSplitPane2().getSize()); writeEntry(out, indent + 2, SPLITPANE2_ELEM, attrValues, true); } if (userPref.getSplitPane3().getSize() >= 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair(SPLITPANE_RIGHT_SIZE_ATTR, "" + userPref.getSplitPane3().getSize()); writeEntry(out, indent + 2, SPLITPANE3_ELEM, attrValues, true); } if (userPref.getNavigationPanelDividerPosition() >= 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair( SPLITPANE_POS_ATTR, "" + userPref.getNavigationPanelDividerPosition()); writeEntry(out, indent + 2, NAV_SPLITPANE_ELEM, attrValues, true); } if (userPref.getNavigationFilterSplitPane().getSize() >= 0 && userPref.getNavigationFilterSplitPane().getSize() < 300) { // FIXUP: sometimes Filter Status panel is too big (18307885) AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair( SPLITPANE_RIGHT_SIZE_ATTR, "" + userPref.getNavigationFilterSplitPane().getSize()); writeEntry(out, indent + 2, NAV_FILTER_SPLITPANE_ELEM, attrValues, true); } writeRecentExperiments(out, indent + 2, userPref); writeHostNames(out, indent + 2, userPref); writeLastClosedConfPath(out, indent + 2, userPref); writeLastExportImportConfPath(out, indent + 2, userPref); writeCompareWarning(out, indent + 2, userPref); writeCustomMetricColors(out, indent + 2, userPref); writeEntry(out, indent, USER_ELEM, true); } if (whatList.contains(UserPref.What.VIEWS)) { writeViews(out, indent, userPref); } if (whatList.contains(UserPref.What.METRICS)) { writeMetrics(out, indent, userPref); } if (whatList.contains(UserPref.What.TIMELINE)) { writeTimeline(out, indent, userPref); } if (whatList.contains(UserPref.What.SOURCEDISASSEMBLY)) { writeSourceDisassembly(out, indent, userPref); } if (whatList.contains(UserPref.What.CALLTREE)) { writeCallStack(out, indent, userPref); } if (whatList.contains(UserPref.What.FORMATS)) { writeFormats(out, indent, userPref); } if (whatList.contains(UserPref.What.SEARCHPATH)) { writeSearchPath(out, indent, userPref); } if (whatList.contains(UserPref.What.PATHMAP)) { writePathmap(out, indent, userPref); } if (whatList.contains(UserPref.What.FUNCTIONCOLORS)) { writeFunctionColors(out, indent, userPref); } if (whatList.contains(UserPref.What.LIBRARYVISIBILITY)) { writeLibraryVisibility(out, indent, userPref); } if (whatList.contains(UserPref.What.MISC)) { writeMisc(out, indent, userPref); } } private void writeViews(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, VIEWS_ELEM, false); writeSideBar(out, indent + 2, userPref); writeMachineModel(out, indent + 2, userPref); writeCustomIndexObjects(out, indent + 2, userPref); writeCustomMemoryObjects(out, indent + 2, userPref); writeEntry(out, indent, VIEWS_ELEM, true); } private void writeSideBar(PrintWriter out, int indent, UserPref userPref) { if (userPref.getViewPanelOrder() != null && !userPref.getViewPanelOrder().isEmpty()) { writeEntry(out, indent + 2, VIEW_ORDER_LIST_ELEM, false); for (UserPref.ViewPanelOrder elem : userPref.getViewPanelOrder()) { AttrValuePair[] attrValues = new AttrValuePair[2]; attrValues[0] = new AttrValuePair(VIEW_ORDER_NAME_ATTR, "" + elem.getName()); attrValues[1] = new AttrValuePair(VIEW_ORDER_SHOWN_ATTR, "" + elem.isShown()); writeEntry(out, indent + 4, VIEW_ORDER_ELEM, attrValues, true); } writeEntry(out, indent + 2, VIEW_ORDER_LIST_ELEM, true); } } private void writeMetrics(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, METRICS_ELEM, false); List list = userPref.getMetricSelectionList(); if (list != null && !list.isEmpty()) { writeEntry(out, indent + 2, METRIC_SELECTION_LIST_ELEM, false); for (MetricNameSelection ms : list) { AttrValuePair[] attrValues = new AttrValuePair[8]; attrValues[0] = new AttrValuePair(METRIC_NAME_ATTR, "" + escapeSpecialCharacters(ms.getName())); attrValues[1] = new AttrValuePair(METRIC_ORDER_SELECTED_ATTR, "" + ms.isSelected()); attrValues[2] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 0, "" + ms.getMetricSelection().getAttributes().isETime()); attrValues[3] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 1, "" + ms.getMetricSelection().getAttributes().isEValue()); attrValues[4] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 2, "" + ms.getMetricSelection().getAttributes().isEPercent()); attrValues[5] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 3, "" + ms.getMetricSelection().getAttributes().isITime()); attrValues[6] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 4, "" + ms.getMetricSelection().getAttributes().isIValue()); attrValues[7] = new AttrValuePair( METRIC_ORDER_EXCLINCL_ATTR + 5, "" + ms.getMetricSelection().getAttributes().isIPercent()); writeEntry(out, indent + 4, METRIC_SELECTION_ELEM, attrValues, true); } writeEntry(out, indent + 2, METRIC_SELECTION_LIST_ELEM, true); } if (userPref.getMetricReversedSort() != userPref.getMetricReversedSortDefault()) { writeEntry(out, indent + 2, METRIC_REVERSED_SORT, "" + userPref.getMetricReversedSort()); } MetricType[] metricSortByMTypeList = userPref.getMetricSortByMTypeList(); if (metricSortByMTypeList != null) { writeEntry(out, indent + 2, METRIC_SORT_LIST_ELEM, false); for (int mType = 0; mType < metricSortByMTypeList.length; mType++) { if (mType > MetricsSetting.MET_NORMAL) { break; // Just save MET_NORMAL for now } AttrValuePair[] attrValues = new AttrValuePair[3]; attrValues[0] = new AttrValuePair(METRIC_MTYPE_ATTR, "" + mType); attrValues[1] = new AttrValuePair(METRIC_NAME_ATTR, "" + metricSortByMTypeList[mType].getCommand()); attrValues[2] = new AttrValuePair(METRIC_SUBTYPE_ATTR, "" + metricSortByMTypeList[mType].getSubType()); writeEntry(out, indent + 4, METRIC_SORT_ELEM, attrValues, true); } writeEntry(out, indent + 2, METRIC_SORT_LIST_ELEM, true); } List[] metricOrderLists = userPref.getMetricOrderLists(); if (metricOrderLists != null && metricOrderLists.length > 0) { writeEntry(out, indent + 2, METRIC_ORDER_LIST_ELEM, false); for (int mType = 0; mType < metricOrderLists.length; mType++) { if (mType > MetricsSetting.MET_NORMAL) { break; // Just save MET_NORMAL for now } AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair(METRIC_MTYPE_ATTR, "" + mType); writeEntry(out, indent + 4, METRIC_ORDER_MTYPE_LIST_ELEM, attrValues, false); List orderList = metricOrderLists[mType]; for (MetricType metricType : orderList) { attrValues = new AttrValuePair[2]; attrValues[0] = new AttrValuePair(METRIC_NAME_ATTR, "" + metricType.getCommand()); attrValues[1] = new AttrValuePair(METRIC_SUBTYPE_ATTR, "" + metricType.getSubType()); writeEntry(out, indent + 6, METRIC_ORDER_ELEM, attrValues, true); } writeEntry(out, indent + 4, METRIC_ORDER_MTYPE_LIST_ELEM, true); } writeEntry(out, indent + 2, METRIC_ORDER_LIST_ELEM, true); } writeEntry(out, indent, METRICS_ELEM, true); } private void writeMachineModel(PrintWriter out, int indent, UserPref userPref) { if (userPref.getMachineModel() != null /*&& userPref.getLoadedMachineModel().length() > 0*/) { writeEntry(out, indent, MACHINE_MODEL_ELEM, "" + userPref.getMachineModel()); } } private void writeCustomMemoryObjects(PrintWriter out, int indent, UserPref userPref) { if (userPref.getCustomMemoryObjects() != null && !userPref.getCustomMemoryObjects().isEmpty()) { writeEntry(out, indent, MEMORY_OBJECT_LIST_ELEM, false); writeCustomObjectList(out, indent + 2, userPref.getCustomMemoryObjects()); writeEntry(out, indent, MEMORY_OBJECT_LIST_ELEM, true); } } private void writeCustomIndexObjects(PrintWriter out, int indent, UserPref userPref) { if (userPref.getCustomIndexObjects() != null && !userPref.getCustomIndexObjects().isEmpty()) { writeEntry(out, indent, INDEX_OBJECT_LIST_ELEM, false); writeCustomObjectList(out, indent + 2, userPref.getCustomIndexObjects()); writeEntry(out, indent, INDEX_OBJECT_LIST_ELEM, true); } } private void writeCustomObjectList(PrintWriter out, int indent, List list) { for (CustomObject customObject : list) { AttrValuePair[] attrValues = new AttrValuePair[2]; attrValues[0] = new AttrValuePair(CUSTOM_OBJECT_NAME_ATTR, customObject.getName()); attrValues[1] = new AttrValuePair( CUSTOM_OBJECT_FORMULA_ATTR, escapeSpecialCharacters(customObject.getFormula())); writeEntry(out, indent + 2, CUSTOM_OBJECT_LIST_ELEM, attrValues, true); } } private void writeRecentExperiments(PrintWriter out, int indent, UserPref userPref) { if (userPref.getExperimentsPicklists().getPicklistMap() != null && userPref.getExperimentsPicklists().getPicklistMap().size() > 0) { Map map = userPref.getExperimentsPicklists().getPicklistMap(); Set keySet = map.keySet(); for (String host : keySet) { ExperimentPickList experimentPicklist = map.get(host); AttrValuePair[] attrValues; attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair(HOST_NAME_ATTR, host); writeEntry(out, indent, EXPERIMENT_LIST_ELEM, attrValues, false); for (ExperimentPickListElement experiment : experimentPicklist.getRecentExperiments()) { int n = 1; if (experiment.getWorkingDirectory() != null) { n++; } if (experiment.getConfPath() != null) { n++; } attrValues = new AttrValuePair[n]; n = 0; attrValues[n++] = new AttrValuePair(PATH_ATTR, experiment.getPath()); if (experiment.getWorkingDirectory() != null) { attrValues[n++] = new AttrValuePair(WD_ATTR, experiment.getWorkingDirectory()); } if (experiment.getConfPath() != null) { attrValues[n++] = new AttrValuePair(CONF_ATTR, experiment.getConfPath()); } writeEntry(out, indent + 2, EXPERIMENT_ELEM, attrValues, true); } writeEntry(out, indent, EXPERIMENT_LIST_ELEM, true); } } } private void writeHostNames(PrintWriter out, int indent, UserPref userPref) { if (userPref.getHostNamePicklist() != null && userPref.getHostNamePicklist().getSize() > 0 && userPref.getConnectionPropertiesMap() != null && !userPref.getConnectionPropertiesMap().isEmpty()) { writeEntry(out, indent, HOSTNAME_LIST_ELEM, false); List elements = userPref.getHostNamePicklist().getStringElements(); for (int i = elements.size() - 1; i >= 0; i--) { StringPickListElement hostElement = elements.get(i); String hostName = hostElement.getString(); String path = userPref.getConnectionPropertiesMap().get(hostName).getPath(); String connectCommand = userPref.getConnectionPropertiesMap().get(hostName).getConnectCommand(); if (connectCommand == null) { connectCommand = ""; } String userName = userPref.getConnectionPropertiesMap().get(hostName).getUserName(); List authentications = userPref.getConnectionPropertiesMap().get(hostName).getAuthentications(); if (userName == null) { userName = ""; } if (path != null) { List attrValues = new ArrayList<>(); attrValues.add(new AttrValuePair(HOSTNAME_NAME_ATTR, hostName)); attrValues.add(new AttrValuePair(HOSTNAME_PATH_ATTR, path)); attrValues.add(new AttrValuePair(HOSTNAME_CONNECT_COMMAND_ATTR, connectCommand)); attrValues.add(new AttrValuePair(HOSTNAME_USERNAME_ATTR, userName)); if (authentications != null) { String auth = Authentication.toXMLString(authentications); if (auth != null && UserPref.getDefaultAuthentications() != null && !Authentication.toXMLString(UserPref.getDefaultAuthentications()) .equals(auth)) { attrValues.add(new AttrValuePair(HOSTNAME_AUTH_ATTR, auth)); } } writeEntry(out, indent + 4, HOSTNAME_ELEM, attrValues.toArray(new AttrValuePair[attrValues.size()]), true); } } writeEntry(out, indent, HOSTNAME_LIST_ELEM, true); } } private void writeLastClosedConfPath(PrintWriter out, int indent, UserPref userPref) { if (userPref.getLastClosedExpConfPath() != null) { writeEntry(out, indent, LAST_CLOSED_EXP_CONF_PATH_ELEM, userPref.getLastClosedExpConfPath()); } } private void writeLastExportImportConfPath(PrintWriter out, int indent, UserPref userPref) { if (userPref.getLastExportImportConfPath() != null) { writeEntry( out, indent, LAST_EXPORT_IMPORT_EXP_CONF_PATH_ELEM, userPref.getLastExportImportConfPath()); } } private void writeCompareWarning(PrintWriter out, int indent, UserPref userPref) { if (userPref.showCompareSourceWarning() != userPref.showCompareSourceWarningDefault()) { writeEntry(out, indent, SHOW_COMPARE_WARNING_ELEM, "" + userPref.showCompareSourceWarning()); } } private void writeCustomMetricColors(PrintWriter out, int indent, UserPref userPref) { if (userPref.getCustomMetricColors() != null) { writeEntry(out, indent, METRIC_COLOR_LIST_ELEM, false); List metricColors = userPref.getCustomMetricColors(); for (MetricColor metricColor : metricColors) { String colorHexRed = String.format("%02x", metricColor.getColor().getRed()); String colorHexGreen = String.format("%02x", metricColor.getColor().getGreen()); String colorHexBlue = String.format("%02x", metricColor.getColor().getBlue()); String colorHex = "0x" + colorHexRed + colorHexGreen + colorHexBlue; AttrValuePair[] attrValues = new AttrValuePair[2]; attrValues[0] = new AttrValuePair(METRIC_COLOR_NAME_ATTR, metricColor.getMetricName()); attrValues[1] = new AttrValuePair(METRIC_COLOR_COLOR_ATTR, colorHex); writeEntry(out, indent + 2, METRIC_COLOR_ITEM_ELEM, attrValues, true); } writeEntry(out, indent, METRIC_COLOR_LIST_ELEM, true); } } private void writeFindPickList(PrintWriter out, int indent, UserPref userPref) { if (userPref.getFindPickList() != null && userPref.getFindPickList().getSize() > 0) { writeEntry(out, indent, FIND_LIST_ELEM, false); List elements = userPref.getFindPickList().getStringElements(); for (int i = elements.size() - 1; i >= 0; i--) { String elem = escapeSpecialCharacters(elements.get(i).getString()); writeEntry(out, indent + 2, FIND_ELEM, elem); } writeEntry(out, indent, FIND_LIST_ELEM, true); } } private void writeWhatList(PrintWriter out, int indent, List whatList) { writeEntry(out, indent, WHAT_LIST_ELEM, false); if (whatList != null && !whatList.isEmpty()) { for (UserPref.What what : whatList) { writeEntry(out, indent + 2, WHAT_ELEM, what.toString()); } } writeEntry(out, indent, WHAT_LIST_ELEM, true); } private void writeLibraryVisibilityPickList(PrintWriter out, int indent, UserPref userPref) { if (userPref.getLibraryVisibilityIncludePickList() != null && userPref.getLibraryVisibilityIncludePickList().getSize() > 0) { String currentLibraryVisibilityFilter = userPref.getLibraryVisibilityIncludeFilter(); if (currentLibraryVisibilityFilter != null && currentLibraryVisibilityFilter.length() > 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair( LIBRARY_VISIBILITY_CURRENT_FILTER_ATTR, currentLibraryVisibilityFilter); writeEntry(out, indent, LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM, attrValues, false); } else { writeEntry(out, indent, LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM, false); } List elements = userPref.getLibraryVisibilityIncludePickList().getStringElements(); for (int i = elements.size() - 1; i >= 0; i--) { String elem = escapeSpecialCharacters(elements.get(i).getString()); writeEntry(out, indent + 2, LIBRARY_VISIBILITY_INCLUDE_FILTER_ELEM, elem); } writeEntry(out, indent, LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM, true); } if (userPref.getLibraryVisibilityExcludePickList() != null && userPref.getLibraryVisibilityExcludePickList().getSize() > 0) { String currentLibraryVisibilityFilter = userPref.getCurrenLibraryVisibilityExcludeFilter(); if (currentLibraryVisibilityFilter != null && currentLibraryVisibilityFilter.length() > 0) { AttrValuePair[] attrValues = new AttrValuePair[1]; attrValues[0] = new AttrValuePair( LIBRARY_VISIBILITY_CURRENT_FILTER_ATTR, currentLibraryVisibilityFilter); writeEntry(out, indent, LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM, attrValues, false); } else { writeEntry(out, indent, LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM, false); } List elements = userPref.getLibraryVisibilityExcludePickList().getStringElements(); for (int i = elements.size() - 1; i >= 0; i--) { String elem = escapeSpecialCharacters(elements.get(i).getString()); writeEntry(out, indent + 2, LIBRARY_VISIBILITY_EXCLUDE_FILTER_ELEM, elem); } writeEntry(out, indent, LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM, true); } } private void writeCallStack(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, CALL_TREE_PROP, false); if (userPref.getCallStackThreshold() != userPref.getCallStackThresholdDefault()) { writeEntry(out, indent + 2, CALL_TREE_THRESHOLD, "" + userPref.getCallStackThreshold()); } writeEntry(out, indent, CALL_TREE_PROP, true); } private void writeFormats(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, FORMATS_ELEM, false); if (userPref.getFormatsViewMode() != userPref.getFormatsViewModeDefault()) { writeEntry(out, indent + 2, FORMATS_VIEW_MODE, "" + userPref.getFormatsViewMode()); } if (userPref.getFormatsStyle() != userPref.getFormatsStyleDefault()) { writeEntry(out, indent + 2, FORMATS_STYLE, "" + userPref.getFormatsStyle()); } if (userPref.getFormatsAppendSoName() != userPref.getFormatsAppendSoNameDefault()) { writeEntry(out, indent + 2, FORMATS_APPEND_SO_NAME, "" + userPref.getFormatsAppendSoName()); } if (userPref.getFormatsCompareMode() != userPref.getFormatsCompareModeDefault()) { writeEntry(out, indent + 2, FORMATS_COMPARE_MODE, "" + userPref.getFormatsCompareMode()); } if (userPref.wrapMetricNamesInTables() != userPref.wrapMetricNamesInTablesDefault()) { writeEntry( out, indent + 2, FORMATS_WRAP_METRIC_NAMES_IN_TABLES_ELEM, "" + userPref.wrapMetricNamesInTables()); } writeEntry(out, indent, FORMATS_ELEM, true); } private void writeSourceDisassembly(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, SOURCE_DISASSEMBLY_ELEM, false); if (SourceDisassemblySetting.changed( userPref.getSourceDisassemblySettingsDefault(), userPref.getSourceDisassemblySettings())) { int[] values = userPref.getSourceDisassemblySettings(); writeEntry(out, indent + 2, SOURCE_DISASSEMBLY, false); for (int value : values) { writeEntry(out, indent + 4, VALUE_ELEM, "" + value); } writeEntry(out, indent + 2, SOURCE_DISASSEMBLY, true); } writeEntry(out, indent, SOURCE_DISASSEMBLY_ELEM, true); } private void writeLibraryVisibility(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, LIBRARY_VISIBILITY_ELEM, false); writeLibraryVisibilityLoadObjects(out, indent + 2, userPref); writeLibraryVisibilityNativeOrJava(out, indent + 2, userPref); writeLibraryVisibilityPickList(out, indent + 2, userPref); writeEntry(out, indent, LIBRARY_VISIBILITY_ELEM, true); } private void writeMisc(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, MISC_ELEM, false); writeFindPickList(out, indent + 2, userPref); writeEntry(out, indent, MISC_ELEM, true); } private void writeFunctionColors(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, CALL_STACK_FUNCTION_COLORS_ELEM, false); List activeColorRules = userPref.getActiveColorRules(); if (activeColorRules != null && !activeColorRules.isEmpty()) { writeEntry(out, indent + 2, FUNCTION_COLORS_LIST_ELEM, false); writeColorRules(out, indent + 4, activeColorRules); writeEntry(out, indent + 2, FUNCTION_COLORS_LIST_ELEM, true); } writeEntry(out, indent, CALL_STACK_FUNCTION_COLORS_ELEM, true); } private void writeTimeline(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, TIMELINE_ELEM, false); if (!userPref .getTimelineGroupDataByButtonName() .equalsIgnoreCase(userPref.getTimelineGroupDataByButtonNameDefault())) { writeEntry( out, indent + 2, TIMELINE_GROUP_DATA_BY_BUTTON_NAME_ELEM, "" + escapeSpecialCharacters(userPref.getTimelineGroupDataByButtonName())); } if (!userPref.getTimelineTLDataCmd().equalsIgnoreCase(userPref.getTimelineTLDataCmdDefault())) { writeEntry(out, indent + 2, TIMELINE_TLDATA_CMD_ELEM, "" + userPref.getTimelineTLDataCmd()); } if (userPref.getTimelineStackAlign() != userPref.getDefaultTimelineStackAlign()) { writeEntry(out, indent + 2, TIMELINE_STACK_ALIGN_ELEM, "" + userPref.getTimelineStackAlign()); } if (userPref.getTimelineStackDepth() != userPref.getTimelineStackDepthDefault()) { writeEntry(out, indent + 2, TIMELINE_STACK_DEPTH_ELEM, "" + userPref.getTimelineStackDepth()); } if (userPref.getTimelineStackFramePixels() != userPref.getTimelineStackFramePixelsDefault()) { writeEntry( out, indent + 2, TIMELINE_STACK_FRAME_PIXELS_ELEM, "" + userPref.getTimelineStackFramePixels()); } if (userPref.getTimelineShowEventStates() != userPref.getTimelineShowEventStatesDefault()) { writeEntry( out, indent + 2, TIMELINE_SHOW_STATES_ELEM, "" + userPref.getTimelineShowEventStates()); } if (userPref.getTimelineShowEventDensity() != userPref.getTimelineShowEventDensityDefault()) { writeEntry( out, indent + 2, TIMELINE_SHOW_DENSITY_ELEM, "" + userPref.getTimelineShowEventDensity()); } writeEntry(out, indent, TIMELINE_ELEM, true); } private void writeLibraryVisibilityNativeOrJava(PrintWriter out, int indent, UserPref userPref) { if (userPref.getLibraryVisibilityJava() != userPref.getLibraryVisibilityJavaDefault()) { writeEntry(out, indent, LIBRARY_VISIBILITY_JAVA, "" + userPref.getLibraryVisibilityJava()); } } private void writeLibraryVisibilityLoadObjects(PrintWriter out, int indent, UserPref userPref) { List list = userPref.getLibraryVisibilitySettings(); if (list != null && !list.isEmpty()) { writeEntry(out, indent, LOADOBJECT_LIST_ELEM, false); for (String s : list) { writeEntry(out, indent + 2, LOADOBJECT_ITEM_ELEM, escapeSpecialCharacters(s)); } writeEntry(out, indent, LOADOBJECT_LIST_ELEM, true); } } private void writeSearchPath(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, SEARCHPATH_ELEM, false); List list = userPref.getSearchPath(); if (list != null && !list.isEmpty()) { if (!SearchPathSetting.isDefault(list)) { writeEntry(out, indent + 2, SEARCHPATH_LIST_ELEM, false); for (String s : list) { writeEntry(out, indent + 4, SEARCHPATH_ITEM_ELEM, escapeSpecialCharacters(s)); } writeEntry(out, indent + 2, SEARCHPATH_LIST_ELEM, true); } } writeEntry(out, indent, SEARCHPATH_ELEM, true); } private void writePathmap(PrintWriter out, int indent, UserPref userPref) { writeEntry(out, indent, PATHMAP_ELEM, false); String[][] pathmap = userPref.getPathmap(); if (pathmap != null && pathmap.length > 0) { if (!PathMapSetting.isDefault(pathmap)) { writeEntry(out, indent + 2, PATHMAP_LIST_ELEM, false); for (int i = 0; i < pathmap[0].length; i++) { String from = pathmap[0][i]; String to = pathmap[1][i]; AttrValuePair[] attrValues = new AttrValuePair[2]; attrValues[0] = new AttrValuePair(PATHMAP_FROM_ATTR, from); attrValues[1] = new AttrValuePair(PATHMAP_TO_ATTR, to); writeEntry(out, indent + 4, PATHMAP_ITEM_ELEM, attrValues, true); } writeEntry(out, indent + 2, PATHMAP_LIST_ELEM, true); } } writeEntry(out, indent, PATHMAP_ELEM, true); } private void writeColorRules(PrintWriter out, int indent, List colorRules) { if (colorRules != null) { for (ColorRule cr : colorRules) { AttrValuePair[] attrValues = new AttrValuePair[3]; attrValues[0] = new AttrValuePair(FUNCTION_COLORS_COLOR_RULE_TYPE_ATTR, "" + cr.getType()); String text = cr.getText() != null ? cr.getText() : ""; attrValues[1] = new AttrValuePair(FUNCTION_COLORS_COLOR_RULE_TEXT_ATTR, escapeSpecialCharacters(text)); attrValues[2] = new AttrValuePair(FUNCTION_COLORS_COLOR_RULE_COLOR_ATTR, "" + cr.getColor().getRGB()); writeEntry(out, indent, FUNCTION_COLORS_COLOR_RULE_ELEM, attrValues, true); } } } private String escapeSpecialCharacters(String s) { s = s.replace("&", "&"); s = s.replace("<", "<"); s = s.replace(">", ">"); s = s.replace("'", "'"); s = s.replace("\"", """); return s; } /** Write entry of this type: or */ private void writeEntry( PrintWriter out, int indent, String elemname, AttrValuePair[] attrValues, boolean b) { if (indent > 0) { out.print(spaces.substring(0, indent)); } out.print("<"); out.print(elemname); if (attrValues != null) { for (int i = 0; i < attrValues.length; i++) { out.print(" " + attrValues[i].getAttr() + "=\"" + attrValues[i].getValue() + "\""); } } if (b) { out.print("/"); } out.println(">"); } /** Write entry of this type: or */ private void writeEntry(PrintWriter out, int indent, String elemname, boolean b) { if (indent > 0) { out.print(spaces.substring(0, indent)); } out.print("<"); if (b) { out.print("/"); } out.print(elemname); out.println(">"); } /** Write entry of this type: v */ private void writeEntry(PrintWriter out, int indent, String elemname, String v) { if (indent > 0) { out.print(spaces.substring(0, indent)); } out.print("<"); out.print(elemname); out.print(">"); out.print(v); out.print(""); } private class AttrValuePair { private String attr; private String value; public AttrValuePair(String attr, String value) { this.attr = attr; this.value = value; } public String getAttr() { return attr; } public String getValue() { return value; } } class MySaxParser extends DefaultHandler { private Stack stack = new Stack(); private String currentElement = null; private String currentText = ""; private List viewPanelOrderList; private List recentExperiments; private String recentExperimentsHost; private Map connectionPropertiesMap; private StringPickList hostNamePickList; private StringPickList findPickList; private List whatList; private StringPickList libraryVisibilityIncludeFilterPickList; private StringPickList libraryVisibilityExcludeFilterPickList; private List sourceDisassemblyValues; private List customIndexObjects; private List customMemoryObjects; private List functionColors; private List metricsOrderList; private MetricType[] metricSortByMType; private List[] metricOrderLists; private int orderMtype; private List metricOrderMTypeList; private List loadobjectList; private List searchPathList; private List pathmap; private List customMetricColors; public void startDocument() throws SAXException {} public void startElement(String namespaceURI, String localName, String element, Attributes atts) throws SAXException { if (element.equals(FRAME_ELEM)) { String w = atts.getValue(FRAME_WIDTH_ATTR); String h = atts.getValue(FRAME_HEIGHT_ATTR); String x = atts.getValue(FRAME_X_ATTR); String y = atts.getValue(FRAME_Y_ATTR); try { Dimension dim = new Dimension(Integer.valueOf(w), Integer.valueOf(h)); Point point = new Point(Integer.valueOf(x), Integer.valueOf(y)); userPref.setFrameSize(dim); userPref.setFrameLocation(point); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(VIEW_ORDER_LIST_ELEM)) { viewPanelOrderList = new ArrayList<>(); } else if (element.equals(METRIC_SELECTION_LIST_ELEM) || element.equals(METRIC_SELECTION_LIST_ELEM_V12)) { metricsOrderList = new ArrayList<>(); } else if (element.equals(METRIC_SORT_LIST_ELEM)) { metricSortByMType = new MetricType[MetricsSetting.MET_LAST]; } else if (element.equals(METRIC_ORDER_LIST_ELEM)) { metricOrderLists = (ArrayList[]) new ArrayList[MetricsSetting.MET_LAST]; } else if (element.equals(METRIC_ORDER_MTYPE_LIST_ELEM)) { String orderMtypeString = atts.getValue(METRIC_MTYPE_ATTR); orderMtype = Integer.valueOf(orderMtypeString); metricOrderMTypeList = new ArrayList<>(); } else if (element.equals(LOADOBJECT_LIST_ELEM)) { loadobjectList = new ArrayList<>(); } else if (element.equals(SEARCHPATH_LIST_ELEM)) { searchPathList = new ArrayList<>(); } else if (element.equals(PATHMAP_LIST_ELEM)) { pathmap = new ArrayList<>(); } else if (element.equals(PATHMAP_ITEM_ELEM)) { String from = atts.getValue(PATHMAP_FROM_ATTR); String to = atts.getValue(PATHMAP_TO_ATTR); String[] map = new String[2]; map[0] = from; map[1] = to; pathmap.add(map); } else if (element.equals(INDEX_OBJECT_LIST_ELEM)) { customIndexObjects = new ArrayList<>(); } else if (element.equals(FUNCTION_COLORS_LIST_ELEM)) { functionColors = new ArrayList<>(); } else if (element.equals(MEMORY_OBJECT_LIST_ELEM)) { customMemoryObjects = new ArrayList<>(); } else if (element.equals(EXPERIMENT_LIST_ELEM)) { String host = "localhost"; // pre version 5 if (userPref.getVersion() >= 5) { host = atts.getValue(HOST_NAME_ATTR); } recentExperiments = new ArrayList<>(); recentExperimentsHost = host; } else if (element.equals(EXPERIMENT_ELEM)) { String path = atts.getValue(PATH_ATTR); String wd = atts.getValue(WD_ATTR); String confPath = atts.getValue(CONF_ATTR); recentExperiments.add(new ExperimentPickListElement(path, wd, confPath)); } else if (element.equals(HOSTNAME_LIST_ELEM)) { connectionPropertiesMap = new HashMap<>(); hostNamePickList = new StringPickList(); } else if (element.equals(METRIC_COLOR_LIST_ELEM)) { customMetricColors = new ArrayList<>(); } else if (element.equals(HOSTNAME_ELEM)) { String name = atts.getValue(HOSTNAME_NAME_ATTR); String path = atts.getValue(HOSTNAME_PATH_ATTR); String connectCommand = null; if (userPref.getVersion() >= 16) { connectCommand = atts.getValue(HOSTNAME_CONNECT_COMMAND_ATTR); } String userName = null; if (userPref.getVersion() >= 4) { userName = atts.getValue(HOSTNAME_USERNAME_ATTR); } List authentications = null; String auth = atts.getValue(HOSTNAME_AUTH_ATTR); if (auth != null) { authentications = Authentication.fromXMLString(auth); } if (authentications == null) { authentications = UserPref.getDefaultAuthentications(); } connectionPropertiesMap.put( name, new ConnectionProperties(path, connectCommand, userName, authentications)); hostNamePickList.addElement(name); } else if (element.equals(METRIC_COLOR_ITEM_ELEM)) { String name = atts.getValue(METRIC_COLOR_NAME_ATTR); String colorString = atts.getValue(METRIC_COLOR_COLOR_ATTR); int colorVal; if (colorString.startsWith("0x")) { colorVal = Integer.parseInt(colorString.substring(2), 16); } else { colorVal = Integer.parseInt(colorString, 10); } Color color = new Color(colorVal); customMetricColors.add(new MetricColor(name, color)); UserPref.getInstance().setCustomMetricColors(customMetricColors); } else if (element.equals(FIND_LIST_ELEM)) { findPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } else if (element.equals(WHAT_LIST_ELEM)) { whatList = new ArrayList(); } else if (element.equals(LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM)) { String currentLibrryVisibilityFilter = atts.getValue(LIBRARY_VISIBILITY_CURRENT_FILTER_ATTR); UserPref.getInstance().setLibraryVisibilityIncludeFilter(currentLibrryVisibilityFilter); libraryVisibilityIncludeFilterPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } else if (element.equals(LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM)) { String currentLibraryVisibilityFilter = atts.getValue(LIBRARY_VISIBILITY_CURRENT_FILTER_ATTR); UserPref.getInstance() .setCurrentLibraryVisibilityExcludeFilter(currentLibraryVisibilityFilter); libraryVisibilityExcludeFilterPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } else if (element.equals(VIEW_ORDER_ELEM)) { String name = atts.getValue(VIEW_ORDER_NAME_ATTR); String shownString = atts.getValue(VIEW_ORDER_SHOWN_ATTR); viewPanelOrderList.add(new ViewPanelOrder(name, Boolean.valueOf(shownString))); } else if (element.equals(METRIC_SELECTION_ELEM)) { if (metricsOrderList != null) { String name = atts.getValue(METRIC_NAME_ATTR); boolean selected = Boolean.valueOf(atts.getValue(METRIC_ORDER_SELECTED_ATTR)); boolean[] exclIncl = new boolean[6]; for (int i = 0; i < 6; i++) { boolean val = Boolean.valueOf(atts.getValue(METRIC_ORDER_EXCLINCL_ATTR + i)); exclIncl[i] = val; } MetricNameSelection metricSetting = new MetricNameSelection(name, selected, exclIncl); metricsOrderList.add(metricSetting); } } else if (element.equals(METRIC_SORT_ELEM)) { if (metricSortByMType != null) { String mTypeString = atts.getValue(METRIC_MTYPE_ATTR); String name = atts.getValue(METRIC_NAME_ATTR); String subTypeString = atts.getValue(METRIC_SUBTYPE_ATTR); int mType = Integer.valueOf(mTypeString); int subType = Integer.valueOf(subTypeString); if (mType >= 0 && mType <= MetricsSetting.MET_LAST) { metricSortByMType[mType] = new MetricType(name, subType); } } } else if (element.equals(METRIC_ORDER_ELEM)) { if (metricOrderMTypeList != null) { String name = atts.getValue(METRIC_NAME_ATTR); String subTypeString = atts.getValue(METRIC_SUBTYPE_ATTR); int subType = Integer.valueOf(subTypeString); metricOrderMTypeList.add(new MetricType(name, subType)); } } else if (element.equals(CUSTOM_OBJECT_LIST_ELEM)) { String name = atts.getValue(CUSTOM_OBJECT_NAME_ATTR); String cormula = atts.getValue(CUSTOM_OBJECT_FORMULA_ATTR); CustomObject customObject = new CustomObject(name, cormula, null, null); // CXXX add descriptions if (customIndexObjects != null) { customIndexObjects.add(customObject); } else if (customMemoryObjects != null) { customMemoryObjects.add(customObject); } } else if (element.equals(FUNCTION_COLORS_COLOR_RULE_ELEM)) { int type = Integer.valueOf(atts.getValue(FUNCTION_COLORS_COLOR_RULE_TYPE_ATTR)); String text = atts.getValue(FUNCTION_COLORS_COLOR_RULE_TEXT_ATTR); if (text.length() == 0) { text = null; } int colorValue = Integer.valueOf(atts.getValue(FUNCTION_COLORS_COLOR_RULE_COLOR_ATTR)); Color color = new Color(colorValue); if (functionColors != null) { functionColors.add(new ColorRule(color, type, text, false)); } } else if (element.equals(NAV_SPLITPANE_ELEM)) { String pos = atts.getValue(SPLITPANE_POS_ATTR); try { int posValue = Integer.valueOf(pos); userPref.setNavigationPanelDividerPosition(posValue); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(NAV_FILTER_SPLITPANE_ELEM)) { try { splitPaneProp(atts, userPref.getNavigationFilterSplitPane()); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(SPLITPANE1_ELEM)) { try { splitPaneProp(atts, userPref.getSplitPane1()); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(SPLITPANE2_ELEM)) { try { splitPaneProp(atts, userPref.getSplitPane2()); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(SPLITPANE3_ELEM)) { try { splitPaneProp(atts, userPref.getSplitPane3()); } catch (NumberFormatException nfe) { errorMessage("INIT_FILE_ERROR", element, nfe); } } else if (element.equals(SOURCE_DISASSEMBLY)) { sourceDisassemblyValues = new ArrayList(); } currentElement = element; stack.push(currentElement); } private void splitPaneProp( Attributes atts, UserPref.SplitPaneFixedRightSizeProp splitPaneFixedRightSizeProp) throws NumberFormatException { String sizeString = atts.getValue(SPLITPANE_RIGHT_SIZE_ATTR); if (sizeString != null) { int size = Integer.valueOf(sizeString); splitPaneFixedRightSizeProp.setSize(size); } } @Override public void characters(char[] ch, int start, int length) { String newcurrentText = new String(ch, start, length); if (newcurrentText.length() > 0 && newcurrentText.charAt(0) == '\n') { currentText = ""; } else { currentText = currentText + newcurrentText; } } @Override public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws SAXException { try { if (qName.equals(VERSION_ELEM)) { userPref.setVersion(Integer.valueOf(currentText)); } else if (qName.equals(LAST_CLOSED_EXP_CONF_PATH_ELEM)) { userPref.setLastClosedExpConfPath(currentText); } else if (qName.equals(LAST_EXPORT_IMPORT_EXP_CONF_PATH_ELEM)) { userPref.setLastExportImportConfPath(currentText); } else if (qName.equals(SHOW_COMPARE_WARNING_ELEM)) { userPref.setShowCompareSourceWarning(Boolean.valueOf(currentText)); } else if (qName.equals(LIBRARY_VISIBILITY_JAVA)) { userPref.setLibraryVisibilityJava(Boolean.valueOf(currentText)); } else if (qName.equals(FORMATS_WRAP_METRIC_NAMES_IN_TABLES_ELEM)) { userPref.setWrapMetricNamesInTables(Boolean.valueOf(currentText)); } else if (qName.equals(METRIC_REVERSED_SORT)) { userPref.setMetricReversedSort(Boolean.valueOf(currentText)); } else if (qName.equals(VIEW_ORDER_LIST_ELEM)) { userPref.setViewPanelOrder(viewPanelOrderList); viewPanelOrderList = null; } else if (qName.equals(METRIC_SELECTION_LIST_ELEM) || qName.equals(METRIC_SELECTION_LIST_ELEM_V12)) { userPref.setMetricSelectionList(metricsOrderList); metricsOrderList = null; } else if (qName.equals(METRIC_SORT_LIST_ELEM)) { userPref.setMetricSortByMTypeList(metricSortByMType); metricSortByMType = null; } else if (qName.equals(METRIC_ORDER_LIST_ELEM)) { userPref.setMetricOrderLists(metricOrderLists); metricOrderLists = null; } else if (qName.equals(METRIC_ORDER_MTYPE_LIST_ELEM)) { metricOrderLists[orderMtype] = metricOrderMTypeList; metricOrderMTypeList = null; } else if (qName.equals(LOADOBJECT_ITEM_ELEM)) { loadobjectList.add(currentText); } else if (qName.equals(SEARCHPATH_ITEM_ELEM)) { searchPathList.add(currentText); } else if (qName.equals(LOADOBJECT_LIST_ELEM)) { userPref.setLibraryVisibilitySettings(loadobjectList); loadobjectList = null; } else if (qName.equals(SEARCHPATH_LIST_ELEM)) { userPref.setSearchPath(searchPathList); searchPathList = null; } else if (qName.equals(PATHMAP_LIST_ELEM)) { String[][] pathmap2 = new String[2][pathmap.size()]; for (int i = 0; i < pathmap.size(); i++) { String[] pathmapItem = pathmap.get(i); pathmap2[0][i] = pathmapItem[0]; pathmap2[1][i] = pathmapItem[1]; } userPref.setPathmap(pathmap2); pathmap = null; } else if (qName.equals(INDEX_OBJECT_LIST_ELEM)) { userPref.setCustomIndexObjects(customIndexObjects); customIndexObjects = null; } else if (qName.equals(FUNCTION_COLORS_LIST_ELEM)) { userPref.setActiveColorRules(functionColors); functionColors = null; } else if (qName.equals(MEMORY_OBJECT_LIST_ELEM)) { userPref.setCustomMemoryObjects(customMemoryObjects); customMemoryObjects = null; } else if (qName.equals(EXPERIMENT_PATH_ELEM)) { recentExperiments.add(new ExperimentPickListElement(currentText, null, null)); } else if (qName.equals(EXPERIMENT_LIST_ELEM)) { userPref.getExperimentsPicklists().add(recentExperimentsHost, recentExperiments); recentExperiments = null; recentExperimentsHost = null; } else if (qName.equals(HOSTNAME_LIST_ELEM)) { userPref.setConnectionPropertiesMap(connectionPropertiesMap); connectionPropertiesMap = null; userPref.setHostNamePicklist(hostNamePickList); hostNamePickList = null; } else if (qName.equals(METRIC_COLOR_LIST_ELEM)) { userPref.setCustomMetricColors(customMetricColors); customMetricColors = null; } else if (qName.equals(FIND_ELEM)) { findPickList.addElement(currentText); } else if (qName.equals(WHAT_ELEM)) { UserPref.What what = UserPref.What.toWhat(currentText); if (what != null) { whatList.add(what); } } else if (qName.equals(LIBRARY_VISIBILITY_INCLUDE_FILTER_ELEM)) { libraryVisibilityIncludeFilterPickList.addElement(currentText); } else if (qName.equals(LIBRARY_VISIBILITY_EXCLUDE_FILTER_ELEM)) { libraryVisibilityExcludeFilterPickList.addElement(currentText); } else if (qName.equals(FIND_LIST_ELEM)) { userPref.setFindPickList(findPickList); findPickList = null; } else if (qName.equals(WHAT_LIST_ELEM)) { userPref.setWhatList(whatList); whatList = null; } else if (qName.equals(LIBRARY_VISIBILITY_INCLUDE_FILTER_LIST_ELEM)) { userPref.setLibraryVisibilityIncludePickList(libraryVisibilityIncludeFilterPickList); libraryVisibilityIncludeFilterPickList = null; } else if (qName.equals(LIBRARY_VISIBILITY_EXCLUDE_FILTER_LIST_ELEM)) { userPref.setLibraryVisibilityExcludePickList(libraryVisibilityExcludeFilterPickList); libraryVisibilityExcludeFilterPickList = null; } else if (qName.equals(CALL_TREE_THRESHOLD)) { userPref.setCallStackThreshold(Integer.valueOf(currentText)); } else if (qName.equals(TIMELINE_GROUP_DATA_BY_BUTTON_NAME_ELEM)) { userPref.setTimelineGroupDataByButtonName(currentText); } else if (qName.equals(TIMELINE_TLDATA_CMD_ELEM)) { userPref.setTimelineTLDataCmd(currentText); } else if (qName.equals(TIMELINE_STACK_ALIGN_ELEM)) { userPref.setTimelineStackAlign(Integer.valueOf(currentText)); } else if (qName.equals(TIMELINE_STACK_DEPTH_ELEM)) { userPref.setTimelineStackDepth(Integer.valueOf(currentText)); } else if (qName.equals(TIMELINE_STACK_FRAME_PIXELS_ELEM)) { userPref.setTimelineStackFramePixels(Integer.valueOf(currentText)); } else if (qName.equals(TIMELINE_SHOW_STATES_ELEM)) { userPref.setTimelineShowEventStates(Boolean.valueOf(currentText)); } else if (qName.equals(TIMELINE_SHOW_DENSITY_ELEM)) { userPref.setTimelineShowEventDensity(Boolean.valueOf(currentText)); } else if (qName.equals(MACHINE_MODEL_ELEM)) { userPref.setMachineModel(currentText); } else if (qName.equals(FORMATS_VIEW_MODE)) { userPref.setFormatsViewMode(Integer.valueOf(currentText)); } else if (qName.equals(FORMATS_STYLE)) { userPref.setFormatsStyle(Integer.valueOf(currentText)); } else if (qName.equals(FORMATS_APPEND_SO_NAME)) { userPref.setFormatsAppendSoName(Boolean.valueOf(currentText)); } else if (qName.equals(FORMATS_COMPARE_MODE)) { userPref.setFormatsCompareMode(Integer.valueOf(currentText)); } else if (qName.equals(VALUE_ELEM)) { sourceDisassemblyValues.add(Integer.valueOf(currentText)); } else if (qName.equals(SOURCE_DISASSEMBLY)) { // If reading older versions, copy default dettings into missing values int[] defaultSettings = SourceDisassemblySetting.getDefaultSourceDisassemblySetting(); int[] values = new int[defaultSettings.length]; int i = 0; for (i = 0; i < sourceDisassemblyValues.size(); i++) { if (i < values.length) { values[i] = sourceDisassemblyValues.get(i); } } // If reading an older version, fill in with default values for the missing settings for (; i < defaultSettings.length; i++) { values[i] = defaultSettings[i]; } userPref.setSourceDisassemblySettings(values); } } catch (NumberFormatException ne) { } stack.pop(); if (stack.empty()) { currentElement = null; } else { currentElement = stack.peek(); } } public void endDocument() throws SAXException {} } class MyErrorHandler implements ErrorHandler { private PrintStream out; MyErrorHandler(PrintStream out) { this.out = out; } private String getParseExceptionInfo(SAXParseException spe) { String systemId = spe.getSystemId(); if (systemId == null) { systemId = "null"; } String info = "URI=" + systemId + " Line=" + spe.getLineNumber() + ": " + spe.getMessage(); return info; } public void warning(SAXParseException spe) throws SAXException { warningMessage("INIT_FILE_READ_WARNING", getParseExceptionInfo(spe)); } public void error(SAXParseException spe) throws SAXException { throw new SAXException("INIT_FILE_ERROR" + getParseExceptionInfo(spe)); } public void fatalError(SAXParseException spe) throws SAXException { throw new SAXException("INIT_FILE_ERROR" + getParseExceptionInfo(spe)); } } private String convertToFileURL(String filename) { String path = new File(filename).getAbsolutePath(); if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); } if (!path.startsWith("/")) { path = "/" + path; } return "file:" + path; } public void parseInitFile(String filename) { boolean validation = false; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating(validation); XMLReader xmlReader = null; try { SAXParser saxParser = spf.newSAXParser(); xmlReader = saxParser.getXMLReader(); } catch (Exception ex) { System.err.println(ex); return; } xmlReader.setContentHandler(new MySaxParser()); xmlReader.setErrorHandler(new MyErrorHandler(System.err)); try { xmlReader.parse(convertToFileURL(filename)); } catch (SAXException se) { errorMessage("INIT_FILE_READ_ERROR", se.getMessage()); } catch (IOException ioe) { errorMessage("INIT_FILE_READ_ERROR", ioe.getMessage()); } } private void errorMessage(String message, String error) { System.err.println("Error: " + message + " " + error); } private void errorMessage(String message, String error, Exception e) { System.err.println("Error: " + message + " " + error + " " + e); } private void warningMessage(String message, String warning) { System.err.println("Warning: " + message + " " + warning); } } gprofng-gui-2.1/org/gprofng/mpmt/persistence/UserPref.java0000644000175000017500000011505615044710303020656 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.persistence; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.ExperimentPickLists; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.metrics.MetricColors.MetricColor; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.remote.Authentication; import org.gprofng.mpmt.settings.CallTreeSetting; import org.gprofng.mpmt.settings.CompareModeSetting; import org.gprofng.mpmt.settings.FormatSetting; import org.gprofng.mpmt.settings.MetricNameSelection; import org.gprofng.mpmt.settings.MetricType; import org.gprofng.mpmt.settings.PathMapSetting; import org.gprofng.mpmt.settings.SearchPathSetting; import org.gprofng.mpmt.settings.SourceDisassemblySetting; import org.gprofng.mpmt.settings.TableSettings; import org.gprofng.mpmt.settings.TimelineSetting; import org.gprofng.mpmt.settings.ViewModeSetting; import org.gprofng.mpmt.settings.ViewsSetting.CustomObject; import org.gprofng.mpmt.statecolors.ColorRule; import org.gprofng.mpmt.toolbar.FindTextPanel; import java.awt.Dimension; import java.awt.Point; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.swing.JFrame; public class UserPref { public enum What { USER, METRICS, SOURCEDISASSEMBLY, FORMATS, TIMELINE, SEARCHPATH, PATHMAP, VIEWS, CALLTREE, FUNCTIONCOLORS, LIBRARYVISIBILITY, MISC; public static What toWhat(String whatString) { if (whatString.equals("USER")) { return USER; } else if (whatString.equals("METRICS")) { return METRICS; } else if (whatString.equals("SOURCEDISASSEMBLY")) { return SOURCEDISASSEMBLY; } else if (whatString.equals("CALLTREE")) { return CALLTREE; } else if (whatString.equals("FORMATS")) { return FORMATS; } else if (whatString.equals("TIMELINE")) { return TIMELINE; } else if (whatString.equals("SEARCHPATH")) { return SEARCHPATH; } else if (whatString.equals("PATHMAP")) { return PATHMAP; } else if (whatString.equals("VIEWS")) { return VIEWS; } else if (whatString.equals("CALLTREE")) { return CALLTREE; } else if (whatString.equals("FUNCTIONCOLORS")) { return FUNCTIONCOLORS; } else if (whatString.equals("LIBRARYVISIBILITY")) { return LIBRARYVISIBILITY; } else if (whatString.equals("MISC")) { return MISC; } return null; } } private static UserPref instance = null; private static final String ANALYZER_INIT_FILE = "analyzer.xml"; /* Update OldUserDirs with old user dirs it should search for settings */ private static final String UserDir = ".gprofng/gui"; private static final String[] OldUserDirs = new String[] { "../../.oracledevstudio/analyzer-paragon-dev", "../../.oracledevstudio/analyzer-12.6" }; // Newest first! public static final String configDirName = "configurations"; public static final String configAsWhenClosedName = "asWhenClosed"; public static final String configDefaultName = "default"; public static final String configurationSuffix = ".config.xml"; private static String userDirFromCommandLine = null; // from gp-display-gui script public static String binDirFromCommandLine = null; public static String dataDirFromCommandLine = null; public static String gprofngdir = null; // Where gp-display-text is installed public static boolean verbose = false; private static final long threeMonth = 90l * 24l * 3600l * 1000l; // 3 month private int version; // What's in this file private List whatList = null; // System settings private Dimension frameSize; private Point frameLocation; private final SplitPaneFixedRightSizeProp splitPane1 = new SplitPaneFixedRightSizeProp(375); private final SplitPaneFixedRightSizeProp splitPane2 = new SplitPaneFixedRightSizeProp(160); private final SplitPaneFixedRightSizeProp splitPane3 = new SplitPaneFixedRightSizeProp(getDefaultSplitPane3RightSize()); private final SplitPaneFixedRightSizeProp navigationFilterSplitPane = new SplitPaneFixedRightSizeProp(160); private Integer navigationPanelDividerPosition; private ExperimentPickLists experimentsPicklists; private Map connectionPropertiesMap = new LinkedHashMap(); private StringPickList hostNamePicklist = new StringPickList(); private String lastClosedExpConfPath = null; private Boolean wrapMetricNamesInTables = null; // private String lastExportImportConfPath = null; // Experiment settings private StringPickList findPickList = null; private List libraryVisibilitySettings = null; private StringPickList libraryVisibilityIncludeFilterPickList = null; private String currentLibraryVisibilityIncludeFilter = null; private StringPickList libraryVisibilityExcludeFilterPickList = null; private String currentLibraryVisibilityExcludeFilter = null; private Boolean libraryVisibilityJava = null; private Integer callStackThreshold; private Integer formatsViewMode = null; private Integer formatsStyle = null; private Boolean formatsAppendSoName = null; private Integer compareMode = null; private int[] sourceDisassemblySettings = null; private List viewPanelOrder; private String machineModel; private List customIndexObjects = null; private List customMemoryObjects = null; private List activeColorRules = null; private String timelineGroupDataByButtonName = null; private String timelineTLDataCmd = null; private Integer timelineStackAlign = null; private Integer timelineStackDepth = null; private Integer timelineStackFramePixels = null; private Boolean timelineShowEventStates = null; private Boolean timelineShowEventDensity = null; private List searchPath = null; private String[][] pathmap = null; private List customMetricColors = null; private Boolean showCompareSourceWarning = null; private List metricSelectionList; private Boolean metricReversedSort = null; private MetricType[] metricSortByMTypeList = null; private List[] metricOrderLists = null; public static UserPref getInstance() { if (instance == null) { instance = new UserPref(); } return instance; } public static String getAnalyzerDirPath(String userDir) { String ret; String userHome = getHomeDirectory(); ret = userHome + "/" + userDir; return ret; } public static String getAnalyzerInitFilePath(String userDir) { return getAnalyzerDirPath(userDir) + "/" + getInitFileName(); } public static String getAnalyzerDirPath() { String ret = userDirFromCommandLine; // from analyzer/tha script if (ret == null || ret.length() == 0) { String userHome = getHomeDirectory(); ret = userHome + "/" + UserDir; } return ret; } public static String getAnalyzerInitFilePath() { return getAnalyzerDirPath() + "/" + getInitFileName(); } public static String[] getOldUserDirs() { String[] ods = OldUserDirs.clone(); return ods; } public static String getDefaultAnalyzerDirPath() { return getAnalyzerDirPath(UserDir); } public static String getDefaultAnalyzerInitFilePath() { return getAnalyzerInitFilePath(getDefaultAnalyzerDirPath()); } public static String getHomeDirectory() { String userHome = System.getProperty("user.home"); if (userHome == null || userHome.equals("?")) { // on some Linux the systems the call above returns "?". userHome = System.getenv("HOME"); } return userHome; } public static String getInitFileName() { return ANALYZER_INIT_FILE; } public static String getConfigurationDirPath(String experimentName) { return experimentName + "/" + configDirName; } public static String getHomeConfigurationDirPath() { return getAnalyzerDirPath() + "/" + configDirName; } public static String getAsWhenClosedConfigName() { return configAsWhenClosedName + "." + getUserName() + configurationSuffix; } public static String getDefaultConfigurationName() { return configDefaultName + configurationSuffix; } public static String getAsWhenClosedConfigDirPath() { return getHomeConfigurationDirPath() + "/" + configAsWhenClosedName; } public static String getAsWhenClosedConfigPath(String experimentPath) { if (!experimentPath.startsWith("/")) { experimentPath = Analyzer.getInstance().getWorkingDirectory() + "/" + experimentPath; } String host = ""; if (Analyzer.getInstance().isRemote()) { host = Analyzer.getInstance().getRemoteHost(); } String mangledFileName = getMangledFileName(experimentPath, host, true); String asWhenClosedConfigPath = getAsWhenClosedConfigDirPath() + "/" + mangledFileName + configurationSuffix; File asWhenClosedConfigFile = new File(asWhenClosedConfigPath); if (!asWhenClosedConfigFile.exists()) { // If asWhenClosedConfigFile doesn't exist and old style do exists, move old to new... String mangledFileNameOld = getMangledFileName(experimentPath, host, false); String asWhenClosedConfigPathOld = getAsWhenClosedConfigDirPath() + "/" + mangledFileNameOld + configurationSuffix; File asWhenClosedConfigFileOld = new File(asWhenClosedConfigPathOld); if (asWhenClosedConfigFileOld.exists()) { asWhenClosedConfigFileOld.renameTo(asWhenClosedConfigFile); } } return asWhenClosedConfigPath; } /** * @param experimentPath assuming full path * @param host * @return */ public static String getMangledFileName( String experimentPath, String host, boolean useTimestamp) { String experimentName = basename(experimentPath); String mangledFileName = null; if (useTimestamp) { File logFile = new File(experimentPath + "/" + "log.xml"); if (logFile.exists()) { String timestamp = null; try { // use creationTime, if available BasicFileAttributes attr = Files.readAttributes(logFile.toPath(), BasicFileAttributes.class); timestamp = "" + attr.creationTime().toMillis(); } catch (IOException ioe) { } if (timestamp == null) { // else use lastModified timestamp = "" + logFile.lastModified(); } mangledFileName = experimentName + "_" + timestamp; } } if (mangledFileName == null) { // Old style... if (host == null || host.isEmpty() || host.equals("localhost")) { host = ""; } else if (!host.endsWith(".")) { host = host + "."; } String hostPlusExperimentPath = host + experimentPath; int hash = hostPlusExperimentPath.hashCode(); if (hash < 0) { hash = -hash; } mangledFileName = experimentName + "_" + hash; } return mangledFileName; } public static String basename(String path) { String name = path; int i = path.lastIndexOf("/"); if (i >= 0 && i < (path.length() - 1)) { name = path.substring(i + 1); } return name; } public static String getUserName() { return System.getProperty("user.name"); } /** * ************************************************************************************************ */ public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public List getWhatList() { return whatList; } public void setWhatList(List whatList) { this.whatList = whatList; } public ExperimentPickLists getExperimentsPicklists() { if (experimentsPicklists == null) { experimentsPicklists = new ExperimentPickLists(); } return experimentsPicklists; } public void setExperimentsPicklists(ExperimentPickLists experimentsPicklists) { this.experimentsPicklists = experimentsPicklists; } public Map getConnectionPropertiesMap() { return connectionPropertiesMap; } public void setConnectionPropertiesMap( Map connectionPropertiesMap) { this.connectionPropertiesMap = connectionPropertiesMap; } public static class ConnectionProperties { private String path; private String connectCommand; private String userName; private List authentications; public ConnectionProperties( String path, String connectCommand, String userName, List authentications) { this.path = path; this.connectCommand = connectCommand; this.userName = userName; this.authentications = authentications; } public String getPath() { return path; } public String getConnectCommand() { return connectCommand; } public String getUserName() { return userName; } public List getAuthentications() { return authentications; } } public static List getDefaultAuthentications() { return Authentication.getDefaultAuthentications(); } public StringPickList getHostNamePicklist() { return hostNamePicklist; } public void setHostNamePicklist(StringPickList hostNamePicklist) { this.hostNamePicklist = hostNamePicklist; } public Dimension getFrameSize() { if (frameSize != null) { return frameSize; } else { return getDefaultFrameSize(); } } public Dimension getDefaultFrameSize() { int screenWidth = AnVariable.SCREEN_SIZE.width; int screenHeight = AnVariable.SCREEN_SIZE.height; int width; int height; if (GUITesting.getInstance().isRunningUnderGUITesting()) { // Use fixed size frame if running under GUI testing return new Dimension(1400, 950); } // Guess a max width so it doesn't come up too wide in a multi monitor environment if (screenHeight <= 480 && screenWidth > 640) { screenWidth = 640; } else if (screenHeight <= 600 && screenWidth >= 800) { screenWidth = 800; } else if (screenHeight <= 768 && screenWidth >= 1024) { screenWidth = 1024; } else if (screenHeight <= 1200 && screenWidth >= 1920) { screenWidth = 1920; } else if (screenWidth >= 1024) { // ??? screenWidth = 1024; // ??? } if (screenWidth <= 400) { width = screenWidth - 10; } else if (screenWidth <= 800) { width = screenWidth - 25; } else if (screenWidth <= 1280) { width = screenWidth - 50; } else { width = screenWidth - 200; } if (screenHeight <= 300) { height = screenHeight - 10; } else if (screenHeight <= 600) { height = screenHeight - 50; } else if (screenHeight <= 1024) { height = screenHeight - 100; } else { height = screenHeight - 200; } return new Dimension(width, height); } public void setFrameSize(Dimension frameSize) { this.frameSize = frameSize; } public Point getFrameLocation() { if (frameLocation != null) { return frameLocation; } else { return getDefaultFrameLocation(); } } public Point getDefaultFrameLocation() { Dimension size = getDefaultFrameSize(); int x = (AnVariable.SCREEN_SIZE.width - size.width) / 2; int y = (AnVariable.SCREEN_SIZE.height - size.height) / 2; if (x <= 0) { x = 0; } if (y <= 0) { y = 0; } return new Point(x, y); } public void setFrameLocation(Point frameLocation) { this.frameLocation = frameLocation; } public SplitPaneFixedRightSizeProp getSplitPane1() { return splitPane1; } public SplitPaneFixedRightSizeProp getSplitPane2() { return splitPane2; } public SplitPaneFixedRightSizeProp getSplitPane3() { return splitPane3; } public SplitPaneFixedRightSizeProp getNavigationFilterSplitPane() { return navigationFilterSplitPane; } public static class SplitPaneFixedRightSizeProp { private Integer defaultSize; private Integer size; public SplitPaneFixedRightSizeProp(Integer defaultSize) { this.defaultSize = defaultSize; } /** * @return the size */ public Integer getSize() { if (size == null) { size = getDefaultSize(); } return size; } /** * @param size the size to set */ public void setSize(Integer size) { this.size = size; } /** * @return the defaultSize */ public Integer getDefaultSize() { return defaultSize; } } public Integer getNavigationPanelDividerPosition() { if (navigationPanelDividerPosition == null) { navigationPanelDividerPosition = 145; // default value } return navigationPanelDividerPosition; } public void setNavigationPanelDividerPosition(Integer navigationPanelDividerPosition) { this.navigationPanelDividerPosition = navigationPanelDividerPosition; } protected Integer getDefaultSplitPane1RightSize() { return 375; } protected Integer getDefaultSplitPane3RightSize() { Dimension size = getDefaultFrameSize(); return (int) (size.height * 0.4); } public String getLastClosedExpConfPath() { return lastClosedExpConfPath; } public void setLastClosedExpConfPath(String lastClosedExpConfPath) { this.lastClosedExpConfPath = lastClosedExpConfPath; } /** * ************************************************************************************************ */ public String getLastExportImportConfPath() { return lastExportImportConfPath; } public void setLastExportImportConfPath(String lastExportImportConfPath) { this.lastExportImportConfPath = lastExportImportConfPath; } /** Find text */ public StringPickList getFindPickList() { if (findPickList == null) { findPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } return findPickList; } public void setFindPickList(StringPickList findPickList) { this.findPickList = findPickList; } /** Library Visibility */ public StringPickList getLibraryVisibilityIncludePickList() { if (libraryVisibilityIncludeFilterPickList == null) { libraryVisibilityIncludeFilterPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } return libraryVisibilityIncludeFilterPickList; } public void setLibraryVisibilityIncludePickList( StringPickList libraryVisibilityIncludeFilterPickList) { this.libraryVisibilityIncludeFilterPickList = libraryVisibilityIncludeFilterPickList; } public String getLibraryVisibilityIncludeFilter() { return currentLibraryVisibilityIncludeFilter; } public void setLibraryVisibilityIncludeFilter(String currentLibraryVisibilityIncludeFilter) { this.currentLibraryVisibilityIncludeFilter = currentLibraryVisibilityIncludeFilter; } public StringPickList getLibraryVisibilityExcludePickList() { if (libraryVisibilityExcludeFilterPickList == null) { libraryVisibilityExcludeFilterPickList = new StringPickList(FindTextPanel.MAX_FIND_ITEMS); } return libraryVisibilityExcludeFilterPickList; } public void setLibraryVisibilityExcludePickList( StringPickList libraryVisibilityExcludeFilterPickList) { this.libraryVisibilityExcludeFilterPickList = libraryVisibilityExcludeFilterPickList; } public String getCurrenLibraryVisibilityExcludeFilter() { return currentLibraryVisibilityExcludeFilter; } public void setCurrentLibraryVisibilityExcludeFilter( String currentLibraryVisibilityExcludeFilter) { this.currentLibraryVisibilityExcludeFilter = currentLibraryVisibilityExcludeFilter; } public boolean getLibraryVisibilityJava() { if (libraryVisibilityJava == null) { libraryVisibilityJava = getLibraryVisibilityJavaDefault(); } return libraryVisibilityJava; } public void setLibraryVisibilityJava(boolean libraryVisibilityJava) { this.libraryVisibilityJava = libraryVisibilityJava; } public boolean getLibraryVisibilityJavaDefault() { return false; } /** Call Tree threshold */ public int getCallStackThreshold() { if (callStackThreshold == null) { callStackThreshold = getCallStackThresholdDefault(); } return callStackThreshold; } public void setCallStackThreshold(int callStackThreshold) { this.callStackThreshold = callStackThreshold; } public int getCallStackThresholdDefault() { return CallTreeSetting.getDefaultThreshold(); } /** Formats View Mode */ public int getFormatsViewMode() { if (formatsViewMode == null) { formatsViewMode = getFormatsViewModeDefault(); } return formatsViewMode; } public void setFormatsViewMode(int formatsViewMode) { this.formatsViewMode = formatsViewMode; } public int getFormatsViewModeDefault() { return ViewModeSetting.getDefaultViewMode().value(); } /** Formats Style */ public int getFormatsStyle() { if (formatsStyle == null) { formatsStyle = getFormatsStyleDefault(); } return formatsStyle; } public void setFormatsStyle(int formatsStyle) { this.formatsStyle = formatsStyle; } public int getFormatsStyleDefault() { return FormatSetting.getDefaultStyle().value(); } /** Formats AppendSoName */ public boolean getFormatsAppendSoName() { if (formatsAppendSoName == null) { formatsAppendSoName = getFormatsAppendSoNameDefault(); } return formatsAppendSoName; } public void setFormatsAppendSoName(boolean formatsAppendSoName) { this.formatsAppendSoName = formatsAppendSoName; } public boolean getFormatsAppendSoNameDefault() { return FormatSetting.getDefaultAppendSoName(); } /** Formats Compare Mode */ public int getFormatsCompareMode() { if (compareMode == null) { compareMode = getFormatsCompareModeDefault(); } return compareMode; } public void setFormatsCompareMode(int compareMode) { this.compareMode = compareMode; } public int getFormatsCompareModeDefault() { return CompareModeSetting.getDefaultCompareMode().value(); } /** source Disassembly Settings */ public int[] getSourceDisassemblySettings() { if (sourceDisassemblySettings == null) { sourceDisassemblySettings = getSourceDisassemblySettingsDefault(); } return sourceDisassemblySettings; } public void setSourceDisassemblySettings(int[] sourceDisassembySettings) { this.sourceDisassemblySettings = sourceDisassembySettings; } public int[] getSourceDisassemblySettingsDefault() { return SourceDisassemblySetting.getDefaultSourceDisassemblySetting(); } /** Views order */ public List getViewPanelOrder() { return viewPanelOrder; } public void setViewPanelOrder(List viewPanelOrder) { this.viewPanelOrder = viewPanelOrder; } public static class ViewPanelOrder { private String name; private boolean shown; public ViewPanelOrder(String name, boolean shown) { this.name = name; this.shown = shown; } /** * @return the name */ public String getName() { return name; } /** * @return the shown */ public boolean isShown() { return shown; } } /** Machine model */ public String getMachineModel() { return machineModel; } public void setMachineModel(String machineModel) { this.machineModel = machineModel; } /** Index and Memory Objects */ public List getCustomIndexObjects() { return customIndexObjects; } public void setCustomIndexObjects(List indexObjects) { this.customIndexObjects = indexObjects; } public List getCustomMemoryObjects() { return customMemoryObjects; } public void setCustomMemoryObjects(List memoryObjects) { this.customMemoryObjects = memoryObjects; } public static void setUserDir(String aUserDir) { userDirFromCommandLine = aUserDir; } /** Function Colors */ public List getActiveColorRules() { if (activeColorRules != null) { return activeColorRules; } else { return getActiveColorRulesDefault(); } } public List getActiveColorRulesDefault() { return new ArrayList<>(); } public void setActiveColorRules(List activeColorRules) { this.activeColorRules = activeColorRules; } /** Metrics */ public List getMetricSelectionList() { return metricSelectionList; } public void setMetricSelectionList(List metricOrder) { this.metricSelectionList = metricOrder; } public boolean getMetricReversedSort() { if (metricReversedSort != null) { return metricReversedSort; } else { return getMetricReversedSortDefault(); } } public boolean getMetricReversedSortDefault() { return false; } public void setMetricReversedSort(Boolean metricReversedSort) { this.metricReversedSort = metricReversedSort; } public MetricType[] getMetricSortByMTypeList() { return metricSortByMTypeList; } public void setMetricSortByMTypeList(MetricType[] metricSortMType) { this.metricSortByMTypeList = metricSortMType; } public List[] getMetricOrderLists() { return metricOrderLists; } public void setMetricOrderLists(List[] metricOrderLists) { this.metricOrderLists = metricOrderLists; } /** Timeline */ public String getTimelineGroupDataByButtonName() { if (timelineGroupDataByButtonName != null) { return timelineGroupDataByButtonName; } else { return getTimelineGroupDataByButtonNameDefault(); } } public String getTimelineGroupDataByButtonNameDefault() { return TimelineSetting.getDefaultGroupDataByButtonName(); } public void setTimelineGroupDataByButtonName(String timelineGroupDataByButtonName) { this.timelineGroupDataByButtonName = timelineGroupDataByButtonName; } public String getTimelineTLDataCmd() { if (timelineTLDataCmd != null) { return timelineTLDataCmd; } else { return getTimelineTLDataCmdDefault(); } } public String getTimelineTLDataCmdDefault() { return TimelineSetting.getDefaultTLDataCmd(); } public void setTimelineTLDataCmd(String timelineTLDataCmd) { this.timelineTLDataCmd = timelineTLDataCmd; } public int getTimelineStackAlign() { if (timelineStackAlign != null) { return timelineStackAlign; } else { return getDefaultTimelineStackAlign(); } } public int getDefaultTimelineStackAlign() { return TimelineSetting.getDefaultStackAlign(); } public void setTimelineStackAlign(Integer timelineStackAlign) { this.timelineStackAlign = timelineStackAlign; } public int getTimelineStackDepth() { if (timelineStackDepth != null) { return timelineStackDepth; } else { return getTimelineStackDepthDefault(); } } public int getTimelineStackDepthDefault() { return TimelineSetting.getDefaultStackDepth(); } public void setTimelineStackDepth(Integer timelineStackDepth) { this.timelineStackDepth = timelineStackDepth; } public int getTimelineStackFramePixels() { if (timelineStackFramePixels != null) { return timelineStackFramePixels; } else { return getTimelineStackFramePixelsDefault(); } } public int getTimelineStackFramePixelsDefault() { return TimelineSetting.getDefaultStackFramePixels(); } public void setTimelineStackFramePixels(Integer timelineStackFramePixels) { this.timelineStackFramePixels = timelineStackFramePixels; } public boolean getTimelineShowEventStates() { if (timelineShowEventStates != null) { return timelineShowEventStates; } else { return getTimelineShowEventStatesDefault(); } } public boolean getTimelineShowEventStatesDefault() { return TimelineSetting.getTimelineShowEventStatesDefault(); } public void setTimelineShowEventStates(Boolean timelineShowEventStates) { this.timelineShowEventStates = timelineShowEventStates; } public boolean getTimelineShowEventDensity() { if (timelineShowEventDensity != null) { return timelineShowEventDensity; } else { return getTimelineShowEventDensityDefault(); } } public boolean getTimelineShowEventDensityDefault() { return TimelineSetting.getTimelineShowEventDensityDefault(); } public void setTimelineShowEventDensity(Boolean timelineShowEventDensity) { this.timelineShowEventDensity = timelineShowEventDensity; } public List getLibraryVisibilitySettings() { return libraryVisibilitySettings; } public void setLibraryVisibilitySettings(List loadObjectSettings) { this.libraryVisibilitySettings = loadObjectSettings; } public List getSearchPath() { if (searchPath == null) { return getSearchPathDefault(); } else { return searchPath; } } public List getSearchPathDefault() { return SearchPathSetting.getDefaultSearchPath(); } public void setSearchPath(List searchPath) { this.searchPath = searchPath; } public String[][] getPathmap() { if (pathmap == null) { return getPathmapDefault(); } else { return pathmap; } } public String[][] getPathmapDefault() { return PathMapSetting.getDefaultPathmap(); } public void setPathmap(String[][] pathmap) { this.pathmap = pathmap; } public List getCustomMetricColors() { return customMetricColors; } public void setCustomMetricColors(List customMetricColors) { this.customMetricColors = customMetricColors; } public boolean showCompareSourceWarning() { if (showCompareSourceWarning == null) { showCompareSourceWarning = showCompareSourceWarningDefault(); } return showCompareSourceWarning; } public boolean showCompareSourceWarningDefault() { return true; } public void setShowCompareSourceWarning(boolean showCompareSourceWarning) { this.showCompareSourceWarning = showCompareSourceWarning; } public Boolean wrapMetricNamesInTables() { if (wrapMetricNamesInTables == null) { wrapMetricNamesInTables = wrapMetricNamesInTablesDefault(); } return wrapMetricNamesInTables; } public void setWrapMetricNamesInTables(Boolean wrapMetricNamesInTables) { this.wrapMetricNamesInTables = wrapMetricNamesInTables; } public Boolean wrapMetricNamesInTablesDefault() { return TableSettings.wrapMetricNamesDefault(); } /** * ************************************************************************************************ */ public void save(String configFilePath, List what) { AnWindow anWindow = AnWindow.getInstance(); JFrame anFrame = anWindow.getFrame(); // Copy states back in to UserPref if (what.contains(UserPref.What.USER)) { setFrameSize(anFrame.getSize()); setFrameLocation(anFrame.getLocation()); setNavigationPanelDividerPosition( anWindow.getNavigationPanelSplitPane().getDividerLocationWhenShowing()); getSplitPane1().setSize(anWindow.getMainViewPanel().getSplitPane1().getSizeInPixels()); getSplitPane2().setSize(anWindow.getMainViewPanel().getSplitPane2().getSizeInPixels()); getSplitPane3().setSize(anWindow.getMainViewPanel().getSplitPane3().getSizeInPixels()); getNavigationFilterSplitPane() .setSize(anWindow.getNavigationPanel().getNavigationSplitPaneSizeInPixels()); } if (!what.contains(UserPref.What.USER) && what.size() > 0 || what.contains(UserPref.What.USER) && what.size() > 1) { if (!anWindow.getViewsPanel().onlyStaticViews()) { setViewPanelOrder(anWindow.getViewsPanel().getViewPanelOrderPref()); } setCallStackThreshold(anWindow.getSettings().getCallTreeSetting().getThreshold()); setFormatsViewMode(anWindow.getSettings().getViewModeSetting().get().value()); setFormatsStyle(anWindow.getSettings().getFormatSetting().getStyle().value()); setFormatsAppendSoName(anWindow.getSettings().getFormatSetting().getAppendSoName()); if (anWindow.getSettings().getCompareModeSetting().comparingExperiments()) { setFormatsCompareMode(anWindow.getSettings().getCompareModeSetting().get().value()); } setSourceDisassemblySettings(anWindow.getSettings().getSourceDisassemblySetting().get()); setMachineModel(anWindow.getSettings().getViewsSetting().getMachineModel()); setCustomIndexObjects(anWindow.getSettings().getViewsSetting().getCustomIndexObjects()); setCustomMemoryObjects(anWindow.getSettings().getViewsSetting().getCustomMemoryObjects()); setActiveColorRules(anWindow.getColorChooser().getColorMap().getActiveRules()); setMetricSelectionList(anWindow.getSettings().getMetricsSetting().getMetricOrder()); setMetricReversedSort( anWindow.getSettings().getMetricsSetting().getMetricStates().isReverseDirectionSorting()); setMetricSortByMTypeList( anWindow.getSettings().getMetricsSetting().getMetricStates().getMetricSortByMType()); setMetricOrderLists( anWindow.getSettings().getMetricsSetting().getMetricStates().getMetricOrderLists()); setTimelineStackDepth(anWindow.getSettings().getTimelineSetting().getTLStackDepth()); setTimelineStackFramePixels( anWindow.getSettings().getTimelineSetting().getTLStackFramePixels()); setTimelineGroupDataByButtonName( anWindow.getSettings().getTimelineSetting().getGroupDataByButtonName()); setTimelineTLDataCmd(anWindow.getSettings().getTimelineSetting().getTLDataCmd()); setTimelineStackAlign(anWindow.getSettings().getTimelineSetting().getStackAlign()); setTimelineShowEventStates(anWindow.getSettings().getTimelineSetting().getShowEventStates()); setTimelineShowEventDensity( anWindow.getSettings().getTimelineSetting().getShowEventDensity()); setLibraryVisibilitySettings( AnWindow.getInstance().getSettings().getLibraryVisibilitySetting().getStates()); setLibraryVisibilityJava(anWindow.getLibraryVisibilityDialog().isJava()); setSearchPath(anWindow.getSettings().getSearchPathSetting().get()); setPathmap(anWindow.getSettings().getPathMapSetting().get()); setWrapMetricNamesInTables(anWindow.getSettings().getTableSettings().wrapMetricNames()); } // Save states in config file new UserPrefPersistence().saveSettings(configFilePath, this, what); } public void restore(String configFilePath) { new UserPrefPersistence().restoreSettings(configFilePath, this); } public void resetExperimentPreferences() { findPickList.removeAllElements(); callStackThreshold = null; formatsViewMode = null; formatsAppendSoName = null; formatsStyle = null; sourceDisassemblySettings = null; machineModel = null; compareMode = null; customIndexObjects = null; customMemoryObjects = null; activeColorRules = null; viewPanelOrder = null; metricSelectionList = null; metricReversedSort = null; metricSortByMTypeList = null; metricOrderLists = null; timelineStackDepth = null; timelineStackFramePixels = null; timelineGroupDataByButtonName = null; timelineTLDataCmd = null; timelineStackAlign = null; timelineShowEventStates = null; timelineShowEventDensity = null; libraryVisibilitySettings = null; searchPath = null; pathmap = null; libraryVisibilityIncludeFilterPickList = null; currentLibraryVisibilityIncludeFilter = null; libraryVisibilityExcludeFilterPickList = null; currentLibraryVisibilityExcludeFilter = null; libraryVisibilityJava = null; wrapMetricNamesInTables = null; } /** Remove config files that are older than threeMonth (3 month)... */ public void cleanupAsWhenClosedFolder() { File asWhenClosedFile = new File(getAsWhenClosedConfigDirPath()); if (asWhenClosedFile.exists()) { File[] files = asWhenClosedFile.listFiles(); long oldTimeStamp = new Date().getTime() - threeMonth; for (File file : files) { if (!file.isDirectory() && file.getName().endsWith(configurationSuffix)) { long lastModified = file.lastModified(); if (lastModified < oldTimeStamp) { file.delete(); AnLog.log("Old config file removed: " + file.getAbsolutePath()); } } } } } /** * FIXUP: Should move this code to AnUtility but AnUtility doesn't run this early due to class * loader issue! * * @param fromDirectoryFile * @param toDirectoryFile * @throws IOException */ public static void copyDirectory(File fromDirectoryFile, File toDirectoryFile) throws IOException { if (fromDirectoryFile.exists() && fromDirectoryFile.isDirectory()) { if (!toDirectoryFile.exists()) { toDirectoryFile.mkdirs(); } String[] children = fromDirectoryFile.list(); for (int i = 0; i < children.length; i++) { File fromFile = new File(fromDirectoryFile, children[i]); if (fromFile.getName().equals(UserPref.configAsWhenClosedName)) { // Don't copy these files just yet.... continue; } File toFile = new File(toDirectoryFile, children[i]); if (fromFile.isDirectory()) { copyDirectory(fromFile, toFile); } else { copyFile(fromFile, toFile); } } } else { // FIXUP: do something reasonable } } public static void copyFile(File fromFile, File toFile) throws IOException { if (fromFile.exists() && !fromFile.isDirectory()) { InputStream inputStream = new FileInputStream(fromFile); OutputStream outputStream = new FileOutputStream(toFile); byte[] buffer = new byte[1024]; int nbytes; while ((nbytes = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, nbytes); } inputStream.close(); outputStream.close(); toFile.setLastModified(fromFile.lastModified()); } else { // FIXUP: do something reasonable } } } gprofng-gui-2.1/org/gprofng/mpmt/HotGapPanel.java0000644000175000017500000000700714744453367016761 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.KeyStroke; public class HotGapPanel extends JPanel { int height = 0; private final FuncListDisp funcListDisp; public HotGapPanel(FuncListDisp funcListDisp) { this.funcListDisp = funcListDisp; init(47); } private void init(int height) { this.height = height; JPanel buttonPan = new JPanel(new GridBagLayout()); buttonPan.setBackground(Color.WHITE); final JButton upButton = new AnIconButton(AnUtility.goUpIcon); final JButton downButton = new AnIconButton(AnUtility.goDownIcon); upButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { funcListDisp.find(null, false, true); funcListDisp.gap.update(); } }); downButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { funcListDisp.find(null, true, true); funcListDisp.gap.update(); } }); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; buttonPan.add(upButton, gridBagConstraints); gridBagConstraints.gridy = 1; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; buttonPan.add(downButton, gridBagConstraints); Dimension dim = new Dimension(AnHotGap.HOTGAP_WIDTH, height); buttonPan.setPreferredSize(dim); setLayout(new BorderLayout()); add(buttonPan, BorderLayout.NORTH); final AnHotGap gap = new AnHotGap(funcListDisp, height); add(gap, BorderLayout.CENTER); funcListDisp.gap = gap; // Hmmm????? setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, AnEnvironment.SCROLLBAR_BORDER_COLOR)); // Previous Hot Line KeyStroke keyStrokeUp = KeyboardShortcuts.sourcePreviousHotLineActionShortcut; upButton.setToolTipText( AnLocale.getString("Previous Hot Line") + AnUtility.keyStrokeToStringFormatted(keyStrokeUp)); // Next Hot Line KeyStroke keyStrokeDown = KeyboardShortcuts.sourceNextHotLineActionShortcut; downButton.setToolTipText( AnLocale.getString("Next Hot Line") + AnUtility.keyStrokeToStringFormatted(keyStrokeDown)); } public void headerheightChanged(int height) { if (height < 40) { height = 40; } if (this.height == height) { return; } removeAll(); init(height); funcListDisp.updateGap(); } } gprofng-gui-2.1/org/gprofng/mpmt/ResolveFilePathDialog.java0000644000175000017500000002222314744453367020770 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.ToolTipPopup; import java.awt.Frame; import javax.swing.JLabel; public class ResolveFilePathDialog extends AnDialog2 { private ResolveFilePathPanel resolveFilePathPanel; private String unResolvedPath; private long obj_id; public ResolveFilePathDialog(Frame owner, String unResolvedPath, long obj_id) { super(owner, owner, AnLocale.getString("Resolve Source File")); this.unResolvedPath = unResolvedPath; this.obj_id = obj_id; setHelpTag(AnVariable.HELP_ResolveSourceFile); resolveFilePathPanel = new ResolveFilePathPanel(this, unResolvedPath); setCustomPanel(resolveFilePathPanel); // getHelpButton().setVisible(false); // getHelpButton().setEnabled(false); } @Override protected void setStatus(AnDialog2.Status status) { super.setStatus(status); if (status == AnDialog2.Status.OK) { String resolvedPath = resolveFilePathPanel.getResolvedPath(); if (resolveFilePathPanel.archiveFiles()) { if (resolveFilePathPanel.resolveThisFileOnly()) { long[] ids = new long[1]; String[] paths = new String[1]; ids[0] = obj_id; paths[0] = resolvedPath; archive(ids, paths); } else { String unresolvedDir = AnUtility.dirname(unResolvedPath); String resolvedDir = AnUtility.dirname(resolvedPath); // System.out.println("unresolvedDir: " + unresolvedDir); // System.out.println("resolvedDir: " + resolvedDir); archiveAll(unresolvedDir, resolvedDir); } } else { // if (resolveFilePathPanel.resolveThisFileOnly()) { // String[] oldPaths = new String[1]; // String[] newPaths = new String[1]; // oldPaths[0] = unResolvedPath; // newPaths[0] = resolvedPath; // setLocations(oldPaths, newPaths); // } else { if (unResolvedPath.startsWith("/")) { // Use Path Map (native) int slash = 0; int unResolvedLength = unResolvedPath.length(); int resolvedLength = resolvedPath.length(); for (int i = 1; i < resolvedLength; i++) { if (resolvedPath.charAt(resolvedLength - i) == '/') { slash = i; } if (unResolvedPath.charAt(unResolvedLength - i) != resolvedPath.charAt(resolvedLength - i)) { break; } } String from = unResolvedPath.substring(0, unResolvedLength - slash); String to = resolvedPath.substring(0, resolvedLength - slash); addPathmap(from, to); } else { // Use Search Path (Java) String searchPath; if (resolvedPath.endsWith(unResolvedPath)) { searchPath = resolvedPath.substring(0, resolvedPath.length() - unResolvedPath.length() - 1); } else { searchPath = resolvedPath; } addSearchPath(searchPath); } } // } } } private void addSearchPath(String searchPath) { // System.out.println("Search Path: " + searchPath); AnWindow.getInstance().getSettings().getSearchPathSetting().add(this, searchPath); String ttText = "" + searchPath + " " + AnLocale.getString("added to Search Path settings"); JLabel label = new JLabel(ttText); ToolTipPopup toolTipPopup = new ToolTipPopup( AnWindow.getInstance().getViews().getCurrentViewDisplay(), label, ToolTipPopup.Location.CENTER, true); toolTipPopup.show(0, 4000); } private void addPathmap(final String from, final String to) { // System.out.println("Pathmap: " + from + " -> " + to); AnWindow.getInstance().getSettings().getPathMapSetting().addPathMap(this, from, to); String ttText = "" + from + " -> " + to + " " + AnLocale.getString("added to Pathmap settings"); JLabel label = new JLabel(ttText); ToolTipPopup toolTipPopup = new ToolTipPopup( AnWindow.getInstance().getViews().getCurrentViewDisplay(), label, ToolTipPopup.Location.CENTER, true); toolTipPopup.show(0, 4000); } public void archiveAll(final String unresolvedDir, final String resolvedDir) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { Object[] o = dbeResolvedWith_pathmap(unresolvedDir, resolvedDir); // IPC if (o == null) { return; // BUG? } String[] oldPaths = (String[]) o[0]; String[] newPaths = (String[]) o[1]; long[] ids = (long[]) o[2]; archive(ids, newPaths); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGING)); dbe_archive(ids, newPaths); // IPC AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGED)); } } }, "Archive All thread"); } public void archive(final long[] ids, final String[] paths) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGING)); dbe_archive(ids, paths); // IPC AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGED)); } } }, "Archive thread"); } public void setLocations(final String fnames[], final String locations[]) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (AnVariable.mainFlowLock) { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGING)); dbeSetLocations(fnames, locations); // IPC AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(this, AnChangeEvent.Type.SOURCE_FINDING_CHANGED)); } } }, "set source locations thread"); } protected void dbe_archive(final long ids[], final String locations[]) { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("dbe_archive"); window.IPC().send(ids); window.IPC().send(locations); window.IPC().recvVoid(); } } protected void dbeSetLocations(final String fnames[], final String locations[]) { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("dbeSetLocations"); window.IPC().send(fnames); window.IPC().send(locations); window.IPC().recvVoid(); } } protected Object[] dbeResolvedWith_setpath(final String path) { AnWindow window = AnWindow.getInstance(); // obj[0] - list of old pathes // obj[1] - list of new pathes // obj[2] - list of ids synchronized (IPC.lock) { window.IPC().send("dbeResolvedWith_setpath"); window.IPC().send(path); return (Object[]) window.IPC().recvObject(); } } protected Object[] dbeResolvedWith_pathmap(final String old_prefix, final String new_prefix) { AnWindow window = AnWindow.getInstance(); // obj[0] - list of old pathes // obj[1] - list of new pathes // obj[2] - list of ids synchronized (IPC.lock) { window.IPC().send("dbeResolvedWith_pathmap"); window.IPC().send(old_prefix); window.IPC().send(new_prefix); return (Object[]) window.IPC().recvObject(); } } } gprofng-gui-2.1/org/gprofng/mpmt/AnEvent.java0000644000175000017500000000711214744453367016154 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import java.util.EventObject; public final class AnEvent extends EventObject { public static final int EVT_COMPUTE = 1; // AnTable, Settings: when double-clicking on already selected row in caller/callee, // Settings: when applying any change public static final int EVT_UPDATE = 2; // ColorMap: when channging colors, AnTable: when ???? // public final static int EVT_NEWFMT = 3; // Settings: Formats have changed // public final static int EVT_NEWSRC = 4; // Settings: Search Path/Pathmap changed, AnTable: // when double-clicking in row // public final static int EVT_NEWDIS = 5; // Settings: Search Path/Pathmap changed // public final static int EVT_NEWTM = 6; // Settings: when timeline properties have changed // public final static int EVT_RUN = 7; // Settings: when applying any change public static final int EVT_SET = 8; // Antable: ????? public static final int EVT_SELECT = 9; // AnTable: when selecting row in AnTable (single/multi) public static final int EVT_SORT = 10; // AnTable, Settings: when sorting column by clicking in table header // public final static int EVT_ORDER = 11; // Settings: when switching column order in // AnTable public static final int EVT_SCROLL = 12; // AnTable: initial when Caller/Callee opened public static final int EVT_SWITCH = 13; // AnTable: when switching column order in AnTable public static final int EVT_RESET = 14; // AnTable: not used public static final int EVT_SETHEAD = 15; // AnTable: Set Head from Caller/Callee context menu public static final int EVT_SETTAIL = 16; // AnTable: Set Tail from Caller/Callee context menu public static final int EVT_BACK = 17; // AnTable: when clicking Forward public static final int EVT_FORWARD = 18; // AnTable: when clicking Backward public static final int EVT_COPY_ALL = 19; // AnTable: when clicking Copy All public static final int EVT_COPY_SEL = 20; // AnTable: when clicking Copy Selected public static final int EVT_RESIZE = 99; // Should not clash with display types private final int type, dsp_type; private final int value; private final Object aux; public AnEvent(final Object source, final int type, final int value, final Object aux) { super(source); this.type = type; this.value = value; this.dsp_type = AnDisplay.DSP_Null; this.aux = aux; } public AnEvent( final Object source, final int type, final int value, final int dsp_type, final Object aux) { super(source); this.type = type; this.dsp_type = dsp_type; this.value = value; this.aux = aux; } public int getType() { return type; } public int getDispType() { return dsp_type; } public int getValue() { return value; } public Object getAux() { return aux; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(type); return sb.toString(); } } gprofng-gui-2.1/org/gprofng/mpmt/NoMetricsSelectedPanel.form0000644000175000017500000001060214744453367021170 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/AnDisplay.java0000644000175000017500000004564015044710303016464 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnTable.UpdateAction; import org.gprofng.mpmt.AnWindow.AnDispTab; import org.gprofng.mpmt.Analyzer.HelpAction; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.filter.CustomFilterAction; import org.gprofng.mpmt.filter.RedoFilterAction; import org.gprofng.mpmt.filter.RemoveAllFilterAction; import org.gprofng.mpmt.filter.UndoFilterAction; import org.gprofng.mpmt.ipc.IPCCancelledException; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Component; import java.util.ArrayList; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSeparator; import javax.swing.SwingConstants; import javax.swing.border.LineBorder; public abstract class AnDisplay extends JPanel { public final AnWindow window; private static JFrame jframe; protected final int type; protected final int subtype; protected int parent_type = -1; protected boolean available; // true if view is available protected boolean selected; // true if view is selected and showing protected boolean computed; // true if view's data has been computed and is up-to-date protected UpdateAction tailAction; protected boolean inCompute; protected boolean forceCompute; protected final boolean can_sort; public AnHotGap gap; private String help_id; private AnDispTab anDispTab; // Constructor protected AnDisplay(final AnWindow window, final int type, final String help_id) { this(window, type, 0, help_id); } protected AnDisplay( final AnWindow window, final int type, final int subtype, final String help_id) { this.window = window; jframe = window.getFrame(); this.type = type; this.subtype = subtype; this.help_id = help_id; selected = false; computed = false; inCompute = false; forceCompute = false; can_sort = ((type != DSP_Source) && (type != DSP_Disassembly) && (type != DSP_SourceV2) && (type != DSP_DisassemblyV2)); // FIXUP: REARCH tailAction = null; // Initialize GUI components & set preferred size initComponents(); setHelpAction(help_id); setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR, 0)); } // Initialize GUI components protected abstract void initComponents(); // Should be overridden if ... public JPopupMenu getFilterPopup() { return null; } // abstract JPopupMenu getFilterPopup(); public void showFilterPopup(Component parent) { JPopupMenu popup; popup = getFilterPopup(); if (popup == null) { popup = getDefaultFilterPopup(); } if (popup != null) { if (parent == null || !parent.isShowing()) { parent = this; } popup.show(parent, 15, 15); } } private void setHelpAction(final String help_id) { // if (help_id != null) { HelpAction helpAction = new HelpAction(help_id); registerKeyboardAction( helpAction, "help", KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); registerKeyboardAction( helpAction, "help", KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_FOCUSED); registerKeyboardAction( helpAction, "help", KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_IN_FOCUSED_WINDOW); // } } public void showHelp() { Analyzer.showHelp(help_id); } public String getHelpID() { return help_id; } // Display type public final int getType() { return type; } // Is current selected tab? public void setSelected(final boolean set) { selected = set; } public final boolean isSelected() { return selected; } // Need re-compute? public void setComputed(final boolean set) { computed = set; } public final boolean isComputed() { return computed; } // Clear display protected void clear() { // FIXUP: RE_ARCH } // Clear navigation history protected void clearHistory() { // FIXUP: RE_ARCH } public void setNavigationAction(final UpdateAction action) { tailAction = action; } // Update view specific tool bar public void updateToolBar() {} // sync src&dis view public void syncSrcDisWin() {} // Reset display protected void reset() { clear(); } public final void computeOnAWorkerThread() { computeOnAWorkerThread(null, null); } /** * Do long-running task in a separate thread * * @param context */ public final void computeOnAWorkerThread( final IPCContext context, final AbstractAction postComputeAction) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { compute(context, postComputeAction); } }, "Display_thread"); ; } public void compute(final IPCContext context, final AbstractAction postComputeAction) { synchronized (AnVariable.mainFlowLock) { IPCContext currentContext = context; if (currentContext == null) { currentContext = IPCContext.newCurrentContext(null, IPCContext.Scope.SESSION, false, window); } // System.out.println("\n============= AnDisplay compute Start" + // currentContext.getTaskName() + " Channel: " + currentContext.getChannel()); Object progressBarHandle = window.getSystemProgressPanel().progressBarStart(AnLocale.getString("Computing")); try { // in case there will be an exception inside doCompute doCompute(); // on worker thread and synchronized (AnVariable.mainFlowLock) } catch (IPCCancelledException ex) { System.out.println("\ncompute cancelled..."); inCompute = false; computed = false; } finally { currentContext = IPCContext.newCurrentContext(null, IPCContext.Scope.SESSION, false, window); // System.out.println("\n============= AnDisplay compute End" + // currentContext.getTaskName() + " Channel: " + currentContext.getChannel()); } if (postComputeAction != null) { postComputeAction.actionPerformed(null); } window.getSystemProgressPanel().progressBarStop(progressBarHandle); } } /* * Change selection */ public void changeSelection(AnTable table, int index) { return; } /** * Override and return true if text find is supported * * @return */ protected boolean supportsFindText() { return false; } // Find public int find(final String str, final boolean next, boolean caseSensitive) { return -1; } // Check if "Back" action is available public boolean isBackActionAvailable() { return false; } // Check if "Forward" action is available public boolean isForwardActionAvailable() { return false; } // Compute & update display public abstract void doCompute(); public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = "not implemented"; return text; } // Display error string on the status area protected final void showError(final String msg) { window.showError(msg); } // Display warning string on the status area protected final void showWarning(final String msg) { window.showWarning(msg); } /** * @return the anDispTab */ public AnDispTab getAnDispTab() { return anDispTab; } /** * @param anDispTab the anDispTab to set */ public void setAnDispTab(AnDispTab anDispTab) { this.anDispTab = anDispTab; } public JPopupMenu getDefaultFilterPopup() { List menuItems = getDefaultFilterMenuItems(); JPopupMenu popup = new JPopupMenu(); for (JComponent menuItem : menuItems) { popup.add(menuItem); } return popup; } public List getDefaultFilterMenuItems() { List menuItems = new ArrayList<>(); JMenuItem menuItem; CustomFilterAction customFilter = new CustomFilterAction(); menuItem = new JMenuItem(customFilter); customFilter.jmi = menuItem; menuItem.setEnabled(true); menuItems.add(menuItem); menuItems.add(new JSeparator(SwingConstants.HORIZONTAL)); UndoFilterAction undoFilter = new UndoFilterAction(); menuItem = new JMenuItem(undoFilter); undoFilter.jmi = menuItem; menuItem.setEnabled(window.getFilters().canUndoLastFilter()); menuItems.add(menuItem); RedoFilterAction redoFilter = new RedoFilterAction(); menuItem = new JMenuItem(redoFilter); redoFilter.jmi = menuItem; menuItem.setEnabled(window.getFilters().canRedoLastFilter()); menuItems.add(menuItem); RemoveAllFilterAction removeAllFilter = new RemoveAllFilterAction(); menuItem = new JMenuItem(removeAllFilter); removeAllFilter.jmi = menuItem; menuItem.setEnabled(window.getFilters().canRemoveAllFilters()); menuItems.add(menuItem); if (window.getFilters().anyFilters()) { menuItems.add(window.getFilters().removeFilterMenuItem()); } return menuItems; } public List getVisibleSubviews() { return new ArrayList<>(); } public List getSelectedSubviews() { return null; } public JPanel getToolbarPanel() { return null; } protected void setAccessibility(String name) { AccessibleContext context = getAccessibleContext(); context.setAccessibleName(name); context.setAccessibleDescription(name); } /** * @return the available */ protected boolean isAvailable() { return available; } /** * @param available the available to set */ protected void setAvailable(boolean available) { this.available = available; } /** * Some views show only 'Values' and not Exclusive and Inclusive in tables. * Fixup: they come in as 'Exclusive' but are not really 'Exclusive'. * Should be fixed in gp-display-text * * @return */ public boolean showOnlyValuesInTables() { return type == DSP_MemoryObject || type == DSP_DataObjects || type == DSP_DataLayout || type == DSP_IndexObject || type == DSP_IO || type == DSP_IOFileDescriptors || type == DSP_IOCallStacks || type == DSP_Heap; } /** * Some views show only 'Included' and not Exclusive and Inclusive in tables. * Fixup: Should be in gp-display-text. * * @return */ public boolean showOnlyIncludedInTables() { return type == DSP_Source || type == DSP_Disassembly || type == DSP_SourceDisassembly; } /** * Some views show only 'Attributed' and not Exclusive and Inclusive in tables. * Fixup: they come in as 'Exclusive' but are not really 'Exclusive'. * Should be fixed in gp-display-text * * @return */ public boolean showOnlyAttributedInTables() { return type == DSP_Callers; } protected void debug() { if (getAnDispTab() != null) { System.out.println("AnDisplay: " + getAnDispTab().getTCmd()); } else { System.out.println("AnDisplay: " + getClass().getName()); } System.out.println(" available: " + available); System.out.println(" selected: " + selected); System.out.println(" computed: " + computed); } /*------ Constants shared with enums.h (KEEP IN SYNC!) ---------------*/ public static final int DSP_Welcome = -3; // not used by DBE, not in enums.h public static final int DSP_Null = 0; // ??? public static final int DSP_Functions = 1; public static final int DSP_Lines = 2; public static final int DSP_PCs = 3; public static final int DSP_Source = 4; public static final int DSP_Disassembly = 5; public static final int DSP_CallerCalleeSelf = 6; public static final int DSP_Callers = 7; public static final int DSP_Callees = 8; public static final int DSP_CallTree = 9; public static final int DSP_Timeline = 10; public static final int DSP_Statistics = 11; public static final int DSP_Experiments = 12; public static final int DSP_MemoryObject = 14; public static final int DSP_DataObjects = 15; public static final int DSP_DataLayout = 16; public static final int DSP_SourceSelectedObject = 17; public static final int DSP_InstructionFrequency = 18; public static final int DSP_Races = 19; public static final int DSP_IndexObject = 20; public static final int DSP_DualSource = 21; public static final int DSP_SourceDisassembly = 22; public static final int DSP_Deadlocks = 23; public static final int DSP_MPITimeline = 24; public static final int DSP_MPIChart = 25; public static final int DSP_SourceV2 = 27; public static final int DSP_DisassemblyV2 = 28; public static final int DSP_IO = 31; public static final int DSP_Overview = 32; public static final int DSP_IOFileDescriptors = 33; public static final int DSP_IOCallStacks = 34; public static final int DSP_MiniFunctions = 35; public static final int DSP_MiniCallerCalleeSelf = 36; public static final int DSP_MiniCaller = 37; public static final int DSP_MiniCallee = 38; public static final int DSP_Heap = 39; public static final int DSP_CallFlame = 40; public static final int DSP_MAX = DSP_CallFlame; // Always the highest number /* By Type: AnDisplay Type Family Variable User Name Internal Name ---- ------ ----------------- ------------------------ ----------------- -3 0 DSP_WELCOME Welcome welcome 1 0 DSP_FUNCTION Functions functions 2 0 DSP_LINE Lines lines 3 0 DSP_PC PCs pcs 4 7 DSP_SOURCE Source source 5 7 DSP_DISASM Disassembly disasm 6 0 DSP_SELF 7 1 DSP_CALLER Callers-Callees callers-callees 8 0 DSP_CALLEE 9 4 DSP_CALLTREE Call Tree calltree 10 0 DSP_TIMELINE Timeline timeline 11 0 DSP_STATIS Statistics statistics 12 0 DSP_EXP Experiments header 13 14 2 DSP_MEMOBJ Generic Memory Object Views 15 2 DSP_DATAOBJ Data Objects data_objects 16 2 DSP_DLAYOUT Data Layout data_layout 17 0 DSP_SRC_FILE ***Not used anymore ???*** 18 0 DSP_IFREQ Instruction Frequency ifreq 19 0 DSP_RACES Races races 20 3 DSP_INDXOBJ Generic Index Object Views 21 0 DSP_RACESOURCE Dual Source dsrc 22 0 DSP_SOURCE_DISASM Source/Disassembly srcdis 23 0 DSP_DEADLOCKS Deadlocks deadlocks 24 0 DSP_MPVIEW_TL MPI Timeline mpi_timeline 25 0 DSP_MPVIEW_CHART MPI Chart mpi_chart 26 27 7 DSP_SOURCE_V2 ***Not used anymore ???*** 28 7 DSP_DISASM_V2 ***Not used anymore ???*** 29 30 31 6 DSP_IOACTIVITY I/O ioactivity 32 0 DSP_OVERVIEW Overview overview 33 6 DSP_IOVFD ***Not used anymore ???*** 34 6 DSP_IOCALLSTACK ***Not used anymore ???*** 35 0 DSP_MINIFUNCTION 36 0 DSP_MINISELF 37 0 DSP_MINICALLER 38 0 DSP_MINICALLEE 39 8 DSP_HEAP Heap heap By Family: AnDisplay Type Family Variable User Name Internal Name ---- ------ ----------------- ------------------------ ----------------- -3 0 DSP_WELCOME Welcome welcome 1 0 DSP_FUNCTION Functions functions 2 0 DSP_LINE Lines lines 3 0 DSP_PC PCs pcs 6 0 DSP_SELF 8 0 DSP_CALLEE 10 0 DSP_TIMELINE Timeline timeline 11 0 DSP_STATIS Statistics statistics 12 0 DSP_EXP Experiments header 17 0 DSP_SRC_FILE ***Not used anymore ???*** 18 0 DSP_IFREQ Instruction Frequency ifreq 19 0 DSP_RACES Races races 21 0 DSP_RACESOURCE Dual Source dsrc 22 0 DSP_SOURCE_DISASM Source/Disassembly srcdis 23 0 DSP_DEADLOCKS Deadlocks deadlocks 24 0 DSP_MPVIEW_TL MPI Timeline mpi_timeline 25 0 DSP_MPVIEW_CHART MPI Chart mpi_chart 32 0 DSP_OVERVIEW Overview overview 35 0 DSP_MINIFUNCTION 36 0 DSP_MINISELF 37 0 DSP_MINICALLER 38 0 DSP_MINICALLEE 7 1 DSP_CALLER Callers-Callees callers-callees 14 2 DSP_MEMOBJ Generic Memory Object Views 15 2 DSP_DATAOBJ Data Objects data_objects 16 2 DSP_DLAYOUT Data Layout data_layout 20 3 DSP_INDXOBJ Generic Index Object Views 9 4 DSP_CALLTREE Call Tree calltree 31 6 DSP_IOACTIVITY I/O ioactivity 33 6 DSP_IOVFD ***Not used anymore ???*** 34 6 DSP_IOCALLSTACK ***Not used anymore ???*** 4 7 DSP_SOURCE Source source 5 7 DSP_DISASM Disassembly disasm 27 7 DSP_SOURCE_V2 ***Not used anymore ???*** 28 7 DSP_DISASM_V2 ***Not used anymore ???*** 39 8 DSP_HEAP Heap heap */ } gprofng-gui-2.1/org/gprofng/mpmt/metrics/0000755000175000017500000000000015044723234015461 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricLabel.java0000644000175000017500000001407014744453367020446 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnObject; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.util.gui.AnUtility; import javax.swing.ImageIcon; import static org.gprofng.mpmt.util.gui.AnUtility.SPACES_BETWEEN_COLUMNS; public class MetricLabel { private ImageIcon icon; private ImageIcon sortIcon; private String[] titleLines; private String tip; private String unit; private double clock; private double total; private AnObject maxAnObject; private AnMetric anMetric; public MetricLabel( AnMetric anMetric, String tip, String unit, double clock, double total, AnObject maxAnObject, ImageIcon sortIcon) { this.anMetric = anMetric; this.tip = tip; this.unit = unit; this.clock = clock; this.total = total; this.maxAnObject = maxAnObject; this.sortIcon = sortIcon; titleLines = new String[2]; titleLines[1] = anMetric.getUserName(); String compareModifier = ""; if (anMetric.getCompareMode() == CompareMode.CMP_DELTA) { compareModifier = " " + AnLocale.getString("Delta"); } else if (anMetric.getCompareMode() == CompareMode.CMP_RATIO) { compareModifier = " " + AnLocale.getString("Ratio"); } if (this.anMetric.getSubType() == AnMetric.EXCLUSIVE) { titleLines[0] = AnLocale.getString("Exclusive") + compareModifier; icon = AnUtility.excl_icon; } else if (this.anMetric.getSubType() == AnMetric.INCLUSIVE) { titleLines[0] = AnLocale.getString("Inclusive") + compareModifier; icon = AnUtility.incl_icon; } else if (this.anMetric.getSubType() == 8) { // 8 = ATTRIBUTED titleLines[0] = AnLocale.getString("Attributed") + compareModifier; icon = null; } else { titleLines[0] = ""; icon = null; } } public String getText() { return getTip(); } public final ImageIcon getIcon() { return icon; } public final String[] getLegendAndTitleLines() { if (getAnMetric() != null) { if (getAnMetric().legend != null && getAnMetric().legend.length() > 0) { String[] t = new String[getTitleLines().length + 1]; t[0] = getAnMetric().legend; for (int i = 0; i < getTitleLines().length; i++) { t[i + 1] = getTitleLines()[i]; } return t; // title } } return getTitleLines(); } public AnMetric getAnMetric() { return anMetric; } public double getClock() { return clock; } public String getUnit() { return unit; } public ImageIcon getSortIcon() { return sortIcon; } public String[] getTitleLines() { return titleLines; } public String getTip() { return tip; } public double getTotal() { return total; } public AnObject getMaxAnObject() { return maxAnObject; } /** * @param maxAnObject the maxAnObject to set */ public void setMaxAnObject(AnObject maxAnObject) { this.maxAnObject = maxAnObject; } private int columnWidth = 0; private int headerWidth = 0; private int valWidth = 0; private int percentWidth = 0; public void init_width() { if (columnWidth > 0) { return; } AnMetric m = getAnMetric(); AnObject obj = getMaxAnObject(); if (m.isTVisible() || m.isVVisible()) { valWidth = obj.toString().length(); if (unit != null && valWidth < unit.length()) { valWidth = unit.length(); } } if (m.isPVisible()) { if (valWidth > 0) { columnWidth += SPACES_BETWEEN_COLUMNS; } percentWidth = obj.toPercent(getTotal()).length(); } columnWidth += valWidth + percentWidth; if (unit != null) { headerWidth = unit.length(); } String[] titles = getLegendAndTitleLines(); for (int i = 0; i < titles.length; i++) { if (headerWidth < titles[i].length()) { headerWidth = titles[i].length(); } } if (columnWidth < headerWidth) { columnWidth = headerWidth; } } private int max_val(int i1, int i2, int i3) { int cnt = i1; if (cnt < i2) { cnt = i2; } return i3 > cnt ? i3 : cnt; } // Make the caller and callee views the same width public void updateWidth(MetricLabel m1, MetricLabel m2) { init_width(); m1.init_width(); m2.init_width(); valWidth = max_val(valWidth, m1.valWidth, m2.valWidth); percentWidth = max_val(percentWidth, m1.percentWidth, m2.percentWidth); headerWidth = max_val(headerWidth, m1.headerWidth, m2.headerWidth); columnWidth = valWidth + percentWidth; if (valWidth > 0) { columnWidth += SPACES_BETWEEN_COLUMNS; } if (columnWidth < headerWidth) { columnWidth = headerWidth; } m1.valWidth = m2.valWidth = valWidth; m1.percentWidth = m2.percentWidth = percentWidth; m1.headerWidth = m2.headerWidth = headerWidth; m1.columnWidth = m2.columnWidth = columnWidth; } public int getValWidth() { init_width(); return valWidth; } public int getPercentWidth() { init_width(); return percentWidth; } public int getHeaderWidth() { init_width(); return headerWidth; } public int getColumnWidth() { init_width(); return columnWidth; } public void dump() { System.out.print("MetricLabel: "); for (int i = 0; i < titleLines.length; i++) { System.out.print(titleLines[i] + " "); } System.out.println(); } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricsGUI.java0000644000175000017500000012140515044710303020213 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.overview.AnBarTree; import org.gprofng.mpmt.overview.AnBarTree.BarNode; import org.gprofng.mpmt.overview.Bar; import org.gprofng.mpmt.overview.Bar.ValueColor; import org.gprofng.mpmt.overview.BarPanel; import org.gprofng.mpmt.overview.CheckBoxBarPanel; import org.gprofng.mpmt.overview.Overview; import org.gprofng.mpmt.overview.TurnerLabelPanel; import org.gprofng.mpmt.overview.TurnerPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Formatter; import java.util.Iterator; import java.util.List; import java.util.Stack; import java.util.Vector; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTree; public class MetricsGUI { public static final boolean SHOW_ATTRIBUTES_IN_OVERVIEW = false; private int metricDisplayNameBaseWidth = 500; private int metricCheckBoxesPosition = 425; private Image exclusiveIcon = AnUtility.excl_icon.getImage(); private Image inclusiveIcon = AnUtility.incl_icon.getImage(); private static MetricsGUI instance = null; private MetricNode rootNode; private AnWindow window; private JTree tree; private JPanel rootPanel; public MetricsGUI(MetricNode rootNode, AnWindow window) { instance = this; this.rootNode = rootNode; this.window = window; } public static MetricsGUI getInstance() { return instance; } public int getMetricDisplayNameBaseWidth() { // int longestName = longestName(rootNode, 0); return metricDisplayNameBaseWidth; } public void refreshMetricsPanel() { // tree.validate(); // tree.repaint(100); if (tree != null) { for (int i = 0; i < tree.getRowCount(); i++) { // FIXUP: hack..... if (tree.isExpanded(i)) { tree.collapseRow(i); tree.expandRow(i); } else { tree.expandRow(i); tree.collapseRow(i); } } } rootPanel.repaint(); } public void setTreeNodeStateSelected( SelectableMetricNode selectableMetricNode, boolean selected) { if (tree != null) { ((AnBarTree) tree).setTreeNodeStateSelected(selectableMetricNode, selected); } } public void expandAllNodes() { if (tree != null) { for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i); } } } public void collapseAllNodes() { if (tree != null) { for (int i = tree.getRowCount() - 1; i >= 0; i--) { tree.collapseRow(i); } } } public JPanel createAvailableMetricsPanel() { rootPanel = new PanelWithHeaders(); rootPanel.setLayout(new GridBagLayout()); rootPanel.setBackground(Color.WHITE); JLabel titleLabel = new JLabel(AnLocale.getString("Available Metrics")); AnUtility.setAccessibleContext(titleLabel.getAccessibleContext(), titleLabel.getText()); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; rootPanel.add(titleLabel, gridBagConstraints); if (!SHOW_ATTRIBUTES_IN_OVERVIEW) { int titleLabelWidth = titleLabel.getPreferredSize().width; int fontSize = new JLabel().getFont().getSize(); int xOffset = 550 - titleLabelWidth; if (window.getSettings().getCompareModeSetting().comparingExperiments()) { xOffset += 100; } if (fontSize <= 12) { } else { xOffset += (fontSize - 12) * 25; } JPanel buttonPanel = createButtonPanel(); xOffset = xOffset - (buttonPanel.getPreferredSize().width / 2); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, xOffset, 0, 0); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; rootPanel.add(buttonPanel, gridBagConstraints); } JPanel barPanel = createBarPanel(rootNode); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; rootPanel.add(barPanel, gridBagConstraints); // panel.setBorder(new LineBorder(Color.green)); return rootPanel; } private class PanelWithHeaders extends JPanel { private final int fontHeight = getFontMetrics(getFont()).getHeight(); private int selectedLabelX = -1; private final int selectedLabelWidth = 60; private final int exclusiveLabelX = 82; private final int exclusiveLabelWidth = 80; private final int inclusiveLabelX = 102; private final int inclusiveLabelWidth = 80; private final int labelsY = 30; private int getFirstLabelX() { if (selectedLabelX <= 0) { int fontSize = new JLabel().getFont().getSize(); selectedLabelX = window.getSettings().getCompareModeSetting().comparingExperiments() ? getMetricDisplayNameBaseWidth() + 126 : getMetricDisplayNameBaseWidth() + 25; if (fontSize <= 12) { } else { selectedLabelX += (fontSize - 12) * 25; } } return selectedLabelX; } @Override public void paint(Graphics g) { super.paint(g); if (SHOW_ATTRIBUTES_IN_OVERVIEW) { int x; int y = labelsY; g.setFont( g.getFont() .deriveFont((float) 12)); // Always use size 12 font to paint headers (for now!) g.setColor(Color.BLACK); x = getFirstLabelX(); x = x - 20; // g.drawString(AnLocale.getString("Show in views"), x, y); g.drawString(AnLocale.getString("Show in views"), x, y + 14); x += exclusiveLabelX; x = x + 20; g.drawImage(exclusiveIcon, x, y - exclusiveIcon.getHeight(null) + 2, null); g.drawString(AnLocale.getString("Exclusive"), x + exclusiveIcon.getHeight(null) + 2, y); g.drawString(AnLocale.getString("Time Value %"), x - 5, y + 14); x += inclusiveLabelX; g.drawImage(inclusiveIcon, x, y - exclusiveIcon.getHeight(null) + 2, null); g.drawString(AnLocale.getString("Inclusive"), x + exclusiveIcon.getHeight(null) + 2, y); g.drawString(AnLocale.getString("Time Value %"), x - 5, y + 14); addMouseMotionListener( new MouseAdapter() { @Override public void mouseMoved(MouseEvent e) { int x = e.getX(); int y = e.getY(); if (x >= getFirstLabelX() && x <= (getFirstLabelX() + selectedLabelWidth) && y >= (labelsY - fontHeight) && y <= labelsY + fontHeight) { setToolTipText(AnLocale.getString("Choose metrics to be shown in data views")); } else if (x >= getFirstLabelX() + exclusiveLabelX && x <= (getFirstLabelX() + exclusiveLabelX + exclusiveLabelWidth) && y >= (labelsY - fontHeight) && y <= labelsY + fontHeight) { setToolTipText( AnLocale.getString( "Exclusive metrics do not include activity in called functions")); } else if (x >= getFirstLabelX() + exclusiveLabelX + inclusiveLabelX && x <= (getFirstLabelX() + exclusiveLabelX + inclusiveLabelX + inclusiveLabelWidth) && y >= (labelsY - fontHeight) && y <= labelsY + fontHeight) { setToolTipText( AnLocale.getString("Inclusive metrics include activity in called functions")); } else { setToolTipText(null); } } }); } } } public JPanel createButtonPanel() { JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; gridBagConstraints = new GridBagConstraints(); int gridx = 0; gridBagConstraints.gridx = gridx++; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 0, 0, 0); JButton hotButton = new OverviewButton(AnLocale.getString("Hot")); hotButton.setMnemonic(AnLocale.getString('o', "OverviewHotButtonMN")); hotButton.setIcon(AnUtility.hot_icon); hotButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().hotAction(); } }); hotButton.setToolTipText( AnLocale.getString( "Select only metrics with the highest activity levels (marked check boxes)")); // JPanel hotPanel = new JPanel(); // hotPanel.setLayout(new GridBagLayout()); // hotPanel.setBackground(AnEnvironment.METRIC_HOT_HIGHLIGHT); // hotPanel.setPreferredSize(new Dimension(hotButton.getPreferredSize().width+4, // hotButton.getPreferredSize().height+4)); // GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); // gridBagConstraints2.anchor = GridBagConstraints.CENTER; // hotPanel.add(hotButton, gridBagConstraints2); buttonPanel.add(hotButton, gridBagConstraints); gridBagConstraints.gridx = gridx++; gridBagConstraints.anchor = GridBagConstraints.WEST; JButton defaultButton = new OverviewButton(AnLocale.getString("Reset")); defaultButton.setMnemonic(AnLocale.getString('R', "OverviewResetButtonMN")); defaultButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().resetAction(); } }); defaultButton.setToolTipText(AnLocale.getString("Select the default set of metrics")); gridBagConstraints.insets = new Insets(0, 6, 0, 0); buttonPanel.add(defaultButton, gridBagConstraints); gridBagConstraints.gridx = gridx++; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 6, 0, 0); gridBagConstraints.weightx = 1.0; JButton clearAllButton = new OverviewButton(AnLocale.getString("Clear All")); clearAllButton.setMnemonic(AnLocale.getString('A', "OverviewClearAllButtonMN")); clearAllButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getSettings().getMetricsSetting().clearAction(); } }); clearAllButton.setToolTipText(AnLocale.getString("Deselect all metrics")); buttonPanel.add(clearAllButton, gridBagConstraints); // buttonPanel.setBorder(new LineBorder(Color.green)); return buttonPanel; } class OverviewButton extends JButton { public OverviewButton(String text) { super(text); setText(text); setFont(Overview.defaultPlainFont); setMargin(new Insets(0, 4, 0, 4)); setOpaque(false); setBackground(new Color(237, 240, 244)); } @Override protected void paintComponent(Graphics g) { g.setColor(Color.red); g.fillRect(0, 0, getWidth(), getHeight()); Graphics2D g2d = (Graphics2D) g; int x = 15; int y = 25; Color topColor = new Color(240, 245, 239 + 15); Color bottomColor = new Color(176 + 20, 189 + 20, 201 + 20); GradientPaint gp; gp = new GradientPaint(0, 0, bottomColor, 0, getHeight() / 2, topColor); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight() / 2); gp = new GradientPaint(0, getHeight() / 2, topColor, 0, getHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(0, getHeight() / 2, getWidth(), getHeight()); super.paintComponent(g); } } // private int longestName(MetricNode node, int max) { // int len = 0; // if (node == null || node.getMetricBasic() == null || // node.getMetricBasic().getDisplayName() == null) { // len = 0; // } // else { // len = node.getMetricBasic().getDisplayName().length(); // } // System.out.println(node.getMetricBasic().getDisplayName() + " " + len); // if (len > max) { // max = len; // } // for (MetricNode child : node.getChildren()) { // max = longestName(child, max); // } // return max; // } private JPanel createBarPanel(MetricNode node) { JPanel metricsBottomComponent = new JPanel(); metricsBottomComponent.setOpaque(false); metricsBottomComponent.setLayout(new GridBagLayout()); int gridy = 0; if (node == null) { return metricsBottomComponent; } TurnerPanel hwCounterMetricTurnerPanel = null; for (MetricNode child : node.getChildren()) { JPanel metricsPanel = null; if (child.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_ROOT_CATEGORY) { TurnerLabelPanel metric1TopComponent = new TurnerLabelPanel(child.getMetricBasic().getDisplayName(), formatValueLabel(child)); metric1TopComponent.setOpaque(false); JPanel metric1BottomComponent = aggregateTreeRootCategory(child); metricsPanel = new TurnerPanel( metric1TopComponent, metric1BottomComponent, 4, true, true, Overview.METRICS_BACKGROUND); } else if (child.getMetricType() == MetricNode.MetricType.AGGREGATE_LIST_CATEGORY || child.getMetricType() == MetricNode.MetricType .AGGREGATE_TREE_CATEGORY) { // FIXUP: may not always be correct. Workaround for // Linux HWC (16575950). Perhaps th tree itself should // be changed. TurnerLabelPanel metric1TopComponent = new TurnerLabelPanel(child.getMetricBasic().getDisplayName(), formatValueLabel(child)); metric1TopComponent.setOpaque(false); JPanel metric1BottomComponent = aggregateListCategory(child); metricsPanel = new TurnerPanel( metric1TopComponent, metric1BottomComponent, 4, true, true, Overview.METRICS_BACKGROUND); } else if (child.getMetricType() == MetricNode.MetricType.PLAIN_LIST_CATEGORY) { if (!child.isHiddenInOverview()) { TurnerLabelPanel metric1TopComponent = new TurnerLabelPanel( child.getMetricBasic().getDisplayName(), formatValueLabel(child)); metric1TopComponent.setOpaque(false); JPanel metric1BottomComponent = createBarPanel(child); // recursive! metricsPanel = new TurnerPanel( metric1TopComponent, metric1BottomComponent, 4, true, true, Overview.METRICS_BACKGROUND); } } else if (child.getMetricType() == MetricNode.MetricType.PLAIN || child.getMetricType() == MetricNode.MetricType.PLAIN_ROOT || child.getMetricType() == MetricNode.MetricType.PLAIN_CHILD) { if (!child.isHiddenInOverview()) { String name = child.getMetricBasic().getName(); String displayName = child.getMetricBasic().getDisplayName(); String displayNameValue = displayName; String tooltip = displayNameValue; Bar bar = null; if (child instanceof ValueMetricNode) { ValueMetricNode childValueMetricNode = (ValueMetricNode) child; displayNameValue = displayName + ": " + formatValueUnit(childValueMetricNode); // "Bugs 16624403 and 19539622" (leave this string intact for searches) if (displayName.equals("Block Covered %") || displayName.equals("Instr Covered %")) { displayNameValue = displayName; // revert to name without value } tooltip = displayNameValue; CompareBarData[] compareBars = null; compareBars = getCompareValueColors(childValueMetricNode, childValueMetricNode.getValue(0)); if (compareBars != null && compareBars.length > 0) { tooltip = formatToolTip(childValueMetricNode); int percent = childValueMetricNode.getValue(0).gtZero() ? 100 : 0; bar = new Bar(MetricColors.getColor(name), percent, compareBars); } } int maxWidth = maxWidthInPixelsOfChildren(node) + 50; int nodeLevel = nodeLevel(child); if (child instanceof SelectableMetricNode) { if (child.getMetricType() == MetricNode.MetricType.PLAIN_ROOT || child.getMetricType() == MetricNode.MetricType.PLAIN_CHILD) { nodeLevel++; } CheckBoxBarPanel checkBoxBarPanel = new CheckBoxBarPanel( child, child.isSelected(), child.isHot(), displayNameValue, tooltip, bar, maxWidth, null, -1, nodeLevel); // FIXUP: add bar when we have tables.... if (child.getMetricType() == MetricNode.MetricType.PLAIN_ROOT) { hwCounterMetricTurnerPanel = new TurnerPanel(checkBoxBarPanel, null, 0, true, false, Color.white); metricsPanel = hwCounterMetricTurnerPanel; } else if (child.getMetricType() == MetricNode.MetricType.PLAIN_CHILD) { if (hwCounterMetricTurnerPanel != null) { hwCounterMetricTurnerPanel.setBottomPanelComponent(checkBoxBarPanel); } hwCounterMetricTurnerPanel = null; } else { metricsPanel = checkBoxBarPanel; } } else { metricsPanel = new BarPanel( child, child.isSelected(), child.isHot(), displayNameValue, tooltip, bar, maxWidth, null, -1, nodeLevel); // FIXUP: add bar when we have tables.... } } } else { System.err.println("MetricsPanel:getMetricsPanels() not handling " + child.getMetricType()); assert false; } if (metricsPanel != null) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy++; gridBagConstraints.weightx = 1; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); // gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.WEST; metricsBottomComponent.add(metricsPanel, gridBagConstraints); } } return metricsBottomComponent; } private JPanel aggregateListCategory(MetricNode node) { MetricValue totalValueNode = null; String totalValueNodeText = null; if (node instanceof ValueMetricNode && ((ValueMetricNode) node).hasValues()) { ValueMetricNode parentValueMetricNode = (ValueMetricNode) node; totalValueNode = parentValueMetricNode.getValue(0); totalValueNodeText = parentValueMetricNode.getMetricBasic().getDisplayName(); } JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); int gridy = 0; for (MetricNode child : node.getChildren()) { if (child.getMetricType() == MetricNode.MetricType.PLAIN) { int percent = 0; CompareBarData[] compareBars = null; String toolTipText = null; if (child instanceof ValueMetricNode && totalValueNode != null) { ValueMetricNode childValueMetricNode = (ValueMetricNode) child; if (childValueMetricNode.hasValues()) { percent = childValueMetricNode.getValue(0).percentOf(totalValueNode); compareBars = getCompareValueColors(childValueMetricNode, totalValueNode); toolTipText = formatToolTip(childValueMetricNode, totalValueNode, totalValueNodeText); } } GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy++; gridBagConstraints.insets = new Insets(0, 2, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; ValueColor[] valueColor = new Bar.ValueColor[] { new Bar.ValueColor(percent, MetricColors.getColor(child.getMetricBasic().getName())) }; Bar bar = new Bar(valueColor, percent, compareBars); CheckBoxBarPanel barPanel = new CheckBoxBarPanel( child, child.isSelected(), child.isHot(), child.getMetricBasic().getDisplayName(), toolTipText, bar, 31, null, -2, 3); panel.add(barPanel, gridBagConstraints); } } return panel; } private String formatToolTip(ValueMetricNode valueMetricNode) { return formatToolTip(valueMetricNode, null, null); } private String formatToolTip( ValueMetricNode valueMetricNode, MetricValue refMetric, String refMetricName) { String tt = ""; if (valueMetricNode.getValues().size() > 0) { String metricDisplayName = valueMetricNode.getMetricBasic().getDisplayName(); if (valueMetricNode.getValues().size() == 1) { tt = metricDisplayName + ": " + formatMetricValue(valueMetricNode.getValue(0), refMetric, refMetricName); } else { StringBuilder buf = new StringBuilder(); buf.append(""); buf.append("" + metricDisplayName + ""); int n = 0; for (MetricValue metricValue : valueMetricNode.getValues()) { buf.append("
"); if (n == 0) { String valueTxt = formatMetricValue(metricValue, refMetric, refMetricName); buf.append("Baseline"); for (int i = 0; i < 19; i++) { buf.append(" "); } if (valueMetricNode.getValues().size() > 2) { for (int i = 0; i < 3; i++) { buf.append(" "); } } buf.append(": " + valueTxt); } else { String valueTxt = formatMetricValue(metricValue, valueMetricNode.getValues().get(0), null); if (valueMetricNode.getValues().size() == 2) { buf.append("Comparison Group: " + valueTxt); } else { buf.append("Comparison Group " + n + ": " + valueTxt); } } n++; } buf.append(""); tt = buf.toString(); } } return tt; } private String formatMetricValue( MetricValue metricValue, MetricValue refMetricValue, String refMetricName) { String valueUnit = metricValue.formatValueUnit(); if (metricValue.getValueType() == MetricValue.ValueType.LABEL_ONLY || refMetricValue == null) { // No comparison to a reference return valueUnit; } String compareText = ""; int percent = metricValue.percentOf(refMetricValue); String percentString; if (percent == MetricValue.PERCENT_NAN) { percentString = "+INF%"; } else { percentString = new Formatter().format("%d%%", percent).toString(); } if (refMetricName != null) { // show percent of some other total compareText = new Formatter() .format(", " + AnLocale.getString("%s of %s"), percentString, refMetricName) .toString(); } else { // show delta from base MetricValue diffValue = metricValue.clone(); diffValue.subtract(refMetricValue); String diffValueString = diffValue.formatValue(); if (!diffValue.ltZero()) { diffValueString = "+" + diffValueString; } compareText = new Formatter().format(" (%s, %s)", diffValueString, percentString).toString(); } String txt = new Formatter().format("%s%s", valueUnit, compareText).toString(); return txt; } private String formatValueLabel(MetricNode node) { String label = null; if (node instanceof ValueMetricNode) { ValueMetricNode valueMetricNode = (ValueMetricNode) node; if (valueMetricNode.hasValues()) { MetricValue metricValue = valueMetricNode.getValue(0); if (metricValue.getValueType() == MetricValue.ValueType.LABEL_ONLY) { label = metricValue.getLabel(); } else { label = new Formatter() .format( "%s: %s", valueMetricNode.getValue(0).getLabel(), valueMetricNode.getValue(0).formatValueUnit()) .toString(); } } } return label; } private String formatValueUnit(ValueMetricNode valueMetricNode) { String valueUnit = ""; if (valueMetricNode.hasValues()) { valueUnit = valueMetricNode.getValue(0).formatValueUnit(); } return valueUnit; } private static int stringWidthInPixels(String s) { int width = new JLabel(s).getPreferredSize().width; return width + 30; } private static int maxWidthInPixelsOfChildren(MetricNode node) { int maxWidth = 0; { for (MetricNode child : node.getChildren()) { String displayName = child.getMetricBasic().getDisplayName(); int width = stringWidthInPixels(displayName); if (width > maxWidth) { maxWidth = width; } } } return maxWidth; } private static void maxWidthInPixelsOfChildren( MetricNode node, int level, int maxWidthAtLevel[]) { for (MetricNode child : node.getChildren()) { String displayName = child.getMetricBasic().getDisplayName(); int width = stringWidthInPixels(displayName); if (width > maxWidthAtLevel[level]) { maxWidthAtLevel[level] = width; } if (!child.getChildren().isEmpty()) { maxWidthInPixelsOfChildren(child, level + 1, maxWidthAtLevel); } } } private static int maxWidthInPixels(int maxWidthAtLevel[]) { int max = 0; for (int i = 0; i < maxWidthAtLevel.length; i++) { if (maxWidthAtLevel[i] > max) { max = maxWidthAtLevel[i]; } } return max; } private JPanel aggregateTreeRootCategory(MetricNode node) { List rootNodes = new ArrayList<>(); int maxWidthAtLevel[] = new int[10]; int level = 0; maxWidthInPixelsOfChildren(node, level + 1, maxWidthAtLevel); for (MetricNode child : node.getChildren()) { if (child.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_CATEGORY) { Vector treeNode = aggregateTreeCategory(node, child, maxWidthAtLevel, level + 1); rootNodes.add(treeNode); } else if (child.getMetricType() == MetricNode.MetricType.PLAIN) { // Vector treeNode = aggregateTreeCategory(node, child, // maxWidthAtLevel, level+1); MetricValue totalValueNode = null; String totalValueNodeText = null; if (node instanceof ValueMetricNode && ((ValueMetricNode) node).hasValues()) { totalValueNode = ((ValueMetricNode) node).getValue(0); totalValueNodeText = node.getMetricBasic().getDisplayName(); } int percent = 0; CompareBarData[] compareBars = null; String toolTipText = null; if (child instanceof ValueMetricNode) { ValueMetricNode nodeValueMetricNode = (ValueMetricNode) child; if (nodeValueMetricNode.hasValues() && totalValueNode != null) { percent = nodeValueMetricNode.getValue(0).percentOf(totalValueNode); compareBars = getCompareValueColors(nodeValueMetricNode, totalValueNode); toolTipText = formatToolTip(nodeValueMetricNode, totalValueNode, totalValueNodeText); } } int maxWidth = maxWidthInPixelsOfChildren(node); List barValueColors = new ArrayList<>(); barValueColors.add( new Bar.ValueColor(percent, MetricColors.getColor(child.getMetricBasic().getName()))); Bar cpuBar = new Bar(barValueColors, percent, compareBars); Vector plainNode = new AnBarTree.BarNode( child, false, toolTipText, cpuBar, maxWidth, 0); rootNodes.add(plainNode); } else { System.err.println( "MetricsPanel:aggregateTreeRootCategory() not handling " + child.getMetricType()); assert false; } } Vector rootVector = new AnBarTree.BarNode( node, true, null, null, rootNodes, maxWidthInPixels(maxWidthAtLevel), level); // GUI tree = new AnBarTree(rootVector); JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); panel.add(tree, gridBagConstraints); // expandBranchesWithSelections(node, tree); // Hack to get rid of all turners on leaf nodes expandAllNodes(); collapseAllNodes(); // Expand only root node tree.expandRow(0); return panel; } // private void expandBranchesWithSelections(MetricNode rootNode, JTree tree) { // if (tree == null) { // return; // } // Stack levels = new Stack(); // levels.push(-1); // expandBranchesWithSelectionsOrIsHot(levels, rootNode, tree); // } private void expandBranchesWithSelectionsOrIsHot( Stack levels, MetricNode node, JTree tree) { if (node instanceof SelectableMetricNode) { boolean hasSelectionsOrHot = node.isSelected() || node.isHot(); if (hasSelectionsOrHot) { Iterator iterator = levels.iterator(); while (iterator.hasNext()) { int level = iterator.next().intValue(); if (iterator.hasNext() && level >= 0) { tree.expandRow(level); } } } } int currentLevel = levels.peek().intValue(); levels.push(currentLevel + 1); for (MetricNode child : node.getChildren()) { expandBranchesWithSelectionsOrIsHot(levels, child, tree); } levels.pop(); } private int nodeLevel(MetricNode targetNode) { int level = nodeLevel(rootNode, targetNode, 0); return level; } private int nodeLevel(MetricNode node, MetricNode targetNode, int level) { for (MetricNode child : node.getChildren()) { if (child == targetNode) { return level + 1; } int l = nodeLevel(child, targetNode, level + 1); if (l > 0) { return l; } } return -1; } private CompareBarData[] getCompareValueColors(ValueMetricNode node, MetricValue totalValueNode) { if (node.hasValues()) { if (node.getValues().size() <= 1) { return null; } else { CompareBarData[] compareValueColors = new CompareBarData[node.getValues().size() - 1]; for (int valueNo = 1; valueNo < node.getValues().size(); valueNo++) { MetricValue metricValue = node.getValues().get(valueNo); int percent = metricValue.percentOf(totalValueNode); List valueColorList = new ArrayList<>(); if (node.getChildren() != null && !node.getChildren().isEmpty()) { for (MetricNode child : node.getChildren()) { if (child.getChildren() != null && !child.getChildren().isEmpty()) { for (MetricNode grandchildren : child .getChildren()) { // handles User/System/trap CPU time //YM: Should probably // be recursive MetricValue metricValue2 = ((ValueMetricNode) grandchildren).getValues().get(valueNo); int percent2 = metricValue2.percentOf(node.getValue(valueNo)); ValueColor valueColor = new ValueColor( percent2, MetricColors.getColor(grandchildren.getMetricBasic().getName())); valueColorList.add(valueColor); } } else { MetricValue metricValue2 = ((ValueMetricNode) child).getValues().get(valueNo); int percent2 = metricValue2.percentOf(node.getValue(valueNo)); ValueColor valueColor = new ValueColor( percent2, MetricColors.getColor(child.getMetricBasic().getName())); valueColorList.add(valueColor); } } } else { ValueColor valueColor = new ValueColor(100, MetricColors.getColor(node.getMetricBasic().getName())); valueColorList.add(valueColor); } compareValueColors[valueNo - 1] = new CompareBarData(percent, valueColorList); } // dumpCompareValueColors(node, compareValueColors); return compareValueColors; // for (int i = 1; i < node.getValues().size(); i++) { // MetricValue metricValue = node.getValues().get(i); // int percent = metricValue.percentOf(totalValueNode); // // List valueColorList = new ArrayList<>(); // ValueColor valueColor = new ValueColor(50, Bar.BAR_COMPARE_COLORS[i % // 2]); // valueColorList.add(valueColor); // valueColor = new ValueColor(50, Bar.BAR_COMPARE_COLORS[(i+1) % 2]); // valueColorList.add(valueColor); // // compareValueColors[i - 1] = new CompareBarData(percent, // valueColorList); // } // dumpCompareValueColors(node, compareValueColors); // return compareValueColors; } } return null; } private void dumpCompareValueColors(ValueMetricNode node, CompareBarData[] compareValueColors) { System.out.println("compareValueColors: " + node.getMetricBasic().getDisplayName()); for (CompareBarData cbd : compareValueColors) { System.out.print("CompareBarData:" + cbd.getPercentOfTotal()); for (ValueColor vc : cbd.getValueColors()) { System.out.print(" ["); System.out.print(vc.getValue() + " " + vc.getColor()); System.out.print("]"); } System.out.println(); } } private Vector aggregateTreeCategory( MetricNode rootNode, MetricNode node, int maxWidthAtLevel[], int level) { MetricValue totalValueNode = null; String totalValueNodeText = null; if (rootNode instanceof ValueMetricNode && ((ValueMetricNode) rootNode).hasValues()) { totalValueNode = ((ValueMetricNode) rootNode).getValue(0); totalValueNodeText = rootNode.getMetricBasic().getDisplayName(); } List barNodes = new ArrayList<>(); List barValueColors = new ArrayList<>(); List children = node.getChildren(); for (MetricNode child : children) { if (child.getMetricType() == MetricNode.MetricType.PLAIN) { int percent = 0; CompareBarData[] compareBars = null; String toolTipText = null; if (child instanceof ValueMetricNode) { ValueMetricNode childValueMetricNode = (ValueMetricNode) child; if (childValueMetricNode.hasValues()) { percent = childValueMetricNode.getValue(0).percentOf(totalValueNode); compareBars = getCompareValueColors(childValueMetricNode, totalValueNode); toolTipText = formatToolTip(childValueMetricNode, totalValueNode, totalValueNodeText); } } barNodes.add( new BarNode( child, child.isSelected(), toolTipText, new Bar( new Bar.ValueColor[] { new Bar.ValueColor( percent, MetricColors.getColor(child.getMetricBasic().getName())) }, percent, compareBars), maxWidthInPixels(maxWidthAtLevel), level + 1)); barValueColors.add( new Bar.ValueColor(percent, MetricColors.getColor(child.getMetricBasic().getName()))); } else if (child.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_CATEGORY) { int percent = 0; CompareBarData[] compareBars = null; String toolTipText = null; if (child instanceof ValueMetricNode) { ValueMetricNode childValueMetricNode = (ValueMetricNode) child; if (childValueMetricNode.hasValues()) { percent = childValueMetricNode.getValue(0).percentOf(totalValueNode); compareBars = getCompareValueColors(childValueMetricNode, totalValueNode); toolTipText = formatToolTip(childValueMetricNode, totalValueNode, totalValueNodeText); } } Vector vector = aggregateTreeCategory(rootNode, child, maxWidthAtLevel, level + 1); List barValueColorsThisBar = new ArrayList<>(); for (AnBarTree.BarNode barNode : vector) { List valueColorList = barNode.getBar().getValueColor(); for (ValueColor valueColor : valueColorList) { barValueColors.add(valueColor); barValueColorsThisBar.add(valueColor); } } barNodes.add( new BarNode( child, child.isSelected(), toolTipText, new Bar(barValueColorsThisBar, percent, compareBars), vector, maxWidthInPixels(maxWidthAtLevel), level + 1)); } } int percent = 0; CompareBarData[] compareBars = null; String toolTipText = null; if (node instanceof ValueMetricNode) { ValueMetricNode nodeValueMetricNode = (ValueMetricNode) node; if (nodeValueMetricNode.hasValues() && totalValueNode != null) { percent = nodeValueMetricNode.getValue(0).percentOf(totalValueNode); compareBars = getCompareValueColors(nodeValueMetricNode, totalValueNode); toolTipText = formatToolTip(nodeValueMetricNode, totalValueNode, totalValueNodeText); } } Bar cpuBar = new Bar(barValueColors, percent, compareBars); Vector cpuNode = new AnBarTree.BarNode( node, node.isSelected(), toolTipText, cpuBar, barNodes, maxWidthInPixels(maxWidthAtLevel), level); return cpuNode; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/BasicMetric.java0000644000175000017500000000304214744453367020445 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; public class BasicMetric { private final String name; // BaseMetric.cc:cmd (aux for hwcs) example: "datapagefault", not I18N private final String shortDescription; // BaseMetricTreeNode.cc: May be null. private final String displayName; // BaseMetric.cc:user_name "Data Page Fault" public BasicMetric(String name, String description, String displayName) { this.name = name; this.shortDescription = description; this.displayName = displayName; } public String getName() { return name; } public String getShortDescription() { // may return null return shortDescription; } public String getDisplayName() { return displayName; } @Override public BasicMetric clone() { BasicMetric clone = new BasicMetric(getName(), getShortDescription(), getDisplayName()); return clone; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricColors.java0000644000175000017500000000767514744453367020705 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import java.awt.Color; import java.util.HashMap; public class MetricColors { private static Color defaultSingle = new Color(145, 145, 145); private static Color defaultMissing = defaultSingle; public static final Color GREEN = new Color(95, 200, 48); public static final Color LIGHT_GREEN = new Color(0xcc, 0xff, 0x00); public static final Color GOLDEN_YELLOW = new Color(0xfd, 0xde, 0x00); public static final Color FUSCHIA = new Color(242, 0, 255); public static final Color PLUM = new Color(169, 19, 182); public static final Color BLUE_VIOLET = new Color(116, 1, 223); public static final Color ORANGE = new Color(0xff, 0x96, 0x09); public static final Color RED = new Color(255, 18, 0); public static final Color COBALT = new Color(0, 34, 255); public static final Color DARK_GREY = new Color(112, 119, 137); public static final Color CYAN = Color.CYAN; public static final Color BLUE = Color.BLUE; public static final Color GRAY = Color.GRAY; public static final Color BLACK = Color.BLACK; private static final HashMap colorHashMap = new HashMap(); static { // SOLARIS MICROSTATES colorHashMap.put("user".hashCode(), GREEN); colorHashMap.put("system".hashCode(), LIGHT_GREEN); colorHashMap.put("trap".hashCode(), GOLDEN_YELLOW); colorHashMap.put("datapfault".hashCode(), FUSCHIA); colorHashMap.put("textpfault".hashCode(), PLUM); colorHashMap.put("kernelpfault".hashCode(), BLUE_VIOLET); colorHashMap.put("stop".hashCode(), ORANGE); colorHashMap.put("wait".hashCode(), RED); colorHashMap.put("sleep".hashCode(), COBALT); colorHashMap.put("lock".hashCode(), DARK_GREY); // colorHashMap.put("totalcpu".hashCode(), colorHashMap.get("user".hashCode())); // TBR? colorHashMap.put("owait".hashCode(), colorHashMap.get("wait".hashCode())); // TBR? // DEAD_CODE? colorHashMap.put("readiobytes".hashCode(), new Color(219, 87, 100)); colorHashMap.put("writeiobytes".hashCode(), new Color(252, 88, 78)); // DEAD_CODE END colorHashMap.put("heapalloccnt".hashCode(), defaultSingle); colorHashMap.put("heapallocbytes".hashCode(), defaultSingle); colorHashMap.put("heapleakcnt".hashCode(), defaultSingle); colorHashMap.put("heapleakbytes".hashCode(), defaultSingle); } public static void setCustomMetricColor(String name, Color color) { if (name.equals("default")) { defaultSingle = color; defaultMissing = color; } else { colorHashMap.put(name.hashCode(), color); } } public static Color getColor(String name) { int hashCode = name.hashCode(); Color color = colorHashMap.get(hashCode); if (color == null) { // System.err.println("MetricsColors.getColor \'" + name + "\' not found in color // map!"); color = defaultMissing; } return color; } public static class MetricColor { private String metricName; private Color color; public MetricColor(String metricName, Color color) { this.metricName = metricName; this.color = color; } /** * @return the metricName */ public String getMetricName() { return metricName; } /** * @return the color */ public Color getColor() { return color; } } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricOption.java0000644000175000017500000000505614744453367020703 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnMetric; public class MetricOption { private final MetricAttr capable; // static capability private MetricAttr selected; // frontend sets these private final MetricAttr defaultAttrs; public MetricOption(MetricAttr capable, MetricAttr defaultValues) { this.capable = capable; this.selected = defaultValues.clone(); this.defaultAttrs = defaultValues; validateSelected(); } private void validateSelected() { int selectedBits = selected.getVisibleAttrs(); int allowedBits = selectedBits & capable.getVisibleAttrs(); if (selectedBits != allowedBits) { // illegal selected bits! // for time values, meaning of .er.rc dmetrics command's . and + symbols is swapped. if (capable.isTime() && selected.isValue()) { selected.setAttrs(allowedBits | AnMetric.VAL_TIMEVAL); // YXXX lame } else { selected.setAttrs(allowedBits); // unexpected, should bail out here? } } } /** * @return the capable */ public MetricAttr getCapable() { return capable; } /** * @return the selected */ public MetricAttr getSelected() { return selected; } /** * @param selected the selected to set */ public void setSelected(MetricAttr selected) { this.selected = selected; } /** * @return the selected */ public boolean hasSelections() { if (selected == null) { return false; } return selected.hasVisibleAttrs(); } /** * @return the userSavedValues */ public MetricAttr getDefaultAttrs() { return defaultAttrs; } public MetricOption clone() { MetricAttr capableClone = getCapable().clone(); // MetricAttr selectedClone = getSelected().clone(); MetricAttr defaultAttrsClone = defaultAttrs.clone(); MetricOption clone = new MetricOption(capableClone, defaultAttrsClone); return clone; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricAttr.java0000644000175000017500000000574314744453367020350 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnMetric; public class MetricAttr { // AKA DBE ValueStyle bitmask private int enabledAttrs; // bitmask, e.g. AnMetric.VAL_TIMEVAL public MetricAttr(boolean is_hidden, boolean time, boolean value, boolean percent) { setAttrs(is_hidden, time, value, percent); } public MetricAttr(int value_styles) { enabledAttrs = value_styles; } /** * @return set the enabledAttrs */ public void setAttrs(int value_styles) { enabledAttrs = value_styles; } public void setAttrs(boolean is_hidden, boolean time, boolean value, boolean percent) { enabledAttrs = 0; if (is_hidden) { enabledAttrs |= AnMetric.VAL_HIDE_ALL; } if (time) { enabledAttrs |= AnMetric.VAL_TIMEVAL; } if (value) { enabledAttrs |= AnMetric.VAL_VALUE; } if (percent) { enabledAttrs |= AnMetric.VAL_PERCENT; } } public void setTime(boolean time) { setAttrs(isHidden(), time, isValue(), isPercent()); } public void setValue(boolean value) { setAttrs(isHidden(), isTime(), value, isPercent()); } public void setPercent(boolean percent) { setAttrs(isHidden(), isTime(), isValue(), percent); } /** * @return the hidden */ public boolean isHidden() { boolean hidden = (enabledAttrs & AnMetric.VAL_HIDE_ALL) != 0; return hidden; } /** * @return the time */ public boolean isTime() { boolean time = (enabledAttrs & AnMetric.VAL_TIMEVAL) != 0; return time; } /** * @return the value */ public boolean isValue() { boolean value = (enabledAttrs & AnMetric.VAL_VALUE) != 0; return value; } /** * @return the percent */ public boolean isPercent() { boolean percent = (enabledAttrs & AnMetric.VAL_PERCENT) != 0; return percent; } /** * @return true if any Attrs enabled */ public boolean hasVisibleAttrs() { int visibleAttrs = getVisibleAttrs(); boolean enabled = (visibleAttrs != 0); return enabled; } /** * @return the enabledAttrs */ public int getVisibleAttrs() { if (isHidden()) { return AnMetric.VAL_NA; } int visibleAttrs = (enabledAttrs & ~AnMetric.VAL_HIDE_ALL); return visibleAttrs; } public MetricAttr clone() { MetricAttr clone = new MetricAttr(enabledAttrs); return clone; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricNode.java0000644000175000017500000001735215044710303020276 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import java.util.ArrayList; import java.util.List; public class MetricNode { public static final int ALL_LIST_ID = 0; public static final int IO_LIST_ID = 16; public static final int HEAP_LIST_ID = 43; public static final int DATASPACE_HWC_LIST_ID = 72; public enum MetricType { PLAIN_CATEGORY, PLAIN_LIST_CATEGORY, AGGREGATE_LIST_CATEGORY, PLAIN_TREE_CATEGORY, AGGREGATE_TREE_ROOT_CATEGORY, AGGREGATE_TREE_CATEGORY, PLAIN, PLAIN_ROOT, PLAIN_CHILD }; private final BasicMetric metricBasic; private MetricType metricType; private final List children; private boolean hiddenInOverview; // never show this in overview public MetricNode(BasicMetric metricBasic, MetricType metricType) { this.metricBasic = metricBasic; this.metricType = metricType; this.children = new ArrayList<>(); this.hiddenInOverview = false; } public void setHiddenInOverview(boolean hiddenInOverview) { this.hiddenInOverview = hiddenInOverview; } /** * @return the hiddenInOverview */ public boolean isHiddenInOverview() { return hiddenInOverview; } public void addChild(MetricNode metricNode) { children.add(metricNode); } public List getChildren() { return children; } public BasicMetric getMetricBasic() { return metricBasic; } public MetricType getMetricType() { return metricType; } public void setMetricType(MetricType metricType) { this.metricType = metricType; } public List findByName(String name) { List list = new ArrayList<>(); findByName(name, list); return list; } private void findByName(String name, List list) { if (getMetricBasic().getName() != null && getMetricBasic().getName().equals(name)) { list.add(this); } for (MetricNode child : getChildren()) { child.findByName(name, list); } } public void postProcessRoot() { // only call this on root! for (MetricNode child : getChildren()) { postProcess(child); } } private void postProcess(MetricNode node) { // System.out.println("MetricNode.postProcess " + node.getMetricType() + " " + // node.getMetricBasic().getName()); // HACK BEGIN: AGGREGATE_TREE_ROOT_CATEGORY has the wrong value. should have tsame value as // first AGGREGATE_TREE_CATEGORY if (node.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_ROOT_CATEGORY) { for (MetricNode child : node.getChildren()) { if (child.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_CATEGORY && child instanceof ValueMetricNode && ((ValueMetricNode) child).hasValues()) { double totalValue = ((ValueMetricNode) child).getValue(0).getDValue(); ((ValueMetricNode) node).getValue(0).setDValue(totalValue); } } } // HACK END // Insert child node in those AGGREGATE_TREE_CATEGORY that don't have children if (node.getMetricType() == MetricNode.MetricType.AGGREGATE_TREE_CATEGORY) { if (node.getChildren() == null || node.getChildren().isEmpty()) { if (node instanceof SelectableMetricNode) { // Add identical node as a MetricType.PLAIN child SelectableMetricNode selectableMetricNode = (SelectableMetricNode) node; BasicMetric basicMetricClone = node.getMetricBasic().clone(); MetricOption exclusiveClone = selectableMetricNode.getExclusive().clone(); MetricOption inclusiveClone = selectableMetricNode.getInclusive().clone(); SelectableMetricNode child = new SelectableMetricNode( basicMetricClone, MetricNode.MetricType.PLAIN, exclusiveClone, inclusiveClone, selectableMetricNode.getValueType()); node.addChild(child); // Set the same value List list = new ArrayList<>(); for (MetricValue metricValue : selectableMetricNode.getValues()) { MetricValue metricValueClone = metricValue.clone(); list.add(metricValueClone); } child.setValues(list); } } } // Transfer 'hot' to AnMetrics so others can know if (node instanceof SelectableMetricNode) { SelectableMetricNode smnode = (SelectableMetricNode) node; AnWindow.getInstance() .getSettings() .getMetricsSetting() .setHotMetric(smnode.getMetricBasic().getName(), smnode.isHot()); } // Look for HW Counter pairs pairs. They come in pairs like "tcycles"/"cycles". Mark them as // PLAIN_ROOT/PLAIN_CHILD. AnMetric[] availableMetrics = AnWindow.getInstance().getSettings().getMetricsSetting().getAvailableAnMetrics(); if (node.getMetricType() == MetricNode.MetricType.PLAIN_LIST_CATEGORY) { // FIXUP List children = node.getChildren(); for (int i = 0; i < children.size(); i++) { String name = children.get(i).getMetricBasic().getName(); AnMetric anMetric = AnWindow.getInstance().getSettings().getMetricsSetting().getAvailableAnMetric(name); if (anMetric != null) { String aux = anMetric.getAux(); if (aux != null && !name.equals(aux)) { for (int j = 0; j < children.size(); j++) { if (children.get(j).getMetricBasic().getName().equals(aux)) { children.get(i).setMetricType(MetricType.PLAIN_ROOT); children.get(j).setMetricType(MetricType.PLAIN_CHILD); break; } } } } // if (name.startsWith("t") && i < (children.size()-1) && // name.substring(1).equals(children.get(i+1).getMetricBasic().getName())) { // children.get(i).setMetricType(MetricType.PLAIN_ROOT); // children.get(i+1).setMetricType(MetricType.PLAIN_CHILD); // i++; // } } } for (MetricNode child : node.getChildren()) { postProcess(child); } } public boolean hasSelections() { boolean hasSelections = false; if (this instanceof SelectableMetricNode) { SelectableMetricNode selectableMetricNode = (SelectableMetricNode) this; hasSelections = selectableMetricNode.hasSelections(); } return hasSelections; } public boolean isSelected() { boolean selected = false; if (this instanceof SelectableMetricNode) { SelectableMetricNode selectableMetricNode = (SelectableMetricNode) this; selected = selectableMetricNode.isSelected(); } return selected; } public boolean isHot() { boolean isHot = false; if (this instanceof SelectableMetricNode) { ValueMetricNode valueMetricNode = (ValueMetricNode) this; List values = valueMetricNode.getValues(); for (MetricValue value : values) { if (value.getHighlight()) { isHot = true; break; } } } return isHot; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/IPCMetricsAPI.java0000644000175000017500000002614515044710303020541 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import java.util.ArrayList; import java.util.List; public class IPCMetricsAPI { public static boolean isJavaEnabled = false; public static boolean getJavaEnableIPC() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getJavaEnable"); // New ipc request! IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { // blocking // Things are fine isJavaEnabled = ipcResult.getBoolean(); return isJavaEnabled; } return false; } public static MetricNode getAllAvailableMetricsIPC(int dbevindex) { // Getting list of metrics from backend boolean include_unregistered_metrics = false; IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getRefMetricTree"); // New ipc request! ipcHandle.append(dbevindex); ipcHandle.append(include_unregistered_metrics); IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { // blocking // Things are fine Object[] data = (Object[]) ipcResult.getObject(); MetricNode nodeTree = parseRefMetricTreeIpcData(null, data, 0); return nodeTree; } return null; } private static MetricNode parseRefMetricTreeIpcData(String parentName, Object[] data, int level) { Object fields[] = (Object[]) data[0]; Object children[] = (Object[]) data[1]; String name = ((String[]) fields[0])[0]; String username = ((String[]) fields[1])[0]; String description = ((String[]) fields[2])[0]; int flavors = ((int[]) fields[3])[0]; // bitmask e.g. EXCLUSIVE int vtype = ((int[]) fields[4])[0]; // e.g.AnVariable:VT_INT int vstyles_capable = ((int[]) fields[5])[0]; // bitmask e.g.VAL_TIMEVAL int vstyles_e_default_values = ((int[]) fields[6])[0]; // excl defaults: VAL_TIME, etc. int vstyles_i_default_values = ((int[]) fields[7])[0]; // incl defaults: VAL_TIME, etc. boolean registered = ((boolean[]) fields[8])[0]; boolean aggregation = ((boolean[]) fields[9])[0]; boolean has_value = ((boolean[]) fields[10])[0]; String unit = ((String[]) fields[11])[0]; String unit_uname = ((String[]) fields[12])[0]; if (name != null && name.equals("name")) { // YXXX where should we put this special case? return null; } boolean is_total_time = false; // YXXX Yuck. where should we put Thomas' special case? if (name != null) { if (name.equals("total")) { is_total_time = true; } if (name.equals("totalcpu") && parentName != null && !parentName.equals( "total")) { // See 18378636 - Overview is insufficient to pick metrics for er_kernel // experiments is_total_time = true; } } boolean isHiddenInOverview = ((flavors & AnMetric.STATIC) != 0); if (name != null && name.equals("PROFDATA_TYPE_STATIC")) { isHiddenInOverview = true; } if (!isJavaEnabled && name != null && name.equals("PROFDATA_TYPE_GCDURATION")) { isHiddenInOverview = true; } boolean selectable = (vstyles_capable != 0) ? true : false; MetricNode.MetricType mtype; if (name == null) { // unnamed node mtype = MetricNode.MetricType.PLAIN_CATEGORY; } else if (aggregation) { mtype = MetricNode.MetricType.AGGREGATE_TREE_CATEGORY; } else if (children.length > 0) { mtype = MetricNode.MetricType.PLAIN_LIST_CATEGORY; } else { // System.out.println("=================== " + vtype + " " + name); mtype = MetricNode.MetricType.PLAIN; } BasicMetric basicMetric = new BasicMetric(name, description, username); MetricNode node; if (selectable) { MetricOption exclusive = new MetricOption( new MetricAttr(vstyles_capable), new MetricAttr(vstyles_e_default_values)); MetricOption inclusive = new MetricOption( new MetricAttr(vstyles_capable), new MetricAttr(vstyles_i_default_values)); node = new SelectableMetricNode(basicMetric, mtype, exclusive, inclusive, vtype); } else if (has_value) { node = new ValueMetricNode(basicMetric, mtype, unit, unit_uname); } else { node = new MetricNode(basicMetric, mtype); } node.setHiddenInOverview(isHiddenInOverview); // YXXX yuck: if is_total, insert a dummy "total thread time" node MetricNode parentNode = node; if (is_total_time && aggregation) { BasicMetric totalBMetric = new BasicMetric("YXXX_TOTAL_TIME_PLUS_THREADS", description, username); parentNode = new ValueMetricNode(totalBMetric, MetricNode.MetricType.AGGREGATE_TREE_ROOT_CATEGORY); parentNode.addChild(node); } // debug printing if (false) { for (int jj = 0; jj < level; jj++) { System.out.printf(" "); } System.out.printf( "%c L%d, %s, %s, %s\n", registered ? '*' : ' ', level, username, name, mtype); System.out.printf( "\taggregation=%d\thas_val=%d\tflavors=%d\t" + "vtype=%d\tviz_capable=%d\te_viz=%d\ti_viz=%d\n", aggregation ? 1 : 0, has_value ? 1 : 0, flavors, vtype, vstyles_capable, vstyles_e_default_values, vstyles_i_default_values); } for (int ii = 0; ii < children.length; ii++) { Object[] child_data = (Object[]) children[ii]; MetricNode child = parseRefMetricTreeIpcData(name, child_data, level + 1); if (child != null) { // child may decide it is invisible node.addChild(child); } } return parentNode; } public static boolean updateMetricValues(int dbevindex, List valueMetricList) { // System.out.println("updateMetricValues:"); // split into lists of nodes w/ metrics and nodes that just have values List selectableMetrics = new ArrayList<>(); List valueMetricsOnly = new ArrayList<>(); for (ValueMetricNode valueMetricNode : valueMetricList) { if (valueMetricNode instanceof SelectableMetricNode) { selectableMetrics.add((SelectableMetricNode) valueMetricNode); } else { valueMetricsOnly.add(valueMetricNode); } } boolean rc; rc = ipcGetRefMetricTreeValues(dbevindex, selectableMetrics, valueMetricsOnly); return rc; } private static boolean ipcGetRefMetricTreeValues( int dbevindex, List metlist, List nonmetlist) { if (metlist.isEmpty() && nonmetlist.isEmpty()) { return false; } String mcmds[] = new String[metlist.size()]; int ii = 0; for (SelectableMetricNode item : metlist) { String mcmd = item.getMetricBasic().getName(); mcmds[ii++] = mcmd; } String nmcmds[] = new String[nonmetlist.size()]; ii = 0; for (ValueMetricNode item : nonmetlist) { String mcmd = item.getMetricBasic().getName(); nmcmds[ii++] = mcmd; } IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getRefMetricTreeValues"); // New ipc request! ipcHandle.append(dbevindex); ipcHandle.append(mcmds); ipcHandle.append(nmcmds); IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { // blocking // Things are fine Object[] data = (Object[]) ipcResult.getObject(); return parseRefMetricValuesIpcData(data, metlist, nonmetlist); } else { int i = 0; // for breakpoint // error handling } return true; // YXXX not sure the meaning of this } private static boolean parseRefMetricValuesIpcData( final Object[] rawData, List metlist, List nonmetlist) { int nc = metlist.size() + nonmetlist.size(); // num columns (one for each value) Object[] valueColumns = (Object[]) rawData[0]; Object[] highlightColumns = (Object[]) rawData[1]; if (nc != valueColumns.length || nc != highlightColumns.length) { return true; // YXXX weird, broken } int metIndex = 0; int nonMetIndex = 0; for (int i = 0; i < nc; i++) { ValueMetricNode node; ArrayList mvlist = new ArrayList<>(); String label; if (i < metlist.size()) { node = metlist.get(metIndex++); label = node.getMetricBasic().getDisplayName(); } else { node = nonmetlist.get(nonMetIndex++); label = node.getMetricBasic().getDisplayName(); } String unit = null; if (node instanceof SelectableMetricNode) { MetricOption excl = ((SelectableMetricNode) node).getExclusive(); if (excl.getCapable().isTime()) { unit = AnLocale.getString("Seconds"); } } else if (node instanceof ValueMetricNode) { String vmunit = node.getUnit(); if (vmunit != null && vmunit.compareTo("SECONDS") == 0) { unit = AnLocale.getString("Seconds"); } } if (valueColumns[i] instanceof double[]) { double[] dd = (double[]) valueColumns[i]; for (int jj = 0; jj < dd.length; jj++) { mvlist.add(new MetricValue(label, dd[jj], MetricValue.ValueType.DOUBLE, unit)); } } else if (valueColumns[i] instanceof int[]) { int[] ii = (int[]) valueColumns[i]; for (int jj = 0; jj < ii.length; jj++) { mvlist.add(new MetricValue(label, ii[jj], MetricValue.ValueType.LONG, unit)); } } else if (valueColumns[i] instanceof long[]) { long[] ii = (long[]) valueColumns[i]; for (int jj = 0; jj < ii.length; jj++) { mvlist.add(new MetricValue(label, ii[jj], MetricValue.ValueType.LONG, unit)); } // May need to handle AnAddress here } else if (valueColumns[i] instanceof String[]) { String[] ii = (String[]) valueColumns[i]; for (int jj = 0; jj < ii.length; jj++) { mvlist.add(new MetricValue(ii[jj], MetricValue.ValueType.LABEL_ONLY)); } } else { int jj = 0; // happens if there are no experiments loaded } for (int jj = 0; jj < mvlist.size(); jj++) { boolean[] highlights = (boolean[]) highlightColumns[i]; MetricValue mv = mvlist.get(jj); boolean highlight = highlights[jj]; mv.setHighlight(highlight); } node.setValues(mvlist); } return false; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/MetricValue.java0000644000175000017500000001652614744453367020513 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import java.util.Formatter; public class MetricValue { public static final int PERCENT_NAN = Integer.MAX_VALUE; public enum ValueType { LONG, DOUBLE, LABEL_ONLY /* no value or unit */ }; private String label; // "I/O Bytes" private double dValue; // 12.345 private long lValue; // 12345 private final ValueType valueType; // LONG/DOUBLE private final String unit; // "MB" private boolean highlight; // Metric value is "hot" public MetricValue(String label, long lValue, ValueType valueType, String unit) { this.label = label; this.lValue = lValue; this.dValue = 0; this.valueType = valueType; this.unit = unit; if (valueType != ValueType.LONG) { System.err.println("MetricValue error: value doesn't match value type!"); } highlight = false; } public MetricValue(String label, double dValue, ValueType valueType, String unit) { this.label = label; this.lValue = 0; this.dValue = dValue; this.valueType = valueType; this.unit = unit; if (valueType != ValueType.DOUBLE) { System.err.println("MetricValue error: value doesn't match value type!"); } highlight = false; } public MetricValue(String label, ValueType valueType) { this.label = label; this.lValue = 0; this.dValue = 0; this.valueType = valueType; this.unit = null; if (valueType != ValueType.LABEL_ONLY) { System.err.println("MetricValue error: value doesn't match value type!"); } highlight = false; } public void setHighlight(boolean highlight) { this.highlight = highlight; } public boolean getHighlight() { return highlight; } public String getLabel() { return label; } public double getDValue() { return dValue; } public void setDValue(double value) { this.dValue = value; // Reformat label, if necessary // Hack. See 18378636 - Overview is insufficient to pick metrics for er_kernel experiments if (valueType == ValueType.LABEL_ONLY) { String valueString = new Formatter().format("%.3f", getDValue()).toString(); if (label != null && !label.startsWith(valueString)) { int spaceIndex = label.lastIndexOf(' '); if (spaceIndex > 0) { label = valueString + label.substring(spaceIndex); } } } } public long getLValue() { return lValue; } public void setLValue(long lValue) { this.lValue = lValue; } public ValueType getValueType() { return valueType; } public String getUnit() { return unit; } public String formatValue() { String value = ""; if (null != getValueType()) { switch (getValueType()) { case LONG: value = "" + getLValue(); break; case DOUBLE: value = new Formatter().format("%.3f", getDValue()).toString(); break; case LABEL_ONLY: value = ""; // nothing to add break; default: value = ""; assert false; // should not happen break; } } return value; } public String formatValueUnit() { String valueUnit = formatValue(); if (getUnit() != null) { valueUnit += " " + getUnit(); } return valueUnit; } public boolean gtZero() { if (null != getValueType()) { switch (getValueType()) { case DOUBLE: return getDValue() > 0; case LONG: return getLValue() > 0; case LABEL_ONLY: return false; default: System.err.println("MetricValue:percentOf() not handling type " + getValueType()); assert false; break; } } return false; } public boolean ltZero() { if (null != getValueType()) { switch (getValueType()) { case DOUBLE: return getDValue() < 0; case LONG: return getLValue() < 0; case LABEL_ONLY: return false; default: System.err.println("MetricValue:percentOf() not handling type " + getValueType()); assert false; break; } } return false; } public void subtract(MetricValue opNode) { if (null != getValueType()) { switch (getValueType()) { case DOUBLE: dValue -= opNode.getDValue(); break; case LONG: lValue -= opNode.getLValue(); break; case LABEL_ONLY: break; default: System.err.println("MetricValue:percentOf() not handling type " + getValueType()); assert false; break; } } } public int percentOf(MetricValue totalValueNode) { int percent = 0; if (null != getValueType()) { switch (getValueType()) { case DOUBLE: { double totalValue = totalValueNode.getDValue(); double childValue = getDValue(); if (totalValue == 0) { if (childValue == 0) { percent = 0; } else { percent = PERCENT_NAN; } } else { percent = (int) ((childValue * 100) / totalValue + 0.5f); // YXXX Thomas, comment on why add 0.5 to a double? } break; } case LONG: { long totalValue = totalValueNode.getLValue(); long childValue = getLValue(); if (totalValue == 0) { if (childValue == 0) { percent = 0; } else { percent = PERCENT_NAN; } } else { percent = (int) ((childValue * 100) / totalValue + 0.5f); // YXXX don't you want to convert to double before division? } break; } case LABEL_ONLY: percent = PERCENT_NAN; break; default: System.err.println("MetricValue:percentOf() not handling type " + getValueType()); assert false; break; } } return percent; } public MetricValue clone() { MetricValue clone = null; if (null != getValueType()) { switch (getValueType()) { case DOUBLE: clone = new MetricValue(getLabel(), getDValue(), getValueType(), getUnit()); break; case LONG: clone = new MetricValue(getLabel(), getLValue(), getValueType(), getUnit()); break; case LABEL_ONLY: clone = new MetricValue(getLabel(), getValueType()); break; default: System.err.println("MetricValue:clone() error"); assert false; break; } } return clone; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/SelectableMetricNode.java0000644000175000017500000001501715044710303022256 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.AnWindow; import java.util.ArrayList; import java.util.List; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class SelectableMetricNode extends ValueMetricNode { private final MetricOption exclusive; // presentation's exclusive checkboxes private final MetricOption inclusive; // presentation's inclusive checkboxes private final int valueType; // YXXX placeholder. For now, AnVariable.VT_INT, etc. private List changeListeners = new ArrayList<>(); public SelectableMetricNode( BasicMetric metricBasic, MetricType metricsGroupType, MetricOption exclusive, MetricOption inclusive, int valueType) { super(metricBasic, metricsGroupType); this.exclusive = exclusive; this.inclusive = inclusive; this.valueType = valueType; } /** * @return the exclusive */ public MetricOption getExclusive() { return exclusive; } /** * @return the inclusive */ public MetricOption getInclusive() { return inclusive; } /** * @return the hasSelections */ @Override public boolean hasSelections() { boolean exclIsSelected = exclusive != null ? exclusive.hasSelections() : false; boolean inclIsSelected = inclusive != null ? inclusive.hasSelections() : false; return exclIsSelected || inclIsSelected; } /** * @return true if selected */ @Override public boolean isSelected() { boolean selected = AnWindow.getInstance() .getSettings() .getMetricsSetting() .isSelected(getMetricBasic().getName()); return selected; } public int getValueType() { return valueType; } private boolean[] internalSetSelected(boolean detailsCheckBox, boolean forceDefaults) { // System.out.println("setSelected:" + selected + " " + apply + " " + detailsCheckBox); // dumpAttr(this); // AnWindow anWindow = AnWindow.getInstance(); boolean eT = exclusive.getCapable().isTime() && exclusive.getSelected().isTime(); boolean eV = exclusive.getCapable().isValue() && exclusive.getSelected().isValue(); boolean eP = exclusive.getCapable().isPercent() && exclusive.getSelected().isPercent(); boolean iT = inclusive.getCapable().isTime() && inclusive.getSelected().isTime(); boolean iV = inclusive.getCapable().isValue() && inclusive.getSelected().isValue(); boolean iP = inclusive.getCapable().isPercent() && inclusive.getSelected().isPercent(); if (!detailsCheckBox) { if (forceDefaults || !(eT || eV || eP || iT || iV || iP)) { // nothing selected, fall back to saved defaults eT = exclusive.getCapable().isTime() && exclusive.getDefaultAttrs().isTime(); eV = exclusive.getCapable().isValue() && exclusive.getDefaultAttrs().isValue(); eP = exclusive.getCapable().isPercent() && exclusive.getDefaultAttrs().isPercent(); iT = inclusive.getCapable().isTime() && inclusive.getDefaultAttrs().isTime(); iV = inclusive.getCapable().isValue() && inclusive.getDefaultAttrs().isValue(); iP = inclusive.getCapable().isPercent() && inclusive.getDefaultAttrs().isPercent(); } if (!(eT || eV || eP || iT || iV || iP)) { // still nothing, select something using heuristics eT = exclusive.getCapable().isTime(); if (!eT) { eV = exclusive.getCapable().isValue(); } if (!eT && !eV) { eP = exclusive.getCapable().isPercent(); } // iT = inclusive.getCapable().isTime(); // if (!iT) { // iV = inclusive.getCapable().isValue(); // } } } // Save the changes exclusive.getSelected().setAttrs(false, eT, eV, eP); inclusive.getSelected().setAttrs(false, iT, iV, iP); boolean[] exclusiveIncluseValues = new boolean[] {eT, eV, eP, iT, iV, iP}; return exclusiveIncluseValues; } public boolean[] setSelected(boolean selected, boolean detailsCheckBox) { return internalSetSelected(detailsCheckBox, false); } public boolean[] setDefaults() { return internalSetSelected(false, true); } public void addChangeListener(ChangeListener changeListener) { changeListeners.add(changeListener); } public void removeChangeListener(ChangeListener changeListener) { changeListeners.remove(changeListener); } public void fireChange() { for (ChangeListener changeListener : changeListeners) { ChangeEvent changeEvent = new ChangeEvent(this); changeListener.stateChanged(changeEvent); } } private static void dumpAttr(SelectableMetricNode selectableMetricNode) { System.err.println( selectableMetricNode.getMetricBasic().getDisplayName() + " - " + selectableMetricNode.getMetricBasic().getDisplayName()); System.err.println(" Exclusive Inclusive"); System.err.println(" Time Value % Time Value % "); dumpAttr( "Sel", selectableMetricNode.getExclusive().getSelected(), selectableMetricNode.getInclusive().getSelected()); dumpAttr( "Cap", selectableMetricNode.getExclusive().getCapable(), selectableMetricNode.getInclusive().getCapable()); } private static void dumpAttr(String what, MetricAttr exEtricAttr, MetricAttr inEtricAttr) { System.err.print(what); System.err.print(" " + dumpAttr(exEtricAttr.isTime())); System.err.print(" " + dumpAttr(exEtricAttr.isValue())); System.err.print(" " + dumpAttr(exEtricAttr.isPercent())); System.err.print(" "); System.err.print(" " + dumpAttr(inEtricAttr.isTime())); System.err.print(" " + dumpAttr(inEtricAttr.isValue())); System.err.print(" " + dumpAttr(inEtricAttr.isPercent())); System.err.println(); } private static String dumpAttr(boolean b) { return b ? "x" : " "; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/ValueMetricNode.java0000644000175000017500000000373115044710303021267 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import java.util.ArrayList; import java.util.List; public class ValueMetricNode extends MetricNode { private List values; private String unit; private String unit_uname; public ValueMetricNode( BasicMetric metricBasic, MetricType metricsGroupType, String unit, String unit_uname) { super(metricBasic, metricsGroupType); this.values = new ArrayList<>(); this.unit = unit; this.unit_uname = unit_uname; } public ValueMetricNode(BasicMetric metricBasic, MetricType metricsGroupType) { super(metricBasic, metricsGroupType); this.values = new ArrayList<>(); this.unit = null; this.unit_uname = null; } public String getUnit() { return unit; } public String getUnitUname() { return unit_uname; } /** * @return the value */ public MetricValue getValue(int no) { if (no < values.size()) { return values.get(no); } else { return null; } } /** * @return whether it has the value set */ public boolean hasValues() { return !values.isEmpty(); } /** * @return the value */ public List getValues() { return values; } /** * @param value the value to set */ public void setValues(List values) { this.values = values; } } gprofng-gui-2.1/org/gprofng/mpmt/metrics/CompareBarData.java0000644000175000017500000000237214744453367021072 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.metrics; import org.gprofng.mpmt.overview.Bar.ValueColor; import java.util.List; /** * @author tpreisle */ public class CompareBarData { private int percentOfTotal; // private List valueColors; public CompareBarData(int percent, List valueColors) { this.percentOfTotal = percent; this.valueColors = valueColors; } /** * @return the percent */ public int getPercentOfTotal() { return percentOfTotal; } /** * @return the valueColors */ public List getValueColors() { return valueColors; } } gprofng-gui-2.1/org/gprofng/mpmt/DisassemblyView.java0000644000175000017500000001114314744453367017725 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; public final class DisassemblyView extends AnCompDisp implements AnChangeListener { public DisassemblyView() { super(AnWindow.getInstance(), AnDisplay.DSP_Disassembly, AnVariable.HELP_TabsDisassembly); setAccessibility(AnLocale.getString("Disassembly")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("DisassemblyView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: setComputed(false); clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: addExperiment(); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: if (selected) { filterChanged(); } setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case SOURCE_FINDING_CHANGING: setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SRC_DIS || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SEARCH_PATH || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.PATH_MAP || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { setComputed(false); if (oneDispPanel != null) { oneDispPanel.forceCompute = true; // ?????? } if (selected) { computeOnAWorkerThread(); } } break; case SELECTED_OBJECT_CHANGED: if (selected) { computeOnAWorkerThread(); } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void setComputed(boolean set) { super.setComputed(set); AnWindow.getInstance().getCalledByCallsDisassemblyView().setComputed(set); } @Override protected void setAvailable(boolean set) { super.setAvailable(set); AnWindow.getInstance().getCalledByCallsDisassemblyView().setAvailable(set); } } gprofng-gui-2.1/org/gprofng/mpmt/export/0000755000175000017500000000000015044723235015335 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/export/ExportPanel.form0000644000175000017500000003100714744453367020420 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/export/ExportDialog.java0000644000175000017500000000371414744453367020542 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.export; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; public class ExportDialog extends AnDialog2 { private final ExportPanel exportPanel; public ExportDialog(Frame owner, ExportSupport exportSupport) { super(owner, owner, AnLocale.getString("Export")); exportPanel = new ExportPanel(this, exportSupport); setCustomPanel(exportPanel); setHelpTag(AnVariable.HELP_Export); getOKButton().setText(AnLocale.getString("Export")); // getOKButton().setMnemonic(AnLocale.getString('E', "EXPORT_DIALOG_SAVE_MN")); ); getOKButton().setToolTipText(AnLocale.getString("Save the file")); } public String getOutputFilePath() { return exportPanel.getOutputFilePath(); } public ExportSupport.ExportFormat getExportFormat() { return exportPanel.getExportFormat(); } public Character getDelimiter() { return exportPanel.getDelimiter(); } public Integer getLimit() { return exportPanel.getLimit(); } public Boolean getIncludeSubviews() { return exportPanel.getIncludeSubviews(); } @Override protected void setStatus(Status status) { super.setStatus(status); if (status == Status.OK) { exportPanel.saveStates(); } } } gprofng-gui-2.1/org/gprofng/mpmt/export/Export.java0000644000175000017500000001351115044710303017372 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.export; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.export.ExportSupport.ExportFormat; import java.awt.Component; import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.imageio.ImageIO; public class Export { public static void exportText(String text, String outputFilePath) { printTextToFile(text, outputFilePath); } public static void exportImage(Component component, String outputFilePath) { printImageToFile(component, outputFilePath); } // ---------------------------------------------------------------------------------------------------- // private static AnWindow getAnWindow() { // return (AnWindow) Analyzer.getInstance().win_list.get(0); // } // Print display private static void printTextToFile(String textImage, String file) { if (file == null || file.equals("")) { // Print to standard output System.out.println(textImage); } else { File of = null; try { of = new File(file); // Write to temp file BufferedWriter bw = new BufferedWriter(new FileWriter(of)); bw.write(textImage); bw.close(); } catch (IOException e) { String s = "analyzer: error: cannot write to file " + of.getAbsolutePath(); // FIXUP } } } private static String printImageToFile(Component display, String file) { String s = null; if (display == null) { return null; } if (file != null) { if (file.equals("")) { s = "Please, specify file name (recommended suffix .jpg)"; return s; } else { File of = null; try { of = new File(file); // Capture image to output file captureComponentToJpeg(display, of); } catch (IOException e) { s = "analyzer: error: cannot write to file " + of.getAbsolutePath(); return s; } } } return null; } private static void captureComponentToJpeg(Component c, File destFile) throws IOException { BufferedImage image = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_RGB); c.paint(image.createGraphics()); ImageIO.write(image, "JPEG", destFile); } private static ExportFormat getFormat() { ExportFormat format = null; int printMode = getPrintMode(); if (printMode == 0) { format = ExportFormat.TEXT; } else if (printMode == 1) { format = ExportFormat.HTML; } else if (printMode == 2) { format = ExportFormat.CSV; } else { assert true; } return format; } public static void setFormat(ExportFormat format, Character delimiter) { String printMode = null; if (format == ExportFormat.TEXT) { printMode = "text"; } else if (format == ExportFormat.HTML) { printMode = "html"; } else if (format == ExportFormat.CSV) { printMode = "" + delimiter; } else { assert true; } setPrintMode(printMode); } private static Integer getLimit() { Integer limit = null; int lim = getPrintLimit(); if (lim != 0) { limit = lim; } return limit; } public static void setLimit(Integer limit) { int lim = 0; if (limit != null) { lim = limit.intValue(); } setPrintLimit(lim); } private String getDelimiter() { return getPrintDelim(); } public static String printData( final int type, final int subtype, final String printer, final String file) { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("printData"); window.IPC().send(0); window.IPC().send(type); window.IPC().send(subtype); window.IPC().send(printer); window.IPC().send(file); return window.IPC().recvString(); } } private static int getPrintLimit() { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("getPrintLimit"); window.IPC().send(0); return window.IPC().recvInt(); } } private static String setPrintLimit(int limit) { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("setPrintLimit"); window.IPC().send(0); window.IPC().send(limit); return window.IPC().recvString(); } } private static String setPrintMode(final String m) { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("setPrintMode"); window.IPC().send(0); window.IPC().send(m); return window.IPC().recvString(); } } private static int getPrintMode() { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("getPrintMode"); window.IPC().send(0); return window.IPC().recvInt(); } } private static String getPrintDelim() { AnWindow window = AnWindow.getInstance(); synchronized (IPC.lock) { window.IPC().send("getPrintDelim"); window.IPC().send(0); String s = window.IPC().recvString(); if (s == null) { return ","; } return s; } } } gprofng-gui-2.1/org/gprofng/mpmt/export/ExportPanel.java0000644000175000017500000005373415044710303020365 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.export; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.export.ExportSupport.ExportFormat; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.List; import javax.swing.JFileChooser; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; /** * @author tpreisle */ public class ExportPanel extends javax.swing.JPanel { private static final Color errorColor = Color.red; private static final Color warningColor = new Color(255, 150, 0); private ExportDialog exportDialog; private JFileChooser fileChooser; private ExportSupport exportSupport; private static Integer limitSaved = null; private static ExportFormat formatSaved = null; private static File directorySaved = null; private static String fileNameSaved = "output"; private static Character delimiterSaved = ','; private static Boolean includeSubviews = false; /** Creates new form ExportPanel */ public ExportPanel(ExportDialog exportDialog, ExportSupport exportSupport) { setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); this.exportDialog = exportDialog; this.exportSupport = exportSupport; List formats = exportSupport.getSupportedExportFormats(); initComponents(); infoScrollPane.setBorder(null); // infoTextArea.setOpaque(false); infoTextArea.setEditable(false); infoTextArea.setRows(1); infoTextArea.setWrapStyleWord(true); infoTextArea.setLineWrap(true); infoTextArea.setText( AnLocale.getString( "Save the data shown in the current view to a file of the specified format.")); infoTextArea.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setAccessibleContext( infoTextArea.getAccessibleContext(), AnLocale.getString("Info area")); // fileBrowseButton.setIcon(AnUtility.brws_icon); // fileBrowseButton.setToolTipText(AnLocale.getString("Browse for file")); // ToolBarButton.setBehaviour(fileBrowseButton); // errorLabel.setFont(exportDialog.getDialogFont()); // fileBrowseButton.setFont(exportDialog.getDialogFont()); // dirLabel.setFont(exportDialog.getDialogFont()); // dirTextFeild.setFont(exportDialog.getDialogFont()); // formatComboBox.setFont(exportDialog.getDialogFont()); // delimiterLabel.setFont(exportDialog.getDialogFont()); // delimiterTextField.setFont(exportDialog.getDialogFont()); // formatLabel.setFont(exportDialog.getDialogFont()); // limitLabel.setFont(exportDialog.getDialogFont()); // limitTextField.setFont(exportDialog.getDialogFont()); // pathLabelExt.setFont(exportDialog.getDialogFont()); pathLabelExt.setForeground(new Color(150, 150, 150)); nameLabel.setText(AnLocale.getString("File Name:")); String outputFileTT = AnLocale.getString("Name of output file"); nameLabel.setToolTipText(outputFileTT); nameTextField.setToolTipText(outputFileTT); nameLabel.setDisplayedMnemonic(AnLocale.getString('F', "ExportFileNameLabelMnemonic")); nameLabel.setLabelFor(nameTextField); nameTextField.setToolTipText(outputFileTT); dirLabel.setText(AnLocale.getString("Directory:")); dirLabel.setDisplayedMnemonic(AnLocale.getString('D', "ExportDirectoryLabelMemonic")); dirLabel.setLabelFor(dirTextField); String dirTT = AnLocale.getString("Directory where to store output file"); dirLabel.setToolTipText(dirTT); dirTextField.setToolTipText(dirTT); dirBrowseButton.setToolTipText(AnLocale.getString("Browse for Directory (ALT B)")); dirBrowseButton.setMnemonic(AnLocale.getString('B', "ExportBrowseButtonMnemonic")); formatLabel.setText(AnLocale.getString("Export as:")); formatLabel.setDisplayedMnemonic(AnLocale.getString('X', "ExportFormatLabelMnemonic")); formatLabel.setLabelFor(formatComboBox); String formatTT = AnLocale.getString("Format of the exported data or image"); formatLabel.setToolTipText(formatTT); formatComboBox.setToolTipText(formatTT); subviewsCheckBox.setText(AnLocale.getString("Include subviews")); subviewsCheckBox.setMnemonic(AnLocale.getString('I', "ExportIncludeSubviewsMnemonic")); subviewsCheckBox.setSelected(includeSubviews); limitLabel.setText(AnLocale.getString("Maximum:")); String limitTT = AnLocale.getString("Number of lines to export beginning from the top of the data display"); limitLabel.setToolTipText(limitTT); limitTextField.setToolTipText(limitTT); formatComboBox.removeAllItems(); for (ExportFormat format : formats) { formatComboBox.addItem(format); } delimiterLabel.setText(AnLocale.getString("Delimiter:")); String delimiterTT = AnLocale.getString("Character used to separate values"); delimiterLabel.setToolTipText(delimiterTT); delimiterTextField.setToolTipText(delimiterTT); delimiterTextField.setHorizontalAlignment(JTextField.CENTER); if (delimiterSaved != null) { delimiterTextField.setText("" + delimiterSaved); } else { delimiterTextField.setText("" + ','); } // Restore saved states if (limitSaved == null) { limitTextField.setText(""); } else { limitTextField.setText("" + limitSaved.intValue()); } if (formatSaved != null) { for (int i = 0; i < formatComboBox.getItemCount(); i++) { if (formatComboBox.getItemAt(i) == formatSaved) { formatComboBox.setSelectedIndex(i); break; } } } if (directorySaved == null) { directorySaved = new File(Analyzer.getInstance().getWorkingDirectory()); } dirTextField.setText(directorySaved.getAbsolutePath()); String defaultName = fileNameSaved; nameTextField.setText(defaultName); if (getFilePathWithExtension().exists()) { for (int i = 1; i < 999; i++) { nameTextField.setText(defaultName + "_" + i); if (!getFilePathWithExtension().exists()) { break; } } } validateInput(); nameTextField.getDocument().addDocumentListener(new DocListener()); dirTextField.getDocument().addDocumentListener(new DocListener()); delimiterTextField.getDocument().addDocumentListener(new DocListener()); limitTextField.getDocument().addDocumentListener(new DocListener()); dirBrowseButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browse(); } }); formatComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { validateInput(); } }); } class DocListener implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) { validateInput(); } @Override public void insertUpdate(DocumentEvent e) { validateInput(); } @Override public void removeUpdate(DocumentEvent e) { validateInput(); } } private void browse() { fileChooser = new JFileChooser(); File fp = getFilePathWithExtension(); fileChooser.setCurrentDirectory(fp.getParentFile()); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { File selFile = fileChooser.getSelectedFile(); if (selFile.isDirectory()) { dirTextField.setText(selFile.getAbsolutePath()); } else { nameTextField.setText(selFile.getName()); dirTextField.setText(selFile.getParentFile().getAbsolutePath()); } } validateInput(); } private File getFilePathWithExtension() { String fileName = nameTextField.getText(); String dirName = dirTextField.getText(); String filePath = dirName + "/" + fileName; String ext = null; String newExt = null; int i = fileName.lastIndexOf('.'); if (i >= 0 && i < (fileName.length() - 1)) { ext = fileName.substring(i + 1); } if (ext == null || ext.length() == 0) { ExportFormat format = (ExportFormat) formatComboBox.getSelectedItem(); if (format == ExportFormat.CSV) { newExt = "csv"; } else if (format == ExportFormat.HTML) { newExt = "html"; } else if (format == ExportFormat.JPG) { newExt = "jpg"; } else if (format == ExportFormat.TEXT) { newExt = "txt"; } else { assert true; } } if (ext != null && ext.length() > 0) { // } else if (filePath.endsWith(".")) { filePath = filePath + newExt; } else { filePath = filePath + "." + newExt; } return new File(filePath); } public Character getDelimiter() { Character delim = ','; String delimText = delimiterTextField.getText(); if (delimText.length() == 1) { delim = delimText.charAt(0); } if (delimText.length() >= 2) { delim = null; } return delim; } private Integer getLineLimit() throws NumberFormatException { String limit = limitTextField.getText(); if (limit.length() == 0) { return null; } return Integer.valueOf(limit); } private void validateInput() { ExportFormat format = (ExportFormat) formatComboBox.getSelectedItem(); List subviews = AnWindow.getInstance().getViews().getCurrentViewDisplay().getVisibleSubviews(); if (format == ExportFormat.JPG && subviews.size() > 0) { subviewsCheckBox.setVisible(true); } else { subviewsCheckBox.setVisible(false); } if (format == ExportFormat.JPG || !exportSupport.exportLimitSupported()) { if (limitLabel.isVisible()) { limitLabel.setVisible(false); limitTextField.setVisible(false); } } else { if (!limitLabel.isVisible()) { limitLabel.setVisible(true); limitTextField.setVisible(true); } } if (format == ExportFormat.CSV) { if (!delimiterLabel.isVisible()) { delimiterLabel.setVisible(true); delimiterTextField.setVisible(true); } } else { if (delimiterLabel.isVisible()) { delimiterLabel.setVisible(false); delimiterTextField.setVisible(false); } } AnUtility.setTextAndAccessibleContext(pathLabelExt, AnLocale.getString("Path used: ")); errorLabel.setText(" "); exportDialog.getOKButton().setEnabled(true); String outputFileName = nameTextField.getText(); if (outputFileName.length() == 0) { updateError(AnLocale.getString("File name missing")); return; } File fullPathFile = getFilePathWithExtension(); if (fullPathFile.exists() && fullPathFile.isDirectory()) { updateError(AnLocale.getString("File name missing")); return; } File outputFileParent = fullPathFile.getParentFile(); if (outputFileParent != null && !outputFileParent.exists()) { updateError(AnLocale.getString("Folder doesn't exist")); return; } pathLabelExt.setText(AnLocale.getString("Path used: ") + fullPathFile.getAbsolutePath()); if (fullPathFile.exists()) { updateWarning(AnLocale.getString("File name already exists")); } if (format == ExportFormat.CSV) { Character delim = getDelimiter(); if (delim == null) { updateError("Invalid delimiter character"); return; } } exportDialog.pack(); Integer limit = null; if (limitTextField.isVisible()) { try { limit = getLineLimit(); } catch (NumberFormatException nfe) { updateError(AnLocale.getString("Max Lines is not a valid number")); return; } } if (limit != null && limit <= 0) { updateError(AnLocale.getString("Max Lines should be empty or greater than 0")); return; } } private void updateWarning(String warningText) { errorLabel.setForeground(warningColor); errorLabel.setText(AnLocale.getString("Warning: ") + warningText); } private void updateError(String errorText) { errorLabel.setForeground(errorColor); errorLabel.setText(AnLocale.getString("Error: ") + errorText); exportDialog.getOKButton().setEnabled(false); } public String getOutputFilePath() { return getFilePathWithExtension().getAbsolutePath(); } public ExportSupport.ExportFormat getExportFormat() { return (ExportFormat) formatComboBox.getSelectedItem(); } public Integer getLimit() { return getLineLimit(); } public Boolean getIncludeSubviews() { return subviewsCheckBox.isSelected(); } protected void saveStates() { ExportFormat format = (ExportFormat) formatComboBox.getSelectedItem(); formatSaved = getExportFormat(); if (format != ExportFormat.JPG) { limitSaved = getLimit(); } if (format == ExportFormat.JPG) { includeSubviews = getIncludeSubviews(); } File outputFile = getFilePathWithExtension(); directorySaved = outputFile.getParentFile(); fileNameSaved = nameTextField.getText(); fileNameSaved = fileNameSaved.replaceAll("\\..*$", ""); fileNameSaved = fileNameSaved.replaceAll("_\\d*$", ""); if (format == ExportFormat.CSV) { delimiterSaved = getDelimiter(); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoScrollPane = new javax.swing.JScrollPane(); infoTextArea = new javax.swing.JTextArea(); nameLabel = new javax.swing.JLabel(); nameTextField = new javax.swing.JTextField(); dirLabel = new javax.swing.JLabel(); dirTextField = new javax.swing.JTextField(); dirBrowseButton = new javax.swing.JButton(); formatLabel = new javax.swing.JLabel(); formatComboBox = new javax.swing.JComboBox(); delimiterLabel = new javax.swing.JLabel(); delimiterTextField = new javax.swing.JTextField(); subviewsCheckBox = new javax.swing.JCheckBox(); limitLabel = new javax.swing.JLabel(); limitTextField = new javax.swing.JTextField(); errorLabel = new javax.swing.JLabel(); pathLabelExt = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); infoTextArea.setColumns(20); infoTextArea.setRows(5); infoScrollPane.setViewportView(infoTextArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; add(infoScrollPane, gridBagConstraints); nameLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(nameLabel, gridBagConstraints); nameTextField.setColumns(20); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(nameTextField, gridBagConstraints); dirLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(dirLabel, gridBagConstraints); dirTextField.setColumns(60); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(dirTextField, gridBagConstraints); dirBrowseButton.setText("..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(dirBrowseButton, gridBagConstraints); formatLabel.setText("jLabel2"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(formatLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(formatComboBox, gridBagConstraints); delimiterLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(10, 8, 0, 0); add(delimiterLabel, gridBagConstraints); delimiterTextField.setColumns(2); delimiterTextField.setText(","); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(delimiterTextField, gridBagConstraints); subviewsCheckBox.setText("jCheckBox1"); subviewsCheckBox.setOpaque(false); subviewsCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { subviewsCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(10, 8, 0, 0); add(subviewsCheckBox, gridBagConstraints); limitLabel.setText("jLabel3"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(limitLabel, gridBagConstraints); limitTextField.setColumns(10); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 4, 0, 0); add(limitTextField, gridBagConstraints); errorLabel.setForeground(new java.awt.Color(255, 0, 51)); errorLabel.setText("error"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(errorLabel, gridBagConstraints); pathLabelExt.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(pathLabelExt, gridBagConstraints); } // //GEN-END:initComponents private void subviewsCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_subviewsCheckBoxActionPerformed // TODO add your handling code here: } // GEN-LAST:event_subviewsCheckBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel delimiterLabel; private javax.swing.JTextField delimiterTextField; private javax.swing.JButton dirBrowseButton; private javax.swing.JLabel dirLabel; private javax.swing.JTextField dirTextField; private javax.swing.JLabel errorLabel; private javax.swing.JComboBox formatComboBox; private javax.swing.JLabel formatLabel; private javax.swing.JScrollPane infoScrollPane; private javax.swing.JTextArea infoTextArea; private javax.swing.JLabel limitLabel; private javax.swing.JTextField limitTextField; private javax.swing.JLabel nameLabel; private javax.swing.JTextField nameTextField; private javax.swing.JLabel pathLabelExt; private javax.swing.JCheckBox subviewsCheckBox; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/export/ExportSupport.java0000644000175000017500000000262114744453367021013 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.export; import java.util.List; public interface ExportSupport { public enum ExportFormat { TEXT("Text (.txt)"), HTML("HTML (.html)"), CSV("CSV (.csv)"), JPG("JPEG (.jpg)"); private String name; private ExportFormat(String name) { this.name = name; } @Override public String toString() { return name; } } /** * @return list of supported export formats */ public List getSupportedExportFormats(); /** * Whether or not if this view supports limit * * @return true if limit is supported */ public boolean exportLimitSupported(); public String exportAsText(Integer limit, ExportSupport.ExportFormat format, Character delimiter); } gprofng-gui-2.1/org/gprofng/mpmt/progress/0000755000175000017500000000000015044723235015660 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/progress/CancelContext.java0000644000175000017500000000216614744453367021216 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; public class CancelContext { private String taskName; private Cancellable cancellable; public CancelContext(String taskName, Cancellable cancellable) { this.taskName = taskName; this.cancellable = cancellable; } /** * @return the cancellable */ public Cancellable getCancellable() { return cancellable; } /** * @return the taskName */ public String getTaskName() { return taskName; } } gprofng-gui-2.1/org/gprofng/mpmt/progress/SystemProgressPanel.java0000644000175000017500000001133614744453367022454 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.Stack; public class SystemProgressPanel extends ProgressPanel { private ProgressHandle progressHandle; private class Task { private String name; public Task(String name) { this.name = name; } public String getName() { return name; } } private Stack progressBars = new Stack(); public SystemProgressPanel() { super(); progressHandle = createHandle(); } public void reset() { finishProgress(); setProgressCancelContext(null); progressBars = new Stack(); } public synchronized Object progressBarStart(String taskName) { // IPCContext.newCurrentContext("Unknown task...", IPCContext.Scope.SESSION, this); <=== // FIXUP: need real name of task like "Opening Experiment..." if (progressBars.empty()) { startProgress(); } progressHandle.progress(taskName); Task task = new Task(taskName); progressBars.push(task); // System.out.println("SystemProgresspanel start: " + progressBars.size() + " " + // progressBars.peek().getName()); return task; } public synchronized void progressBarStop(Object id) { if (progressBars.empty()) { AnLog.log( "error: SystemProgresspanel:progressBarStop: progressBars is empty!. See bug 19598982"); return; } boolean didIt = progressBars.remove(id); if (!didIt) { AnLog.log( "error: SystemProgresspanel:progressBarStop: can't find id " + ((Task) id).getName()); } if (progressBars.empty()) { finishProgress(); // <=== FIXUP: should be done in IPCResult setProgressCancelContext(null); // <=== FIXUP: should be done in IPCResult } else { String taskName = progressBars.peek().getName(); progressHandle.progress(taskName); } // System.out.println("SystemProgresspanel stop : " + progressBars.size() + " " + // (progressBars.size() > 0 ? progressBars.peek().getName() : "-")); } private void startProgress() { AnUtility.invokeLaterOnSwingThread( new Runnable() { @Override public void run() { startProgressImpl(); } }); } private void startProgressImpl() { if (progressHandle == null) { return; } progressHandle.switchToIndeterminate(); progressHandle.start(); } public CancelContext getProgressCancelContext() { if (progressHandle == null) { return null; } else { return progressHandle.getCancelContext(); } } public void setProgressCancelContext(final CancelContext cancelContex) { AnUtility.invokeLaterOnSwingThread( new Runnable() { @Override public void run() { setProgressCancelContextImpl(cancelContex); // / } }); } private void setProgressCancelContextImpl(CancelContext cancelContex) { if (progressHandle == null) { return; } progressHandle.setCancelContext(cancelContex); } public void setProgress(final int percentage, final String proc_str) { AnUtility.invokeLaterOnSwingThread( new Runnable() { @Override public void run() { setProgressImpl(percentage, proc_str); } }); } private void setProgressImpl(final int percentage, final String proc_str) { if (progressHandle == null) { return; } if (percentage > 0) { progressHandle.switchToDeterminate(100); progressHandle.progress(proc_str, percentage); } else { progressHandle.switchToIndeterminate(); if (proc_str != null && proc_str.length() > 0) { progressHandle.progress(proc_str); } } } private void finishProgress() { AnUtility.invokeLaterOnSwingThread( new Runnable() { @Override public void run() { finishProgressImpl(); } }); } private void finishProgressImpl() { if (progressHandle == null) { return; } progressHandle.finish(); } } gprofng-gui-2.1/org/gprofng/mpmt/progress/ProgressPanel.java0000644000175000017500000002203215044710303021216 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; public class ProgressPanel extends JPanel implements MouseListener { private Cursor currentCursor; private InternalHandle internalHandle; public ProgressPanel() { initComponents(); label.setFont(label.getFont().deriveFont(Font.PLAIN)); progressBar.setIndeterminate(true); progressBar.setFont( progressBar.getFont().deriveFont((float) progressBar.getFont().getSize() - 2)); Dimension dim; dim = progressBar.getPreferredSize(); dim.height = 14; progressBar.setPreferredSize(dim); dim = new Dimension(0, 22); verticalFiller.setPreferredSize(dim); label.addMouseListener(this); progressBar.addMouseListener(this); cancelButton.addMouseListener(this); cancelButton.setToolTipText(AnLocale.getString("Click to cancel task...")); // cancelButton.setEnabled(false); setOpaque(false); } /** * Create a progress ui handle for a long lasting task. * * @param allowToCancel either null, if the task cannot be cancelled or an instance of {@link * org.openide.util.Cancellable} that will be called when user triggers cancel of the task. * @param displayName to be shown in the progress UI * @return an instance of {@link org.netbeans.api.progress.ProgressHandle}, initialized but not * started. */ public ProgressHandle createHandle(CancelContext cancelContext) { return new ProgressHandle(internalHandle = new InternalHandle(this, cancelContext)); } public ProgressHandle createHandle() { return createHandle(null); } protected void progress(String message, int workunit) { String txt = message; if (txt != null) { int len = txt.length(); if (len > 0) { if (len > 45) { txt = txt.substring(0, 45) + "..."; } label.setText(txt); label.setToolTipText(message); progressBar.setToolTipText(message); } } if (workunit > 0) { progressBar.setValue(workunit); } } protected void toDeterminate(int workunits, int xxx) { progressBar.setIndeterminate(false); progressBar.setMinimum(0); progressBar.setMaximum(workunits); progressBar.setStringPainted(true); } protected void toIndeterminate() { progressBar.setIndeterminate(true); progressBar.setStringPainted(false); } @Override public void setVisible(boolean b) { if (GUITesting.getInstance().isRunningUnderGUITesting()) { super.setVisible(b); } else { label.setVisible(b); progressBar.setVisible(b); cancelButton.setVisible(b); } } @Override public void mouseEntered(MouseEvent e) { currentCursor = getCursor(); setCursor(Cursor.getDefaultCursor()); } @Override public void mouseExited(MouseEvent e) { setCursor(currentCursor); } @Override public void mouseReleased(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseClicked(MouseEvent e) {} /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); cancelButton = new javax.swing.JButton(); verticalFiller = new javax.swing.Box.Filler( new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0)); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; add(label, gridBagConstraints); progressBar.setPreferredSize(new java.awt.Dimension(70, 16)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.ipadx = 138; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(progressBar, gridBagConstraints); cancelButton.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/gprofng/mpmt/icons/cancelProcess.png"))); cancelButton.setBorderPainted(false); cancelButton.setContentAreaFilled(false); cancelButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); cancelButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); add(cancelButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; add(verticalFiller, gridBagConstraints); } // //GEN-END:initComponents private void cancelButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cancelButtonActionPerformed final CancelContext cancelContext = internalHandle.getCancelContext(); if (cancelContext == null) { return; } String msg = cancelContext.getTaskName() + "\n" + AnLocale.getString("Are you sure you want to cancel this task?"); JOptionPane optionPane = new JOptionPane(msg, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); optionPane.setFont(optionPane.getFont().deriveFont(Font.PLAIN)); JDialog dialog = optionPane.createDialog( AnWindow.getInstance().getFrame(), AnLocale.getString("Cancel Task")); disableYesButtonAndChangeFont(optionPane); // FIXUP: hack dialog.setVisible(true); Object selectedValue = optionPane.getValue(); if (selectedValue != null && selectedValue instanceof Integer) { int ret = ((Integer) selectedValue).intValue(); if (ret == JOptionPane.YES_OPTION) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { cancelContext.getCancellable().cancel(); } }, "CancelTaskThread"); } } } // GEN-LAST:event_cancelButtonActionPerformed private void disableYesButtonAndChangeFont(JComponent component) { for (Component comp : component.getComponents()) { if (comp instanceof JComponent) { JComponent childComp = (JComponent) comp; if (childComp instanceof JButton || childComp instanceof JLabel) { childComp.setFont(childComp.getFont().deriveFont(Font.PLAIN)); // if (childComp instanceof JButton) { // JButton button = (JButton)childComp; // if (button.getText().equals("Yes")) { // button.setEnabled(false); // FIXUP: remove to enable // cancelling of tasks..... // } // } } disableYesButtonAndChangeFont(childComp); } } } protected void setCancelButtonEnabled(boolean enable) { cancelButton.setEnabled(enable); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelButton; private javax.swing.JLabel label; private javax.swing.JProgressBar progressBar; private javax.swing.Box.Filler verticalFiller; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/progress/ProgressPanel.form0000644000175000017500000001221014744453367021261 00000000000000
gprofng-gui-2.1/org/gprofng/mpmt/progress/ProgressHandle.java0000644000175000017500000001115414744453367021401 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; /** * Instances provided by the ProgressHandleFactory allow the users of the API to notify the progress * bar UI about changes in the state of the running task. Progress component will be visualized only * after one of the start() methods. */ public final class ProgressHandle { private InternalHandle internal; /** Creates a new instance of ProgressHandle */ ProgressHandle(InternalHandle internal) { this.internal = internal; } /** * start the progress indication for indeterminate task. it will be visualized by a progress bar * in indeterminate mode. start method can be called just once. */ public void start() { start(0, -1); } /** * start the progress indication for a task with known number of steps. start method * can be called just once. * * @param workunits total number of workunits that will be processed */ public void start(int workunits) { start(workunits, -1); } /** * start the progress indication for a task with known number of steps and known time estimate for * completing the task. start method can be called just once. * * @param workunits total number of workunits that will be processed * @param estimate estimated time to process the task in seconds */ public void start(int workunits, long estimate) { internal.start("", workunits, estimate); } /** * Currently determinate task (with percentage or time estimate) can be switched to indeterminate * mode. This method has to be called after calling start method and before calling * finish method (the task has to be running). */ public void switchToIndeterminate() { internal.toIndeterminate(); } /** * Currently indeterminate task can be switched to show percentage completed. This method has to * be called after calling start method and before calling finish method * (the task has to be running). A common usecase is to calculate the amount of work in the * beginning showing in indeterminate mode and later switch to the progress with known steps * * @param workunits a definite number of complete units of work out of the total */ public void switchToDeterminate(int workunits) { internal.toDeterminate(workunits, -1); } /** * Finish the task, remove the task's component from the progress bar UI. This method has to be * called after calling start method (the task has to be running). */ public void finish() { internal.finish(); } /** * Notify the user about completed workunits. This method has to be called after calling * start method and before calling finish method (the task has to be running). * * @param workunit a cumulative number of workunits completed so far */ public void progress(int workunit) { progress(null, workunit); } /** * Notify the user about progress by showing message with details. This method has to be called * after calling start method and before calling finish method (the task * has to be running). * * @param message details about the status of the task */ public void progress(String message) { progress(message, -1); } /** * Notify the user about completed workunits and show additional detailed message. This method has * to be called after calling start method and before calling finish * method (the task has to be running). * * @param message details about the status of the task * @param workunit a cumulative number of workunits completed so far */ public void progress(String message, int workunit) { internal.progress(message, workunit); } public void setCancelContext(CancelContext cancelContext) { internal.setCancelContext(cancelContext); } public CancelContext getCancelContext() { return internal.getCancelContext(); } } gprofng-gui-2.1/org/gprofng/mpmt/progress/Cancellable.java0000644000175000017500000000171614744453367020651 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; public interface Cancellable { /** * Cancel processing of the job. Called not more then once for specific job. * * @return true if the job was succesfully cancelled, false if job can't be cancelled for some * reason */ public boolean cancel(); } gprofng-gui-2.1/org/gprofng/mpmt/progress/InternalHandle.java0000644000175000017500000000464214744453367021355 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.progress; import javax.swing.SwingUtilities; class InternalHandle { private ProgressPanel progressPanel; private CancelContext cancelContext; protected InternalHandle(ProgressPanel progressPanel, CancelContext cancelContext) { this.progressPanel = progressPanel; setCancelContext(cancelContext); } protected void progress(final String message, final int workunit) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { progressPanel.progress(message, workunit); } }); } protected void finish() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { progressPanel.setVisible(false); } }); } protected void toDeterminate(final int workunits, final int xxx) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { progressPanel.toDeterminate(workunits, xxx); } }); } protected void toIndeterminate() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { progressPanel.toIndeterminate(); } }); } protected void start(String message, int workunits, long estimate) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { progressPanel.setVisible(true); } }); } protected void setCancelContext(CancelContext cancelContext) { this.cancelContext = cancelContext; progressPanel.setCancelButtonEnabled(cancelContext != null); } protected CancelContext getCancelContext() { return cancelContext; } } gprofng-gui-2.1/org/gprofng/mpmt/ConfigurationPanel.java0000644000175000017500000004576415044710303020376 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Component; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.ListCellRenderer; import javax.swing.filechooser.FileFilter; /** * @author tpreisle */ public class ConfigurationPanel extends javax.swing.JPanel { private File expFile = null; /** Creates new form ExtraPanel */ public ConfigurationPanel(boolean includeWorkingDir) { initComponents(); useConfCheckBox.setText(AnLocale.getString("Use this Configuration")); useConfCheckBox.setToolTipText( AnLocale.getString( "If checked, the experiment will be opened using the specified Configuration")); useConfCheckBox.setMnemonic( AnLocale.getString('U', "OpenExperimentDialogUseThisConfigurationCheckBox")); AnUtility.setAccessibleContext( useConfCheckBox.getAccessibleContext(), AnLocale.getString("Use this Configuration")); confComboBox.setRenderer(new ComboBoxRenderer()); AnUtility.setAccessibleContext( confComboBox.getAccessibleContext(), AnLocale.getString("Use this Configuration")); confBrowseButton.setToolTipText(AnLocale.getString("Browse for Configuration File")); alwaysCheckBox.setText( AnLocale.getString("Always re-open this experiment with this Configuration")); alwaysCheckBox.setToolTipText( AnLocale.getString( "If checked, the experiment will be opened using this Configuration when re-opened")); alwaysCheckBox.setMnemonic(AnLocale.getString('A', "OpenExperimentDialogAlwaysReopenCheckBox")); AnUtility.setAccessibleContext( alwaysCheckBox.getAccessibleContext(), AnLocale.getString("Always re-open this experiment with this Configuration")); if (includeWorkingDir) { workingDirCheckBox.setText(AnLocale.getString("Change Working Directory")); workingDirCheckBox.setSelected(true); workingDirCheckBox.setMnemonic( AnLocale.getString('W', "OpenExperimentDialogChangeWorkingDirectoryCheckBox")); workingDirLabel.setText(AnLocale.getString("Directory:")); wdBrowseButton.setToolTipText(AnLocale.getString("Browse for Working Directory")); AnUtility.setAccessibleContext( workingDirCheckBox.getAccessibleContext(), AnLocale.getString("Change Working Directory")); AnUtility.setAccessibleContext( wdBrowseButton.getAccessibleContext(), AnLocale.getString("Browse for Working Directory")); AnUtility.setAccessibleContext( workingDirLabel.getAccessibleContext(), AnLocale.getString("Directory:")); AnUtility.setAccessibleContext( workingDirTextField.getAccessibleContext(), AnLocale.getString("Working Directory")); } else { workingDirCheckBox.setVisible(false); workingDirLabel.setVisible(false); workingDirTextField.setVisible(false); wdBrowseButton.setVisible(false); } updateStates(); } public class ComboBoxRenderer implements ListCellRenderer { private final ListCellRenderer originalRenderer; public ComboBoxRenderer() { originalRenderer = confComboBox.getRenderer(); } @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component component = originalRenderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); if (addSeparator(index)) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(new JSeparator(), BorderLayout.NORTH); panel.add(component, BorderLayout.CENTER); return panel; } else { return component; } } private boolean addSeparator(int index) { if (confComboBox.getItemCount() <= 1) { return false; } if (index < 1) { return false; } String previousPath = ((ConfName) confComboBox.getItemAt(index - 1)).getPath(); String previousDir = AnUtility.dirname(previousPath); String thisPath = ((ConfName) confComboBox.getItemAt(index)).getPath(); String thisDir = AnUtility.dirname(thisPath); return !previousDir.equals(thisDir); } } private void updateStates() { boolean UseOn = useConfCheckBox.isSelected(); confBrowseButton.setEnabled(UseOn); confComboBox.setEnabled(UseOn); alwaysCheckBox.setEnabled(UseOn); boolean wdOn = workingDirCheckBox.isSelected(); workingDirLabel.setEnabled(wdOn); workingDirTextField.setEnabled(wdOn); wdBrowseButton.setEnabled(wdOn); } public void initConfigurationChoices(File file) { this.expFile = file; List list = new ArrayList<>(); File confDir; // look inside experiment confDir = new AnFile(UserPref.getConfigurationDirPath(file.getAbsolutePath())); // Local or remote addConfigFile(confDir, list); // look in parent folder confDir = new AnFile(file.getParentFile().getAbsolutePath()); // Local or remote addConfigFile(confDir, list); // look in Home folder confDir = new File(UserPref.getHomeConfigurationDirPath()); // Always local addConfigFile(confDir, list); // Add As Last Time This Experiment Closed String asClosedPath = null; asClosedPath = UserPref.getAsWhenClosedConfigPath(file.getAbsolutePath()); if (asClosedPath != null && new File(asClosedPath).exists()) { list.add( new ConfName(asClosedPath, AnLocale.getString("As This Experiment Closed Last Time"))); } // Add As Current Experiment String[][] experimentsGroups = AnWindow.getInstance().getExperimentGroups(); if (experimentsGroups != null && experimentsGroups.length > 0) { String asPreviousClosedPath = UserPref.getAsWhenClosedConfigPath(experimentsGroups[0][0]); String previousDisplayName = AnLocale.getString("As Current Experiment"); list.add(new ConfName(asPreviousClosedPath, previousDisplayName)); } // Add As Previous Experiment Closed else if (UserPref.getInstance().getLastClosedExpConfPath() != null && UserPref.getInstance().getLastClosedExpConfPath().length() > 0) { String asPreviousClosedPath = UserPref.getInstance().getLastClosedExpConfPath(); String previousDisplayName = AnLocale.getString("As Previous Experiment Closed"); list.add(new ConfName(asPreviousClosedPath, previousDisplayName)); } confComboBox.removeAllItems(); for (ConfName confName : list) { confComboBox.addItem(confName); } useConfCheckBox.setSelected(false); if (confComboBox.getItemCount() == 0) { useConfCheckBox.setEnabled(false); } // Look for default boolean defaultFound = false; for (int i = 0; i < confComboBox.getItemCount(); i++) { ConfName confName = (ConfName) confComboBox.getItemAt(i); if (confName.isDefault()) { confComboBox.setSelectedItem(confName); useConfCheckBox.setSelected(true); defaultFound = true; break; } } if (!defaultFound) { // Look for As Last Experiment Closed for (int i = 0; i < confComboBox.getItemCount(); i++) { ConfName confName = (ConfName) confComboBox.getItemAt(i); if (confName.isAsLast()) { confComboBox.setSelectedItem(confName); // useConfCheckBox.setSelected(true); // Don't select it by default. // It's cpnfusing! break; } } } updateStates(); } private void addConfigFile(File dir, List list) { if (!dir.exists() || !dir.isDirectory()) { return; } File[] found = dir.listFiles(); if (found != null) { for (File f : found) { if (f.getName().endsWith(UserPref.configurationSuffix) && !f.getName().contains(UserPref.configAsWhenClosedName)) { list.add(new ConfName(f.getAbsolutePath(), null)); } } } } public void setWorkingDirectory(String wd) { workingDirTextField.setText(wd); workingDirTextField.setCaretPosition(wd.length()); } public String getWorkingDirectory() { String wd = null; if (workingDirCheckBox.isSelected()) { wd = workingDirTextField.getText(); if (wd.length() == 0) { wd = null; } } return wd; } public String getConfiguration() { String configuration = null; if (useConfCheckBox.isSelected()) { ConfName confName = (ConfName) confComboBox.getSelectedItem(); if (confName != null) { configuration = confName.getPath(); } } return configuration; } public boolean alwaysUseThisConfiguration() { boolean always = alwaysCheckBox.isSelected(); return always; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; useConfCheckBox = new javax.swing.JCheckBox(); confComboBox = new javax.swing.JComboBox(); confBrowseButton = new javax.swing.JButton(); alwaysCheckBox = new javax.swing.JCheckBox(); workingDirCheckBox = new javax.swing.JCheckBox(); workingDirLabel = new javax.swing.JLabel(); workingDirTextField = new javax.swing.JTextField(); wdBrowseButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); useConfCheckBox.setText("NOI18N"); useConfCheckBox.setOpaque(false); useConfCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { useConfCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; add(useConfCheckBox, gridBagConstraints); confComboBox.setEditable(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 21, 0, 0); add(confComboBox, gridBagConstraints); confBrowseButton.setText("..."); confBrowseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { confBrowseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(confBrowseButton, gridBagConstraints); alwaysCheckBox.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 18, 0, 0); add(alwaysCheckBox, gridBagConstraints); workingDirCheckBox.setText("NOI18N"); workingDirCheckBox.setOpaque(false); workingDirCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { workingDirCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(workingDirCheckBox, gridBagConstraints); workingDirLabel.setText("NOI18N"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 21, 0, 0); add(workingDirLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(workingDirTextField, gridBagConstraints); wdBrowseButton.setText("..."); wdBrowseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { wdBrowseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(wdBrowseButton, gridBagConstraints); } // //GEN-END:initComponents private void wdBrowseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_wdBrowseButtonActionPerformed String currentWD = workingDirTextField.getText(); AnChooser chooser = AnWindow.getInstance() .getAnChooser( AnLocale.getString("Working Directory"), AnChooser.DIR_CHOOSER, currentWD); int res = chooser.showDialog(AnWindow.getInstance().getFrame(), null); if (res == AnChooser.APPROVE_OPTION) { File wdFile = chooser.getSelectedAnFile(); String wd = wdFile.getAbsolutePath(); workingDirTextField.setText(wd); } } // GEN-LAST:event_wdBrowseButtonActionPerformed private void workingDirCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_workingDirCheckBoxActionPerformed updateStates(); } // GEN-LAST:event_workingDirCheckBoxActionPerformed private void useConfCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_useConfCheckBoxActionPerformed updateStates(); } // GEN-LAST:event_useConfCheckBoxActionPerformed private void confBrowseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_confBrowseButtonActionPerformed AnChooser chooser = AnWindow.getInstance() .getAnChooser( AnLocale.getString("Configurations"), AnChooser.DIR_FILE_CHOOSER, expFile.getParent()); // JFileChooser chooser = new JFileChooser(expFile.getParent()); chooser.setFileFilter(new ConfigFilter()); chooser.setFileHidingEnabled(false); // FIXUP: ???? int res = chooser.showDialog(AnWindow.getInstance().getFrame(), null); if (res == AnChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); String path = file.getAbsolutePath(); ConfName confName = new ConfName(path, null); confComboBox.addItem(confName); confComboBox.setSelectedItem(confName); } } // GEN-LAST:event_confBrowseButtonActionPerformed private class ConfigFilter extends FileFilter { @Override public String getDescription() { return UserPref.configurationSuffix; } @Override public boolean accept(File f) { boolean accept = f.isDirectory() || (f.getName().endsWith(UserPref.configurationSuffix) && !f.getName().startsWith(UserPref.getAsWhenClosedConfigName())); return accept; } } private class ConfName { private String path; private String displayName; private boolean isDefault; private boolean isAsLast; public ConfName(String path, String displayName) { this.path = path; isDefault = false; isAsLast = false; String baseName = AnUtility.basename(path); if (path.contains("/" + UserPref.configAsWhenClosedName + "/")) { isAsLast = true; } else { if (baseName.equals(UserPref.getDefaultConfigurationName())) { isDefault = true; } } if (displayName != null) { this.displayName = displayName; } else { this.displayName = defaultDisplayName(baseName); } } private String defaultDisplayName(String baseName) { String defaultDisplayName; if (path.contains("/" + UserPref.configAsWhenClosedName + "/")) { defaultDisplayName = AnLocale.getString("As Last Experiment Closed"); } else { String confName = baseName; if (confName.endsWith(UserPref.configurationSuffix)) { confName = baseName.substring(0, confName.length() - UserPref.configurationSuffix.length()); } String displayPath = path; int n = displayPath.length(); if (n > 70) { displayPath = displayPath.substring(0, 25) + "....." + displayPath.substring(n - 45, n); } defaultDisplayName = confName + " - (" + displayPath + ")"; } return defaultDisplayName; } @Override public String toString() { return displayName; } public boolean isDefault() { return isDefault; } public boolean isAsLast() { return isAsLast; } public String getPath() { return path; } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox alwaysCheckBox; private javax.swing.JButton confBrowseButton; private javax.swing.JComboBox confComboBox; private javax.swing.JCheckBox useConfCheckBox; private javax.swing.JButton wdBrowseButton; private javax.swing.JCheckBox workingDirCheckBox; private javax.swing.JLabel workingDirLabel; private javax.swing.JTextField workingDirTextField; // End of variables declaration//GEN-END:variables } gprofng-gui-2.1/org/gprofng/mpmt/AnTable.java0000644000175000017500000056627315044710303016120 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.DEBUG; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADED_FAILED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADING_ADDED_OR_REMOVED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADING_NEW; import static org.gprofng.mpmt.event.AnChangeEvent.Type.FILTER_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.FILTER_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.MOST_RECENT_EXPERIMENT_LIST_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTED_OBJECT_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_UPDATE; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SOURCE_FINDING_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SOURCE_FINDING_CHANGING; import static org.gprofng.mpmt.util.gui.AnUtility.SPACES_BETWEEN_COLUMNS; import static org.gprofng.mpmt.util.gui.AnUtility.EOL; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.DisasmDisp.DisRenderer; import org.gprofng.mpmt.SourceDisp.SrcRenderer; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.filter.FilterClause; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.table.AnJTable; import org.gprofng.mpmt.table.AnTableHeaderPanel; import org.gprofng.mpmt.table.AnTableScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; import javax.swing.DefaultListSelectionModel; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.border.EtchedBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.EventListenerList; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.TableColumnModelEvent; import javax.swing.event.TableColumnModelListener; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; public final class AnTable extends AnTableScrollPane implements AnChangeListener { private static final int AT_LIST = 0; public static final int AT_SRC = 1; protected static final int AT_SRC_ONLY = 2; public static final int AT_DIS = 3; private static final int AT_COM = 4; public static final int AT_QUOTE = 5; protected static final int AT_FUNC = 6; private static final int AT_EMPTY = 7; protected static final int AT_DIS_ONLY = 8; private static final int NUMBER_SPACE = 3; private static Font TableFont; private static Font QuoteFont; static { JTable jtable = new JTable(); Font org_font = jtable.getFont(); TableFont = new Font("Monospaced", org_font.getStyle(), org_font.getSize()); QuoteFont = TableFont.deriveFont(Font.ITALIC); } // Action names private final String STR_ACTION_COPY_ALL = AnLocale.getString("Copy All"); private final String STR_ACTION_COPY_SEL = AnLocale.getString("Copy Selected"); private final String STR_ACTION_BACK = AnLocale.getString("Back"); private final String STR_ACTION_FORWARD = AnLocale.getString("Forward"); private final String STR_ACTION_SETHEAD = AnLocale.getString("Set Head"); private final String STR_ACTION_SETTAIL = AnLocale.getString("Set Tail"); private final String STR_ACTION_REMOVE = AnLocale.getString("Remove"); private final String STR_ACTION_PREPEND = AnLocale.getString("Add Caller"); private final String STR_ACTION_APPEND = AnLocale.getString("Add Callee"); private final String STR_ACTION_RECENTER = AnLocale.getString("Set Center"); private final String STR_ACTION_RESET = AnLocale.getString("Reset"); private final String STR_ACTION_SHOW_DISASM = AnLocale.getString("Show Disassembly"); private final String STR_ACTION_SHOW_SOURCE = AnLocale.getString("Show Source"); private final String STR_ACTION_SHOW_SELECTED_FUNCTION = AnLocale.getString("Show the Selected Function"); private final String STR_ACTION_SHOW_CALLER_DISASM = AnLocale.getString("Show Caller Disassembly"); protected static final String STR_ACTION_SHOW_CALLEE_DISASM = AnLocale.getString("Show Callee Disassembly"); private final String STR_ACTION_SHOW_CALLER_SOURCE = AnLocale.getString("Show Caller Source"); protected static final String STR_ACTION_SHOW_CALLEE_SOURCE = AnLocale.getString("Show Callee Source"); private static final String ADD_FILTER = AnLocale.getString("Add Filter"); private static final String FILTER_SIMILARLY_NAMED_SHORT_NAME = AnLocale.getString("Similarly Named"); private static final String FILTER_SIMILARLY_NAMED_LONG_NAME = AnLocale.getString("Include only stacks containing similarly-named functions"); private static final String FILTER_SIMILARLY_NAMED_ACTION_NAME = "FilterSimilarlyNamed"; private static final String FILTER_CALLSTACK_FRAGMENT_SHORT_NAME = AnLocale.getString("Callstack Fragment"); private static final String FILTER_CALLSTACK_FRAGMENT_LONG_NAME = AnLocale.getString("Include only stacks containing this callstack fragment"); private static final String FILTER_CALLSTACK_FRAGMENT_ACTION_NAME = "FilterCallstackFragment"; private static final String FILTER_NOT_CALLSTACK_FRAGMENT_SHORT_NAME = AnLocale.getString("Not Callstack Fragment"); private static final String FILTER_NOT_CALLSTACK_FRAGMENT_LONG_NAME = AnLocale.getString("Include only stacks not containing this callstack fragment"); private static final String FILTER_NOT_CALLSTACK_FRAGMENT_ACTION_NAME = "FilterNotCallstackFragment"; private static final String FILTER_SELECTED_FUNCTION_SHORT_NAME = AnLocale.getString("Selected Function"); private static final String FILTER_SELECTED_FUNCTION_LONG_NAME = AnLocale.getString("Include only stacks containing the selected function"); private static final String FILTER_SELECTED_FUNCTION_ACTION_NAME = "FilterSelectedFunction"; private static final String FILTER_SELECTED_FUNCTIONS_SHORT_NAME = AnLocale.getString("Selected Functions"); private static final String FILTER_SELECTED_FUNCTIONS_LONG_NAME = AnLocale.getString("Include only stacks containing the selected functions"); private static final String FILTER_SELECTED_FUNCTIONS_ACTION_NAME = "FilterSelectedFunctions"; private static final String FILTER_NOT_SELECTED_FUNCTION_SHORT_NAME = AnLocale.getString("Not Selected Function"); private static final String FILTER_NOT_SELECTED_FUNCTION_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected function"); private static final String FILTER_NOT_SELECTED_FUNCTION_ACTION_NAME = "FilterNotSelectedFunction"; private static final String FILTER_NOT_SELECTED_FUNCTIONS_SHORT_NAME = AnLocale.getString("Not Selected Functions"); private static final String FILTER_NOT_SELECTED_FUNCTIONS_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected functions"); private static final String FILTER_NOT_SELECTED_FUNCTIONS_ACTION_NAME = "FilterNotSelectedFunctions"; private static final String FILTER_LEAF_FUNCTION_SHORT_NAME = AnLocale.getString("Selected Leaf Function"); private static final String FILTER_LEAF_FUNCTION_LONG_NAME = AnLocale.getString("Include only stacks with the selected function as leaf"); private static final String FILTER_LEAF_FUNCTION_ACTION_NAME = "FilterSelectedLeafFunction"; private static final String FILTER_LEAF_FUNCTIONS_SHORT_NAME = AnLocale.getString("Selected Leaf Functions"); private static final String FILTER_LEAF_FUNCTIONS_LONG_NAME = AnLocale.getString("Include only stacks with the selected functions as leaf"); private static final String FILTER_LEAF_FUNCTIONS_ACTION_NAME = "FilterSelectedLeafFunctions"; private final String FILTER_SELECTED_LINE_SHORT_NAME = AnLocale.getString("Selected Line"); private final String FILTER_SELECTED_LINE_LONG_NAME = AnLocale.getString("Include only stacks containing the selected line"); private final String FILTER_SELECTED_LINE_ACTION_NAME = "FilterSelectedLine"; private final String FILTER_SELECTED_LINES_SHORT_NAME = AnLocale.getString("Selected Lines"); private final String FILTER_SELECTED_LINES_LONG_NAME = AnLocale.getString("Include only stacks containing the selected lines"); private final String FILTER_SELECTED_LINES_ACTION_NAME = AnLocale.getString("FilterSelectedLines"); private final String FILTER_NOT_SELECTED_LINE_SHORT_NAME = AnLocale.getString("Not Selected Line"); private final String FILTER_NOT_SELECTED_LINE_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected line"); private final String FILTER_NOT_SELECTED_LINE_ACTION_NAME = "FilterNotSelectedLine"; private final String FILTER_NOT_SELECTED_LINES_SHORT_NAME = AnLocale.getString("Not Selected Lines"); private final String FILTER_NOT_SELECTED_LINES_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected lines"); private final String FILTER_NOT_SELECTED_LINES_ACTION_NAME = "FilterNotSelectedLines"; private final String FILTER_SELECTED_PC_SHORT_NAME = AnLocale.getString("Selected PC"); private final String FILTER_SELECTED_PC_LONG_NAME = AnLocale.getString("Include only stacks containing the selected PC"); private final String FILTER_SELECTED_PC_ACTION_NAME = "FilterSelected PC"; private final String FILTER_SELECTED_PCS_SHORT_NAME = AnLocale.getString("Selected PCs"); private final String FILTER_SELECTED_PCS_LONG_NAME = AnLocale.getString("Include only stacks containing the selected PCs"); private final String FILTER_SELECTED_PCS_ACTION_NAME = "AddFilterSelectedPCs"; private final String FILTER_NOT_SELECTED_PC_SHORT_NAME = AnLocale.getString("Not Selected PC"); private final String FILTER_NOT_SELECTED_PC_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected PC"); private final String FILTER_NOT_SELECTED_PC_ACTION_NAME = AnLocale.getString("FilterNotSelectedPC"); private final String FILTER_NOT_SELECTED_PCS_SHORT_NAME = AnLocale.getString("Not Selected PCs"); private final String FILTER_NOT_SELECTED_PCS_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected PCs"); private final String FILTER_NOT_SELECTED_PCS_ACTION_NAME = AnLocale.getString("FilterNotSelected PCs"); private static final String FILTER_WITHOUT_SELECTED_ITEMS_SHORT_NAME = AnLocale.getString("Without Selected Items"); private static final String FILTER_WITHOUT_SELECTED_ITEMS_LONG_NAME = AnLocale.getString("Include only events without selected items"); private static final String FILTER_WITHOUT_SELECTED_ITEMS_ACTION_NAME = "FilterWithoutSelectedItems"; private static final String FILTER_WITH_SELECTED_ITEMS_SHORT_NAME = AnLocale.getString("With Selected Items"); private static final String FILTER_WITH_SELECTED_ITEMS_LONG_NAME = AnLocale.getString("Include only events with selected items"); private static final String FILTER_WITH_SELECTED_ITEMS_ACTION_NAME = "FilterWithSelectedItems"; private static final String FILTER_WITH_SELECTED_FILE_SHORT_NAME = AnLocale.getString("Selected Files"); private static final String FILTER_WITH_SELECTED_FILE_LONG_NAME = AnLocale.getString("Include only events containing the selected files"); private static final String FILTER_WITH_SELECTED_FILE_ACTION_NAME = "FilterWithSelectedFiles"; private static final String FILTER_NOT_SELECTED_FILE_SHORT_NAME = AnLocale.getString("Unselected Files"); private static final String FILTER_NOT_SELECTED_FILE_LONG_NAME = AnLocale.getString("Include only events not containing the selected files"); private static final String FILTER_NOT_SELECTED_FILE_ACTION_NAME = "FilterWithNotSelectedFiles"; private static final String FILTER_WITH_SELECTED_IOVFD_SHORT_NAME = AnLocale.getString("Selected File Descriptors"); private static final String FILTER_WITH_SELECTED_IOVFD_LONG_NAME = AnLocale.getString("Include only events containing the selected file descriptors"); private static final String FILTER_WITH_SELECTED_IOVFD_ACTION_NAME = "FilterWithSelectedFileDescriptors"; private static final String FILTER_NOT_SELECTED_IOVFD_SHORT_NAME = AnLocale.getString("Unselected File Descriptors"); private static final String FILTER_NOT_SELECTED_IOVFD_LONG_NAME = AnLocale.getString("Include only events not containing the selected file descriptors"); private static final String FILTER_NOT_SELECTED_IOVFD_ACTION_NAME = "FilterWithNotSelectedFileDescriptors"; private static final String FILTER_WITH_SELECTED_IOSTACK_SHORT_NAME = AnLocale.getString("Selected Stacks"); private static final String FILTER_WITH_SELECTED_IOSTACK_LONG_NAME = AnLocale.getString("Include only events containing the selected stacks"); private static final String FILTER_WITH_SELECTED_IOSTACK_ACTION_NAME = "FilterWithSelectedIOStacks"; private static final String FILTER_NOT_SELECTED_IOSTACK_SHORT_NAME = AnLocale.getString("Unselected Stacks"); private static final String FILTER_NOT_SELECTED_IOSTACK_LONG_NAME = AnLocale.getString("Include only events not containing the selected stacks"); private static final String FILTER_NOT_SELECTED_IOSTACK_ACTION_NAME = "FilterWithNotSelectedIOStacks"; private static final String FILTER_WITH_SELECTED_HEAPSTACK_SHORT_NAME = AnLocale.getString("Selected Stacks"); private static final String FILTER_WITH_SELECTED_HEAPSTACK_LONG_NAME = AnLocale.getString("Include only events containing the selected stacks"); private static final String FILTER_WITH_SELECTED_HEAPSTACK_ACTION_NAME = "FilterWithSelectedHeapStacks"; private static final String FILTER_NOT_SELECTED_HEAPSTACK_SHORT_NAME = AnLocale.getString("Unselected Stacks"); private static final String FILTER_NOT_SELECTED_HEAPSTACK_LONG_NAME = AnLocale.getString("Include only events not containing the selected stacks"); private static final String FILTER_NOT_SELECTED_HEAPSTACK_ACTION_NAME = "FilterWithNotSelectedHeapStacks"; private static final String FILTER_WITH_SELECTED_HEAPACTIVESTACK_SHORT_NAME = AnLocale.getString("Peak Active Allocations"); private static final String FILTER_WITH_SELECTED_HEAPACTIVESTACK_LONG_NAME = AnLocale.getString("Include only active allocations for the peak"); private static final String FILTER_WITH_SELECTED_HEAPACTIVESTACK_ACTION_NAME = "FilterActiveHeapAllocations"; private static final String FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_SHORT_NAME = AnLocale.getString("Only Leaks"); private static final String FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_LONG_NAME = AnLocale.getString("Include only allocations that leaked"); private static final String FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME = "FilterHeapLeaked"; private static final String FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_SHORT_NAME = AnLocale.getString("Exclude Leaks"); private static final String FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_LONG_NAME = AnLocale.getString("Exclude allocations that leaked"); private static final String FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME = "FilterHeapExcludeLeaked"; private static final String FILTER_WITH_SELECTED_JGROUP_SHORT_NAME = AnLocale.getString("Selected JGroup"); private static final String FILTER_WITH_SELECTED_JGROUP_LONG_NAME = AnLocale.getString("Include only JThreads in selected group"); private static final String FILTER_WITH_SELECTED_JGROUP_ACTION_NAME = "FilterWithSelectedJGroup"; private static final String FILTER_WITH_SELECTED_JPARENT_SHORT_NAME = AnLocale.getString("Selected JParent"); private static final String FILTER_WITH_SELECTED_JPARENT_LONG_NAME = AnLocale.getString("Include only JThreads in selected parent"); private static final String FILTER_WITH_SELECTED_JPARENT_ACTION_NAME = "FilterWithSelectedJParent"; private final String STR_ACTION_UNDOFILTER = AnLocale.getString("Undo Filter Action"); private final String STR_ACTION_REDOFILTER = AnLocale.getString("Redo Filter Action"); private final String STR_ACTION_REMOVE_ALL_FILTERS = AnLocale.getString("Remove All Filters"); private final String STR_ACTION_CUSTOM_FILTER = ADD_FILTER + ": " + AnLocale.getString("Advanced Custom Filter..."); private AnMenuListener menuListener; private AnTable anTable; private JTable table; private int type; private JTableHeader tableHeader; private FListTableModel tableModel; private FListColumnModel columnModel; private FontMetrics fontMetrics; private int[][] columnWidth; private int rowHeight; private String[] names; private int orgRow; // What is this? private int selectedRow; private int nameColumn; private int sortColumn; private int nameWidth; private boolean hasHeader; private boolean canSort; private boolean isSingle; private boolean colScroll; private boolean hasSelect; private boolean wrapMetricNames; public boolean columnsSaved = false; public int[] selected_indices; private String acName; private String acDesc; private JLabel acLabel; private AnDisplay parent = null; public AnHotGap gap; protected SrcRenderer srcRenderer = null; protected DisRenderer disRenderer = null; private NavigationHistoryPool navHistoryPool = null; private int groupId = 0; private JComponent allHeaderPanel = null; private static Integer MIN_CELL_WIDTH = null; private HotGapPanel hotGapPanel = null; /** * Returns a new instance of AnTable, which extends JScrollPane and contains a JTable inside. * *

This method always creates a new JTable, according to the specified requirements. It sets * Accessible Name, Accessible Description and Label for the JTable. * * @param type Type of AnDisplay, that creates AnTable (parent type) * @param hasHeader Boolean flag: if true, AnTable has header * @param hasColumnButton * @param can_sort Boolean flag: if true, information can be sorted * @param isSingle Boolean flag: if true, the table does not allow multiselection * @param colScroll Boolean flag: if true, set HorizontalScrollBar as needed (false - never) * @param hasSelect Boolean flag: if true, show selection * @param wrapMetricNames * @param accessibleName Accessible Name for JTable * @param accessibleDescr Accessible Description for JTable * @param LabelFor Label for JTable * @see AnTable */ public AnTable( int type, boolean hasHeader, boolean hasColumnButton, boolean can_sort, boolean isSingle, boolean colScroll, boolean hasSelect, boolean wrapMetricNames, String accessibleName, String accessibleDescr, JLabel LabelFor) { super(type, hasColumnButton); this.type = type; this.hasHeader = hasHeader; this.canSort = can_sort; this.isSingle = isSingle; this.colScroll = colScroll; this.hasSelect = hasSelect; this.wrapMetricNames = wrapMetricNames; this.acName = accessibleName; this.acDesc = accessibleDescr; this.acLabel = LabelFor; anTable = this; fontMetrics = null; rowHeight = 20; orgRow = -1; selectedRow = 0; nameColumn = 0; sortColumn = -1; nameWidth = 0; columnWidth = new int[1][4]; columnWidth[0][0] = 30; columnWidth[0][1] = columnWidth[0][2] = columnWidth[0][3] = 10; initComponents(); AnEventManager.getInstance().addListener(this); } public void setHotGapPanel(HotGapPanel hotGapPanel) { this.hotGapPanel = hotGapPanel; } private static int getMinimumColumnWidth() { if (MIN_CELL_WIDTH == null) { MIN_CELL_WIDTH = AnTableHeaderPanel.getMinimumColumnWidth(); } return MIN_CELL_WIDTH; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("IOView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: case EXPERIMENTS_LOADED: case FILTER_CHANGED: case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.TABLE_FORMATS) { tableModel.updateTableHeaders(); } break; case DEBUG: break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } /* * Hack: Set parent * used to clear selections in all tables in Callers-Callees tab */ public void setParent(AnDisplay parent) { this.parent = parent; } public AnDisplay getAnParent() { return parent; } protected NavigationHistoryPool getNavigationHistoryPool() { return navHistoryPool; } public int getNameCol() { return nameColumn; } public int getType() { return anTable.type; } public boolean wrapMetricNames() { return wrapMetricNames; } public void setWrapMetricNames(boolean val) { wrapMetricNames = val; } protected AnMenuListener getMenuListener() { return menuListener; } // Initialize GUI components private void initComponents() { final Dimension psize; final ListSelectionModel sel_model; final CallHandler callHandler; final JLabel corner; switch (type) { case AnDisplay.DSP_Functions: navHistoryPool = new NavigationHistoryPool(); break; case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: disRenderer = new DisRenderer(anTable); navHistoryPool = new NavigationHistoryPool(); break; case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: srcRenderer = new SrcRenderer(anTable); navHistoryPool = new NavigationHistoryPool(); break; } gap = null; tableModel = new FListTableModel(); columnModel = new FListColumnModel(); table = new AnJTable(tableModel, columnModel); AnUtility.setAccessibleContext( table.getAccessibleContext(), AnLocale.getString("Table")); // FIXUP: export table is using AccessibleContext in output! table.setBorder(null); // A11Y for tables AccessibleContext ac = table.getAccessibleContext(); if (acName != null) { ac.setAccessibleName(acName); } if (acDesc != null) { ac.setAccessibleDescription(acDesc); } if (acLabel != null) { acLabel.setLabelFor(table); } callHandler = new CallHandler(); table.registerKeyboardAction(callHandler, "ENTER", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); table.registerKeyboardAction(callHandler, "CNTRL_C", KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // Popup menu menuListener = new AnMenuListener(this); table.addMouseListener(menuListener); this.addMouseListener(menuListener); KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); table .getActionMap() .put( ks, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { JPopupMenu popup = initPopup(false); if (popup != null) { JTable src = (JTable) ev.getSource(); Rectangle cellRect, visRect; visRect = src.getVisibleRect(); cellRect = visRect; int selrow = src.getSelectedRow(); if (selrow >= 0) { cellRect = src.getCellRect(selrow, 0, false); } // if current view doesn't include selected row, scroll if (!visRect.contains(cellRect)) { // calculate middle based on selected row // being below or above current visible rows if (visRect.y < cellRect.y) { cellRect.y += visRect.height / 2; } else { cellRect.y -= visRect.height / 2; } src.scrollRectToVisible(cellRect); } popup.show(src, cellRect.x, cellRect.y + cellRect.height); } } }); switch (type) { case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: // Previous Hot Line KeyStroke keyStrokeUp = KeyboardShortcuts.sourcePreviousHotLineActionShortcut; table.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeUp, keyStrokeUp); table .getActionMap() .put( keyStrokeUp, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { gap.HG_Prev_Hot_Line(); } }); // Next Hot Line KeyStroke keyStrokeDown = KeyboardShortcuts.sourceNextHotLineActionShortcut; table.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeDown, keyStrokeDown); table .getActionMap() .put( keyStrokeDown, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { gap.HG_Next_Hot_Line(); } }); // Next NZ Line KeyStroke keyStrokeNextNZ = KeyboardShortcuts.sourceNextNonZeroLineActionShortcut; table.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeNextNZ, keyStrokeNextNZ); table .getActionMap() .put( keyStrokeNextNZ, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { gap.HG_Next_NZ_Line(); } }); // Previous NZ Line KeyStroke keyStrokePreviousNZ = KeyboardShortcuts.sourcePreviousNonZeroLineActionShortcut; table .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(keyStrokePreviousNZ, keyStrokePreviousNZ); table .getActionMap() .put( keyStrokePreviousNZ, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { gap.HG_Prev_NZ_Line(); } }); } table.setAutoCreateColumnsFromModel(true); table.setShowGrid(false); table.setIntercellSpacing(new Dimension(0, 0)); // table.setShowVerticalLines(true); // table.setGridColor(AnEnvironment.TABLE_VERTICAL_GRID_COLOR); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setAutoscrolls(false); if (isSingle) { psize = table.getPreferredScrollableViewportSize(); psize.height = TableFont.getSize() + table.getRowMargin() + 5; table.setPreferredScrollableViewportSize(psize); } // Set selecting mode & add events listener for row selecting sel_model = table.getSelectionModel(); // sel_model.setSelectionMode(canSort // ? ListSelectionModel.SINGLE_SELECTION // : ListSelectionModel.SINGLE_INTERVAL_SELECTION); if (!isSingle) { sel_model.addListSelectionListener(new CellHandler()); } if (!hasSelect) { table.addMouseListener(callHandler); table.registerKeyboardAction(callHandler, "SPACE", KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } else { table.addMouseListener(new TableAdapter()); } // Set table font as proportionally-spaced table.setFont(TableFont); // Set default table cell renderer table.setDefaultRenderer(Object.class, new CellRenderer()); table.setDefaultEditor(Object.class, new CellEditor()); // Set table as the View component setViewportView(table); corner = new JLabel(); corner.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); setCorner(UPPER_RIGHT_CORNER, corner); setHorizontalScrollBarPolicy( colScroll ? HORIZONTAL_SCROLLBAR_AS_NEEDED : HORIZONTAL_SCROLLBAR_NEVER); setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); if (isSingle) { getVerticalScrollBar().setEnabled(false); } // Add events listener for sorting (clicks on header), and // Set default header renderer tableHeader = table.getTableHeader(); if (hasHeader) { } else { table.setTableHeader(null); if (colScroll) { getHorizontalScrollBar().addAdjustmentListener(new ScrollHandler()); } } // Add resize listener addComponentListener(new TableListener()); } public JTable getTable() { return table; } /** * @param view Hack to prevent header panel to be overriden */ @Override public void setColumnHeaderView(Component view) { if (allHeaderPanel != null) { super.setColumnHeaderView(allHeaderPanel); } else { super.setColumnHeaderView(view); } } // Set header for table without real header public void setHeader(final AnTable other_table) { tableHeader = other_table.tableHeader; } // Set table as the View component public void setViewport() { setViewportView(table); } // Returns sort column public int getSortColumn() { return sortColumn; } public boolean canSort() { return canSort; } public String[] getNames() { return names; } public int getSrcType(int row) { if (tableModel != null) { return tableModel.getSrcType(row); } return AT_LIST; } public void goToLine(int row) { if (row < 0) { return; } switch (type) { case AnTable.AT_SRC: case AnTable.AT_DIS: case AnTable.AT_QUOTE: break; default: return; } Object[][] d = getTableData(); if (d.length <= row) { return; } setSelectedRow(row); } // Returns row count public int getRowCount() { if (null == table) { return -1; } return table.getRowCount(); } /** Performs default action for double click */ public void performDefaultAction() { // System.out.println("performDefaultAction"); // Switch Display switch (type) { case AnDisplay.DSP_Functions: case AnDisplay.DSP_Lines: { // Default action: Show Source parent.window.setSelectedView(AnDisplay.DSP_Source); break; } case AnDisplay.DSP_PCs: case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: { // Default action: Show Disassembly parent.window.setSelectedView(AnDisplay.DSP_Disassembly); break; } case AnDisplay.DSP_MiniFunctions: { parent.window.setSelectedView(AnDisplay.DSP_Functions); break; } case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: { parent.window.getSettings().toggleDisFuncScope(); break; } case AnDisplay.DSP_MiniCaller: case AnDisplay.DSP_MiniCallee: { updateSelectedRow(table.getSelectedRow()); break; } } } /** Create text presentation of the table header. */ protected String printTableHeader(String sortedby, Object[][] MaximumValues) { JTable t = table; String empty = ""; String tname = empty; // Get table name (preferably localized) if (null != t.getAccessibleContext()) { tname = t.getAccessibleContext().getAccessibleName(); } else { // There should be some other way to get table name tname = t.getName(); } if (null == tname) { tname = empty; } return printTableHeader(tname, sortedby, MaximumValues); } private static void append_blanks(StringBuilder sb, int n) { for (int i = 0; i < n; i++) { sb.append(' '); } } private static void stripTrailing(StringBuilder sb) { int length = sb.length(); while (length > 0 && Character.isWhitespace(sb.charAt(length - 1))) { length--; } sb.setLength(length); } /** Create text presentation of the table header. */ protected synchronized String printTableHeader( String tname, String sortedby, Object[][] MaximumValues) { // Prepare text presentation of the table StringBuilder sb = new StringBuilder(); if (canSort) { // text = "Functions sorted by metric: Exclusive Total CPU Time\n" int sc = getSortColumn(); if (sc >= 0) { MetricLabel m = getTableModel().getLabel(sc); String ltext = m.getAnMetric().getName(); if (tname != null && tname.length() > 0) { sb.append(tname); sb.append(" "); } sb.append(sortedby); sb.append(" "); sb.append(ltext); sb.append(EOL); } } else if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { // Print Source File name if (names != null && names.length > 0) { sb.append(names[0]); // Source File: ... } } else if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) { // Print Load Object name if (names != null && names.length > 2) { sb.append(names[2]); // Load Object: ... } } if (sb.length() > 0) { sb.append(EOL); } else if (tname != null && tname.length() > 0) { sb.append(tname); sb.append(EOL); } StringBuilder line = new StringBuilder(); StringBuilder column = new StringBuilder(); MetricLabel[] labels = tableModel.metricLabels; for (int lineN = 0;; lineN++) { line.setLength(0); for (int i = 0; i < labels.length; i++) { MetricLabel ml = labels[i]; String[] titles = ml.getLegendAndTitleLines(); String s = ""; if (lineN < titles.length && titles[lineN] != null) { s = titles[lineN]; } line.append(s); if (i + 1 < labels.length) { append_blanks(line, ml.getColumnWidth() + SPACES_BETWEEN_COLUMNS - s.length()); } } stripTrailing(line); if (line.length() == 0) { break; } sb.append(line); sb.append(EOL); } line.setLength(0); for (int i = 0; i < labels.length; i++) { MetricLabel ml = labels[i]; AnMetric m = ml.getAnMetric(); column.setLength(0); String s = ml.getUnit(); if (s == null || s.length() == 0) { if (!m.isNameMetric() && (m.isTVisible() || m.isVVisible())) { column.append("#"); } } else { column.append(s); } if (m.isPVisible()) { append_blanks(column, ml.getValWidth() - column.length()); if (ml.getValWidth() > 0) { append_blanks(column, SPACES_BETWEEN_COLUMNS); } append_blanks(column, ml.getPercentWidth() - 3); column.append("%"); } if (i + 1 < labels.length) { append_blanks(column, ml.getColumnWidth() + SPACES_BETWEEN_COLUMNS - column.length()); } line.append(column); } stripTrailing(line); if (line.length() != 0) { sb.append(line); sb.append(EOL); } return sb.toString(); } /** Create text presentation of the table. */ protected String printTableContents(Object[][] MaximumValues, int printLimit) { boolean last_only = false; boolean selected_only = false; return printTableContents(printLimit, last_only, selected_only); } /** Create text presentation of the selected rows of the table. */ protected String printSelectedTableContents(Object[][] MaximumValues, int printLimit) { boolean last_only = false; boolean selected_only = true; return printTableContents(printLimit, last_only, selected_only); } /** Create text presentation of the table. * @param printLimit * @param last_only * @param selected_only * @return */ public synchronized String printTableContents(int printLimit, boolean last_only, boolean selected_only) { if (printLimit < 0) { return ""; } TableModel tModel = table.getModel(); int rows = tModel.getRowCount(); if (columnWidth.length <= 1) { return EOL + AnLocale.getString("No metrics selected for this view") + EOL; } if (printLimit > 0 && rows < printLimit) { rows = printLimit; // print max printLimit } MetricLabel[] labels = tableModel.metricLabels; int sz = rows; int[] selected_ind = null; if (selected_only) { selected_ind = table.getSelectedRows(); if (null == selected_ind) { return ""; } sz = selected_ind.length; } StringBuilder sb = new StringBuilder(); StringBuilder line = new StringBuilder(); StringBuilder column = new StringBuilder(); for (int index = 0; index < sz; index++) { int i = index; if (selected_only) { i = selected_ind[index]; } // Check if all values are empty boolean emptyValues = false; int src_type = tableModel.getSrcType(i); if (src_type < 0) { src_type = -src_type; } if ((src_type == AT_SRC_ONLY) || (src_type == AT_COM) || (src_type == AT_FUNC) || (src_type == AT_EMPTY) || (src_type == AT_DIS_ONLY)) { emptyValues = true; } line.setLength(0); for (int j = 0; j < labels.length; j++) { MetricLabel ml = labels[j]; AnMetric m = ml.getAnMetric(); Object cellValue = tModel.getValueAt(i, j); column.setLength(0); if (m.isNameMetric()) { column.append(cellValue.toString()); } else if (!emptyValues && !(last_only && (i + 1 != rows))) { if (m.isTVisible() || m.isVVisible()) { String s = cellValue.toString(); append_blanks(column, ml.getValWidth() - s.length()); column.append(s); } else if (ml.getValWidth() > 0) { append_blanks(column, ml.getValWidth()); } if (m.isPVisible()) { if (ml.getValWidth() > 0) { append_blanks(column, SPACES_BETWEEN_COLUMNS); } String s = ((AnObject) cellValue).toPercent(ml.getTotal()); append_blanks(column, ml.getPercentWidth() - s.length()); column.append(s); } } if (j + 1 < labels.length) { append_blanks(column, ml.getColumnWidth() + SPACES_BETWEEN_COLUMNS - column.length()); } line.append(column); } stripTrailing(line); sb.append(line); sb.append(EOL); } sb.append(EOL); return sb.toString(); } // Listener for resize private final class TableListener implements ComponentListener { @Override public final void componentResized(final ComponentEvent e) { tableModel.fitColumnResize(-1); if (nameColumn != (columnWidth.length - 1)) { // See 22289649 - table headers not aligned with numbers when window is resized TableColumnModel columnModel = table.getColumnModel(); TableColumn nameColumn = columnModel.getColumn(AnTable.this.nameColumn); if (AnTable.this.nameColumn >= 0 && AnTable.this.nameColumn < columnWidth.length - 1 && columnWidth[AnTable.this.nameColumn].length > 0) { if (columnWidth[AnTable.this.nameColumn][0] != nameColumn.getWidth()) { columnWidth[AnTable.this.nameColumn][0] = nameColumn.getWidth(); tableModel.updateTableHeaders(); // FIXUP: called too often in some cases.... } } } } @Override public void componentHidden(final ComponentEvent e) {} @Override public void componentMoved(final ComponentEvent e) {} @Override public void componentShown(final ComponentEvent e) {} } // Returns table model public FListTableModel getTableModel() { // public for mem/idx objs return tableModel; } // A JLabel for table cell private static final class FListLabel extends JLabel { final boolean is_number; public FListLabel(final String text, final JComponent cmp, final int horizontalAlignment) { super(text); getAccessibleContext().setAccessibleDescription(text); getAccessibleContext().setAccessibleName(text); setHorizontalAlignment(horizontalAlignment); setVerticalAlignment(TOP); setFont(cmp.getFont()); setBorder(AnVariable.labelBorder); setForeground(cmp.getForeground()); setBackground(cmp.getBackground()); is_number = (cmp instanceof JTable) && (horizontalAlignment == RIGHT); } protected final void paintComponent(final Graphics g) { final FontMetrics fm; final int ascent; int pos; final String str; String cstr; char ch; if (g == null) { System.err.println("NULL GRAPHICS"); } if (!is_number) { super.paintComponent(g); return; } fm = g.getFontMetrics(); ascent = fm.getAscent(); pos = getWidth() - getInsets().right; str = getText(); for (int i = str.length() - 1; i >= 0; i--) { ch = str.charAt(i); if (ch == '@') { pos -= NUMBER_SPACE; } else { cstr = String.valueOf(ch); pos -= fm.stringWidth(cstr); g.drawString(cstr, pos, ascent); } } } // Overridden for performance reasons. public final void validate() {} public final void revalidate() {} public final void repaint( final long tm, final int x, final int y, final int width, final int height) {} public final void repaint(final Rectangle r) {} protected final void firePropertyChange( final String propertyName, final Object oldValue, final Object newValue) { if (propertyName.equals("text")) { super.firePropertyChange(propertyName, oldValue, newValue); } } public final void firePropertyChange( final String propertyName, final boolean oldValue, final boolean newValue) {} } // A JPanel which may contain one or more values private final class CellPanel extends JPanel { public CellPanel(JTable table, boolean isSelected, int align) { setLayout(new FlowLayout(align, 0, 0)); if (isSelected || isSingle) { setForeground(table.getSelectionForeground()); setBackground(table.getSelectionBackground()); } else { setForeground(table.getForeground()); setBackground(table.getBackground()); } } } private final class CellEditor extends AbstractCellEditor implements TableCellEditor, Serializable { private CellRenderer cr = new CellRenderer(); public Component getTableCellEditorComponent( final JTable table, final Object value, final boolean isSelected, final int row, final int column) { return (cr.getTableCellRendererComponent(table, value, isSelected, true, row, column)); } @Override public Object getCellEditorValue() { return null; } } // Table cell renderer private final class CellRenderer implements TableCellRenderer, Serializable { @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final CellPanel panel; final int mcolumn; int src_type; final int[] col_w; FListLabel fl; final MetricLabel label; Dimension psize; if (value == null) { JPanel panel2 = new JPanel(); panel2.setBackground(Color.red); return panel2; } panel = new CellPanel( table, isSelected, value instanceof String ? FlowLayout.LEFT : FlowLayout.CENTER); if (hasFocus) { panel.setBorder(AnVariable.tableFocusBorder); } // color background every other line if (!isSelected) { if (canSort() && column == sortColumn) { if (row % 2 == 1) { panel.setBackground(AnEnvironment.TABLE_LINE_BACKGROUND_SELECTED_COLUMN_COLOR_2); } else { panel.setBackground(AnEnvironment.TABLE_LINE_BACKGROUND_SELECTED_COLUMN_COLOR_1); } } else if (row % 2 == 1) { panel.setBackground(AnEnvironment.TABLE_LINE_BACKGROUND_COLOR_2); } } mcolumn = table.convertColumnIndexToModel(column); col_w = columnWidth[mcolumn]; panel.setOpaque(true); // Check if flagged as important src_type = tableModel.getSrcType(row); if (src_type < 0) { src_type = -src_type; } if (mcolumn != nameColumn) { HashMap mark = tableModel.hotMarks.get(row); if (mark != null) { Boolean bvalue = mark.get(mcolumn); if (bvalue != null && bvalue) { panel.setBackground(AnVariable.HILIT_COLOR); } } mark = tableModel.hotMarks_inc.get(row); if (mark != null) { Boolean bvalue = mark.get(mcolumn); if (bvalue != null && bvalue) { panel.setBackground(AnVariable.HILIT_INC_COLOR); } } } // Just single string if (value instanceof String) { if (type != AnDisplay.DSP_DataLayout) { if ((src_type == AT_SRC) || (src_type == AT_SRC_ONLY)) { // get rendered src panel from SourceDisp SrcRenderer.SrcTextPane st = null; if (srcRenderer != null) { st = srcRenderer.getSrcTextPane((String) value, table, row); } else if (disRenderer != null) { st = disRenderer.getSrcTextPane((String) value, table, row); } if (st != null) { psize = new Dimension(col_w[1], rowHeight); st.setPreferredSize(new Dimension(psize)); st.setMinimumSize(new Dimension(psize)); st.setMaximumSize(new Dimension(psize)); if (disRenderer != null) { panel.setBackground(AnVariable.SRCDIS_COLOR); } panel.add(st); return panel; } } else if ((src_type == AT_DIS) || (src_type == AT_DIS_ONLY)) { if (disRenderer != null) { DisRenderer.DisTextPane dt; dt = disRenderer.getDisTextPane((String) value, table, row); psize = new Dimension(col_w[1], rowHeight); dt.setPreferredSize(new Dimension(psize)); dt.setMinimumSize(new Dimension(psize)); dt.setMaximumSize(new Dimension(psize)); panel.add(dt); return panel; } } } panel.add(fl = new FListLabel((String) value, table, JLabel.LEFT)); if (((String) value).startsWith("<")) { fl.setFont(QuoteFont); } if ((((String) value).trim()).startsWith("(")) { fl.setFont(QuoteFont); } psize = new Dimension(col_w[1], rowHeight); fl.setPreferredSize(new Dimension(psize)); fl.setMinimumSize(new Dimension(psize)); fl.setMaximumSize(new Dimension(psize)); if (type == AnDisplay.DSP_MiniCallee || type == AnDisplay.DSP_MiniCaller || type == AnDisplay.DSP_MiniCallerCalleeSelf) { panel.setToolTipText((String) value); } // Set text color if (src_type == AT_COM) { fl.setForeground(AnVariable.CCOMP_COLOR); fl.setBackground(AnVariable.COMENTARY_COLOR); panel.setBackground(AnVariable.COMENTARY_COLOR); } else if ((type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) && ((src_type == AT_SRC) || (src_type == AT_SRC_ONLY))) { fl.setForeground(AnVariable.DISRC_COLOR); } else if ((type == AnDisplay.DSP_DataLayout) && ((src_type == AT_SRC) || (src_type == AT_SRC_ONLY))) { fl.setFont(QuoteFont); } else if ((src_type == AT_QUOTE) || (src_type == AT_FUNC)) { fl.setForeground(AnVariable.QUOTE_COLOR); fl.setFont(QuoteFont); panel.setBackground(AnVariable.COMENTARY_COLOR); if (src_type == AT_FUNC) { if (srcRenderer != null) { if (srcRenderer.functionCallerCalleeAdded.get(row) == null) { srcRenderer.addFunctionByRow(row); } } else if (disRenderer != null) { if (disRenderer.functionCallerCalleeAdded.get(row) == null) { disRenderer.addFunctionByRow(row); } } } } if (column < tableModel.columnCount - 1) { Color borderColor; if (AnWindow.getInstance().getExperimentGroups().length == 1) { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_METRIC_COLOR; } else { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_METRIC_COMP_COLOR; } panel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, borderColor)); } return panel; } // Check the source line type, return for empty metrics if ((src_type == AT_SRC_ONLY) || (src_type == AT_COM) || (src_type == AT_FUNC) || (src_type == AT_EMPTY) || (src_type == AT_DIS_ONLY)) { return panel; } // May contain multiple columns; value, time, and percent label = tableModel.getLabel(mcolumn); if (label == null) { return panel; } if (label.getClock() != -1.0) { panel.add( fl = new FListLabel( ((AnObject) value).toFormTime(label.getClock()), table, JLabel.RIGHT)); psize = new Dimension(col_w[1], rowHeight); fl.setPreferredSize(new Dimension(psize)); fl.setMinimumSize(new Dimension(psize)); fl.setMaximumSize(new Dimension(psize)); } if (label.getUnit() != null) { panel.add(fl = new FListLabel(((AnObject) value).toFormString(), table, JLabel.RIGHT)); psize = new Dimension(col_w[2], rowHeight); fl.setPreferredSize(new Dimension(psize)); fl.setMinimumSize(new Dimension(psize)); fl.setMaximumSize(new Dimension(psize)); } if (label.getTotal() != -1.0) { panel.add( fl = new FListLabel( ((AnObject) value).toPercent(label.getTotal()), table, JLabel.RIGHT)); psize = new Dimension(col_w[3], rowHeight); fl.setPreferredSize(new Dimension(psize)); fl.setMinimumSize(new Dimension(psize)); fl.setMaximumSize(new Dimension(psize)); } if (column < tableModel.columnCount - 1) { Color borderColor; if (AnWindow.getInstance().getExperimentGroups().length == 1) { if (tableModel .metricLabels[column] .getAnMetric() .getComd() .equals(tableModel.metricLabels[column + 1].getAnMetric().getComd())) { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_COLOR; } else { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_METRIC_COLOR; } } else { // Compare mode if (tableModel .metricLabels[column] .getAnMetric() .getComd() .equals(tableModel.metricLabels[column + 1].getAnMetric().getComd())) { if (tableModel.metricLabels[column].getAnMetric().getSubType() == tableModel.metricLabels[column + 1].getAnMetric().getSubType()) { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_COLOR; } else { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_ATTRIBUTE_COMP_COLOR; } } else { borderColor = AnEnvironment.TABLE_VERTICAL_GRID_METRIC_COMP_COLOR; } } panel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, borderColor)); } if (hasFocus) { // Override other border settings panel.setBorder(AnVariable.tableFocusBorder); } return panel; } } public void clearHistory() { if (navHistoryPool != null) { navHistoryPool.clearAll(); } } // Remove all rows & columns @Override public void removeAll() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { tableModel.removeAll(); } }); } // Remove all rows public void removeAllRows() { tableModel.removeAllRows(); } // Show message only public void showMessage(String msg) { showMessage(getErrorMessagePanel(msg)); } public void showMessage(Component component) { allHeaderPanel = null; setViewportView(component); } private JPanel getErrorMessagePanel(String text) { JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); JLabel label = new JLabel(text); label.setHorizontalAlignment(JLabel.CENTER); label.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); label.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Error message")); panel.add(label); return panel; } // Set table data public void setData( final MetricLabel[] label, final Object[][] data, final String[] names, final int[] src_type, final int org_row, final int name_col, final int sort_col) { this.names = names; this.orgRow = org_row; this.nameColumn = name_col; this.sortColumn = sort_col; switch (type) { case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: if (disRenderer != null) { long sel_src = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_SourceSelectedObject, 0); long sel_instr = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_Disassembly, 0); int view_mode = parent.window.getSettings().getViewModeSetting().get().value(); disRenderer.maxSrcCachedNumber = 1; // XXXX don't cache disasm view data since there is no consistant row to content // map disRenderer.renderSrc(names, data, src_type, sel_src, view_mode); disRenderer.renderDis(data, src_type, sel_instr); // must be called after renderSrc } break; case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: if (srcRenderer != null) { long sel_src = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_SourceSelectedObject, 0); int view_mode = parent.window.getSettings().getViewModeSetting().get().value(); srcRenderer.renderSrc(names, data, src_type, sel_src, view_mode); } break; default: } AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { tableModel.setData(label, data, src_type, null, null); } }); } // Set table data public void setData( final MetricLabel[] metricLabels, final Object[][] data, final String[] names, final int[] src_type, final int org_row, final int name_col, final int sort_col, final int[][] marks, final int[][] marks_inc) { this.names = names; this.orgRow = org_row; this.nameColumn = name_col; this.sortColumn = sort_col; switch (type) { case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: if (disRenderer != null) { long sel_src = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_SourceSelectedObject, 0); long sel_instr = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_Disassembly, 0); int view_mode = parent.window.getSettings().getViewModeSetting().get().value(); disRenderer.maxSrcCachedNumber = 1; // XXXX don't cache disasm view data since there is no consistant row to content // map disRenderer.renderSrc(names, data, src_type, sel_src, view_mode); disRenderer.renderDis(data, src_type, sel_instr); // must be called after renderSrc } break; case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: if (srcRenderer != null) { AnUtility.checkIPCOnWrongThread(false); long sel_src = parent.window.getSelectedObject().getSelObj(AnDisplay.DSP_SourceSelectedObject, 0); AnUtility.checkIPCOnWrongThread(true); int view_mode = parent.window.getSettings().getViewModeSetting().get().value(); srcRenderer.renderSrc(names, data, src_type, sel_src, view_mode); } break; default: } AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { // Set row selection if (org_row > 0 && org_row < table.getRowCount()) { table.changeSelection(org_row, 0, false, false); } tableModel.setData(metricLabels, data, src_type, marks, marks_inc); } }); } private Object[][] getTableData() { return tableModel.getTableData(); } // Set table column size public void setColumn(final int row_height) { this.rowHeight = row_height; tableModel.setColumn(); } // Set row visible; Place the actual update on the system event queue public void showSelectedRow() { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { showSelectedRowNow(); } }); } /** Show selected row Note: use EventDispatchThread to call this method */ public void showSelectedRowNow() { final int vis_row; final Rectangle cellRect, visRect; vis_row = canSort ? tableModel.getSortRow(orgRow) : orgRow; cellRect = table.getCellRect(vis_row, 0, false); visRect = table.getVisibleRect(); cellRect.x = visRect.x; // if current view doesn't include selected row, scroll if (!visRect.contains(cellRect)) { // calculate middle based on selected row // being below or above current visible rows if (visRect.y < cellRect.y) { cellRect.y += visRect.height / 2; } else { cellRect.y -= visRect.height / 2; } table.scrollRectToVisible(cellRect); } // clear multiple selection if (table.getSelectedRowCount() > 1) { table.clearSelection(); } // Set row selection if (table.getSelectedRow() != vis_row) { table.changeSelection(vis_row, 0, false, false); } } // Get keyboard focus @Override public void requestFocus() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { table.requestFocus(); } }); } public void clearSelection() { table.clearSelection(); } // Clear selected row public void clearSelectedRow() { table.clearSelection(); // Should reset the rows after clearSelection, otherwise repeated // recompute request event will be sent. orgRow = -1; } // Get scrolling value public int getScroll() { return getHorizontalScrollBar().getValue(); } // Set scrolling value; Place the actual update on the system event queue public void setScroll(final int scroll_pos) { SwingUtilities.invokeLater( new Runnable() { public void run() { getHorizontalScrollBar().setValue(scroll_pos); } }); } // Move columns public void moveColumn(final int from, final int to) { table.moveColumn(from, to); } // Set column width public void setColumnWidth(final int column, final int width) { final TableColumn col = table.getColumnModel().getColumn(column); if (col.getPreferredWidth() != width) { col.setPreferredWidth(columnWidth[column][0] = width); } } // Return column width info public int[][] getColumnWidth() { return columnWidth; } // Return raw height public int getRowHeight() { return rowHeight; } // Get string width public int stringWidth(final String str) { if (fontMetrics == null) { if (table.getGraphics() == null) { return 0; } fontMetrics = table.getGraphics().getFontMetrics(); } return fontMetrics.stringWidth(str); } public boolean canGoBack() { if (navHistoryPool == null) { return false; } SelObjInfo so = navHistoryPool.getHistory().getBack(); boolean can_go_back = navHistoryPool.getHistory().canGoBack(); boolean inError = anTable.getViewport().getView() != table; if (inError) { so = navHistoryPool.getHistory().getCurrent(); can_go_back = (so != null); } return can_go_back; } public boolean canGoForward() { if (navHistoryPool == null) { return false; } return navHistoryPool.getHistory().canGoForward(); } public void goBack() { String txt = STR_ACTION_BACK; SelObjInfo so = navHistoryPool.getHistory().getBack(); boolean can_go_back = navHistoryPool.getHistory().canGoBack(); boolean inError = anTable.getViewport().getView() != table; if (inError) { so = navHistoryPool.getHistory().getCurrent(); can_go_back = (so != null); } if (so != null && can_go_back) { NavigationHistoryUpdateAction nhua = new NavigationHistoryUpdateAction(txt, so.id, so.lineno, so.name); nhua.actionPerformed(null); } } public void goForward() { String txt = STR_ACTION_FORWARD; SelObjInfo so = navHistoryPool.getHistory().getForward(); if (so != null && navHistoryPool.getHistory().canGoForward()) { NavigationHistoryUpdateAction nhua = new NavigationHistoryUpdateAction(txt, so.id, so.lineno, so.name); nhua.actionPerformed(null); } } // Set current selected row and make it visible public void setSelectedRow(final int org_row) { this.orgRow = org_row; showSelectedRow(); // record history if (navHistoryPool != null && navHistoryPool.getHistory().enabled) { navHistoryPool.getHistory().goToSelected(org_row, false); } } // Experimental code // Set current selected row and make it visible public void setSelectedRowNow(final int org_row) { this.orgRow = org_row; AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { showSelectedRowNow(); } }); } // Return current selected row public int getSelectedRow() { return orgRow; } // Return current selected rows public int[] getSelectedRows() { return selected_indices; } // Find the part after the current row public int findAfter(final String str, final boolean next, boolean caseSensitive) { final int row, nr, last_line; row = tableModel.getSortRow(orgRow); nr = tableModel.getRowCount(); last_line = nr - 1; if (next) { if (row < last_line) { return tableModel.find(str, 1, row + 1, nr, caseSensitive); } } else { if (row > 0) { return tableModel.find(str, -1, row - 1, -1, caseSensitive); } } return -1; } // Find the part before the current row public int findBefore(final String str, final boolean next, boolean caseSensitive) { final int row, nr, last_line; row = tableModel.getSortRow(orgRow); if (row < 0) { return -1; } nr = tableModel.getRowCount(); last_line = nr - 1; if (next) { return tableModel.find(str, 1, 0, row + 1, caseSensitive); } else if (row <= last_line) { return tableModel.find(str, -1, last_line, row - 1, caseSensitive); } return -1; } // Sort table data public void sort(final int col) { if (canSort && (col >= 0)) { tableModel.sort(table.convertColumnIndexToModel(col)); } } // Listener to the event changed private final EventListenerList listenerList = new EventListenerList(); // Add a listener to the list public void addAnListener(final AnListener listener) { listenerList.add(AnListener.class, listener); } // Never used // // Remove a listener from the list // public void removeAnListener(final AnListener listener) { // listenerList.remove(AnListener.class, listener); // } // // Fire AnEvent to the listener public void fireAnEvent(final AnEvent event) { // System.out.println("AnTable fireAnEvent: " + event); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { final Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == AnListener.class) { ((AnListener) listeners[i + 1]).valueChanged(event); } } } }); } // Events listener for row selecting, clicks on cell/row private final class CellHandler implements ListSelectionListener { public final void valueChanged(final ListSelectionEvent event) { final int first, last, new_row; final Rectangle cellRect, visRect; // for mini-c-c pane, only handle mouseclicked event if (type == AnDisplay.DSP_MiniCallee || type == AnDisplay.DSP_MiniCaller) { return; } if (event.getValueIsAdjusting()) { return; } // Which row is selected first = event.getFirstIndex(); if (first == -1) { return; } if (table.getSelectedRowCount() == 1) { // Single selection selectedRow = table.getSelectedRow(); } else { if (selectedRow == first) { last = event.getLastIndex(); // index of last row that may have changed // No change, happens when clicked on header (but now skipped for multi-sel) if ((selectedRow == last) && (type == AnDisplay.DSP_MiniCallee || type == AnDisplay.DSP_MiniCaller)) { return; } selectedRow = last; } else { selectedRow = first; } } // Update status with selected row(s) and total number of rows String selectedRows; if (table.getSelectedRowCount() == 1) { // Single selection selectedRows = "" + (table.getSelectedRow() + 1); } else { DefaultListSelectionModel dlsm = (DefaultListSelectionModel) event.getSource(); selectedRows = (dlsm.getMinSelectionIndex() + 1) + "-" + (dlsm.getMaxSelectionIndex() + 1); } AnWindow.getInstance() .getTableStatusHandle() .setText(selectedRows + "/" + table.getRowCount()); // Make it visible (setAutoscrolls has been turned off) cellRect = table.getCellRect(selectedRow, 0, false); visRect = table.getVisibleRect(); cellRect.x = visRect.x; if (!visRect.contains(cellRect)) { table.scrollRectToVisible(cellRect); } // Need to update summary display new_row = tableModel.getRow(selectedRow); // Get all selected indices ListSelectionModel listmodel = table.getSelectionModel(); if (listmodel.isSelectionEmpty() == false) { selected_indices = table.getSelectedRows(); } // Fire valueChanged event if (orgRow != new_row) { orgRow = new_row; // record history if (!(selectedRow != 0 && orgRow == 0)) { fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, orgRow, null)); if (navHistoryPool != null && navHistoryPool.getHistory().enabled) { navHistoryPool.getHistory().goToSelected(orgRow, true); } } } else { if ((type == AnDisplay.DSP_Lines) || (type == AnDisplay.DSP_PCs)) { fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, orgRow, null)); } } } } // -------------- Properties ---------------- // /** Implements menu item: Properties */ class SettingsAction extends AbstractAction { int index = 0; public SettingsAction(String what, int id) { super(what, AnUtility.gear_icon); index = id; } @Override public void actionPerformed(ActionEvent ev) { parent.window.getSettings().showDialog(index); } } // Events listener for selecting on already selected row for CallerCalleesDisp private final class CallHandler extends MouseAdapter implements ActionListener { @Override public void mouseClicked(final MouseEvent event) { if (event.getClickCount() == 2) { updateSelectedRow(table.rowAtPoint(event.getPoint())); } else { if (event.getButton() == MouseEvent.BUTTON3 && (type == AnDisplay.DSP_MiniCaller || type == AnDisplay.DSP_MiniCallee)) { return; } setSelectedRow(table.rowAtPoint(event.getPoint())); } } @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals("SPACE")) { setSelectedRow(table.getSelectedRow()); } else if (cmd.equals("ENTER")) { int table_row = table.getSelectedRow(); if (table_row == -1) { return; } orgRow = tableModel.getRow(table_row); if (orgRow == -1) { return; } performDefaultAction(); } else if (cmd.equals("CNTRL_C")) { int printLimit = 0; String text = anTable.printSelectedTableContents(null, printLimit); AnUtility.copyToClipboard(text); } } public void setSelectedRow(final int table_row) { // CellHandler will handle this kind of event if (table_row == -1) { return; } orgRow = tableModel.getRow(table_row); if (orgRow < 0) { System.out.println("AnTable.CallHandler.setSelectedRow() org_row=" + orgRow); return; } fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, orgRow, null)); } } private void updateSelectedRow(final int table_row) { // CellHandler will handle this kind of event if (table_row == -1) { return; } orgRow = tableModel.getRow(table_row); if (orgRow < 0) { System.out.println("AnTable.CallHandler.updateSelectedRow() org_row=" + orgRow); return; } fireAnEvent(new AnEvent(anTable, AnEvent.EVT_COMPUTE, orgRow, null)); } private final class TableAdapter extends MouseAdapter { @Override public void mouseClicked(final MouseEvent event) { final int table_row; // int src_type = model.getSrcType(table.getSelectedRow()); // never used if (event.getClickCount() == 2) { table_row = table.getSelectedRow(); if ((orgRow == -1) || (table_row == -1)) { return; } orgRow = tableModel.getRow(table_row); // Perform default action performDefaultAction(); // fireAnEvent(new AnEvent(anTable, AnEvent.EVT_NEWSRC, // orgRow, null)); } else { // Single click is already processed in CellHandler.valueChanged() when selection // changed // fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, // orgRow, null)); switch (type) { case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: if (event.getClickCount() == 1 && event.getButton() == event.BUTTON1 && disRenderer != null) { int row = table.getSelectedRow(); // XXXX since source/disasm views are unsortable, we just // assume no need for model.getRow() disRenderer.updateSelectedRegs(row); boolean isJump = disRenderer.goToAddr(row); if (!isJump) { disRenderer.goToCallee(row, event); } disRenderer.goToSrcLine(row); disRenderer.caretLinePosition = -1; // reset caret position } case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: if (event.getClickCount() == 1 && event.getButton() == event.BUTTON1 && srcRenderer != null) { int row = table.getSelectedRow(); // XXXX since source/disasm views are unsortable, we just // assume no need for model.getRow() srcRenderer.goToCallee(row, event); srcRenderer.caretLinePosition = -1; // reset caret position } } } } } // Events listener for scrolling private final class ScrollHandler implements AdjustmentListener { @Override public void adjustmentValueChanged(final AdjustmentEvent event) { fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SCROLL, event.getValue(), null)); } } // Events listener for column switching private final class OldColumnHandler implements TableColumnModelListener { @Override public void columnMoved(final TableColumnModelEvent event) { final int from, to; from = event.getFromIndex(); to = event.getToIndex(); if (from == to) { return; } fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SWITCH, from, to)); } @Override public void columnMarginChanged(final ChangeEvent event) { final TableColumn resizingColumn; final TableColumnModel cmodel; final int nc, width; int columnIndex; if (tableHeader == null) { return; } if ((resizingColumn = tableHeader.getResizingColumn()) == null) { return; } cmodel = table.getColumnModel(); nc = cmodel.getColumnCount(); for (columnIndex = 0; columnIndex < nc; columnIndex++) { if (cmodel.getColumn(columnIndex) == resizingColumn) { tableModel.fitColumnResize(columnIndex); if (type == AnDisplay.DSP_Callers) { width = resizingColumn.getWidth(); fireAnEvent(new AnEvent(anTable, AnEvent.EVT_RESIZE, columnIndex, width)); } break; } } } @Override public void columnAdded(final TableColumnModelEvent event) {} @Override public void columnRemoved(final TableColumnModelEvent event) {} @Override public void columnSelectionChanged(final ListSelectionEvent event) {} } // Table Model for Function List public final class FListTableModel extends AbstractTableModel { // public for memobj/indexobj public MetricLabel[] metricLabels; private Object[][] data; private int[] src_type; private Row[] rows; private int rowCount; private int columnCount; public HashMap> hotMarks; public HashMap> hotMarks_inc; // Constructor public FListTableModel() { initData(); } public void updateTableHeaders() { boolean wrapMetricNames = AnTable.this.wrapMetricNames; if (AnTable.this.wrapMetricNames) { wrapMetricNames = AnWindow.getInstance().getSettings().getTableSettings().wrapMetricNames(); } allHeaderPanel = new AnTableHeaderPanel(AnTable.this, metricLabels, wrapMetricNames); setColumnHeaderView(allHeaderPanel); if (allHeaderPanel.getPreferredSize().height > 1 && hotGapPanel != null) { hotGapPanel.headerheightChanged(allHeaderPanel.getPreferredSize().height); } } public boolean isCellEditable(int row, int col) { int st = tableModel.getSrcType(row); if (st < 0) { st = -st; } // Just single string if (this.data[col][row] instanceof String) { if ((type != AnDisplay.DSP_DataLayout) && ((st == AT_SRC) || (st == AT_SRC_ONLY) || (st == AT_DIS) || (st == AT_DIS_ONLY))) { return (col == nameColumn); } } return false; } // Initialize data private void initData() { metricLabels = new MetricLabel[0]; data = new Object[1][0]; src_type = new int[0]; rows = new Row[0]; columnCount = 0; rowCount = 0; hotMarks = new HashMap>(); hotMarks_inc = new HashMap>(); } // Remove all rows & columns public final void removeAll() { initData(); fireTableChanged(null); } // Remove all rows public final void removeAllRows() { rowCount = 0; fireTableChanged(null); } // Set table data public final void setData( MetricLabel[] metricLabels, Object[][] data, int[] src_type, int[][] marks, int[][] marks_inc) { this.data = data; this.src_type = src_type; // Get numbers of rows/columns columnCount = metricLabels.length; // FIXUP: sometimes label == null if you quickly select/deselect metrics in // overview rowCount = data[0].length; // Initialize the rows elements rows = new Row[rowCount]; for (int i = 0; i < rowCount; i++) { rows[i] = new Row(i); } setLabel(metricLabels); if (marks != null && marks_inc != null) { for (int i = 0; i < marks[0].length; i++) { HashMap colMarks = hotMarks.get(marks[0][i]); if (colMarks == null) { colMarks = new HashMap(); hotMarks.put(marks[0][i], colMarks); } colMarks.put(marks[1][i], true); } for (int i = 0; i < marks_inc[0].length; i++) { HashMap colMarks = hotMarks_inc.get(marks_inc[0][i]); if (colMarks == null) { colMarks = new HashMap(); hotMarks_inc.put(marks_inc[0][i], colMarks); } colMarks.put(marks_inc[1][i], true); } } // New headers if (hasHeader) { updateTableHeaders(); } } private Object[][] getTableData() { // public for mem/idx objs return data; } // Returns line contents for selected row public String getSrcLine(final int row) { return (row != -1) ? (String) getValueAt(row, nameColumn) : null; } // Set table label only private void setLabel(final MetricLabel[] label) { this.metricLabels = label; // Use "AWT-EventQueue-0" thread to avoid race conditions AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { if (!columnsSaved) { columnWidth = new int[columnCount][4]; } if (columnCount != 0) { initWidth(); } // Update later for caller-callee display; need the maximum width if (hasSelect) { setColumn(); } } }); } // Set table columns for caller-callee display public final void setColumn() { if (columnCount != 0) { fitColumn(); table.setRowHeight(rowHeight); } fireTableChanged(null); } // Sizes the table columns to fit the available space. private void fitColumn() { int total_width, i; if (isSingle || (nameColumn < 0)) { return; } total_width = getViewportBorderBounds().width; for (i = 0; i < columnCount; i++) { if (i != nameColumn) { total_width -= columnWidth[i][0]; } } nameWidth = columnWidth[nameColumn][0]; if (columnWidth[nameColumn][0] < total_width) { columnWidth[nameColumn][0] = total_width; } } // Sizes the table columns to fit the available space. public final void fitColumnResize(final int index) { int ext_width; final TableColumnModel cm; final TableColumn column; if (isSingle || (index == nameColumn) || (nameColumn < 0)) { return; } ext_width = getViewportBorderBounds().width; cm = table.getColumnModel(); // Compute the extendable width of the name column for (int i = 0; i < columnCount; i++) { if (i != nameColumn) { ext_width -= cm.getColumn(i).getWidth(); } } // Extend the name column if (nameWidth < ext_width) { column = cm.getColumn(nameColumn); column.setPreferredWidth(ext_width); column.setWidth(ext_width); if (type == AnDisplay.DSP_Callers) { fireAnEvent(new AnEvent(anTable, AnEvent.EVT_RESIZE, nameColumn, ext_width)); } } // if the user has manually adjusted the columns, note it & save the size if (index >= 0) { columnsSaved = true; final TableColumn col = cm.getColumn(index); columnWidth[index][0] = col.getWidth(); } } // Find the maximum column width for each field private void initWidth() { CellPanel cpanel = new CellPanel(table, true, FlowLayout.CENTER); cpanel.add(new FListLabel(AnVariable.all_chars, table, JLabel.LEFT)); rowHeight = cpanel.getPreferredSize().height; for (int i = 0; i < columnCount; i++) { int totalColumnWidth = 0; CellPanel cellPanel = new CellPanel(table, true, FlowLayout.CENTER); MetricLabel lb = metricLabels[i]; if (data[i] instanceof String[]) { FListLabel fListLabel = new FListLabel(lb.getMaxAnObject().toString(), table, JLabel.LEFT); int cellwidth = fListLabel.getPreferredSize().width + 15; totalColumnWidth += cellwidth; cellPanel.add(fListLabel); columnWidth[i][1] = cellwidth; } else { if (lb.getClock() != -1.0) { FListLabel fListLabel = new FListLabel(lb.getMaxAnObject().toFormTime(lb.getClock()), table, JLabel.RIGHT); int cellwidth = fListLabel.getPreferredSize().width + 15; totalColumnWidth += cellwidth; columnWidth[i][1] = cellwidth; } if (lb.getUnit() != null) { FListLabel fListLabel = new FListLabel(lb.getMaxAnObject().toFormString(), table, JLabel.RIGHT); int cellwidth = fListLabel.getPreferredSize().width + 15; totalColumnWidth += cellwidth; columnWidth[i][2] = cellwidth; } if (lb.getTotal() != -1.0) { FListLabel fListLabel = new FListLabel(lb.getMaxAnObject().toPercent(lb.getTotal()), table, JLabel.RIGHT); int cellwidth = fListLabel.getPreferredSize().width + 15; totalColumnWidth += cellwidth; columnWidth[i][3] = cellwidth; } } columnWidth[i][0] = totalColumnWidth + 30; // Saves white space int minCellWidth; if (AnWindow.getInstance().getExperimentGroups().length == 1) { minCellWidth = getMinimumColumnWidth(); } else { minCellWidth = getMinimumColumnWidth() / 2; } if (columnWidth[i][0] < minCellWidth) { columnWidth[i][0] = minCellWidth; } } } @Override public final int getRowCount() { return rowCount; } @Override public final int getColumnCount() { return columnCount; } public final int getSrcType(final int r) { int res = AT_LIST; try { if ((src_type != null) && (r < rowCount)) { res = src_type[r]; } } catch (java.lang.ArrayIndexOutOfBoundsException e) { // CR 6999912 } return (res); } public final MetricLabel getLabel(final int c) { if (metricLabels != null) { if (metricLabels.length > c) { if (c >= 0) { return metricLabels[c]; } } } return null; } public final String getColumnName(final int c) { return ((c >= 0) && (c < columnCount)) ? metricLabels[c].getTitleLines()[0] + metricLabels[c].getTitleLines()[1] + metricLabels[c].getIcon() : ""; } // Needed for memobj/indexobj display public int getNameCol() { return nameColumn; } public final Object getValueAt(final int r, final int c) { int idx = 0; try { if (r < rowCount) { if (rows[r] == null) { return null; } idx = rows[r].index; } if ((c >= 0) && (c < columnCount) && (data[c] != null) && (idx < data[c].length)) { return data[c][idx]; } } catch (java.lang.ArrayIndexOutOfBoundsException e) { // CR 6999912 (desynchronization) return null; } return null; } // Find private final int find( String str, final int incr, int start, final int end, boolean caseSensitive) { String text; if (str == null) { // Search for High-Metric item while (start != end) { if (getSrcType(start) < 0) { return start; } start += incr; } } else if (nameColumn >= 0) { // Search string if (!caseSensitive) { str = str.toLowerCase(); } while ((start != -1) && (start != end)) { text = (String) getValueAt(start, nameColumn); if (text == null) { // see 23193063 return -1; } if (!caseSensitive) { text = text.toLowerCase(); } if ((text != null) && (text.indexOf(str) != -1)) { return getRow(start); } start += incr; } } return -1; } // Get the un-sorted row index public final int getRow(final int row) { if (row >= rows.length) { return 0; } return (rowCount == 0) ? row : rows[row].index; } // Get the sorted row index public final int getSortRow(final int row) { try { // For most case, non-sorted, it's just the original row index if ((rowCount == 0) || (row == -1) || (rows[row].index == row)) { return row; } for (int i = 0; i < rowCount; i++) { if (rows[i].index == row) { return i; } } } catch (java.lang.ArrayIndexOutOfBoundsException e) { // CR 6999912 (desynchronization) return row; } return row; } // Sort the table data public void sort(final int col) { // Sort by column sortColumn sortColumn = col; // if (type != AnDisplay.DSP_DLAYOUT) // Arrays.sort(rows); fireTableDataChanged(); // Repaint header, header's sort indicator changed if (hasHeader) { tableHeader.repaint(); } // Restore the selected row, should be after updating table data if (hasSelect) { showSelectedRow(); } } // Object which stores the un-sorted row index private final class Row implements Comparable { public final int index; public Row(final int index) { this.index = index; } public final int compareTo(final Row other) { final int col = (sortColumn >= 0) ? sortColumn : -sortColumn - 1; final int index_o = other.index; final Object a = data[col][index]; final Object b = data[col][index_o]; return index - index_o; } } } // Table Column Model for Function List private final class FListColumnModel extends DefaultTableColumnModel { // Set column width here @Override public void moveColumn(int columnIndex, int newIndex) { if (columnIndex == newIndex) { return; } if (columnIndex < 0) { // HACK: why is columnIndex < 0? Sometimes it is if you quickly move a column. return; } super.moveColumn( columnIndex, newIndex); // To change body of generated methods, choose Tools | Templates. } public void addColumn(final TableColumn tc) { final int width; width = columnWidth[tc.getModelIndex()][0]; tc.setPreferredWidth(width); tc.setWidth(width); super.addColumn(tc); } // Workaround for (columnIndex>=tableColumns.size()), Swing sync problem public TableColumn getColumn(int columnIndex) { final int size = tableColumns.size(); TableColumn tc; if ((columnIndex < 0) || (columnIndex >= size)) { if (size > 0) { columnIndex = 0; } else { return new TableColumn(); } } if (size <= 0) { return new TableColumn(); } try { tc = tableColumns.elementAt(columnIndex); } catch (java.lang.ArrayIndexOutOfBoundsException e) { tc = new TableColumn(); } return tc; } } public void sortTable(int colNum) { if (colNum >= tableModel.getColumnCount()) { return; } final int model_col = table.convertColumnIndexToModel(colNum); tableModel.sort(model_col); AnEvent ev = new AnEvent(anTable, AnEvent.EVT_SORT, model_col, type, colNum); fireAnEvent(ev); table.requestFocus(); } /* * Update tables in Callers-Callees tab * Possible actions: * Prepend - insert selected caller at the beginning of the stack fragment * Append - add selected callee to the end of the stack fragment * Recenter - replace the stack fragment with the selected function * Remove - remove selected function from the stack fragment * Reset - replace the stack fragment with the Selected Object * Set Head - remove all functions above the selected function from the stack fragment * Set Tail - remove all functions below the selected function from the stack fragment * Set Filter: Name in Stack - set the selected function name as filter * Set Filter: Call Path in Stack - set the call path to the selected function as filter * Set Filter: Function in Stack - set the selected function as filter * Set Filter: Function is Leaf - set the selected function as filter */ protected void updateAnTable(String actionName) { updateTable(null, null, actionName); if (!(parent instanceof IOView) && !(parent instanceof HeapView)) { parent.updateToolBar(); parent.syncSrcDisWin(); } } private void updateTable(String shortName, String longName, String actionName) { if ((parent != null) && ((parent instanceof CallerCalleesView) || (parent instanceof FuncListDisp))) { if (actionName.equals(STR_ACTION_REMOVE_ALL_FILTERS)) { parent.window.getFilters().addClause(FilterClause.getNoFiltersClause(), false); return; } if (actionName.equals(STR_ACTION_UNDOFILTER)) { parent.window.getFilters().undoLastFilteraction(); return; } if (actionName.equals(STR_ACTION_REDOFILTER)) { parent.window.getFilters().redoLastFilteraction(); return; } if (actionName.equals(STR_ACTION_SHOW_SELECTED_FUNCTION)) { if (orgRow >= 0) { fireAnEvent( new AnEvent( anTable, AnEvent.EVT_COMPUTE, // AnEvent.EVT_UPDATE, orgRow, null)); } return; } if (actionName.equals(STR_ACTION_SHOW_SOURCE)) { parent.window.setSelectedView(AnDisplay.DSP_Source); return; } if (actionName.equals(STR_ACTION_SHOW_CALLEE_SOURCE) || actionName.equals(STR_ACTION_SHOW_CALLER_SOURCE)) { if (parent.parent_type == AnDisplay.DSP_SourceDisassembly || parent.parent_type == AnDisplay.DSP_DualSource) { parent.window.setSelectedView(parent.parent_type); } else { parent.window.setSelectedView(AnDisplay.DSP_Source); } return; } if (actionName.equals(STR_ACTION_SHOW_CALLEE_DISASM) || actionName.equals(STR_ACTION_SHOW_CALLER_DISASM)) { if (parent.parent_type == AnDisplay.DSP_SourceDisassembly) { parent.window.setSelectedView(parent.parent_type); } else { parent.window.setSelectedView(AnDisplay.DSP_Disassembly); } return; } if (actionName.equals(STR_ACTION_SHOW_DISASM)) { parent.window.setSelectedView(AnDisplay.DSP_Disassembly); return; } if (actionName.equals(STR_ACTION_CUSTOM_FILTER)) { parent.window.getFilters().showCustomFilterDialog(); return; } boolean setFilter = false; long ID = parent.window.getSelectedObject().getSelObjV2("FUNCTION"); long[] cstack = null; String clause = "(" + ID + ")"; String stack = parent.window.getSettings().getViewModeSetting().getStackName(); if (parent instanceof CallerCalleesView) { cstack = ((CallerCalleesView) parent).getStack(); } if (actionName.equals(FILTER_SIMILARLY_NAMED_ACTION_NAME)) { setFilter = true; clause = parent.window.getObjNameV2(ID); clause = getFunctionName(clause); clause = "(FNAME(\".*" + clause + ".*\") SOME IN " + stack + ")"; } else if (actionName.equals(FILTER_WITH_SELECTED_JGROUP_ACTION_NAME)) { setFilter = true; int namecol = getTableModel().getNameCol(); for (int selrow : anTable.getSelectedRows()) { String name = (String) getTableModel().data[namecol][selrow]; if (name.contains("JThread")) { int indx0 = name.indexOf("Group"); int indx1 = name.indexOf("'", indx0); int indx2 = name.indexOf(",", indx1 + 1); if (indx2 == -1) { indx2 = name.lastIndexOf("'"); } else { indx2--; } clause = name.substring(indx1 + 1, indx2); break; } } clause = "(JGROUP(\"" + clause + "\") SOME IN JTHREAD)"; } else if (actionName.equals(FILTER_WITH_SELECTED_JPARENT_ACTION_NAME)) { setFilter = true; int namecol = getTableModel().getNameCol(); for (int selrow : anTable.getSelectedRows()) { String name = (String) getTableModel().data[namecol][selrow]; if (name.contains("JThread")) { int indx0 = name.indexOf("Parent"); int indx1 = name.indexOf("'", indx0); int indx2 = name.indexOf(",", indx1 + 1); if (indx2 == -1) { indx2 = name.lastIndexOf("'"); } else { indx2--; } clause = name.substring(indx1 + 1, indx2); break; } } clause = "(JPARENT(\"" + clause + "\") SOME IN JTHREAD)"; } else if (actionName.equals(FILTER_SELECTED_FUNCTION_ACTION_NAME) || actionName.equals(FILTER_SELECTED_FUNCTIONS_ACTION_NAME)) { setFilter = true; if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { // Special case for Callers-Callees view (CR 25631707) if (selected_indices.length > 1) { clause = "(" + clause + " SOME IN " + stack + ")"; } else { clause = "(" + clause + " IN " + stack + ")"; } } else { clause = getFilterForSelectedObjects(stack); } } else if (actionName.equals(FILTER_SELECTED_LINE_ACTION_NAME) || actionName.equals(FILTER_SELECTED_LINES_ACTION_NAME)) { setFilter = true; clause = getFilterForSelectedObjects(stack + "L"); } else if (actionName.equals(FILTER_SELECTED_PC_ACTION_NAME) || actionName.equals(FILTER_SELECTED_PCS_ACTION_NAME)) { setFilter = true; clause = getFilterForSelectedObjects(stack + "I"); } else if (actionName.equals(FILTER_NOT_SELECTED_FUNCTION_ACTION_NAME) || actionName.equals(FILTER_NOT_SELECTED_FUNCTIONS_ACTION_NAME)) { setFilter = true; clause = String.format("(!%s)", getFilterForSelectedObjects(stack)); } else if (actionName.equals(FILTER_NOT_SELECTED_LINE_ACTION_NAME) || actionName.equals(FILTER_NOT_SELECTED_LINES_ACTION_NAME)) { setFilter = true; clause = String.format("(!%s)", getFilterForSelectedObjects(stack + "L")); } else if (actionName.equals(FILTER_NOT_SELECTED_PC_ACTION_NAME) || actionName.equals(FILTER_NOT_SELECTED_PCS_ACTION_NAME)) { setFilter = true; clause = String.format("(!%s)", getFilterForSelectedObjects(stack + "I")); } else if (actionName.equals(FILTER_LEAF_FUNCTION_ACTION_NAME) || actionName.equals(FILTER_LEAF_FUNCTIONS_ACTION_NAME)) { setFilter = true; if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { // Special case for Callers-Callees view (CR 25644886) clause = "((" + stack + "+0) IN " + clause + ")"; } else { clause = String.format("((%s+0) IN %s)", stack, get_list_of_selected_objects()); } } else if (actionName.equals(FILTER_CALLSTACK_FRAGMENT_ACTION_NAME)) { setFilter = true; if ((cstack != null) && (cstack.length > 0)) { clause = "("; for (int i = 0; ; ) { clause = clause + cstack[i]; if (++i < cstack.length) { clause = clause + ","; } else { clause = clause + ")"; break; } } clause = "(" + clause + " ORDERED IN " + stack + ")"; } } else if (actionName.equals(FILTER_NOT_CALLSTACK_FRAGMENT_ACTION_NAME)) { setFilter = true; if ((cstack != null) && (cstack.length > 0)) { clause = "("; for (int i = 0; ; ) { clause = clause + cstack[i]; if (++i < cstack.length) { clause = clause + ","; } else { clause = clause + ")"; break; } } clause = "(!(" + clause + " ORDERED IN " + stack + "))"; } } else if (actionName.equals(FILTER_WITH_SELECTED_FILE_ACTION_NAME)) { long ids[] = AnWindow.getInstance().getIOView().getSelectedIds(selected_indices, AnDisplay.DSP_IO); if (ids != null && ids.length > 0) { long[] vfds = parent.window.getSelectedObject().getSelObjsIO(ids, AnDisplay.DSP_IO); if (vfds != null && vfds.length > 0) { StringBuffer strBuf = new StringBuffer(); strBuf.append("(IOVFD IN ("); for (int i = 0; i < vfds.length; i++) { strBuf.append(vfds[i]); if (i + 1 < vfds.length) { strBuf.append(","); } } strBuf.append("))"); clause = strBuf.toString(); setFilter = true; } } } else if (actionName.equals(FILTER_NOT_SELECTED_FILE_ACTION_NAME)) { long ids[] = AnWindow.getInstance().getIOView().getSelectedIds(selected_indices, AnDisplay.DSP_IO); if (ids != null && ids.length > 0) { long[] vfds = parent.window.getSelectedObject().getSelObjsIO(ids, AnDisplay.DSP_IO); if (vfds != null && vfds.length > 0) { StringBuffer strBuf = new StringBuffer(); strBuf.append("!(IOVFD IN ("); for (int i = 0; i < vfds.length; i++) { strBuf.append(vfds[i]); if (i + 1 < vfds.length) { strBuf.append(","); } } strBuf.append("))"); clause = strBuf.toString(); setFilter = true; } } } else if (actionName.equals(FILTER_WITH_SELECTED_IOVFD_ACTION_NAME)) { long ids[] = AnWindow.getInstance() .getIOView() .getSelectedIds(selected_indices, AnDisplay.DSP_IOFileDescriptors); if (ids != null && ids.length > 0) { long[] vfds = parent.window.getSelectedObject().getSelObjsIO(ids, AnDisplay.DSP_IOFileDescriptors); if (vfds != null && vfds.length > 0) { StringBuffer strBuf = new StringBuffer(); strBuf.append("(IOVFD IN ("); for (int i = 0; i < vfds.length; i++) { strBuf.append(vfds[i]); if (i + 1 < vfds.length) { strBuf.append(","); } } strBuf.append("))"); clause = strBuf.toString(); setFilter = true; } } } else if (actionName.equals(FILTER_NOT_SELECTED_IOVFD_ACTION_NAME)) { long ids[] = AnWindow.getInstance() .getIOView() .getSelectedIds(selected_indices, AnDisplay.DSP_IOFileDescriptors); if (ids != null && ids.length > 0) { long[] vfds = parent.window.getSelectedObject().getSelObjsIO(ids, AnDisplay.DSP_IOFileDescriptors); if (vfds != null && vfds.length > 0) { StringBuffer strBuf = new StringBuffer(); strBuf.append("!(IOVFD IN ("); for (int i = 0; i < vfds.length; i++) { strBuf.append(vfds[i]); if (i + 1 < vfds.length) { strBuf.append(","); } } strBuf.append("))"); clause = strBuf.toString(); setFilter = true; } } } else if (actionName.equals(FILTER_WITH_SELECTED_IOSTACK_ACTION_NAME)) { long stackIds[] = AnWindow.getInstance() .getIOView() .getSelectedIds(selected_indices, AnDisplay.DSP_IOCallStacks); if (stackIds != null && stackIds.length > 0) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("("); for (int j = 0; j < stackIds.length; j++) { StringBuffer strBuf2 = new StringBuffer(); strBuf2.append("(("); strBuf2.append(stackIds[j]); strBuf2.append(")"); strBuf2.append(" == STACKID )"); setFilter = true; if (strBuf2.length() > 0) { strBuf1.append(strBuf2.toString()); } if ((j + 1 < stackIds.length) && (strBuf2.length() > 0)) { strBuf1.append(" || "); } } strBuf1.append(")"); clause = strBuf1.toString(); } } else if (actionName.equals(FILTER_NOT_SELECTED_IOSTACK_ACTION_NAME)) { long stackIds[] = AnWindow.getInstance() .getIOView() .getSelectedIds(selected_indices, AnDisplay.DSP_IOCallStacks); if (stackIds != null && stackIds.length > 0) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("(!("); for (int j = 0; j < stackIds.length; j++) { StringBuffer strBuf2 = new StringBuffer(); strBuf2.append("(("); strBuf2.append(stackIds[j]); strBuf2.append(")"); strBuf2.append(" == STACKID )"); setFilter = true; if (strBuf2.length() > 0) { strBuf1.append(strBuf2.toString()); } if ((j + 1 < stackIds.length) && (strBuf2.length() > 0)) { strBuf1.append(" || "); } } strBuf1.append("))"); clause = strBuf1.toString(); } } else if (actionName.equals(FILTER_WITH_SELECTED_HEAPSTACK_ACTION_NAME)) { long stackIds[] = AnWindow.getInstance() .getHeapView() .getSelectedIds(selected_indices, AnDisplay.DSP_Heap); if (stackIds != null && stackIds.length > 0) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("("); for (int j = 0; j < stackIds.length; j++) { StringBuffer strBuf2 = new StringBuffer(); strBuf2.append("(("); strBuf2.append(stackIds[j]); strBuf2.append(")"); strBuf2.append(" == STACKID )"); setFilter = true; if (strBuf2.length() > 0) { strBuf1.append(strBuf2.toString()); } if ((j + 1 < stackIds.length) && (strBuf2.length() > 0)) { strBuf1.append(" || "); } } strBuf1.append(")"); clause = strBuf1.toString(); } } else if (actionName.equals(FILTER_NOT_SELECTED_HEAPSTACK_ACTION_NAME)) { long stackIds[] = AnWindow.getInstance() .getHeapView() .getSelectedIds(selected_indices, AnDisplay.DSP_Heap); if (stackIds != null && stackIds.length > 0) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("(!("); for (int j = 0; j < stackIds.length; j++) { StringBuffer strBuf2 = new StringBuffer(); strBuf2.append("(("); strBuf2.append(stackIds[j]); strBuf2.append(")"); strBuf2.append(" == STACKID )"); setFilter = true; if (strBuf2.length() > 0) { strBuf1.append(strBuf2.toString()); } if ((j + 1 < stackIds.length) && (strBuf2.length() > 0)) { strBuf1.append(" || "); } } strBuf1.append("))"); clause = strBuf1.toString(); } } else if (actionName.equals(FILTER_WITH_SELECTED_HEAPACTIVESTACK_ACTION_NAME)) { long stackId = 0; long stackIds[] = AnWindow.getInstance() .getHeapView() .getSelectedIds(selected_indices, AnDisplay.DSP_Heap); if (stackIds != null && stackIds.length > 0) { // Only one stack id can be selected. stackId = stackIds[0]; } long peakTimestamp = parent.window.getSelectedObject().getSelObjHeapTimestamp(stackId); // Get the user experiment id. Set the stackId to zero for Total Hist obj int userExpId = parent.window.getSelectedObject().getSelObjHeapUserExpId(0); StringBuffer strBuf1 = new StringBuffer(); if (peakTimestamp > 0) { strBuf1.append( "!((TSTAMP_HI < " + peakTimestamp + ") || (TSTAMP_LO > " + peakTimestamp + ")) && (( EXPID==" + userExpId + " ))"); setFilter = true; clause = strBuf1.toString(); } } else if (actionName.equals(FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME)) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("( HLEAKED > 0 )"); setFilter = true; clause = strBuf1.toString(); } else if (actionName.equals(FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME)) { StringBuffer strBuf1 = new StringBuffer(); strBuf1.append("(( HSIZE > 0 ) && ( HLEAKED == 0))"); setFilter = true; clause = strBuf1.toString(); } if (setFilter) { // parent.window.filter.showDialog(); // parent.window.filter.setSelectedTab(1); // Select advanced filter tab parent .window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field return; } } if (gap != null) { if (actionName.equals(gap.STR_ACTION_NEXT_HOT_LINE)) { gap.HG_Next_Hot_Line(); return; } if (actionName.equals(gap.STR_ACTION_NEXT_NZ_LINE)) { gap.HG_Next_NZ_Line(); return; } if (actionName.equals(gap.STR_ACTION_PREV_HOT_LINE)) { gap.HG_Prev_Hot_Line(); return; } if (actionName.equals(gap.STR_ACTION_PREV_NZ_LINE)) { gap.HG_Prev_NZ_Line(); return; } } if ((parent != null) && ((parent.type == AnDisplay.DSP_IndexObject || parent.type == AnDisplay.DSP_MemoryObject))) { // Threads, CPUs, Samples, Seconds tabs AnUtility.checkIPCOnWrongThread(false); setStandardFilter(shortName, longName, actionName); // IPC AnUtility.checkIPCOnWrongThread(true); } // XXX: AWT - Everything below can be done on AWT thread, // so this code should be moved up to the beginning of this method int disp_type = type; if (parent.parent_type == AnDisplay.DSP_SourceDisassembly || parent.parent_type == AnDisplay.DSP_DualSource) { disp_type = parent.parent_type; } if ((disp_type == AnDisplay.DSP_Source) || (disp_type == AnDisplay.DSP_SourceV2) || (disp_type == AnDisplay.DSP_Disassembly) || (disp_type == AnDisplay.DSP_DisassemblyV2) || (disp_type == AnDisplay.DSP_SourceDisassembly) || (disp_type == AnDisplay.DSP_DualSource)) { if (actionName.equals(STR_ACTION_BACK) || actionName.equals(STR_ACTION_FORWARD)) { parent.window.setSelectedView(disp_type); return; } } // Fire events AnEvent ev; if (actionName.equals(STR_ACTION_BACK)) { ev = new AnEvent(anTable, AnEvent.EVT_BACK, orgRow, null); } else if (actionName.equals(STR_ACTION_FORWARD)) { ev = new AnEvent(anTable, AnEvent.EVT_FORWARD, orgRow, null); } else if (actionName.equals(STR_ACTION_SETHEAD)) { ev = new AnEvent(anTable, AnEvent.EVT_SETHEAD, orgRow, null); } else if (actionName.equals(STR_ACTION_SETTAIL)) { ev = new AnEvent(anTable, AnEvent.EVT_SETTAIL, orgRow, null); } else if (actionName.equals(STR_ACTION_RECENTER)) { ev = new AnEvent(anTable, AnEvent.EVT_SET, orgRow, null); } else if (actionName.equals(STR_ACTION_RESET)) { ev = new AnEvent(anTable, AnEvent.EVT_RESET, orgRow, null); } else if (actionName.equals(STR_ACTION_COPY_ALL)) { ev = new AnEvent(anTable, AnEvent.EVT_COPY_ALL, orgRow, null); } else if (actionName.equals(STR_ACTION_COPY_SEL)) { ev = new AnEvent(anTable, AnEvent.EVT_COPY_SEL, orgRow, null); } else { ev = new AnEvent(anTable, AnEvent.EVT_UPDATE, orgRow, null); } fireAnEvent(ev); table.requestFocus(); } private String get_list_of_selected_objects() { AnUtility.checkIPCOnWrongThread(false); String sObjs = ((FuncListDisp) parent).composeFilterClause(parent.type, parent.subtype, selected_indices); AnUtility.checkIPCOnWrongThread(true); if (sObjs == null) { // Should never happen sObjs = "0"; } String pattern1 = "(LEAF IN ("; if (sObjs.startsWith(pattern1)) { String pattern2 = "))"; if (sObjs.endsWith(pattern2)) { int c1 = pattern1.length() - 1; int c2 = sObjs.length() - 1; sObjs = sObjs.substring(c1, c2); } } return sObjs; } private String getFilterForSelectedObjects(final String stackName) { String sObjs = get_list_of_selected_objects(); AnUtility.checkIPCOnWrongThread(false); String fltr = String.format("(%s SOME IN %s)", sObjs, stackName); return fltr; } /** * Get Function Name * * @param s - a function name with arguments * @return fs - function name */ private String getFunctionName(String s) { String fs = s; if (null != s) { int i = s.indexOf("("); if (i >= 0) { // Everything that is inside (...) is not a part of function name fs = s.substring(0, i); } } return fs; } /** * Sets Standard Filter for Index Object tabs: Threads, CPUs, Samples, Seconds * * @param actionName */ private void setStandardFilter(String shortName, String longName, String actionName) { boolean setFilter = false; String clause = null; if (selected_indices.length > 0) { clause = parent.window.composeFilterClause(parent.type, parent.subtype, selected_indices); if (actionName.equals(FILTER_WITH_SELECTED_ITEMS_ACTION_NAME)) { setFilter = true; } if (actionName.equals(FILTER_WITHOUT_SELECTED_ITEMS_ACTION_NAME)) { clause = "(!" + clause + ")"; setFilter = true; } } if (actionName.equals(STR_ACTION_REMOVE_ALL_FILTERS)) { clause = "1"; setFilter = true; } if (setFilter) { // parent.window.filter.showDialog(); // parent.window.filter.setSelectedTab(1); // Select advanced filter tab parent .window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field return; } } private String getSelectedViewDisplayName() { String ret = "Table"; if (parent != null && parent.window != null) { ret = parent.window.getSelectedView().getDisplayName(); } return ret; } public JPopupMenu initPopup(boolean filterOnly) { JPopupMenu popup = new JPopupMenu(); boolean row_selected = false; int row = table.getSelectedRow(); if (row >= 0) { row_selected = true; } String viewName = getSelectedViewDisplayName(); if (filterOnly) { addFilterPopup(filterOnly, popup, type, viewName, row_selected); } else { addAllPopup(filterOnly, popup, type, viewName, row, row_selected); } return popup; } private void addAllPopup( boolean filterOnly, JPopupMenu popup, int type, String viewName, int row, boolean row_selected) { AccessibleContext ac; UpdateAction ua; JMenuItem mi; JMenu me; String txt; // Add default action if ((type == AnDisplay.DSP_Functions) || (type == AnDisplay.DSP_Lines)) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Show Source" action txt = STR_ACTION_SHOW_SOURCE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // popup.addSeparator(); // Add "Show Disassembly" action txt = STR_ACTION_SHOW_DISASM; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } else if (type == AnDisplay.DSP_PCs) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Show Disassembly" action txt = STR_ACTION_SHOW_DISASM; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } else if ((type == AnDisplay.DSP_Source) || (type == AnDisplay.DSP_SourceV2) || (type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { SrcRenderer renderer = null; if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { renderer = srcRenderer; } else { renderer = disRenderer; } // show a list if lines in multiple functions that are chosen int num = table.getSelectedRows().length; HashMap funcMap = new HashMap(); int funcNum = 0; if (num > 0) { for (int i = 0; i < num; i++) { int r = table.getSelectedRows()[i]; if (renderer.functionId != null && r > 0 && r <= renderer.functionId.size()) { Long funcId = renderer.functionId.get(r); if (funcId != 0 && funcMap.get(funcId) == null) { funcMap.put(funcId, r); } } } for (Long idx : funcMap.keySet()) { int r = funcMap.get(idx).intValue(); String funcName = renderer.getFunction(r); if (funcName != null) { funcNum++; } } } if ((type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) || (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2)) { txt = STR_ACTION_BACK; SelObjInfo so = navHistoryPool.getHistory().getBack(); boolean can_go_back = navHistoryPool.getHistory().canGoBack(); boolean inError = anTable.getViewport().getView() != table; if (inError) { so = navHistoryPool.getHistory().getCurrent(); can_go_back = (so != null); } if (so != null) { NavigationHistoryUpdateAction nhua = new NavigationHistoryUpdateAction(txt, so.id, so.lineno, so.name); mi = new JMenuItem(nhua); } else { mi = new JMenuItem(txt); } ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(can_go_back); mi.setAccelerator(KeyboardShortcuts.backwardActionShortcut); popup.add(mi); txt = STR_ACTION_FORWARD; so = navHistoryPool.getHistory().getForward(); if (so != null) { NavigationHistoryUpdateAction nhua = new NavigationHistoryUpdateAction(txt, so.id, so.lineno, so.name); mi = new JMenuItem(nhua); } else { mi = new JMenuItem(txt); } ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(navHistoryPool.getHistory().canGoForward()); mi.setAccelerator(KeyboardShortcuts.forwardActionShortcut); popup.add(mi); if (popup.getComponentCount() > 0) { popup.addSeparator(); } // add "show callee source/disasm" int[] selectedRows = table.getSelectedRows(); ArrayList callsiteRows = new ArrayList<>(); for (int i = 0; i < selectedRows.length; i++) { int sr = selectedRows[i]; ArrayList calleeFuncs = renderer.calleeInfo.get(sr); if (calleeFuncs != null) { callsiteRows.add(sr); } } JMenuItem mi_dis = null; JMenu me_dis = null; if (callsiteRows.size() > 0) { txt = STR_ACTION_SHOW_CALLEE_SOURCE; // XXXX if the position is changed, please update the // offset in srcRenderer.goToCallee too String txt_dis = STR_ACTION_SHOW_CALLEE_DISASM; me = new JMenu(new UpdateAction(txt)); me_dis = new JMenu(new UpdateAction(txt_dis)); me.setEnabled( row_selected && (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2 || parent.parent_type != AnDisplay.DSP_SourceDisassembly)); JMenu cur_me = me; me_dis.setEnabled( row_selected && (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2 || parent.parent_type != AnDisplay.DSP_SourceDisassembly)); JMenu cur_me_dis = me_dis; int num_items = 0; HashMap calleeSeen = new HashMap(); for (int i = 0; i < callsiteRows.size(); i++) { int sr = callsiteRows.get(i); ArrayList calleeFuncs = renderer.calleeInfo.get(sr); if (calleeFuncs == null) { continue; } Collections.sort(calleeFuncs); boolean seperaterAdded = false; for (int j = 0; j < calleeFuncs.size(); j++) { SelObjInfo fi = calleeFuncs.get(j); if (calleeSeen.get(fi.id) != null && calleeSeen.get(fi.id) == true) { continue; } if (i > 0 && !seperaterAdded) { cur_me.addSeparator(); cur_me_dis.addSeparator(); seperaterAdded = true; } calleeSeen.put(fi.id, true); NavigationUpdateAction nua = new NavigationUpdateAction(txt, fi.id, fi.lineno); NavigationUpdateAction nua_dis = new NavigationUpdateAction(txt_dis, fi.id, fi.lineno); mi = new JMenuItem(); mi.setAction(nua); mi.setText(fi.name); cur_me.add(mi); mi_dis = new JMenuItem(); mi_dis.setAction(nua_dis); mi_dis.setText(fi.name); cur_me_dis.add(mi_dis); num_items++; if (num_items > 0 && num_items % 20 == 0 && !(j == calleeFuncs.size() - 1 && i == callsiteRows.size() - 1)) { JMenu more_me = new JMenu(AnLocale.getString("more...")); cur_me.add(more_me); cur_me = more_me; JMenu more_me_dis = new JMenu(AnLocale.getString("more...")); cur_me_dis.add(more_me_dis); cur_me_dis = more_me_dis; } } } if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { popup.add(me); } else if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) { popup.add(me_dis); } } else { if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { mi = new JMenuItem(STR_ACTION_SHOW_CALLEE_SOURCE); mi.setEnabled(false); popup.add(mi); } if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) { mi = new JMenuItem(STR_ACTION_SHOW_CALLEE_DISASM); mi.setEnabled(false); popup.add(mi); } } if (popup.getComponentCount() > 0) { popup.addSeparator(); } // add "show caller source/disasm" txt = STR_ACTION_SHOW_CALLER_SOURCE; String txt_dis = STR_ACTION_SHOW_CALLER_DISASM; HashMap callerSeen = new HashMap(); me = new JMenu(new UpdateAction(txt)); me.setEnabled( row_selected && (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2 || parent.parent_type != AnDisplay.DSP_SourceDisassembly)); JMenu cur_me = me; me_dis = new JMenu(new UpdateAction(txt_dis)); me_dis.setEnabled( row_selected && (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2 || parent.parent_type != AnDisplay.DSP_SourceDisassembly)); JMenu cur_me_dis = me_dis; int num_items = 0; int num_funcs = 0; for (Long idx : funcMap.keySet()) { ArrayList callerFuncs = renderer.callerInfo.get(idx.longValue()); if (callerFuncs == null) { continue; } Collections.sort(callerFuncs); boolean seperaterAdded = false; for (int j = 0; j < callerFuncs.size(); j++) { SelObjInfo fi = callerFuncs.get(j); if (callerSeen.get(fi.name) != null && callerSeen.get(fi.name) == true) { continue; } if (num_funcs > 0 && !seperaterAdded) { cur_me.addSeparator(); cur_me_dis.addSeparator(); seperaterAdded = true; } callerSeen.put(fi.name, true); NavigationUpdateAction nua = new NavigationUpdateAction(txt, fi.id, fi.lineno); mi = new JMenuItem(); mi.setAction(nua); mi.setText(fi.name); cur_me.add(mi); NavigationUpdateAction nua_dis = new NavigationUpdateAction(txt_dis, fi.id, fi.lineno); mi_dis = new JMenuItem(); mi_dis.setAction(nua_dis); mi_dis.setText(fi.name); cur_me_dis.add(mi_dis); num_items++; if (num_items > 0 && num_items % 20 == 0 && !(j == callerFuncs.size() - 1 && num_funcs == funcMap.size() - 1)) { JMenu more_me = new JMenu(AnLocale.getString("more...")); cur_me.add(more_me); cur_me = more_me; JMenu more_me_dis = new JMenu(AnLocale.getString("more...")); cur_me_dis.add(more_me_dis); cur_me_dis = more_me_dis; } } num_funcs++; } if (num_items > 0) { if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { popup.add(me); } else if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) { popup.add(me_dis); } } else { if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2) { mi = new JMenuItem(STR_ACTION_SHOW_CALLER_SOURCE); mi.setEnabled(false); popup.add(mi); } if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2) { mi = new JMenuItem(STR_ACTION_SHOW_CALLER_DISASM); mi.setEnabled(false); popup.add(mi); } } } if ((type == AnDisplay.DSP_Source) || (type == AnDisplay.DSP_SourceV2)) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Show Disassembly" action txt = STR_ACTION_SHOW_DISASM; if (funcNum > 1 && funcMap != null) { me = new JMenu(new UpdateAction(txt)); me.setEnabled(row_selected); for (Long idx : funcMap.keySet()) { int r = funcMap.get(idx).intValue(); String funcName = renderer.getFunction(r); if (funcName != null) { SrcLineUpdateAction sua = new SrcLineUpdateAction(txt, r); mi = new JMenuItem(); mi.setAction(sua); mi.setText(funcName); me.add(mi); } } popup.add(me); } else { mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } } } if ((type == AnDisplay.DSP_Callers)) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Prepend" action txt = STR_ACTION_PREPEND; UpdateAction ppa = new UpdateAction(txt); mi = new JMenuItem(ppa); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } if ((type == AnDisplay.DSP_Callees)) { // Add "Append" action txt = STR_ACTION_APPEND; UpdateAction apa = new UpdateAction(txt); mi = new JMenuItem(apa); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } if ((type == AnDisplay.DSP_CallerCalleeSelf)) { // Add "Remove" action txt = STR_ACTION_REMOVE; UpdateAction rma = new UpdateAction(txt); mi = new JMenuItem(rma); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(false); if (row == 0) { mi.setEnabled(true); } if (table.getRowCount() - 1 == row) { mi.setEnabled(row_selected); } if (table.getRowCount() <= 1) { mi.setEnabled(false); } popup.add(mi); // Add "Set Head" action txt = STR_ACTION_SETHEAD; ua = new UpdateAction(txt); mi = new JMenuItem(ua); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (row <= 0) { mi.setEnabled(false); } else { mi.setEnabled(true); } popup.add(mi); } if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { // Add "Set Center" action txt = STR_ACTION_RECENTER; UpdateAction rca = new UpdateAction(txt); mi = new JMenuItem(rca); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); if ((type == AnDisplay.DSP_CallerCalleeSelf)) { if (table.getRowCount() <= 1) { mi.setEnabled(false); } } popup.add(mi); } if ((type == AnDisplay.DSP_CallerCalleeSelf)) { // Add "Set Tail" action txt = STR_ACTION_SETTAIL; ua = new UpdateAction(txt); mi = new JMenuItem(ua); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(false); if (row >= 0) { if (row < table.getRowCount() - 1) { mi.setEnabled(true); } } popup.add(mi); } if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // NM // Add "Reset" action // NM txt = STR_ACTION_RESET; // NM UpdateAction rsa = new UpdateAction(txt); // NM mi = new JMenuItem(rsa); // NM ac = mi.getAccessibleContext(); // NM ac.setAccessibleDescription(txt); // NM mi.setEnabled(true); // NM popup.add(mi); // NM // NM // Add separator // NM popup.addSeparator(); // Add "Back" action txt = STR_ACTION_BACK; UpdateAction bka = new UpdateAction(txt); mi = new JMenuItem(bka); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (parent != null) { mi.setEnabled(parent.isBackActionAvailable()); popup.add(mi); } // Add "Forward" action txt = STR_ACTION_FORWARD; UpdateAction fwa = new UpdateAction(txt); mi = new JMenuItem(fwa); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (parent != null) { mi.setEnabled(parent.isForwardActionAvailable()); popup.add(mi); } // Add separator popup.addSeparator(); } if ((type == AnDisplay.DSP_MiniCaller || type == AnDisplay.DSP_MiniCallee)) { txt = STR_ACTION_SHOW_SELECTED_FUNCTION; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); } addFilterPopup(filterOnly, popup, type, viewName, row_selected); popup.addSeparator(); JMenu tableColumnsSubMenu; tableColumnsSubMenu = new JMenu(AnLocale.getString("Table Columns")); for (Component component : AnWindow.getInstance().getSettings().getMetricsSetting().createTableColumnMenuItems(this)) { tableColumnsSubMenu.add(component); } tableColumnsSubMenu.addSeparator(); for (Component component : AnWindow.getInstance().getSettings().getMetricsSetting().getOtherMetricItems(this)) { tableColumnsSubMenu.add(component); } popup.add(tableColumnsSubMenu); if (canSort && !(type == AnDisplay.DSP_MiniCallee || type == AnDisplay.DSP_MiniCaller || type == AnDisplay.DSP_MiniCallerCalleeSelf)) { // Add Select Next submenu JMenu sortSubMenu; sortSubMenu = new JMenu(AnLocale.getString("Sort Table By ")); // Add sorting menu items for (int i = 0; i < tableModel.getColumnCount(); i++) { txt = tableModel.getLabel(i).getText(); // FIXUP SortMenu sm = new SortMenu(i, txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(canSort); sortSubMenu.add(mi); } popup.add(sortSubMenu); } switch (type) { case AnDisplay.DSP_Functions: case AnDisplay.DSP_Lines: case AnDisplay.DSP_SourceDisassembly: case AnDisplay.DSP_Source: case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_SourceV2: case AnDisplay.DSP_DisassemblyV2: // case AnDisplay.DSP_LEAKLIST: case AnDisplay.DSP_InstructionFrequency: { if (gap != null) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Previous Hot Line" action txt = gap.STR_ACTION_PREV_HOT_LINE; mi = new JMenuItem(new UpdateAction(txt)); mi.setAccelerator(KeyboardShortcuts.sourcePreviousHotLineActionShortcut); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(gap.HG_Is_Prev_Hot_Line()); popup.add(mi); // Add "Next Hot Line" action txt = gap.STR_ACTION_NEXT_HOT_LINE; mi = new JMenuItem(new UpdateAction(txt)); mi.setAccelerator(KeyboardShortcuts.sourceNextHotLineActionShortcut); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(gap.HG_Is_Next_Hot_Line()); popup.add(mi); // Add separator popup.addSeparator(); // Add "Previous Non-zero Metric Line" action txt = gap.STR_ACTION_PREV_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); mi.setAccelerator(KeyboardShortcuts.sourcePreviousNonZeroLineActionShortcut); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(gap.HG_Is_Prev_NZ_Line()); popup.add(mi); // Add "Next Non-zero Metric Line" action txt = gap.STR_ACTION_NEXT_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); mi.setAccelerator(KeyboardShortcuts.sourceNextNonZeroLineActionShortcut); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(gap.HG_Is_Next_NZ_Line()); popup.add(mi); } break; } } // popup.addSeparator(); // // Format // JMenu formatByMenuItem = new JMenu(AnLocale.getString("Format")); // JRadioButtonMenuItem jRadioButtonMenuItem; // formatByMenuItem.add(jRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Text"))); // jRadioButtonMenuItem.setSelected(true); // formatByMenuItem.add(jRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Bar"))); // jRadioButtonMenuItem.setEnabled(false); // formatByMenuItem.add(jRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Pie"))); // jRadioButtonMenuItem.setEnabled(false); // popup.add(formatByMenuItem); // Table format // JMenu formatMenuItem = new JMenu(AnLocale.getString("Format")); // final JCheckBoxMenuItem wrapCheckBoxMenuItem = new // JCheckBoxMenuItem(AnLocale.getString("Wrap Long Metric Names in Table Headers")); // // wrapCheckBoxMenuItem.setSelected(AnWindow.getInstance().getSettings().getTableSettings().wrapMetricNames()); // wrapCheckBoxMenuItem.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // // AnWindow.getInstance().getSettings().getTableSettings().setWrapMetricNames(AnTable.this, // wrapCheckBoxMenuItem.isSelected()); // } // // }); // formatMenuItem.add(wrapCheckBoxMenuItem); // popup.add(formatMenuItem); // Compare // CompareModeSetting.CompareMode mode = // AnWindow.getInstance().getSettings().getCompareModeSetting().get(); // JMenu compareMenuItem = new JMenu(AnLocale.getString("Compare Mode")); // if (mode != CompareModeSetting.CompareMode.CMP_DISABLE) { // JRadioButtonMenuItem absoluteRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Absolute")); // JRadioButtonMenuItem deltaRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Delta")); // JRadioButtonMenuItem ratioRadioButtonMenuItem = new // JRadioButtonMenuItem(AnLocale.getString("Ratio")); // absoluteRadioButtonMenuItem.setSelected(mode == // CompareModeSetting.CompareMode.CMP_ENABLE); // deltaRadioButtonMenuItem.setSelected(mode == // CompareModeSetting.CompareMode.CMP_DELTA); // ratioRadioButtonMenuItem.setSelected(mode == // CompareModeSetting.CompareMode.CMP_RATIO); // absoluteRadioButtonMenuItem.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // AnWindow.getInstance().getSettings().getCompareModeSetting().set(this, // CompareModeSetting.CompareMode.CMP_ENABLE); // } // }); // deltaRadioButtonMenuItem.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // AnWindow.getInstance().getSettings().getCompareModeSetting().set(this, // CompareModeSetting.CompareMode.CMP_DELTA); // } // }); // ratioRadioButtonMenuItem.addActionListener(new ActionListener() { // @Override // public void actionPerformed(ActionEvent e) { // AnWindow.getInstance().getSettings().getCompareModeSetting().set(this, // CompareModeSetting.CompareMode.CMP_RATIO); // } // }); // compareMenuItem.add(absoluteRadioButtonMenuItem); // compareMenuItem.add(deltaRadioButtonMenuItem); // compareMenuItem.add(ratioRadioButtonMenuItem); // formatMenuItem.add(compareMenuItem); // } if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { // Add menu item "Copy All" txt = STR_ACTION_COPY_ALL; UpdateAction ca = new UpdateAction(txt); mi = new JMenuItem(ca); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.addSeparator(); popup.add(mi); } switch (type) { case AnDisplay.DSP_Callees: case AnDisplay.DSP_Callers: case AnDisplay.DSP_CallerCalleeSelf: case AnDisplay.DSP_MPIChart: case AnDisplay.DSP_MPITimeline: case AnDisplay.DSP_Null: case AnDisplay.DSP_Overview: case AnDisplay.DSP_Statistics: case AnDisplay.DSP_Timeline: case AnDisplay.DSP_Welcome: break; default: popup.addSeparator(); // Add menu item "Copy Selected" txt = STR_ACTION_COPY_SEL; UpdateAction cs = new UpdateAction(txt); mi = new JMenuItem(cs); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); // Add menu item "Copy All" txt = STR_ACTION_COPY_ALL; UpdateAction ca = new UpdateAction(txt); mi = new JMenuItem(ca); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); break; } switch (type) { case AnDisplay.DSP_Functions: case AnDisplay.DSP_MiniFunctions: case AnDisplay.DSP_IO: case AnDisplay.DSP_Heap: case AnDisplay.DSP_IOFileDescriptors: case AnDisplay.DSP_Lines: case AnDisplay.DSP_PCs: case AnDisplay.DSP_IndexObject: case AnDisplay.DSP_Callers: case AnDisplay.DSP_CallerCalleeSelf: case AnDisplay.DSP_Callees: popup.addSeparator(); // Add menu item Properties mi = new JMenuItem( new SettingsAction( AnLocale.getString("Metric Settings"), parent.window.getSettings().settingsMetricsIndex)); mi.setAccelerator(KeyboardShortcuts.metricsSettingsShortcut); popup.add(mi); break; case AnDisplay.DSP_SourceDisassembly: case AnDisplay.DSP_Source: case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_SourceV2: case AnDisplay.DSP_DisassemblyV2: popup.addSeparator(); // Add menu item Properties mi = new JMenuItem( new SettingsAction( AnLocale.getString("Source/Disassembly Settings"), parent.window.getSettings().settingsSourceDisassemblyIndex)); mi.setAccelerator(KeyboardShortcuts.settingsActionShortcut); popup.add(mi); break; } } private void addFilterPopup( boolean filterOnly, JPopupMenu popup, int type, String viewName, boolean row_selected) { AccessibleContext ac; JMenuItem mi; String txt; if ((type == AnDisplay.DSP_Callers) || (type == AnDisplay.DSP_CallerCalleeSelf) || (type == AnDisplay.DSP_Callees)) { // Add "Set Filter: Stack Fragment in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_CALLSTACK_FRAGMENT_SHORT_NAME, FILTER_CALLSTACK_FRAGMENT_LONG_NAME, FILTER_CALLSTACK_FRAGMENT_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_CALLSTACK_FRAGMENT_LONG_NAME); mi.setEnabled(true); popup.add(mi); // Add "Set Filter: Not Stack Fragment in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_CALLSTACK_FRAGMENT_SHORT_NAME, FILTER_NOT_CALLSTACK_FRAGMENT_LONG_NAME, FILTER_NOT_CALLSTACK_FRAGMENT_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_CALLSTACK_FRAGMENT_LONG_NAME); mi.setEnabled(true); popup.add(mi); // Add "Set Filter: Function in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_SELECTED_FUNCTION_SHORT_NAME, FILTER_SELECTED_FUNCTION_LONG_NAME, FILTER_SELECTED_FUNCTION_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_SELECTED_FUNCTION_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Function is Leaf ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_LEAF_FUNCTION_SHORT_NAME, FILTER_LEAF_FUNCTION_LONG_NAME, FILTER_LEAF_FUNCTION_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_LEAF_FUNCTION_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); if (filterOnly) { popup.addSeparator(); } // Add Manage Filters txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); // Add "Undo Last Filter ..." action txt = STR_ACTION_UNDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Reset Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (parent.window.getFilters().anyFilters()) { popup.add(parent.window.getFilters().removeFilterMenuItem()); } // if (filterOnly) { // popup.addSeparator(); // } } if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_Lines) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_SELECTED_LINES_SHORT_NAME, FILTER_SELECTED_LINES_LONG_NAME, FILTER_SELECTED_LINES_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_SELECTED_LINES_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_LINES_SHORT_NAME, FILTER_NOT_SELECTED_LINES_LONG_NAME, FILTER_NOT_SELECTED_LINES_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_LINES_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } if (type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_PCs) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_SELECTED_PCS_SHORT_NAME, FILTER_SELECTED_PCS_LONG_NAME, FILTER_SELECTED_PCS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_SELECTED_PCS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_PCS_SHORT_NAME, FILTER_NOT_SELECTED_PCS_LONG_NAME, FILTER_NOT_SELECTED_PCS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_PCS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } if (type == AnDisplay.DSP_Functions) { if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Set Filter: Function in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_SELECTED_FUNCTIONS_SHORT_NAME, FILTER_SELECTED_FUNCTIONS_LONG_NAME, FILTER_SELECTED_FUNCTIONS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_SELECTED_FUNCTIONS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Function in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_FUNCTIONS_SHORT_NAME, FILTER_NOT_SELECTED_FUNCTIONS_LONG_NAME, FILTER_NOT_SELECTED_FUNCTIONS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_FUNCTIONS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Function is Leaf ..." mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_LEAF_FUNCTIONS_SHORT_NAME, FILTER_LEAF_FUNCTIONS_LONG_NAME, FILTER_LEAF_FUNCTIONS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_LEAF_FUNCTIONS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Name in Stack ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_SIMILARLY_NAMED_SHORT_NAME, FILTER_SIMILARLY_NAMED_LONG_NAME, FILTER_SIMILARLY_NAMED_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_SIMILARLY_NAMED_LONG_NAME); mi.setEnabled(row_selected); if (table.getSelectedRowCount() > 1) { mi.setEnabled(false); } popup.add(mi); } if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_Lines || type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_PCs || type == AnDisplay.DSP_Functions || type == AnDisplay.DSP_MiniFunctions) { // Add "Manage Filters..." action txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); if (filterOnly) { popup.addSeparator(); } // Add "Undo Last Filter ..." action txt = STR_ACTION_UNDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Set Filter: Reset Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (parent.window.getFilters().anyFilters()) { popup.add(parent.window.getFilters().removeFilterMenuItem()); } // if (filterOnly) { // popup.addSeparator(); // } } if ((type == AnDisplay.DSP_IO) || (type == AnDisplay.DSP_IOFileDescriptors) || (type == AnDisplay.DSP_IOCallStacks)) { if (AnWindow.getInstance().getIOView().getDisplayMode() == AnDisplay.DSP_IO) { // Add "Set Filter: Selected File Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_FILE_SHORT_NAME, FILTER_WITH_SELECTED_FILE_LONG_NAME, FILTER_WITH_SELECTED_FILE_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_FILE_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Exclude Selected File Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_FILE_SHORT_NAME, FILTER_NOT_SELECTED_FILE_LONG_NAME, FILTER_NOT_SELECTED_FILE_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_FILE_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } else if (AnWindow.getInstance().getIOView().getDisplayMode() == AnDisplay.DSP_IOFileDescriptors) { // Add "Set Filter: Selected IOVFD Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_IOVFD_SHORT_NAME, FILTER_WITH_SELECTED_IOVFD_LONG_NAME, FILTER_WITH_SELECTED_IOVFD_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_IOVFD_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Exclude Selected IOVFD Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_IOVFD_SHORT_NAME, FILTER_NOT_SELECTED_IOVFD_LONG_NAME, FILTER_NOT_SELECTED_IOVFD_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_IOVFD_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } else if (AnWindow.getInstance().getIOView().getDisplayMode() == AnDisplay.DSP_IOCallStacks) { // Add "Set Filter: Selected Stack Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_IOSTACK_SHORT_NAME, FILTER_WITH_SELECTED_IOSTACK_LONG_NAME, FILTER_WITH_SELECTED_IOSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_IOSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Exclude Selected Stack Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_IOSTACK_SHORT_NAME, FILTER_NOT_SELECTED_IOSTACK_LONG_NAME, FILTER_NOT_SELECTED_IOSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_IOSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } // Add "Manage Filters..." action txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); if (filterOnly) { popup.addSeparator(); } // Add "Undo Last Filter ..." action txt = STR_ACTION_UNDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Set Filter: Reset Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (parent.window.getFilters().anyFilters()) { popup.add(parent.window.getFilters().removeFilterMenuItem()); } } if (type == AnDisplay.DSP_Heap) { if (AnWindow.getInstance().getHeapView().getDisplayMode() == AnDisplay.DSP_Heap) { // Add "Set Filter: Active Allocation Stacks Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_HEAPACTIVESTACK_SHORT_NAME, FILTER_WITH_SELECTED_HEAPACTIVESTACK_LONG_NAME, FILTER_WITH_SELECTED_HEAPACTIVESTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_HEAPACTIVESTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Allocations That Leaked ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_SHORT_NAME, FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_LONG_NAME, FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_HEAPLEAKEDSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Allocations That Not Leaked ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_SHORT_NAME, FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_LONG_NAME, FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_HEAPLEAKEDSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Selected Stack Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_HEAPSTACK_SHORT_NAME, FILTER_WITH_SELECTED_HEAPSTACK_LONG_NAME, FILTER_WITH_SELECTED_HEAPSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_HEAPSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Exclude Selected Stack Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_NOT_SELECTED_HEAPSTACK_SHORT_NAME, FILTER_NOT_SELECTED_HEAPSTACK_LONG_NAME, FILTER_NOT_SELECTED_HEAPSTACK_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_NOT_SELECTED_HEAPSTACK_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } // Add "Manage Filters..." action txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); if (filterOnly) { popup.addSeparator(); } // Add "Undo Last Filter ..." action txt = STR_ACTION_UNDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Set Filter: Reset Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (parent.window.getFilters().anyFilters()) { popup.add(parent.window.getFilters().removeFilterMenuItem()); } } if ((type == AnDisplay.DSP_IndexObject) || (type == AnDisplay.DSP_MemoryObject)) { // Threads, CPUs, Samples, Seconds tabs if (popup.getComponentCount() > 0) { popup.addSeparator(); } // Add "Set Filter: Selected Objects Only ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_ITEMS_SHORT_NAME, FILTER_WITH_SELECTED_ITEMS_LONG_NAME, FILTER_WITH_SELECTED_ITEMS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_ITEMS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Exclude Selected Objects ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITHOUT_SELECTED_ITEMS_SHORT_NAME, FILTER_WITHOUT_SELECTED_ITEMS_LONG_NAME, FILTER_WITHOUT_SELECTED_ITEMS_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITHOUT_SELECTED_ITEMS_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); if (viewName.equals("Threads")) { boolean jthread_selected = false; int namecol = getTableModel().getNameCol(); for (int selrow : anTable.getSelectedRows()) { String name = (String) getTableModel().data[namecol][selrow]; if (name.contains("JThread")) { jthread_selected = true; break; } } if (jthread_selected) { // Add "Set Filter: Include only JThreads in selected group ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_JGROUP_SHORT_NAME, FILTER_WITH_SELECTED_JGROUP_LONG_NAME, FILTER_WITH_SELECTED_JGROUP_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_JGROUP_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Include only JThreads in selected parent ..." action mi = new JMenuItem( new FilterUpdateAction( viewName, FILTER_WITH_SELECTED_JPARENT_SHORT_NAME, FILTER_WITH_SELECTED_JPARENT_LONG_NAME, FILTER_WITH_SELECTED_JPARENT_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(FILTER_WITH_SELECTED_JPARENT_LONG_NAME); mi.setEnabled(row_selected); popup.add(mi); } } // Add "Manage Filters..." action txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); if (filterOnly) { popup.addSeparator(); } // Add "Undo Last Filter ..." action txt = STR_ACTION_UNDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDOFILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Set Filter: Reset Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(parent.window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (parent.window.getFilters().anyFilters()) { popup.add(parent.window.getFilters().removeFilterMenuItem()); } // if (filterOnly) { // popup.addSeparator(); // } } } // ------- Private classes to implement popup menu items ------- // protected class AnMenuListener extends MouseAdapter { private boolean debug; private AnTable anTable; AnMenuListener(AnTable _anTable) { anTable = _anTable; debug = false; } // Experimental code, mostly "quick and dirty hack" public JPopupMenu initPopup(MouseEvent event) { // Experimental code if (parent != null) { if (parent instanceof CallerCalleesView) { try { parent.changeSelection(anTable, table.rowAtPoint(event.getPoint())); } catch (Exception exc) { System.out.println("AnTable.init_popup() exception: " + exc); exc.printStackTrace(); } setSelectedRowNow(table.rowAtPoint(event.getPoint())); } } return anTable.initPopup(false); } /* private JMenuItem menuItem(String txt, boolean enbl) { UpdateAction act = new UpdateAction(txt); JMenuItem mi = new JMenuItem(act); AccessibleContext ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(enbl); return mi; } */ @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { showPopup(e); } } public void showPopup(MouseEvent e) { if (!Analyzer.getInstance().normalSelection) { int row = table.rowAtPoint(e.getPoint()); if (row != -1 && !table.isRowSelected(row)) { setSelectedRow(row); fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, row, null)); } } JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } class SortMenu extends AbstractAction { private int colNum; public SortMenu(int colNum, String txt) { super(txt); this.colNum = colNum; } public SortMenu(int colNum) { this.colNum = colNum; } public void actionPerformed(ActionEvent ev) { if (colNum < tableModel.getColumnCount()) { sortTable(colNum); } } } /* * Generic action for context menu items. * Action name is passed as String. */ class UpdateAction extends AbstractAction { String actionName = null; public UpdateAction(String txt) { super(txt); actionName = txt; } @Override public void actionPerformed(ActionEvent ev) { Object progressBarHandle = parent .window .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Table Update")); updateAnTable(actionName); parent.window.getSystemProgressPanel().progressBarStop(progressBarHandle); } public void tailFunction() {} } class FilterUpdateAction extends AbstractAction { String viewName; String shortName; String longName; String actionName; public FilterUpdateAction( String viewName, String shortName, String longName, String actionName) { super(ADD_FILTER + ": " + longName); this.viewName = viewName; this.shortName = shortName; this.longName = longName; this.actionName = actionName; } public void actionPerformed(ActionEvent ev) { // parent.window.setBusyCursor(true); AnUtility.checkIPCOnWrongThread(false); updateTable(viewName + ": " + shortName, longName, actionName); AnUtility.checkIPCOnWrongThread(true); // parent.window.setBusyCursor(false); } } /* * Action for context menu items of source line navigation. * Action name is passed as String. */ class SrcLineUpdateAction extends UpdateAction { String actionName = null; int row = -1; public SrcLineUpdateAction(String txt, int r) { super(txt); actionName = txt; row = r; } @Override public void actionPerformed(ActionEvent ev) { Object progressBarHandle = parent .window .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Source Line")); // change selected object parent.window.getSelectedObject().setSelObj(row, parent.type, parent.subtype); updateAnTable(actionName); parent.window.getSystemProgressPanel().progressBarStop(progressBarHandle); } } /* * Action for context menu items of function navigation. * Action name is passed as String. */ class NavigationUpdateAction extends UpdateAction { protected String actionName = null; protected long functionId = -1; protected int lineNo = -1; public NavigationUpdateAction(String txt, long id, int no) { super(txt); actionName = txt; functionId = id; lineNo = no; } public void actionPerformed(ActionEvent ev) { navHistoryPool.getHistory().enabled = true; // change selected object parent.window.getSelectedObject().setSelObjV2(functionId); parent.setNavigationAction(this); parent.setComputed(false); parent.computeOnAWorkerThread(); } public void tailFunction() { if ((type == AnDisplay.DSP_Source) || (type == AnDisplay.DSP_SourceV2)) { if (lineNo != -1) { // -1 is for callee, but here is for caller int base_row = table.getSelectedRow(); int row = srcRenderer.getRowByLineNo(lineNo); if (row != -1) { navHistoryPool.getHistory().enabled = false; anTable.setSelectedRow(row); navHistoryPool.getHistory().enabled = true; anTable.fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, row, null)); // adjust history SelObjInfo back_obj = navHistoryPool.getHistory().goBack(); if (back_obj != null && back_obj.id == functionId && back_obj.lineno == lineNo) { navHistoryPool.getHistory().goBack(); SelObjInfo new_obj = new SelObjInfo(back_obj.id, back_obj.lineno, back_obj.name); navHistoryPool.getHistory().goToNew(new_obj); } else { navHistoryPool.getHistory().goForward(); SrcRenderer.SrcTextMarker sm = srcRenderer.srcRendered.get(srcRenderer.mapRow(base_row)); int base_lineNo = sm == null ? -1 : sm.lineNo; SelObjInfo cur_obj = navHistoryPool.getHistory().getCurrent(); if (navHistoryPool.getHistory().newAdded == false && cur_obj != null && cur_obj.id == functionId && cur_obj.lineno == base_lineNo) { SelObjInfo new_obj = new SelObjInfo(cur_obj.id, lineNo, cur_obj.name); navHistoryPool.getHistory().goToNew(new_obj); } else { cur_obj.lineno = lineNo; } } } } } else if ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { if (lineNo != -1) { // -1 is for callee, but here is for caller int base_row = table.getSelectedRow(); String baseAddrStr = disRenderer.getRowToAddr(base_row, base_row); if (baseAddrStr != null) { Long callsiteAddr = Long.parseLong(baseAddrStr, 16); callsiteAddr += lineNo; // lineNo is actually offset inside function for disasm view Integer callsite = disRenderer.getAddrToRow(Long.toHexString(callsiteAddr), base_row); if (callsite != null) { navHistoryPool.getHistory().enabled = false; anTable.setSelectedRow(callsite); navHistoryPool.getHistory().enabled = true; anTable.fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, callsite, null)); // adjust history SelObjInfo back_obj = navHistoryPool.getHistory().goBack(); if (back_obj != null && back_obj.id == functionId && back_obj.lineno == callsite) { navHistoryPool.getHistory().goBack(); SelObjInfo new_obj = new SelObjInfo(back_obj.id, back_obj.lineno, back_obj.name); navHistoryPool.getHistory().goToNew(new_obj); } else { navHistoryPool.getHistory().goForward(); SelObjInfo cur_obj = navHistoryPool.getHistory().getCurrent(); if (navHistoryPool.getHistory().newAdded == false && cur_obj != null && cur_obj.id == functionId && cur_obj.lineno == base_row) { SelObjInfo new_obj = new SelObjInfo(cur_obj.id, callsite, Long.toHexString(callsiteAddr)); navHistoryPool.getHistory().goToNew(new_obj); } else { cur_obj.lineno = callsite; cur_obj.name = Long.toHexString(callsiteAddr); } } } } } } updateAnTable(actionName); } } class NavigationHistoryUpdateAction extends NavigationUpdateAction { private String addr; public NavigationHistoryUpdateAction(String txt, long id, int no, String a) { super(txt, id, no); addr = a; } public void actionPerformed(ActionEvent ev) { boolean inError = anTable.getViewport().getView() != table; if (actionName.equalsIgnoreCase(STR_ACTION_BACK)) { if (navHistoryPool.getHistory().canGoBack() && !inError) { navHistoryPool.getHistory().goBack(); } } if (actionName.equalsIgnoreCase(STR_ACTION_FORWARD)) { if (navHistoryPool.getHistory().canGoForward()) { navHistoryPool.getHistory().goForward(); } } boolean done = false; navHistoryPool.getHistory().enabled = false; if (!inError && ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2))) { int sel_row = anTable.getSelectedRow(); long fun_id = -1; if (sel_row >= 0 && sel_row < disRenderer.functionId.size()) { fun_id = disRenderer.functionId.get(sel_row); } if (fun_id == functionId) { Integer targetRowObj = disRenderer.getAddrToRow(addr, sel_row); if (targetRowObj != null) { int targetRow = targetRowObj.intValue(); setSelectedRow(targetRow); fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, targetRow, null)); done = true; } } } if (!inError && !done) { if ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { Integer targetRowObj = disRenderer.getAddrToRow(addr, selectedRow); if (targetRowObj != null) { int targetRow = targetRowObj.intValue(); long fun_id = -1; if (targetRow >= 0 && targetRow < disRenderer.functionId.size()) { fun_id = disRenderer.functionId.get(targetRow); } if (fun_id == functionId) { setSelectedRow(targetRow); fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, targetRow, null)); done = true; } } } } if (done) { parent.updateToolBar(); // only for dis view navHistoryPool.getHistory().enabled = true; } if (!done) { // change selected object if (type == AnDisplay.DSP_Functions) { parent.window.getSelectedObject().setSelObj(lineNo, parent.type, parent.subtype); } else { parent.window.getSelectedObject().setSelObjV2(functionId); } parent.setNavigationAction(this); parent.setComputed(false); parent.computeOnAWorkerThread(); } } @Override public void tailFunction() { if ((type == AnDisplay.DSP_Source) || (type == AnDisplay.DSP_SourceV2)) { if (lineNo != -1) { int row = srcRenderer.getRowByLineNo(lineNo); if (row != -1) { anTable.setSelectedRow(row); anTable.fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, row, null)); } } } else if ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { int row = table.getSelectedRow(); for (int i = row; i < anTable.getRowCount(); i++) { String baseAddrStr = disRenderer.getRowToAddr(i, i); if ((baseAddrStr != null && baseAddrStr.equalsIgnoreCase(addr)) || lineNo == i) { anTable.setSelectedRow(i); anTable.fireAnEvent(new AnEvent(anTable, AnEvent.EVT_SELECT, i, null)); break; } } } updateAnTable(actionName); navHistoryPool.getHistory().enabled = true; } } static class SelObjInfo implements Comparable { long id; // function id int lineno; // for callsite dis, lineno is instr offset in one function // for history dis, lineno is row number String name; // for history dis data, name is address if lineno is -1 public SelObjInfo(long idp, int no, String namep) { id = idp; lineno = no; name = namep; } public int compareTo(SelObjInfo o) { return this.name.compareTo(o.name); } } class NavigationHistoryPool { private ArrayList> historyPool = null; public NavigationHistoryPool() { historyPool = new ArrayList<>(); for (int i = 0; i < 3; i++) { historyPool.add(new HashMap()); } for (int i = 0; i < 3; i++) { historyPool.get(i).put("", new NavigationHistory()); } } public NavigationHistory getHistory() { int viewMode = parent.window.getSettings().getViewModeSetting().get().value(); if (viewMode < 0 || viewMode > 2) { System.err.println("Error: wrong view mode!"); return null; } String filterExp = parent.window.getFilters().getFilterStr(0); if (filterExp == null) { filterExp = ""; } NavigationHistory ret = historyPool.get(viewMode).get(filterExp); if (ret == null) { historyPool.get(viewMode).put(filterExp, new NavigationHistory()); ret = historyPool.get(viewMode).get(filterExp); } return ret; } public void clearAll() { for (int i = 0; i < 3; i++) { if (historyPool.get(i) != null) { historyPool.get(i).clear(); } } for (int i = 0; i < 3; i++) { if (historyPool.get(i) != null) { historyPool.get(i).put("", new NavigationHistory()); } } } } class NavigationHistory { private ArrayList history; private int curPos; public boolean enabled; public boolean newAdded; public NavigationHistory() { curPos = -1; history = new ArrayList<>(); enabled = true; newAdded = false; } public void goToNew(SelObjInfo obj) { newAdded = true; curPos++; history.add(curPos, obj); int size = history.size(); for (int i = size - 1; i > curPos; i--) { history.remove(i); } shrinkDuplicated(); } public SelObjInfo goBack() { curPos--; if (curPos >= 0) { return history.get(curPos); } curPos = -1; return null; } public SelObjInfo goForward() { curPos++; if (curPos < history.size()) { return history.get(curPos); } curPos = history.size(); return null; } public SelObjInfo getBack() { if (curPos > 0) { return history.get(curPos - 1); } return null; } public SelObjInfo getForward() { if (curPos < history.size() - 1) { return history.get(curPos + 1); } return null; } public boolean canGoBack() { return (curPos > 0); } public boolean canGoForward() { return (curPos < history.size() - 1); } public SelObjInfo getCurrent() { if (curPos >= 0 && curPos < history.size()) { return history.get(curPos); } return null; } public void goToFuncNew(int row) { SelObjInfo cur_so = navHistoryPool.getHistory().getCurrent(); if (cur_so == null || cur_so.lineno != row) { SelObjInfo new_so = new SelObjInfo(0, row, ""); navHistoryPool.getHistory().goToNew(new_so); } } public void goToSrcNew(int row) { if (srcRenderer == null) { return; } long fun_id = -1; if (row >= 0 && row < srcRenderer.functionId.size()) { fun_id = srcRenderer.functionId.get(row); } if (fun_id == 0) { fun_id = parent.window.getSelectedObject().getSelObjV2("FUNCTION"); } SrcRenderer.SrcTextMarker marker = srcRenderer.srcRendered.get(srcRenderer.mapRow(row)); int lineNo = marker == null ? -1 : marker.lineNo; SelObjInfo cur_so = navHistoryPool.getHistory().getCurrent(); if (cur_so == null || cur_so.id != fun_id || cur_so.lineno != lineNo) { SelObjInfo new_so = new SelObjInfo(fun_id, lineNo, ""); navHistoryPool.getHistory().goToNew(new_so); } } public void goToDisNew(int row) { if (disRenderer == null) { return; } long fun_id = -1; if (row >= 0 && row < disRenderer.functionId.size()) { fun_id = disRenderer.functionId.get(row); } if (fun_id == 0) { fun_id = parent.window.getSelectedObject().getSelObjV2("FUNCTION"); } SelObjInfo cur_so = navHistoryPool.getHistory().getCurrent(); if (cur_so == null || cur_so.id != fun_id || cur_so.lineno != row) { String addr = disRenderer.getRowToAddr(row, row); addr = (addr == null) ? "" : addr; SelObjInfo new_so = new SelObjInfo(fun_id, row, addr); navHistoryPool.getHistory().goToNew(new_so); } } public void shrinkDuplicated() { SelObjInfo cur_so = getCurrent(); if (canGoBack()) { SelObjInfo back_so = getBack(); if (back_so.id == cur_so.id && back_so.lineno == cur_so.lineno) { int i = curPos; while (i < history.size() - 1) { history.set(i, history.get(i + 1)); i++; } history.remove(i); curPos--; } } if (canGoForward()) { SelObjInfo next_so = getForward(); if (next_so.id == cur_so.id && next_so.lineno == cur_so.lineno) { int i = curPos; while (i < history.size() - 1) { history.set(i, history.get(i + 1)); i++; } history.remove(i); } } } public void goToSelected(int org_row, boolean isNew) { if ((type == AnDisplay.DSP_Source) || (type == AnDisplay.DSP_SourceV2)) { if (isNew) { goToSrcNew(org_row); parent.updateToolBar(); } else { SelObjInfo sel_obj = navHistoryPool.getHistory().getCurrent(); Long funcId = null; if ((org_row >= 0) && (srcRenderer.functionId != null) && (org_row < srcRenderer.functionId.size())) { funcId = srcRenderer.functionId.get(org_row); } if (funcId == null) { funcId = parent.window.getSelectedObject().getSelObjV2("FUNCTION"); } SrcRenderer.SrcTextMarker sm = srcRenderer.srcRendered.get(srcRenderer.mapRow(org_row)); int lineNo = -1; if (sel_obj != null && funcId != null && funcId.longValue() != 0 && sm != null) { // XXXX ugly assumption that 0 function id is invalid lineNo = sm.lineNo; sel_obj.id = funcId; sel_obj.lineno = lineNo; sel_obj.name = ""; shrinkDuplicated(); } } } else if ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { if (isNew) { goToDisNew(org_row); parent.updateToolBar(); } else { SelObjInfo sel_obj = navHistoryPool.getHistory().getCurrent(); if (sel_obj != null) { Long funcId = null; if (org_row >= 0 && org_row < disRenderer.functionId.size()) { funcId = disRenderer.functionId.get(org_row); } if (funcId == null) { funcId = parent.window.getSelectedObject().getSelObjV2("FUNCTION"); } String addr = disRenderer.getRowToAddr(org_row, org_row); if (funcId != null && funcId.longValue() != 0) { // XXXX ugly assumption that 0 function id is invalid sel_obj.id = funcId; sel_obj.lineno = org_row; sel_obj.name = addr; shrinkDuplicated(); } } } } else if (type == AnDisplay.DSP_Functions) { if (isNew) { goToFuncNew(org_row); parent.updateToolBar(); } else { SelObjInfo sel_obj = navHistoryPool.getHistory().getCurrent(); if (sel_obj != null) { sel_obj.id = 0; sel_obj.lineno = org_row; sel_obj.name = ""; shrinkDuplicated(); } } } } public void clear() { history.clear(); curPos = -1; } } public void setGroupId(int id) { groupId = id; } public int getGroupId() { return groupId; } } gprofng-gui-2.1/org/gprofng/mpmt/collect/0000755000175000017500000000000015044723235015441 500000000000000gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectPanel2.java0000644000175000017500000012144215044710303020647 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.collect; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.PsParser; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.PopupMenuEvent; import javax.swing.table.DefaultTableModel; /** Creates first page for Collector GUI to profile a running application */ public class CollectPanel2 extends JPanel { private final String STR_ACTION_UPDATE = AnLocale.getString("Refresh"); private final String STR_ACTION_SORTBY = AnLocale.getString("Sort by"); private final String STR_ACTION_COPY_ALL = AnLocale.getString("Copy All"); private JPanel workPanel; private AnWindow anWindow; private AnMenuListener menuListener; private String processID; private String[] tableColumns = new String[6]; /* * Creates new form CollectPanel2 */ public CollectPanel2(final AnWindow aWindow) { workPanel = this; this.anWindow = aWindow; initComponents(); postInitComponents(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel2 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jButton1 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); processesTable = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); jComboBox4 = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); jPanel2.setLayout(new java.awt.GridBagLayout()); jLabel2.setLabelFor(processesTable); jLabel2.setText("Select the Process to profile."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel2.add(jLabel2, gridBagConstraints); jLabel1.setLabelFor(jComboBox1); jLabel1.setText("Filter:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); jPanel2.add(jLabel1, gridBagConstraints); jComboBox1.setEditable(true); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); jPanel2.add(jComboBox1, gridBagConstraints); jButton1.setText("Refresh"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); jPanel2.add(jButton1, gridBagConstraints); processesTable.setAutoCreateRowSorter(true); processesTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null} }, new String [] { "User Name", "PID", "PPID", "Start Time", "CPU time", "Command" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); processesTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane2.setViewportView(processesTable); processesTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel2.add(jScrollPane2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 12); add(jPanel2, gridBagConstraints); jPanel3.setLayout(new java.awt.GridBagLayout()); jTextField1.setColumns(12); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); jPanel3.add(jTextField1, gridBagConstraints); jLabel3.setLabelFor(jTextField1); jLabel3.setText("Target PID:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel3.add(jLabel3, gridBagConstraints); jComboBox2.setEditable(true); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "test.1.er" })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox2, gridBagConstraints); jLabel4.setLabelFor(jComboBox2); jLabel4.setText("Experiment Name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel4, gridBagConstraints); jComboBox3.setEditable(true); jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox3, gridBagConstraints); jLabel5.setLabelFor(jComboBox3); jLabel5.setText("Experiment Directory:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel5, gridBagConstraints); jComboBox4.setEditable(true); jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox4, gridBagConstraints); jLabel6.setLabelFor(jComboBox4); jLabel6.setText("Experiment Group:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel6, gridBagConstraints); jTextField2.setEditable(false); jTextField2.setText("gp-display-text"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); jPanel3.add(jTextField2, gridBagConstraints); jLabel7.setLabelFor(jTextField2); jLabel7.setText("Target Name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); jPanel3.add(jLabel7, gridBagConstraints); jButton2.setText("..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jButton2, gridBagConstraints); jButton6.setText("..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jButton6, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12); add(jPanel3, gridBagConstraints); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton6; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTable processesTable; // End of variables declaration//GEN-END:variables /** Initialize combo boxes with default values */ public void postInitComponents() { AnUtility.setTextAndAccessibleContext( jLabel2, AnLocale.getString("Select the Process to profile.")); AnUtility.setTextAndAccessibleContext(jLabel1, AnLocale.getString("Filter:")); jLabel1.setDisplayedMnemonic(AnLocale.getString('F', "MN_PROFILE_RUNNING_PROCESS_Filter")); jLabel1.setLabelFor(jComboBox1); AnUtility.setTextAndAccessibleContext(jLabel3, AnLocale.getString("Target PID:")); AnUtility.setTextAndAccessibleContext(jLabel4, AnLocale.getString("Experiment Name:")); AnUtility.setTextAndAccessibleContext(jLabel5, AnLocale.getString("Experiment Directory:")); AnUtility.setTextAndAccessibleContext(jLabel6, AnLocale.getString("Experiment Group:")); AnUtility.setTextAndAccessibleContext(jLabel7, AnLocale.getString("Target Name:")); AnUtility.setTextAndAccessibleContext(jButton1, AnLocale.getString("Refresh")); jButton1.setMnemonic(AnLocale.getString('R', "MN_PROFILE_RUNNING_PROCESS_Refresh")); AnUtility.setAccessibleContext(jButton2.getAccessibleContext(), AnLocale.getString("Browse")); AnUtility.setAccessibleContext(jButton6.getAccessibleContext(), AnLocale.getString("Browse")); AnUtility.setAccessibleContext( processesTable.getTableHeader().getAccessibleContext(), AnLocale.getString("Process Table")); processesTable.getSelectionModel().addListSelectionListener(new SelectionHandler()); jComboBox1.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); jComboBox1.setSelectedItem(""); // Filter String user = System.getProperty("user.name"); jComboBox1.addItem(user); // Filter jComboBox2.setSelectedItem("test.1.er"); // Experiment name // jComboBox2.addItem(empty_str); // Experiment name jComboBox3.setSelectedItem(""); // Experiment directory // jComboBox3.addItem(empty_str); // Experiment directory jComboBox4.setSelectedItem(""); // Experiment group // jComboBox4.addItem(empty_str); // Experiment group jButton1.addActionListener(new RefreshActionHandler()); // Refresh jButton2.addActionListener(new ExpDirActionHandler()); // Experiment directory browser jButton6.addActionListener(new ExpGroupActionHandler()); // Experiment group browser // Init column names tableColumns[0] = AnLocale.getString("User Name") + " (UID)"; tableColumns[1] = AnLocale.getString("Process ID") + " (PID)"; tableColumns[2] = AnLocale.getString("Parent Process ID") + " (PPID)"; tableColumns[3] = AnLocale.getString("Start Time") + " (START TIME)"; tableColumns[4] = AnLocale.getString("CPU Time") + " (CPU TIME)"; tableColumns[5] = AnLocale.getString("Process name") + " (COMMAND)"; // Popup menu menuListener = new AnMenuListener(this, processesTable); processesTable.addMouseListener(menuListener); KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; processesTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); processesTable .getActionMap() .put( ks, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { JPopupMenu popup = initPopup(processesTable); if (popup != null) { JTable src = (JTable) ev.getSource(); Rectangle cellRect, visRect; visRect = src.getVisibleRect(); cellRect = visRect; if (cellRect.width > 0) { // calculate a good place to show the menu cellRect.x += cellRect.width / 4; } if (cellRect.height > 0) { cellRect.y += cellRect.height / 4; } popup.show(src, cellRect.x, cellRect.y); } } }); jTextField2.setColumns(50); } /** Copy all lines to the system clipboard */ protected void copyAll() { String text = ""; int rows = processesTable.getRowCount(); int columns = processesTable.getColumnCount(); int collen[] = new int[columns]; // Print table header for (int j = 0; j < columns; j++) { if (tableColumns.length > j) { String s = tableColumns[j]; text += s; collen[j] = s.length(); } if (columns - 1 == j) { break; } text += " | "; } text += "\n"; // Print table rows for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { String s = processesTable.getValueAt(i, j).toString(); text += s; // Try to format the string if (columns - 1 == j) { break; } int k = collen[j] - s.length(); while (k > 0) { text += " "; k--; } text += " | "; } text += "\n"; } // copyToClipboard(text); StringSelection data = new StringSelection(text); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(data, data); } public void update() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { updateTable(); updateSelection(); updateTextFields(); } }); } private void updateTable() { AnUtility.checkIfOnAWTThread(true); final String f = "/bin/ps -ef"; AnUtility.checkIPCOnWrongThread(false); String p = Collector.getRunningProcesses(f); // IPC call String o = Collector.getOSFamily(); // IPC call AnUtility.checkIPCOnWrongThread(true); PsParser psParser = PsParser.getDefault(o); psParser.setPsOutput(p); List th = psParser.getData(true).header(); // Headers // Customize column names for (int i = 0; i < th.size(); i++) { String s = th.get(i); if ("STIME".equals(s)) { th.set(i, "START TIME"); } if ("TIME".equals(s)) { th.set(i, "CPU TIME"); } if ("CMD".equals(s)) { th.set(i, "COMMAND"); } } java.util.regex.Pattern re = java.util.regex.Pattern.compile("."); String filter = getFilter(); if (!"".equals(filter)) { re = java.util.regex.Pattern.compile(".*" + filter + ".*"); } List> tp = psParser.getData(true).processes(re); // Processes // Convert List> to Object[][].... List tpList = new ArrayList<>(); for (List object : tp) { tpList.add(object.toArray()); } Object[][] tpArray = new Object[tpList.size()][]; int index = 0; for (Object[] x : tpList) { tpArray[index++] = x; } ((DefaultTableModel) processesTable.getModel()).setDataVector(tpArray, th.toArray()); // Set coulumn widths (available space goes to last column) for (int i = 0; i < processesTable.getColumnCount() - 1; i++) { processesTable.getColumnModel().getColumn(i).setPreferredWidth(80); processesTable.getColumnModel().getColumn(i).setMaxWidth(300); } } /** * Get Filter * * @return String filter */ private String getFilter() { String filter = ""; if (null != jComboBox1.getSelectedItem()) { filter = jComboBox1.getSelectedItem().toString(); } return filter; } /** * Get Process ID * * @return String PID */ public String getProcessID() { String PID = ""; processID = jTextField1.getText(); if (null != processID) { PID = processID; } return PID; } /** * Get Experiment Directory * * @return String directory */ public String getExperimentDirectory() { String expdir = ""; if (null != jComboBox3.getSelectedItem()) { expdir = jComboBox3.getSelectedItem().toString(); } if (expdir.length() < 1) { // XXX should it be here? expdir = CGetCurDir(); // IPC call } return expdir; } /** * Set Experiment Directory * * @param expdir */ public void setExperimentDirectory(String expdir) { jComboBox3.setSelectedItem(expdir); } /** * Get Experiment Name * * @return String directory */ public String getExperimentName() { String expdir = ""; if (null != jComboBox2.getSelectedItem()) { expdir = jComboBox2.getSelectedItem().toString(); } return expdir; } /** * Get Experiment Group * * @return String group */ public String getExperimentGroup() { String group = ""; if (null != jComboBox4.getSelectedItem()) { group = jComboBox4.getSelectedItem().toString(); } return group; } /** * Set Experiment Group * * @param expdir */ public void setExperimentGroup(String group) { jComboBox4.setSelectedItem(group); } /** * Get Current Directory * * @return */ private String CGetCurDir() { return Analyzer.getInstance().getWorkingDirectory(); } /** * Get Preview Command * * @return String command */ public String getPreviewCommand() { String col_cmd = "collect"; col_cmd += " -P " + getProcessID(); // jTextField1.getText(); col_cmd += " -o " + getExperimentName(); // jComboBox2.getItemAt(0); System.out.println(col_cmd); // DEBUG return col_cmd; } private void actionPerformed2(final ActionEvent event) { int i; final String cmd = event.getActionCommand(); final String empty = ""; final String slash = "/"; if (cmd.equals(empty)) { int theState = event.getID(); // state change event if (theState == Collector.COLLECTING_RUNNING) { // if (buttons[0].isEnabled()) { // the collection has just started // writeln(AnLocale.getString("Running: ") + new File(target.getText()).getName(), // getOutLog()); // set_runtime_buttons(); // } else { // the collection has been resumed // writeln(AnLocale.getString("Data collection resumed"), getOutLog()); // writeln("(" + AnLocale.getString("process id ") + m_collector.getProcessPID() + ")", // getOutLog()); // buttons[2].setText(AnLocale.getString("Pause")); // buttons[2].setActionCommand(AnLocale.getString("Pause")); // } } else if (theState == Collector.COLLECTING_PAUSED) { // writeln(AnLocale.getString("Data collection paused"), getOutLog()); // writeln("(" + AnLocale.getString("process id ") + m_collector.getProcessPID() + ")", // getOutLog()); // buttons[2].setText(AnLocale.getString("Resume")); // buttons[2].setActionCommand(AnLocale.getString("Resume")); } else if (theState == Collector.COLLECTING_TERMINATING) { // writeln(AnLocale.getString("Data collection terminating"), getOutLog()); } else if ((theState == Collector.COLLECTING_TERMINATED) || (theState == Collector.COLLECTING_COMPLETED)) { if (theState == Collector.COLLECTING_TERMINATED) { // writeln(AnLocale.getString("Data collection terminated"), getOutLog()); } // NM if (output_thread != null) { // NM Thread stopped = output_thread; // NM output_thread=null; // NM stopped.interrupt(); // NM } // writeln(AnLocale.getString("Process ID: ") + m_collector.getProcessPID(), getOutLog()); // writeln(AnLocale.getString("Elapsed Time: ") + m_collector.getElapsedTime() + " ms", // getOutLog()); // writeln(AnLocale.getString("Execution completed, exit status is ") + // m_collector.getProcessExitValue(), getOutLog()); // final String actual_expname = m_collector.getActualExpName(); // getBtClear().setEnabled(true); // resetButtons(); // exp_name.setValue(m_collector.getNextExpName()); } } else if (cmd.equals(AnLocale.getString("Refresh"))) { if (anWindow != null) { update(); } else { // TEST refreshPS(processesTable); updateSelection(); updateTextFields(); } } else if (cmd.equals(AnLocale.getString("Pause"))) { // if (m_collector.pause(AnUtility.getSignalValue(pause_sig.getValue()))) { // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Resume"))) { // if (m_collector.resume(AnUtility.getSignalValue(pause_sig.getValue()))) { // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Sample"))) { // if (m_collector.sample(AnUtility.getSignalValue(sample_sig.getValue()))) { // writeln(AnLocale.getString("Manual sample"), getOutLog()); // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Terminate"))) { } else if (cmd.equals(AnLocale.getString("Preview Command:"))) { System.out.println(getPreviewCommand()); } else if (cmd.equals(AnLocale.getString("Cancel"))) { } else { // showChooser(cmd); } } private void updateSelection() { AnUtility.checkIfOnAWTThread(true); String last_pid = processID; // jTextField1.getText(); if ((last_pid != null) && (last_pid.length() > 0)) { // Check if selection is still correct int row = processesTable.getSelectedRow(); int count = processesTable.getRowCount(); if (count < row) { row = -1; } if (row >= 0) { String s = processesTable.getModel().getValueAt(row, 1).toString(); if (!last_pid.equals(s)) { row = -1; } } if (row < 0) { // Find last_pid in the table for (row = 0; row < count; row++) { String s = processesTable.getModel().getValueAt(row, 1).toString(); if (last_pid.equals(s)) { if (row != processesTable.getSelectedRow()) { processesTable.setRowSelectionInterval(row, row); } return; } } // Not found - select first row row = 0; } // New selection if (row < count) { processesTable.setRowSelectionInterval(row, row); return; } } if (null == processID) { // first time processesTable.clearSelection(); } else { int count = processesTable.getRowCount(); if (count > 0) { // select first row int row = 0; processesTable.setRowSelectionInterval(row, row); } } } private void updateTextFields() { AnUtility.checkIfOnAWTThread(true); int rows = processesTable.getRowCount(); if (rows <= 0) { return; } int row = processesTable.getSelectedRow(); if (row < 0) { row = 0; } if (rows < row) { row = 0; } int lastCol = processesTable.getColumnCount() - 1; if (lastCol > 0) { // Get process ID String p = processesTable.getValueAt(row, 1).toString(); jTextField1.setText(p); // Process ID processID = p; // Get process name String s = processesTable.getValueAt(row, lastCol).toString(); int spaceind = s.indexOf(' '); if (spaceind > 0) { s = s.substring(0, spaceind); } jTextField2.setText(s); // Process name } } private final class SelectionHandler implements ListSelectionListener { @Override public void valueChanged(ListSelectionEvent evt) { updateTextFields(); } } /** Refresh Action handler */ private final class RefreshActionHandler implements ActionListener { @Override public void actionPerformed(final ActionEvent event) { processID = jTextField1.getText(); update(); } } /** * "Choose Experiment Directory" action handler Call file chooser and update Experiment Directory */ private final class ExpDirActionHandler implements ActionListener { AnChooser ac = null; String dir = null; @Override public void actionPerformed(final ActionEvent event) { String title = AnLocale.getString("Experiment Directory"); if (null == ac) { ac = anWindow.getAnChooser(title, AnChooser.DIR_CHOOSER, dir); } if ((ac.showOpenDialog(workPanel) == AnChooser.APPROVE_OPTION) && ((ac.getSelectedFile()) != null)) { dir = ac.getSelectedFile().getAbsolutePath(); setExperimentDirectory(dir); } } } /** "Choose Experiment Group" action handler Call file chooser and update Experiment Group */ private final class ExpGroupActionHandler implements ActionListener { AnChooser ac = null; String dir = null; @Override public void actionPerformed(final ActionEvent event) { String title = AnLocale.getString("Experiment Group"); if (null == ac) { ac = anWindow.getAnChooser(title, AnChooser.EXP_GROUP_CHOOSER, dir); } if ((ac.showOpenDialog(workPanel) == AnChooser.APPROVE_OPTION) && ((ac.getSelectedFile()) != null)) { dir = ac.getSelectedFile().getParent(); String group = ac.getSelectedFile().getName(); setExperimentGroup(group); } } } // ================================= UNIT TESTING ===================================== // // For unit testing public static void main(final String[] args) { final int size; String str_args; if (args != null) { size = args.length; if (size > 0) { str_args = ""; for (int i = 1; i < size; i++) { if (i != 1) { str_args += " "; } str_args += args[i]; } } } CollectPanel2 cp = new CollectPanel2(null); cp.Test(cp); } public void Test(CollectPanel2 cp) { final JFrame mframe = new JFrame(); // CollectPanel2 cp = new CollectPanel2(); cp.jButton1.addActionListener(new ActionHandler()); // cp.jButton5.addActionListener(new ActionHandler()); // Preview JScrollPane work_pane = new JScrollPane(cp); work_pane.setMinimumSize(new Dimension(AnVariable.WIN_SIZE)); mframe.add(work_pane); processesTable.setColumnSelectionAllowed(false); processesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); processesTable.getSelectionModel().addListSelectionListener(new SelectionHandler()); jTextField1.setText("25457"); refreshPS(processesTable); updateSelection(); processesTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); // jTable1.setAutoResizeMode(Table.AUTO_RESIZE_LAST_COLUMN); processesTable.doLayout(); mframe.pack(); mframe.setVisible(true); } // Action handler private final class ActionHandler implements ActionListener { @Override public void actionPerformed(final ActionEvent event) { if (anWindow == null) { // TEST refreshPS(processesTable); } actionPerformed2(event); } } private static String[] ps = { "tester 883 882 Nov_09 35:55 /usr/lib/ssh/sshd", "tester 1022 1012 Nov_09 0:00 -csh", "tester 327 23523 16:18:05 0:00 ps -aef", "tester 27385 27384 Dec_04 0:05 /usr/lib/ssh/sshd", "tester 11582 893 Nov_20 0:00 /bin/sh /bin/firefox", "tester 4664 2140 Nov_28 0:00 vertool" }; static boolean resized = false; // Window handler private void refreshPS(JTable t) { int ps_index = 0; String empty_str = ""; String filter = empty_str; if (null != jComboBox1.getSelectedItem()) { filter = jComboBox1.getSelectedItem().toString(); } for (int i = 0; i < t.getRowCount(); i++) { char space = ' '; String s1, s2, s3, s4, s5, s6; String s = empty_str; if ((i < ps.length) && (ps_index < ps.length)) { for (; ps_index < ps.length; ps_index++) { s1 = ps[ps_index]; if (filter.length() > 0) { // Apply filter if (s1.indexOf(filter) < 0) { continue; } } s = s1; ps_index++; break; } } if (s.length() <= 0) { t.setValueAt(s, i, 0); t.setValueAt(s, i, 1); t.setValueAt(s, i, 2); t.setValueAt(s, i, 3); t.setValueAt(s, i, 4); t.setValueAt(s, i, 5); continue; } int p1 = 0; int p2 = s.indexOf(space); // user name s1 = s.substring(p1, p2); t.setValueAt(s1, i, 0); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // PID s2 = s.substring(p1, p2); t.setValueAt(s2, i, 1); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // PPID s3 = s.substring(p1, p2); t.setValueAt(s3, i, 2); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // Start time s4 = s.substring(p1, p2); t.setValueAt(s4, i, 3); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // CPU time s5 = s.substring(p1, p2); t.setValueAt(s5, i, 4); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.length(); // Command s6 = s.substring(p1, p2); t.setValueAt(s6, i, 5); } // if (!resized) { // resized = true; // // Resize jTable1 // TableColumnModel tcm = t.getColumnModel(); // TableColumn tc = tcm.getColumn(0); // int w = tc.getWidth(); // tc.setPreferredWidth((w * 2) / 3); // tc.setWidth((w * 2) / 3); // tc = tcm.getColumn(1); // w = tc.getWidth(); // tc.setPreferredWidth(w / 2); // tc.setWidth(w / 2); // tc = tcm.getColumn(2); // w = tc.getWidth(); // tc.setPreferredWidth(w / 2); // tc.setWidth(w / 2); // tc = tcm.getColumn(3); // w = tc.getWidth(); // tc.setPreferredWidth(w / 2); // tc.setWidth(w / 2); // tc = tcm.getColumn(4); // w = tc.getWidth(); // tc.setPreferredWidth(w / 2); // tc.setWidth(w / 2); // tc = tcm.getColumn(5); // w = tc.getWidth(); // tc.setPreferredWidth(w * 4); // tc.setWidth(w * 4); // } } /* * Generic action for context menu items. * Action name is passed as String. */ class UpdateAction extends AbstractAction { String actionName = null; public UpdateAction(String name) { super(name); this.actionName = name; } public UpdateAction(String name, String actionName) { super(name); this.actionName = actionName; } @Override public void actionPerformed(ActionEvent ev) { // Use AWT thread to perform some actions if (actionName.equals(STR_ACTION_UPDATE)) { update(); return; } if (actionName.equals(STR_ACTION_COPY_ALL)) { copyAll(); return; } // if (actionName.startsWith(STR_ACTION_SORTBY)) { for (int i = 0; i < tableColumns.length; i++) { if (actionName.contains(tableColumns[i])) { processesTable.getRowSorter().toggleSortOrder(i); return; } } // } } } private JPopupMenu initPopup(JTable table) { AccessibleContext ac; JMenuItem mi; JPopupMenu popup = new JPopupMenu(); String txt; boolean row_selected = false; int row = table.getSelectedRow(); if (row >= 0) { row_selected = true; } // Add "Update List of Processes" action txt = STR_ACTION_UPDATE; mi = new JMenuItem(new UpdateAction(txt)); mi.setMnemonic(AnLocale.getString('R', "MN_PROFILE_PROCESS_Refresh_MENU_ITEM")); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // String hotkey = "CTRL_U"; // KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK, // false); // table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, hotkey); // UpdateAction act = new UpdateAction(txt); // table.getActionMap().put(hotkey, act); // mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK)); mi.setEnabled(true); popup.add(mi); // Add "Set Metric" action txt = STR_ACTION_SORTBY; UpdateAction sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (tableColumns.length <= 1) { mi.setEnabled(false); popup.add(mi); } else { JMenu submenu1; submenu1 = new JMenu(txt); for (int i = 0; i < tableColumns.length; i++) { txt = tableColumns[i]; sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(STR_ACTION_SORTBY + ":" + txt); mi.setEnabled(true); submenu1.add(mi); } popup.add(submenu1); } // Add separator popup.addSeparator(); // Add menu item "Copy All" txt = STR_ACTION_COPY_ALL; UpdateAction cs = new UpdateAction(txt); mi = new JMenuItem(cs); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); return popup; } // ------- Private classes to implement popup menu items ------- // private class AnMenuListener extends MouseAdapter { private boolean debug; CollectPanel2 cp; JTable ptable; AnMenuListener(CollectPanel2 collectPanel, JTable table) { this.cp = collectPanel; this.ptable = table; debug = false; } // Experimental code, mostly "quick and dirty hack" public JPopupMenu initPopup(MouseEvent event) { return cp.initPopup(ptable); } /** Check for double click to performs default action */ @Override public void mouseClicked(final MouseEvent e) {} @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } } gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectDialog.java0000644000175000017500000001057514744453367020755 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.collect; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.event.ActionEvent; import javax.swing.JButton; import javax.swing.JFrame; public final class CollectDialog extends AnDialog implements CollectPanel.Provider { private final CollectPanel collectPanel; private final Collector collector; private int prof_type = Collector.PROFILE_APPLICATION; // Constructor public CollectDialog( final AnWindow awindow, final JFrame frame, int profiling_type, String title) { super( awindow, frame, /*CollectPanel.title*/ title, false, CollectPanel.aux, CollectPanel.mnemonic, getHelpID(profiling_type), false /* not modal */); final JButton buttons[] = new JButton[] {ok, apply, aux_actions[0], aux_actions[1], close}; close_on_enter = false; try { if (Analyzer.getInstance().IPC_started == false) { Analyzer.getInstance().startIPC(); } } catch (Exception e) { // Should never come here System.err.println("analyzer: Exception in CollectDialog"); e.printStackTrace(); System.exit(1); } collector = new Collector(window); prof_type = profiling_type; collector.setProfilingType(prof_type); AnUtility.checkIPCOnWrongThread(false); if (prof_type == Collector.SYSTEM_PROFILING) { // profile kernel JButton buttons2[] = new JButton[] {ok, apply, aux_actions[0], aux_actions[1], close}; collectPanel = new CollectPanel(collector, this, this, window, buttons2); } else if (prof_type == Collector.PROFILE_RUNNING_APPLICATION) { // profile running application JButton buttons1[] = new JButton[] {ok, apply, aux_actions[0], aux_actions[1], close}; collectPanel = new CollectPanel(collector, this, this, window, buttons1); } else { // profile new application collectPanel = new CollectPanel(collector, this, this, window, buttons); } AnUtility.checkIPCOnWrongThread(true); setAccessory(collectPanel.work_panel); } private static String getHelpID(int profiling_type) { if (profiling_type == Collector.PROFILE_APPLICATION) { return AnVariable.HELP_CollectDialog; } else if (profiling_type == Collector.PROFILE_RUNNING_APPLICATION) { return AnVariable.HELP_CollectRunningDialog; } else if (profiling_type == Collector.SYSTEM_PROFILING) { return AnVariable.HELP_CollectKernelDialog; } else { return AnVariable.HELP_CollectDialog; } } // Constructor public CollectDialog(final AnWindow awindow, final JFrame frame) { this(awindow, frame, 0, CollectPanel.title); } public void doDialog() { collectPanel.loadExpDefaults(); setVisible(true); } public void doDialog(String[] arguments) { collectPanel.loadExpDefaults(); if ((arguments != null) && (arguments.length > 0)) { collectPanel.target.setValue(arguments[0]); String args = ""; for (int i = 1; i < arguments.length; i++) { if (i > 1) { args += " "; } args += arguments[i]; } collectPanel.args.setValue(args); } setVisible(true); } @Override public void setTitleStr(final String title) { setTitle(title); } public void loadExpDefaults() { collectPanel.loadExpDefaults(); } // Action performed; run collect @Override public void actionPerformed(final ActionEvent event) { collectPanel.actionPerformed(event); } @Override public void setVisible(boolean aFlag) { if (collectPanel != null) { collectPanel.closeHWCDialogs(); } super.setVisible(aFlag); } } gprofng-gui-2.1/org/gprofng/mpmt/collect/HWCSelectDialog.java0000644000175000017500000000560714744453367021151 00000000000000/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package org.gprofng.mpmt.collect; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dialog; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; import java.util.Map; import javax.swing.JButton; public class HWCSelectDialog extends AnDialog2 { private CollectPanel collectPanel; private HWCSelectPanel hwcSelectPanel; public HWCSelectDialog( Dialog dialog, CollectPanel collectPanel, List hwcFlatList, Map hwcNameMap) { super(dialog, collectPanel, AnLocale.getString("Select Hardware Counters")); this.collectPanel = collectPanel; hwcSelectPanel = new HWCSelectPanel(this, hwcFlatList, hwcNameMap); setHelpTag(AnVariable.HELP_CollectDialog); setCustomPanel(hwcSelectPanel); getHelpButton().setVisible(true); getOKButton().setText(AnLocale.getString("Add")); getOKButton().setMnemonic((AnLocale.getString('A', "HWCSelectDialog.Add"))); setModal(false); JButton HWCHelpButton = new JButton(AnLocale.getString("Hardware Counter Descriptions")); AnUtility.setAccessibleContext( HWCHelpButton.getAccessibleContext(), AnLocale.getString("Hardware Counter Help")); HWCHelpButton.setMnemonic((AnLocale.getString('C', "HWCSelectDialog.availableCountersButton"))); HWCHelpButton.setToolTipText(AnLocale.getString("Hardware Counter Help")); HWCHelpButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { HWCSelectDialog.this.collectPanel.showAvailableCountersDialog(); } }); addAuxButton(HWCHelpButton); } @Override public void setVisible(boolean b) { if (b) { hwcSelectPanel.resetGUI(); } super.setVisible(b); } protected List getSelectedEntries() { return hwcSelectPanel.getSelectedEntries(); } @Override protected void setStatus(Status status) { super.setStatus(status); if (getStatus() == AnDialog2.Status.OK) { List selectedList = getSelectedEntries(); collectPanel.addHWCEntry(selectedList); } } } gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectPanel2.form0000644000175000017500000005124614744453367020721 00000000000000

<Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> </TableColumnModel> </Property> <Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor"> <JTableSelectionModel selectionMode="0"/> </Property> <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> <TableHeader reorderingAllowed="true" resizingAllowed="true"/> </Property> </Properties> </Component> </SubComponents> </Container> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanel3"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="12" insetsRight="12" anchor="15" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JTextField" name="jTextField1"> <Properties> <Property name="columns" type="int" value="12"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel3"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jTextField1"/> </Property> <Property name="text" type="java.lang.String" value="Target PID:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox2"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value="test.1.er"/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel4"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox2"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox3"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value=" "/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel5"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox3"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Directory:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox4"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value=" "/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="3" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel6"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox4"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Group:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="jTextField2"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="text" type="java.lang.String" value="gp-display-text"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="0" gridWidth="4" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel7"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jTextField2"/> </Property> <Property name="text" type="java.lang.String" value="Target Name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="jButton2"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="5" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="jButton6"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="5" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectorOpenPanel.form������������������������������������0000644�0001750�0001750�00000011717�14744453367�022021� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="label1"> <Properties> <Property name="text" type="java.lang.String" value="jLabel1"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="experimentLabel"> <Properties> <Property name="text" type="java.lang.String" value="jLabel3"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="pathTextField"> <Properties> <Property name="editable" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="configurationOuterPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="12" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="0" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="0" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> </Container> </SubComponents> </Form> �������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/HWCSelectPanel.java����������������������������������������0000644�0001750�0001750�00000100645�15044710303�020763� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.picklist.StringPickListElement; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; public class HWCSelectPanel extends JPanel { private HWCSelectDialog dialog; private List<HWCEntry> hwcFlatList; // All counters private List<HWCEntry> hwcFilteredList; // Filtered counters only private final Map<String, HWCEntry> hwcNameMap; private TableModel tableModel; private JTable table; private static StringPickList includePicklist = new StringPickList(); private static StringPickList excludePicklist = new StringPickList(); private ItemListener includeItemListener = null; private ItemListener excludeItemListener = null; private JMenuItem copySelectedItems; private JMenuItem copyAllItems; public HWCSelectPanel( HWCSelectDialog dialog, List<HWCEntry> hwcFlatList, Map<String, HWCEntry> hwcNameMap) { AnUtility.checkIfOnAWTThread(true); this.dialog = dialog; this.hwcFlatList = hwcFlatList; this.hwcNameMap = hwcNameMap; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext( infoLabel, AnLocale.getString( "Select one or more HW counters from the list of available counters below.")); // Filter panel filterPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext(filterLabel, " " + AnLocale.getString("Filters")); filterLabel.setLabelFor(includeComboBox); filterLabel.setOpaque(true); checkBoxPanel.setOpaque(false); recommendedIconLabel.setIcon(AnUtility.circleGreenIcon); recommendedCheckBox.setOpaque(false); recommendedCheckBox.setSelected(false); AnUtility.setTextAndAccessibleContext( recommendedCheckBox, AnLocale.getString("Recommended (R)")); recommendedCheckBox.setToolTipText(AnLocale.getString("Recommended hardware counters")); recommendedCheckBox.setMnemonic(AnLocale.getString('R', "HWCSelectPanel.recommendedCheckBox")); timeIconLabel.setIcon(AnUtility.circleRedIcon); timeCheckBox.setOpaque(false); timeCheckBox.setSelected(false); AnUtility.setTextAndAccessibleContext(timeCheckBox, AnLocale.getString("Time (T)")); timeCheckBox.setToolTipText(AnLocale.getString("Hardware counters supporting time profiling")); timeCheckBox.setMnemonic(AnLocale.getString('T', "HWCSelectPanel.timeCheckBox")); memoryIconLabel.setIcon(AnUtility.circleBlueIcon); memoryCheckBox.setOpaque(false); memoryCheckBox.setSelected(false); AnUtility.setTextAndAccessibleContext(memoryCheckBox, AnLocale.getString("Memoryspace (M)")); memoryCheckBox.setToolTipText( AnLocale.getString("Hardware counters supporting memory profiling")); memoryCheckBox.setMnemonic(AnLocale.getString('M', "HWCSelectPanel.memoryCheckBox")); String includeTT = AnLocale.getString("Include entries that contain any of these text strings"); includeLabel.setText(AnLocale.getString("Include:")); includeLabel.setToolTipText(includeTT); includeLabel.setDisplayedMnemonic( AnLocale.getString('I', "HWCSelectPanel.IncludeLabelMnemonic")); includeLabel.setLabelFor(includeComboBox); includeComboBox.setToolTipText(includeTT); String excludeTT = AnLocale.getString("Exclude entries that contain any of these text strings"); excludeLabel.setToolTipText(excludeTT); excludeLabel.setText(AnLocale.getString("Exclude:")); excludeLabel.setDisplayedMnemonic( AnLocale.getString('X', "HWCSelectPanel.ExcludeLabelMnemonic")); excludeLabel.setLabelFor(excludeComboBox); excludeComboBox.setToolTipText(excludeTT); refreshButton.setText(AnLocale.getString("Refresh")); refreshButton.setMnemonic(AnLocale.getString('f', "HWCSelectPanel.RefreshButton")); refreshButton.setToolTipText(AnLocale.getString("Apply filters")); includeComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); excludeComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // Label panel listLabelPanel.setOpaque(false); AnUtility.setTextAndAccessibleContext(listLabel, AnLocale.getString("Available Counters")); listLabel.setDisplayedMnemonic(AnLocale.getString('V', "HWCSelectPanel.listLabel")); // Table tablePanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); tablePanel.setLayout(new BorderLayout()); table = new JTable(tableModel = new TableModel()); table.setDefaultRenderer(String.class, new TableCellRenderer()); table.setBorder(null); table.setBackground(Color.WHITE); table.getTableHeader().setReorderingAllowed(false); table.setFillsViewportHeight(true); table.setAutoCreateRowSorter(true); AnUtility.setAccessibleContext( table.getTableHeader().getAccessibleContext(), AnLocale.getString("Table Header")); // Handle Enter key table.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { if (HWCSelectPanel.this.dialog.getOKButton().isEnabled()) { HWCSelectPanel.this.dialog.getOKButton().doClick(); e.consume(); } } } }); // Handle double-click table.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (HWCSelectPanel.this.dialog.getOKButton().isEnabled()) { HWCSelectPanel.this.dialog.getOKButton().doClick(); e.consume(); } } } }); JPopupMenu popupMenu = new JPopupMenu(); copySelectedItems = new JMenuItem(AnLocale.getString("Copy Selected")); copySelectedItems.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int selectedRows[] = table.getSelectedRows(); copyToClipboard(selectedRows); } }); copyAllItems = new JMenuItem(AnLocale.getString("Copy All")); copyAllItems.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { copyToClipboard(0, table.getRowCount()); } }); popupMenu.add(copySelectedItems); popupMenu.add(copyAllItems); table.setComponentPopupMenu(popupMenu); listLabel.setLabelFor(table); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBorder(null); scrollPane.setBackground(Color.WHITE); tablePanel.add(scrollPane, BorderLayout.CENTER); includeComboBox.addItemListener( includeItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { applyFiltersAndUpdateGUI(); } } }); excludeComboBox.addItemListener( excludeItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { applyFiltersAndUpdateGUI(); } } }); dialog.getOKButton().setEnabled(false); table .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { HWCSelectPanel.this .dialog .getOKButton() .setEnabled(table.getSelectedRowCount() > 0); } }); // Set coulumn widths (available space goes to last column) table.getColumnModel().getColumn(0).setPreferredWidth(35); table.getColumnModel().getColumn(0).setMaxWidth(35); table.getColumnModel().getColumn(1).setPreferredWidth(20); table.getColumnModel().getColumn(1).setMaxWidth(20); table.getColumnModel().getColumn(2).setPreferredWidth(300); table.getColumnModel().getColumn(2).setMaxWidth(800); table.getColumnModel().getColumn(3).setPreferredWidth(100); table.getColumnModel().getColumn(3).setMaxWidth(800); for (int i = 4; i < 6; i++) { table.getColumnModel().getColumn(i).setPreferredWidth(20); table.getColumnModel().getColumn(i).setMaxWidth(20); } setPreferredSize(new Dimension(1250, 800)); applyFiltersAndUpdateGUI(); } private void copyToClipboard(int first, int last) { int selectedRows[] = new int[last - first]; for (int i = 0; i < selectedRows.length; i++) { selectedRows[i] = i + first; } copyToClipboard(selectedRows); } private void copyToClipboard(int selectedRows[]) { int[] columnWidths = getColumnWidths(selectedRows); StringBuilder buf = new StringBuilder(); // Header for (int column = 0; column < table.getColumnCount(); column++) { String headerText = (String) table.getTableHeader().getColumnModel().getColumn(column).getHeaderValue(); String format = '%' + String.format("-%ds", columnWidths[column]); buf.append(String.format(format, headerText)); } buf.append("\n"); buf.append("\n"); // Table rows for (int i : selectedRows) { buf.append(formatRowAsText(columnWidths, i)); buf.append("\n"); } copyToClipboard(buf.toString()); System.out.println(buf.toString()); } private String formatRowAsText(int[] columnWidths, int row) { StringBuilder buf = new StringBuilder(); for (int column = 0; column < table.getColumnCount(); column++) { Object object = table.getModel().getValueAt(row, column); if (object instanceof String) { String format = '%' + String.format("-%ds", columnWidths[column]); buf.append(String.format(format, object)); } } return buf.toString(); } private void copyToClipboard(String text) { StringSelection data = new StringSelection(text); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(data, data); } private int[] getColumnWidths(int selectedRows[]) { int[] columnWidths = getFixedColumnWidths(); for (int row : selectedRows) { String text; int len; text = (String) table.getModel().getValueAt(row, 2); len = text.length() + 3; if (len > columnWidths[2]) { columnWidths[2] = len; } text = (String) table.getModel().getValueAt(row, 3); len = text.length() + 3; if (len > columnWidths[3]) { columnWidths[3] = len; } text = (String) table.getModel().getValueAt(row, 6); len = text.length() + 3; if (len > columnWidths[6]) { columnWidths[6] = len; } } return columnWidths; } private int[] getFixedColumnWidths() { int[] columnWidths = new int[table.getColumnCount()]; columnWidths[0] = 4; columnWidths[1] = 2; columnWidths[2] = 0; // variable width columnWidths[3] = 0; // variable width columnWidths[4] = 2; columnWidths[5] = 2; columnWidths[6] = 0; // variable width return columnWidths; } protected void resetGUI() { // includeComboBox.setSelectedItem(""); // excludeComboBox.setSelectedItem(""); } private void updateFilterComboBoxes(String includeFilterString, String excludeFilterString) { includePicklist.addElement(includeFilterString); excludePicklist.addElement(excludeFilterString); updateFilterComboBoxes( includePicklist, includeFilterString, excludePicklist, excludeFilterString); } private boolean containsIgnoreCase(String string, String clause) { return string != null && string.toLowerCase().contains(clause.toLowerCase()); } private List<HWCEntry> filterEntries( List<HWCEntry> origList, String rawIncludeFilterString, boolean exclude) { String[] substrings = rawIncludeFilterString.split(" "); // multiword match //FIXUP bypass escaped spaces? // String[] substrings = {raw_includeFilterString}; // exact text match List<String> clauses = new ArrayList<>(); for (int ii = 0; ii < substrings.length; ii++) { if (substrings[ii].isEmpty()) { continue; // strip out empty clauses caused by consecutive spaces } clauses.add(substrings[ii]); } final List<HWCEntry> newList; if (clauses.isEmpty()) { newList = new ArrayList<>(origList); } else { newList = new ArrayList<>(); for (HWCEntry entry : origList) { boolean pass = false; for (String clause : clauses) { if (containsIgnoreCase(entry.getMetricText(), clause) || containsIgnoreCase(entry.getCounterText(), clause) || containsIgnoreCase(entry.getDescriptionText(hwcNameMap), clause)) { pass = true; break; } } if (exclude) { if (!pass) { newList.add(entry); } } else if (pass) { newList.add(entry); } } } return newList; } private void updateFilterComboBoxes( StringPickList includePicklist, String currentIncludeFilter, StringPickList excludePicklist, String currentExcludeFilter) { AnUtility.checkIfOnAWTThread(true); includeComboBox.removeAllItems(); includeComboBox.addItem(""); for (StringPickListElement elem : includePicklist.getStringElements()) { if (elem.getString().length() > 0) { includeComboBox.addItem(elem.getString()); } } if (currentIncludeFilter != null) { includeComboBox.setSelectedItem(currentIncludeFilter); } excludeComboBox.removeAllItems(); excludeComboBox.addItem(""); for (StringPickListElement elem : excludePicklist.getStringElements()) { if (elem.getString().length() > 0) { excludeComboBox.addItem(elem.getString()); } } if (currentExcludeFilter != null) { excludeComboBox.setSelectedItem(currentExcludeFilter); } } private void applyFiltersAndUpdateGUI() { AnUtility.checkIfOnAWTThread(true); // System.out.println("applyFiltersAndUpdateGUI"); includeComboBox.removeItemListener(includeItemListener); excludeComboBox.removeItemListener(excludeItemListener); hwcFilteredList = new ArrayList<>(); // Check boxes for (HWCEntry hwcEntry : hwcFlatList) { if (recommendedCheckBox.isSelected() && !hwcEntry.isRecommended()) { continue; } if (timeCheckBox.isSelected() && !hwcEntry.supportsTime(hwcNameMap)) { continue; } if (memoryCheckBox.isSelected() && !hwcEntry.supportsMemspace(hwcNameMap)) { continue; } hwcFilteredList.add(hwcEntry); } // Text filters String includeFilterString = (String) includeComboBox.getSelectedItem(); String excludeFilterString = (String) excludeComboBox.getSelectedItem(); if (includeFilterString == null) { includeFilterString = ""; } if (excludeFilterString == null) { excludeFilterString = ""; } hwcFilteredList = filterEntries(hwcFilteredList, includeFilterString, false); hwcFilteredList = filterEntries(hwcFilteredList, excludeFilterString, true); includeComboBox.addItem(includeFilterString); excludeComboBox.addItem(excludeFilterString); // Update table tableModel.fireTableDataChanged(); // Update labels String format0 = AnLocale.getString(" (%d/%d shown)"); maxListLabel.setText(String.format(format0, hwcFilteredList.size(), hwcFlatList.size())); String format1 = AnLocale.getString("Available HW counters, showing %s out of %s available counters"); String tooltip = String.format(format1, hwcFilteredList.size(), hwcFlatList.size()); maxListLabel.setToolTipText(tooltip); listLabel.setToolTipText(tooltip); // Update comboboxes updateFilterComboBoxes(includeFilterString, excludeFilterString); includeComboBox.addItemListener(includeItemListener); excludeComboBox.addItemListener(excludeItemListener); copySelectedItems.setEnabled(table.getRowCount() > 0); copyAllItems.setEnabled(table.getRowCount() > 0); requestTableFocus(); } private void requestTableFocus() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (table.getModel().getRowCount() > 0) { table.getSelectionModel().setSelectionInterval(0, 0); table.requestFocus(); } } }); } class TableCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); HWCEntry hwcEntry = hwcFilteredList.get(table.convertRowIndexToModel(row)); if (column == 0 || column == 1 || column == 4 || column == 5) { label.setHorizontalAlignment(JLabel.CENTER); } else { label.setHorizontalAlignment(JLabel.LEFT); } if (column == 1 && hwcEntry.isRecommended()) { label.setIcon(AnUtility.circleGreenIcon); label.setText(""); } else if (column == 4 && hwcEntry.supportsTime(hwcNameMap)) { label.setIcon(AnUtility.circleRedIcon); label.setText(""); } else if (column == 5 && hwcEntry.supportsMemspace(hwcNameMap)) { label.setIcon(AnUtility.circleBlueIcon); label.setText(""); } else { label.setIcon(null); } String ttText = hwcEntry.getDescriptionText(hwcNameMap); if (ttText == null || ttText.length() == 0) { ttText = hwcEntry.getMetricText(); } label.setToolTipText(ttText); return label; } } class TableModel extends AbstractTableModel { private String[] columnNames = { "#", AnLocale.getString("R"), AnLocale.getString("Metric"), AnLocale.getString("Counter"), AnLocale.getString("T"), AnLocale.getString("M"), AnLocale.getString("Description") }; @Override public int getColumnCount() { return columnNames.length; } @Override public int getRowCount() { int rowCount; if (hwcFilteredList == null) { rowCount = 0; } else { rowCount = hwcFilteredList.size(); } return rowCount; } @Override public String getColumnName(int col) { return columnNames[col]; } @Override public Object getValueAt(int row, int col) { if (row >= hwcFilteredList.size()) { return null; // FIXUP: why is this necessary? } HWCEntry hwcEntry = hwcFilteredList.get(row); switch (col) { case 0: { return String.format("%03d", hwcEntry.getNo()); } case 1: { return hwcEntry.isRecommended() ? "R" : ""; } case 2: { // Metric return hwcEntry.getMetricText(); } case 3: { // Counter return hwcEntry.getCounterText(); } case 4: { return hwcEntry.supportsTime(hwcNameMap) ? "T" : ""; } case 5: { return hwcEntry.supportsMemspace(hwcNameMap) ? "M" : ""; } case 6: { // Description return hwcEntry.getDescriptionText(hwcNameMap); } default: { return "???"; } } } @Override public Class getColumnClass(int c) { Object o = getValueAt(0, c); if (o != null) { return getValueAt(0, c).getClass(); } else { return super.getColumnClass(c); } } } protected List<HWCEntry> getSelectedEntries() { List<HWCEntry> list = new ArrayList<>(); int selected[] = table.getSelectedRows(); for (int i : selected) { list.add(hwcFilteredList.get(table.convertRowIndexToModel(i)).copy()); } return list; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoLabel = new javax.swing.JLabel(); filterPanel = new javax.swing.JPanel(); filterLabel = new javax.swing.JLabel(); checkBoxPanel = new javax.swing.JPanel(); recommendedIconLabel = new javax.swing.JLabel(); recommendedCheckBox = new javax.swing.JCheckBox(); timeIconLabel = new javax.swing.JLabel(); timeCheckBox = new javax.swing.JCheckBox(); memoryIconLabel = new javax.swing.JLabel(); memoryCheckBox = new javax.swing.JCheckBox(); includeLabel = new javax.swing.JLabel(); includeComboBox = new javax.swing.JComboBox(); excludeLabel = new javax.swing.JLabel(); excludeComboBox = new javax.swing.JComboBox(); refreshButton = new javax.swing.JButton(); listLabelPanel = new javax.swing.JPanel(); listLabel = new javax.swing.JLabel(); maxListLabel = new javax.swing.JLabel(); tablePanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); infoLabel.setText("info..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(infoLabel, gridBagConstraints); filterPanel.setLayout(new java.awt.GridBagLayout()); filterLabel.setText("Filter"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipady = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; filterPanel.add(filterLabel, gridBagConstraints); checkBoxPanel.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); checkBoxPanel.add(recommendedIconLabel, gridBagConstraints); recommendedCheckBox.setText("Recommended"); recommendedCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { recommendedCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); checkBoxPanel.add(recommendedCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; checkBoxPanel.add(timeIconLabel, gridBagConstraints); timeCheckBox.setText("Time"); timeCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { timeCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; checkBoxPanel.add(timeCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; checkBoxPanel.add(memoryIconLabel, gridBagConstraints); memoryCheckBox.setText("Memory"); memoryCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { memoryCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; checkBoxPanel.add(memoryCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; filterPanel.add(checkBoxPanel, gridBagConstraints); includeLabel.setText("Include"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0); filterPanel.add(includeLabel, gridBagConstraints); includeComboBox.setEditable(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0); filterPanel.add(includeComboBox, gridBagConstraints); excludeLabel.setText("and exclude"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 8, 4, 0); filterPanel.add(excludeLabel, gridBagConstraints); excludeComboBox.setEditable(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0); filterPanel.add(excludeComboBox, gridBagConstraints); refreshButton.setText("Refresh"); refreshButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { refreshButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 8, 4, 0); filterPanel.add(refreshButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(filterPanel, gridBagConstraints); listLabelPanel.setLayout(new java.awt.GridBagLayout()); listLabel.setText("Available Counters:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; listLabelPanel.add(listLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; listLabelPanel.add(maxListLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(listLabelPanel, gridBagConstraints); tablePanel.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(tablePanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void refreshButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_refreshButtonActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_refreshButtonActionPerformed private void recommendedCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_recommendedCheckBoxActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_recommendedCheckBoxActionPerformed private void timeCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_timeCheckBoxActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_timeCheckBoxActionPerformed private void memoryCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_memoryCheckBoxActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_memoryCheckBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel checkBoxPanel; private javax.swing.JComboBox excludeComboBox; private javax.swing.JLabel excludeLabel; private javax.swing.JLabel filterLabel; private javax.swing.JPanel filterPanel; private javax.swing.JComboBox includeComboBox; private javax.swing.JLabel includeLabel; private javax.swing.JLabel infoLabel; private javax.swing.JLabel listLabel; private javax.swing.JPanel listLabelPanel; private javax.swing.JLabel maxListLabel; private javax.swing.JCheckBox memoryCheckBox; private javax.swing.JLabel memoryIconLabel; private javax.swing.JCheckBox recommendedCheckBox; private javax.swing.JLabel recommendedIconLabel; private javax.swing.JButton refreshButton; private javax.swing.JPanel tablePanel; private javax.swing.JCheckBox timeCheckBox; private javax.swing.JLabel timeIconLabel; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectPanel.java������������������������������������������0000644�0001750�0001750�00000513033�15044710303�020566� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PipedInputStream; import java.io.PipedOutputStream; import static java.lang.Thread.sleep; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.LineBorder; import javax.swing.border.SoftBevelBorder; import javax.swing.border.TitledBorder; public final class CollectPanel extends JPanel implements ActionListener { private static final int CEXP_NA = 0; private static final int CEXP_TARGET = 1; private static final int CEXP_NAME = 2; private static final int CEXP_DIR = 3; private static final int CEXP_GROUP = 4; private static final int CEXP_WORK = 5; private static final int CEXP_LNCH = 6; private static final int CEXP_ENV = 7; protected final String CSTR_TARGET, CSTR_DIR, CSTR_GROUP, CSTR_WORK, CSTR_TARGET_JDK; private TargetJDK target_jdk = null; public CollectExp target, args, exp_name, work_dir, env_vars, launcher, vm_args; public CollectData descendant, pause_sig, sample_sig, exp_limit, time_limit, arch_exp, clock_prof, sync_trace, hwc1_prof, hwc1_val, dspace_hwc1, hwc2_prof, hwc2_val, dspace_hwc2, io_trace, heap_trace, data_race, count_data, mpi_trace, jvm_prof, sample, dbxsample, ctr_attr, reg_alloc, deadlock_trace, prof_idle; private CollectPanel2 collectPanel2; // "Profile Running Process" private CollectPanel3 collectPanel3; // "System Profiling" public JTextField preview_cmd; // public JTextArea preview_cmd; // public JScrollPane work_panel; public JPanel work_panel; public JTabbedPane tab_pane; public JRadioButton startPaused, startResumed; public JLabel start_state; public List<HWCEntry> selectedHWCList; public JList<HWCEntry> hwcList; private JScrollPane hwcListScrollPane; private HWCSelectDialog hwcSelectDialog = null; private AnDialog2 availableCountersDialog = null; public List<String> sel_attr; public JList<String> attrList; private JScrollPane attrScrollPane; public JButton updateButton, cancelButton; public JPanel buttonPanel; public boolean attr_warn; private JButton propertyButton; private JButton addHWCButton; private JButton removeButton; // private JButton showButton; private JButton remAttr; private JButton addAttr; private JButton modAttr; private JLabel counterLabel; private JLabel selectedAttrLabel; private JPanel hwcPanel; // Data to collect private final String[][] arch_data = { { AnLocale.getString("On"), AnLocale.getString("Used Sources"), AnLocale.getString("All Sources"), AnLocale.getString("Off") }, {ipc_str_on, "usedsrc", "src", ipc_str_off} }; private final String[][] desc_data = { {AnLocale.getString("On"), AnLocale.getString("Off"), AnLocale.getString("Custom")}, {ipc_str_on, ipc_str_off, "=.*"} }; private final String[][] sig_data = { {AnLocale.getString("Off"), "USR1", "USR2", "PROF", AnLocale.getString("Custom")}, {ipc_str_off, "USR1", "USR2", "PROF", "USR1"} }; private final String[][] clock_data = { { AnLocale.getString("Normal (100 Hz)"), AnLocale.getString("High (1000 Hz)"), AnLocale.getString("Low (10 Hz)"), AnLocale.getString("Custom (msec)") }, {ipc_str_on, "high", "low", "10.0"} }; private final String[][] hwc_data = { { AnLocale.getString("Auto"), AnLocale.getString("Low"), AnLocale.getString("Mid"), AnLocale.getString("High"), AnLocale.getString("Custom") }, {"", "low", ipc_str_on, "high", "9999991"} }; private final String[][] sync_data = { {AnLocale.getString("Calibrate"), AnLocale.getString("All"), AnLocale.getString("Custom")}, {"calibrate", "all", "0"} }; private final String[][] samp_data = { {AnLocale.getString("Normal"), AnLocale.getString("Custom")}, {ipc_str_on, "1"} }; private final String[][] count_types = { {AnLocale.getString("On"), AnLocale.getString("Static")}, {ipc_str_on, "static"} }; private final String[][] limit_data = { {AnLocale.getString("Unlimited"), AnLocale.getString("Custom")}, {ipc_str_empty, ipc_str_empty} }; private final String[][] limit_time = { {AnLocale.getString("Unlimited"), AnLocale.getString("Custom")}, {ipc_str_empty, ipc_str_empty} }; private final String[][] mpi_data = { { AnLocale.getString("OMPT"), AnLocale.getString("CT"), AnLocale.getString("OPENMPI"), AnLocale.getString("MPICH2"), AnLocale.getString("MVAPICH2"), AnLocale.getString("off") }, {"OMPT", "CT", "OPENMPI", "MPICH2", "MVAPICH2", ipc_str_off} }; private final String[][] hwc_dsp_data = { {AnLocale.getString("Off"), AnLocale.getString("On")}, {ipc_str_off, ipc_str_on} }; private final String[][] prof_idle_data = { {AnLocale.getString("On"), AnLocale.getString("Off")}, {ipc_str_on, ipc_str_off} }; private final String external_terminal = "/usr/bin/gnome-terminal"; // backend info about system's hwcs private final int maxHWC; private final String[][] hwcSets; private final List<List<HWCEntry>> hwcLists; private final String[] hwc_attr_list; // hwc attribute list private final String[] hwc_help; // hwc help text private final Map<String, HWCEntry> hwcI18NMap; // Will be faced out private final Map<String, HWCEntry> hwcNameMap; private final List<HWCEntry> hwcFlatList; private JLabel errorLabel; // backend info saved into format needed for combo boxes private final String[][] hwc_name_data; private final String[][] hwc_att_data; private String[][] hwc_reg_data; private final ArrayList<CollectData> data_list, left_list; private final boolean profile_running_process; private final boolean system_profiling; private int target_type; private boolean toAdd; public JDialog hwcPropertyDialog; private CollectChooser dir_chooser; private CollectChooser target_chooser; private CollectChooser exp_group_chooser; private Collector collector; private JTextArea out_log; private JTextArea pioTextArea; private JButton bt_clear; private JPanel pioPanel; private AnWindow anWindow; private static Boolean mpi_support() { return false; } public JTextArea getOutLog() { return out_log; } public void setOutLog(JTextArea area) { out_log = area; } public JButton getBtClear() { return bt_clear; } private final JButton[] buttons; private JButton RunButton = null; private final AnDialog m_dialog; private final Provider m_prov; private Thread output_thread; private Thread read_file_thread = null; // Read collect_output_file private int autoUpdaterState = 0; // Interface constants /* Interface strings GUI <-> CLI */ static final String ipc_str_clkprof = "clkprof"; static final String ipc_str_hwcprof = "hwcprof"; static final String ipc_str_javaprof = "javaprof"; static final String ipc_str_sample = "sample"; static final String ipc_str_synctrace = "synctrace"; static final String ipc_str_heaptrace = "heaptrace"; static final String ipc_str_iotrace = "iotrace"; static final String ipc_str_thatrace = "thatrace"; static final String ipc_str_count = "count"; static final String ipc_str_MPIexpt = "MPIexpt"; // -M option static final String ipc_str_MPItrace = "MPItrace"; // -m option static final String ipc_str_dbxsample = "dbxsample"; // not implemented yet static final String ipc_str_sample_sig = "sample_sig"; // not implemented yet static final String ipc_str_pause_resume_sig = "pause_resume_sig"; // not implemented yet static final String ipc_str_descendant = "descendant"; // not implemented yet static final String ipc_str_arch_exp = "arch_exp"; // not implemented yet static final String ipc_str_time_limit = "time_limit"; // not implemented yet static final String ipc_str_exp_limit = "exp_limit"; // not implemented yet static final String ipc_str_hwc2_prof = "hwc2_prof"; static final String ipc_str_hwc_default = "default"; static final String ipc_str_hwc1_val = "hwc1_val"; // not implemented yet static final String ipc_str_dspace_hwc1 = "dspace_hwc1"; // not implemented yet static final String ipc_str_hwc_reg_alloc = "hwc_reg_alloc"; // not implemented yet static final String ipc_str_hwc_ctr_attr = "hwc_ctr_attr"; // not implemented yet // Standard answers static final String ipc_str_empty = ""; static final String ipc_str_comma = ","; static final String ipc_str_auto = "auto"; static final String ipc_str_on = "on"; static final String ipc_str_off = "off"; static final String ipc_str_space = " "; static final String ipc_str_unknown_control = "Unknown control"; static final String ipc_str_internal_error = "Internal error"; static final String ipc_str_zero = "0"; static final String ipc_str_all = "all"; static final String ipc_str_None = "None"; static final String ipc_str_race = "race"; static final String ipc_str_deadlock = "deadlock"; static final String ipc_str_prof_idle = "prof_idle"; // Semaphores private final Object globalSem = new Object(); // private Boolean inItemStateChanged = false; private Boolean clkprof_on_by_default = true; private Boolean javaprof_on_by_default = true; private Boolean hwcprof_on_by_default = false; private Boolean sample_on_by_default = true; private Boolean clkprof_not_changed_by_user = true; private Boolean javaprof_not_changed_by_user = true; private Boolean hwcprof_not_changed_by_user = true; private Boolean sample_not_changed_by_user = true; private String collect_output_file = null; // Temporary file for collect's output private String temp_file_name = null; // Temporary file for generated profiling script public CollectPanel( Collector collector, AnDialog anDialog, Provider cprov, AnWindow anWindow, JButton[] buttons) { this.collector = collector; this.anWindow = anWindow; this.m_dialog = anDialog; this.m_prov = cprov; CSTR_TARGET = AnLocale.getString("Target Program"); CSTR_DIR = AnLocale.getString("Experiment Directory"); CSTR_GROUP = AnLocale.getString("Experiment Group"); CSTR_WORK = AnLocale.getString("Working Directory"); CSTR_TARGET_JDK = AnLocale.getString("Target JDK"); data_list = new ArrayList<>(); left_list = new ArrayList<>(); this.buttons = buttons; // int h = CollectUtility.text_font.getSize(); // float hf = h; // titlefont = CollectUtility.text_font.deriveFont(1, hf); if (collector.getProfilingType() == Collector.PROFILE_RUNNING_APPLICATION) { profile_running_process = true; } else { profile_running_process = false; } if (collector.getProfilingType() == Collector.SYSTEM_PROFILING) { system_profiling = true; } else { system_profiling = false; } // HW Counters IPC // Note: could be done in parallel to reduce latency hwcSets = getHwcSets(system_profiling); maxHWC = getHwcMaxConcurrent(system_profiling); hwc_attr_list = getHwcAttrList(system_profiling); hwcLists = getHWCsAllProcess(getHwcsAll(system_profiling)); hwc_help = getHwcHelp(system_profiling); // populate hwc_map and hwcFlatList hwcI18NMap = new HashMap<>(); hwcNameMap = new HashMap<>(); hwcFlatList = new ArrayList<>(); // prepend default counters at top of list for (int ii = 0; hwcSets[0] != null && ii < hwcSets[0].length; ii++) { HWCEntry hwcEntry = new HWCEntry( true, hwcSets[1][ii], hwcSets[1][ii], hwcSets[0][ii], null, 0, 0, 0, null, null, false, false, true); hwcI18NMap.put(hwcEntry.getI18n(), hwcEntry); hwcNameMap.put(hwcEntry.getName(), hwcEntry); hwcEntry.setNo(hwcFlatList.size()); hwcFlatList.add(hwcEntry); } for (List<HWCEntry> list : hwcLists) { for (HWCEntry hwcEntry : list) { hwcI18NMap.put(hwcEntry.getI18n(), hwcEntry); hwcNameMap.put(hwcEntry.getName(), hwcEntry); hwcEntry.setNo(hwcFlatList.size()); hwcFlatList.add(hwcEntry); } } // populate *_data fields used in dropdowns if (hwcFlatList.isEmpty()) { hwc_name_data = new String[2][0]; // THOMAS: should probably disable HWCs in this case } else { hwc_name_data = new String[2][hwcFlatList.size()]; int ii = 0; for (HWCEntry hwcentry : hwcFlatList) { hwc_name_data[0][ii] = hwcentry.getI18n(); hwc_name_data[1][ii] = hwcentry.getName(); ii++; } hwc_reg_data = setRegData(hwcFlatList.get(0).getI18n()); } // populate hwc_att_data final String[] alist = hwc_attr_list; if ((alist == null) || (alist.length == 0)) { hwc_att_data = new String[2][1]; hwc_att_data[0][0] = AnLocale.getString("None"); hwc_att_data[1][0] = "0"; } else { hwc_att_data = new String[2][alist.length]; hwc_att_data[0] = alist; for (int i = 0; i < hwc_att_data[0].length; i++) { hwc_att_data[1][i] = "0"; } } // dumpHWCounters(); initComponents(); initButtons(); if (profile_running_process) { collectPanel2.update(); } if (system_profiling) { collectPanel3.update(); } autoUpdate(); collector.addCollectingStatusListener(this); } private void dumpHWCEntry(int no, HWCEntry hwcentry) { System.out.println("=============================== " + no); System.out.println("recommended: " + hwcentry.isRecommended()); System.out.println("name : " + hwcentry.getName()); System.out.println("collector : " + hwcentry.getCollectorString()); System.out.println("i18n : " + hwcentry.getI18n()); System.out.println("int_name : " + hwcentry.getIntName()); System.out.println("short_desc : " + hwcentry.getShortDesc()); System.out.println("metric : " + hwcentry.getMetric()); System.out.println( "val: " + hwcentry.getVal() + ", timecvt: " + hwcentry.getTimecvt() + ", supportsAttrs: " + hwcentry.supportsAttrs() + ", supportsMemspace: " + hwcentry.supportsMemspace(hwcNameMap) + ", memop: " + hwcentry.getMemop()); System.out.print("regs: "); if (hwcentry.getRegList() != null) { for (int i = 0; i < hwcentry.getRegList().length; i++) { System.out.print(" " + hwcentry.getRegList()[i]); } } System.out.println(""); } private void dumpHWCounters() { int no = 0; System.out.println("************************************************* hwc_max_reg"); System.out.println(maxHWC); System.out.println("************************************************* hwc_sets"); System.out.println("hwc_sets"); for (int i = 0; i < hwcSets[0].length; i++) { System.out.println(i + ": " + hwcSets[0][i] + ", " + hwcSets[1][i]); } System.out.println("************************************************* hwcs (std)"); no = 0; for (HWCEntry hwcentry : hwcLists.get(0)) { dumpHWCEntry(no++, hwcentry); } System.out.println("************************************************* hwcs (raw)"); no = 0; for (HWCEntry hwcentry : hwcLists.get(1)) { dumpHWCEntry(no++, hwcentry); } System.out.println("************************************************* hwcFlatList"); no = 0; for (HWCEntry hwcentry : hwcFlatList) { dumpHWCEntry(no++, hwcentry); } System.out.println("************************************************* hwc_attr_list"); for (int i = 0; i < hwc_attr_list.length; i++) { System.out.println(i + ": " + hwc_attr_list[i]); } } /** Check fields and update buttons */ private void autoUpdate() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { String err = null; RunButton = buttons[0]; while (null != target) { try { Thread.sleep(200); // wait 200 milliseconds if (!m_dialog.isVisible()) { continue; // to sleep } synchronized (globalSem) { if (autoUpdaterState == 1) { String target_name = target.getText(); if (profile_running_process) { if (null != target_name) { target_name = collectPanel2.getProcessID(); } } if (system_profiling) { if (null == target_name) { target_name = collectPanel3.getProcessID(); } } if ((null != target_name) && (target_name.length() > 0)) { RunButton.setEnabled(true); // XXX should use AWT thread RunButton.setToolTipText(AnLocale.getString("Start Profiling")); } else if (system_profiling) { RunButton.setEnabled(true); // XXX should use AWT thread RunButton.setToolTipText(AnLocale.getString("Start Kernel Profiling")); } else { RunButton.setEnabled(false); // XXX should use AWT thread RunButton.setToolTipText(AnLocale.getString("Target must be specified")); } if (getErrorText().length() > 0) { RunButton.setEnabled(false); // XXX should use AWT thread RunButton.setToolTipText(getErrorText()); } if (!profile_running_process && !system_profiling) { // Dependency between data_race, deadlock_trace, and descendant if ((data_race.check.isEnabled()) || (deadlock_trace.check.isEnabled())) { if ((data_race.isChecked()) || (deadlock_trace.isChecked())) { // disable descendant.combo TEMPORARY (DEBUG) descendant.combo.setEnabled(false); // descendant.combo.setSelectedIndex(1); // off } else { descendant.combo.setEnabled(true); // descendant.combo.setSelectedIndex(0); // on } } if ((descendant.field != null) && (ipc_str_on.equals(descendant.field.getText()))) { // do not disable data_race - on is a default // data_race.check.setEnabled(false); // deadlock_trace.check.setEnabled(false); } else { // Update descendant mode if ((descendant.field != null) && (ipc_str_off.equals(descendant.field.getText()))) { Collector.setCollectorControlValue( descendant.name, ipc_str_off); // IPC call } else { Collector.unsetCollectorControlValue(descendant.name); // IPC call } if ((!data_race.check.isEnabled())) { // try to enable data_race err = Collector.setCollectorControlValue( data_race.name, ipc_str_on); // IPC call if (null == err) { data_race.check.setEnabled(true); // Only if other controls allow if (!data_race.isChecked()) { Collector.unsetCollectorControlValue(data_race.name); // IPC call } } else { data_race.check.setEnabled(false); data_race.check.setSelected(false); // err = m_window.setCollectorControlValue(data_race.name, ipc_str_off); // // IPC call } } if ((!deadlock_trace.check.isEnabled())) { // try to enable deadlock_trace err = Collector.setCollectorControlValue( deadlock_trace.name, ipc_str_on); // IPC call if (null == err) { deadlock_trace.check.setEnabled(true); if (!deadlock_trace.isChecked()) { Collector.unsetCollectorControlValue(deadlock_trace.name); // IPC call } } else { deadlock_trace.check.setEnabled(false); deadlock_trace.check.setSelected(false); // err = m_window.setCollectorControlValue(deadlock_trace.name, // ipc_str_off); // IPC call } } } // End of Dependency between data_race, deadlock_trace, and descendant } // !in_dbx } if (autoUpdaterState == 2) { break; // Done } } // end of critical section } catch (Exception e) { // break; } } } }, "autoUpdateCollectDialog"); } /** * Set AutoUpdater State * * @param state */ private void setAutoUpdaterState(int state) { autoUpdaterState = state; try { Thread.sleep(300); // wait 200 milliseconds } catch (Exception e) { // break; } } /** * Read lines from specified InputStream and print them to the Process Output (JTextArea * pioTextArea) * * @param from */ private void output(InputStream from, List<String> fromVector) { String line; Thread thisThread = Thread.currentThread(); BufferedReader br = null; if (null == fromVector) { br = new BufferedReader(new InputStreamReader(from)); } boolean closed = false; JTextArea to = pioTextArea; int line_number = 0; while ((output_thread == thisThread) && !closed) { try { line = null; if (null == br) { if (fromVector.size() > 0) { line = fromVector.get(0); fromVector.remove(0); } else if (output_thread != thisThread) { closed = true; break; } } else { line = br.readLine(); } if (line != null) { if (line.length() > 0) { line_number++; if (line_number < 100) { // XXX: TEMPORARY HACK!!! String pattern = "Creating experiment directory "; int idx = line.indexOf(pattern); if (idx >= 0) { idx += pattern.length(); String substr = line.substring(idx); idx = substr.indexOf(ipc_str_space); if (idx > 1) { String expname = substr.substring(0, idx); // test.*.er collector.setActualExpName(expname); } // XXX: ANOTHER TEMPORARY HACK!!! pattern = "(Process ID: "; int n = line.indexOf(pattern); if (n >= 0) { n += pattern.length(); long p = 0; int d = 0; while ((d >= 0) && (d <= 9)) { p = p * 10 + d; d = line.charAt(n) - '0'; n++; } if (p > 0) { collector.setProcessPID(p); } } } } write /*ln*/(line, to); // We need a short delay to make sure the responsiveness // is good - otherwise AWT thread can be overloaded with // output requests and buttons Pause, Resume, Terminate // work with long delays. 10 milliseconds should be enough. // Thread.sleep(10); if (line_number % 100 == 0) { Thread.sleep(10); } continue; } } Thread.sleep(10); // empty line } catch (Exception e) { // don't print anything, this exception is expected // printException(e, AnLocale.getString("I/O exception 0")); if (output_thread != thisThread) { // closed = true; break; } } finally { // closed = true; } // NM if (output_thread == thisThread) { // NM closed = false; // TEMPORARY // NM } } } /** * Read lines from specified InputStream and print them to the Process Output (JTextArea * pioTextArea) * * @param from */ private void output(InputStream from, JTextArea out) { BufferedReader br = new BufferedReader(new InputStreamReader(from)); boolean closed = false; JTextArea to = pioTextArea; if (out != null) { to = out; } int line_number = 0; while (!closed) { String line; try { line = br.readLine(); if (line != null) { if (line.length() > 0) { line_number++; if (line_number < 100) { // XXX: TEMPORARY HACK!!! String pattern = "Creating experiment directory "; int idx = line.indexOf(pattern); if (idx >= 0) { idx += pattern.length(); String substr = line.substring(idx); idx = substr.indexOf(ipc_str_space); if (idx > 1) { String expname = substr.substring(0, idx); // test.*.er collector.setActualExpName(expname); } // XXX: ANOTHER TEMPORARY HACK!!! pattern = "(Process ID: "; int n = line.indexOf(pattern); if (n >= 0) { n += pattern.length(); long p = 0; int d = 0; while ((d >= 0) && (d <= 9)) { p = p * 10 + d; d = line.charAt(n) - '0'; n++; } if (p > 0) { collector.setProcessPID(p); } } } } // write/*ln*/(line, to); writeln(line, to); // We need a short delay to make sure the responsiveness // is good - otherwise AWT thread can be overloaded with // output requests and buttons Pause, Resume, Terminate // work with long delays. 10 milliseconds should be enough. if (line_number % 100 == 0) { Thread.sleep(10); } continue; } } Thread.sleep(10); // empty line } catch (Exception e) { // don't print anything, this exception is expected // printException(e, AnLocale.getString("I/O exception 0")); closed = true; break; } } } private static void printException(Exception e, String annot_msg) { if (annot_msg != null) { System.err.println(annot_msg + ": " + e.getMessage()); // DEBUG } else { System.err.println(e.getMessage()); // DEBUG } } private void write(final String line, final JTextArea to) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { to.append(line); to.setCaretPosition(to.getDocument().getLength()); } }); } // Output with new line private void writeln(final String line, final JTextArea to) { write(line + "\n", to); } // Add one collect argument private static void addOne(final ArrayList<String> cmd_list, final String flag, final String str) { if ((str != null) && (str.length() > 0)) { if (flag != null) { cmd_list.add(flag); } cmd_list.add(str); } } private ArrayList<String> getCmdList() { final ArrayList<String> cmd_list = new ArrayList<>(); final String hwc1, hwc2; String cmd = Analyzer.getInstance().getPathToCollect(); // experiment name/dir/group if (profile_running_process) { cmd_list.add(cmd); addOne(cmd_list, "-P", collectPanel2.getProcessID()); addOne(cmd_list, "-o", collectPanel2.getExperimentName()); } else if (system_profiling) { cmd = Analyzer.getInstance().getPathToCollectKernel(); cmd_list.add(cmd); String pid = collectPanel3.getProcessID(); if ((null != pid) && (pid.length() > 0)) { addOne(cmd_list, "-F", "=" + pid); } else { // er_kernel supports only one -F option String proc = collectPanel3.getProcessName(); if ((null != proc) && (proc.length() > 0)) { addOne(cmd_list, "-F", "=" + proc); } else { addOne(cmd_list, "-F", descendant.getValue()); } } addOne(cmd_list, "-o", collectPanel3.getExperimentName()); addOne(cmd_list, "-x", prof_idle.getValue()); } else { // profile application cmd_list.add(cmd); addOne(cmd_list, "-o", exp_name.getText()); } // don't add default limit value (now it's 2000 MB) addOne(cmd_list, "-L", exp_limit.getValue()); addOne(cmd_list, "-t", time_limit.getValue()); if (!profile_running_process && !system_profiling) { if (!descendant.getValue().equals(ipc_str_on)) { // Now "on" is the default value addOne(cmd_list, "-F", descendant.getValue()); } } else { // dbx cannot profile descendants // already done for er_kernel } // Archiving if (!arch_exp.getValue().equals(ipc_str_on)) { // Now "on" is the default value addOne(cmd_list, "-A", arch_exp.getValue()); } // set signals if (pause_sig.getValue() != null) { if (!pause_sig.getValue().equals(ipc_str_off)) { if (startResumed.isSelected()) { addOne(cmd_list, "-y", pause_sig.getValue() + ",r"); } else { addOne(cmd_list, "-y", pause_sig.getValue()); } } } addOne(cmd_list, "-l", sample_sig.getValue()); // data to collect addOne(cmd_list, "-p", clock_prof.getValue()); addOne(cmd_list, "-S", sample.getValue()); if (((hwc1 = hwc1_prof.getValue()) != null) && (selectedHWCList.size() > 0)) { String ctrlist = ipc_str_empty; String separator = ipc_str_empty; for (int i = 0; i < selectedHWCList.size(); i++) { String ctrname = selectedHWCList.get(i).getCollectorString(); addOne(cmd_list, "-h", ctrname); } } if (!profile_running_process && !system_profiling) { // Tracing options addOne(cmd_list, "-s", sync_trace.getValue()); if ((null != io_trace.getValue()) && (!io_trace.getValue().equals(ipc_str_off))) { addOne(cmd_list, "-i", io_trace.getValue()); } addOne(cmd_list, "-H", heap_trace.getValue()); // thread analyzer parameters if ((data_race.isChecked()) || (deadlock_trace.isChecked())) { boolean comma_is_required = false; String tha_params = ipc_str_empty; if (data_race.isChecked()) { comma_is_required = true; tha_params += "race"; } if (deadlock_trace.isChecked()) { tha_params += comma_is_required ? ipc_str_comma : ipc_str_empty; tha_params += "deadlock"; } addOne(cmd_list, "-r", tha_params); } addOne(cmd_list, "-c", count_data.getValue()); String mpi_trace_value = mpi_trace.getValue(); if (mpi_trace_value != null) { if (!mpi_trace_value.equals(ipc_str_off)) { addOne(cmd_list, "-M", mpi_trace_value); } } String java_prof = jvm_prof.getValue(); if (java_prof == null) { // pass "-j off" java_prof = ipc_str_off; addOne(cmd_list, "-j", java_prof); } // no need to pass "-j on" because it is the default } else // tracing is not supported by 'collect -P' { if (!system_profiling) { // Now 'collect -P' can support java profiling addOne(cmd_list, "-j", jvm_prof.getValue()); } } if (!profile_running_process /* && !system_profiling */) { target_type = getTargetType(target.getText()); // target command & arguments cmd_list.add(target.getText()); addOne(cmd_list, null, args.getText()); } else { // 'collect -P' does not need target } return cmd_list; } // Initialize the HWC configuration dialog public void showHWCPropertyDialog(HWCEntry entry) { String title = AnLocale.getString("Hardware Counter Properties"); AnDialog2 hwcPropertyDialog2 = new AnDialog2(m_dialog, m_dialog, title); hwcPropertyDialog2.getAccessibleContext().setAccessibleDescription(title); hwcPropertyDialog2.setCustomPanel(getHwcPanel(entry)); hwcPropertyDialog2.getOKButton().setText(AnLocale.getString("Update")); hwcPropertyDialog2.setVisible(true); if (hwcPropertyDialog2.getStatus() == AnDialog2.Status.OK) { int selectedIndex = hwcList.getSelectedIndex(); updateCtrList(entry); hwcList.setSelectedIndex(selectedIndex); } } // Initialize the HWC configuration dialog public void showHWCSelectDialog() { if (hwcSelectDialog == null) { hwcSelectDialog = new HWCSelectDialog(m_dialog, this, hwcFlatList, hwcNameMap); } hwcSelectDialog.setVisible(true); } public void closeHWCDialogs() { if (hwcSelectDialog != null) { hwcSelectDialog.setVisible(false); } if (availableCountersDialog != null) { availableCountersDialog.setVisible(false); } } protected void addHWCEntry(List<HWCEntry> selectedList) { int oldSize = selectedHWCList.size(); for (HWCEntry entry : selectedList) { if (entry.isSet()) { List<String> names = entry.getSetNames(); for (String name : names) { HWCEntry nameEntry = hwcNameMap.get(name); if (nameEntry != null) { selectedHWCList.add(nameEntry); } else { // FIXUP.... } } } else { selectedHWCList.add(entry); } } updateButtons(); int newSelectedIndex = oldSize++; // if (newSelectedIndex >= 0) { //FIXUP always >0 hwcList.setSelectedIndex(newSelectedIndex); // } hwcList.requestFocus(); } // Update list of selected counters void updateCtrList(HWCEntry hwcEntry) { String hwc1; String regval = ipc_str_empty; String attr = ipc_str_empty; // Warn user if add attribute wasn't hit after a change if (attr_warn == true) { final String msg = AnLocale.getString( "Attribute selection changed and Add Attribute was not clicked, do you want to" + " discard changes"); final int user_choice = JOptionPane.showConfirmDialog( this, msg, AnLocale.getString("Question"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.NO_OPTION) // do not discard changes { return; } } if (toAdd == true) { if ((hwc1 = hwc2_prof.getValue()) != null) { final String aggr_prof1 = dspace_hwc1.getValue() != null && dspace_hwc1.getValue().equals(ipc_str_on) ? "+" : ipc_str_empty; String[] hwcs = hwc1.split(ipc_str_comma); for (int i = 0; i < sel_attr.size(); i++) { attr = attr + sel_attr.get(i); } if (!reg_alloc.getValue().equals("None")) { regval = "/" + reg_alloc.getValue(); } String suffix = ipc_str_comma + hwc1_val.getValue(); if (suffix != null && suffix.equals(ipc_str_comma)) { suffix = ipc_str_empty; } // if (!hwcs[0].equals(ipc_str_hwc_default) && // ipc_str_on.equals(hwc1_val.getValue())) { // suffix = ipc_str_empty; // default // } String ctrstr = aggr_prof1 + hwcs[0] + attr + regval + suffix; // HWCEntry hwcEntry = null; // for (HWCEntry entry : selectedHWCList) { // if (entry.getName().equals(hwcs[0])) { // hwcEntry = entry; // break; // } // } // if (hwcEntry == null) { // hwcEntry = hwcNameMap.get(hwcs[0]); // } if (hwcEntry != null) { hwcEntry.setCollectorString(ctrstr); } // // If this register was already added - remove it // for (int i = 0; i < selectedHWCList.size(); i++) { // String s = selectedHWCList.get(i); // int k = s.indexOf(ipc_str_comma); // if (k > 0) { // s = s.substring(0, k); // } // int m = hwc1.indexOf(ipc_str_comma); // String newhwc = hwc1; // if (m > 0) { // newhwc = hwc1.substring(0, m); // } // if (s.equals(newhwc)) { // selectedHWCList.remove(i); // remove duplicate // } // } // selectedHWCList.add(ctrstr); // FIXUP updateButtons(); } } else // Modify existing entry { System.out.println(AnLocale.getString("Existing counter to be modified")); } attr_warn = false; } // Delete counter from list void deleteCtrFromList() { int idx = hwcList.getSelectedIndex(); selectedHWCList.remove(idx); updateButtons(); } // Add/Update attribute list void addAttribute() { attr_warn = false; String attrname = (String) ctr_attr.combo.getSelectedItem(); String attrStr = "~" + attrname + "="; String attrEntry = attrStr + ctr_attr.getValue(); Iterator<String> en = sel_attr.iterator(); boolean found = false; for (int i = 0; en.hasNext(); i++) { String cur_elem = en.next(); if (cur_elem.indexOf(attrStr) != -1) { sel_attr.set(i, attrEntry); // replace element found = true; } } if (!found) { sel_attr.add(attrEntry); } setAttrButtons(); } // Delete attribute from list void removeAttribute() { int idx = attrList.getSelectedIndex(); sel_attr.remove(idx); setAttrButtons(); } private void showChooser(String cmd) { if (cmd.equals(CSTR_TARGET)) { if (target_chooser == null) { target_chooser = new CollectChooser(AnChooser.TARGET_CHOOSER); } target_chooser.setDialogTitle(cmd); target_chooser.getFile(cmd); } else if (cmd.equals(CSTR_GROUP)) { if (exp_group_chooser == null) { exp_group_chooser = new CollectChooser(AnChooser.EXP_GROUP_CHOOSER); } exp_group_chooser.setDialogTitle(cmd); exp_group_chooser.getFile(cmd); } else if (cmd.equals(CSTR_DIR) || cmd.equals(CSTR_WORK) || cmd.equals(CSTR_TARGET_JDK)) { if (dir_chooser == null) { dir_chooser = new CollectChooser(AnChooser.DIR_CHOOSER); } dir_chooser.setDialogTitle(cmd); dir_chooser.getFile(cmd); } } private boolean checkSignals() { if (pause_sig.getValue() != null) { if (!pause_sig.getValue().equals(ipc_str_off)) { if (AnUtility.getSignalValue(pause_sig.getValue()) == -1) { AnUtility.showMessage( work_panel, AnLocale.getString("Illegal pause signal: ") + pause_sig.getValue(), JOptionPane.ERROR_MESSAGE); return false; } } } if (sample_sig.getValue() != null) { if (!sample_sig.getValue().equals(ipc_str_off)) { if (AnUtility.getSignalValue(sample_sig.getValue()) == -1) { AnUtility.showMessage( work_panel, AnLocale.getString("Illegal sample signal: ") + sample_sig.getValue(), JOptionPane.ERROR_MESSAGE); return false; } } } return true; } /** * checks java version used and warn user if its earlier then 1.4.2_02 TODO: Don't use AWT thread! * Create a special thread to call this method */ // NM public void checkJavaVersion() { // boolean check = false; // String line; // String version_str = "unknown"; // int ind; // // try { // final String[] javaversion = {getJavaStr(), "-version"}; // final Process p = Runtime.getRuntime().exec(javaversion); // p.waitFor(); // final InputStream data = p.getErrorStream(); // final BufferedReader br = new BufferedReader(new InputStreamReader(data)); // // while ((line = br.readLine()) != null) { // ind = line.indexOf("java version"); // if (ind != -1) { // version_str = (line.substring(ind + 13, line.length())).trim(); // break; // } // } // writeln(AnLocale.getString("Using java version ") + version_str + " ...", // getOutLog()); // version_str = version_str.substring(1, version_str.length() - 1); // skip quotes // ind = version_str.lastIndexOf('-'); // if (ind != -1) // cut -rc, -beta etc. from the end of the version string // { // version_str = version_str.substring(0, ind); // } // // ind = version_str.indexOf('.'); // if (ind != -1) { // String ver = version_str.substring(0, ind); // major version // int v = Integer.parseInt(ver); // if (v == 1) { // 1.?.? // int ind_next = version_str.indexOf('.', ind + 1); // ver = version_str.substring(ind + 1, ind_next); // ind = ind_next; // v = Integer.parseInt(ver); // if (v == 4) { // 1.4.? // ind_next = version_str.indexOf('_', ind + 1); // if (ind_next != -1) { // ver = version_str.substring(ind + 1, ind_next); // ind = ind_next; // v = Integer.parseInt(ver); // if (v == 2) { // 1.4.2_?? // ver = version_str.substring(ind + 1, version_str.length()); // v = Integer.parseInt(ver); // if (v >= 2) // 1.4.2_02 or later // { // check = true; // } else // 1.4.2_01 or earlier // { // check = false; // } // } else if (v > 2) // 1.4.3_?? // { // check = true; // } else { // check = false; // } // } else { // ver = version_str.substring(ind + 1, version_str.length()); // v = Integer.parseInt(ver); // if (v > 2) // 1.4.3 or later // { // check = true; // } else // 1.4.2 or earlier // { // check = false; // } // } // } else if (v < 4) // 1.3.* // { // check = false; // } else // 1.5.0 or later // { // check = true; // } // } else if (v > 1) // 2.*.* // { // check = true; // } else // major version less then 1 // { // check = false; // } // } // data.close(); // close Input Stream // } catch (NumberFormatException e) { // check = false; // } catch (IOException e) { // writeln(e.getMessage(), getOutLog()); // check = false; // } catch (InterruptedException e) { // writeln(e.getMessage(), getOutLog()); // check = false; // } // if (!check) { // writeln(AnLocale.getString("Warning: Java profiling requires JVM version 1.4.2_02 or // later"), // getOutLog()); // } // } // NM public String getJavaStr() { // String java_str = "java"; // final String header = target_jdk.getHeader(); // String jdk_path; // if (header.equals(AnLocale.getString("Path:"))) // { // jdk_path = target_jdk.getText().trim(); // } else if (header.equals(AnLocale.getString("Default (PATH based)"))) // { // jdk_path = "java"; // } else { // jdk_path = target_jdk.getText(); // } // // if (!jdk_path.equals(ipc_str_empty)) { // // // if (!jdk_path.equals(java_str)) { // Not Default (PATH based) // if (!jdk_path.endsWith(File.separator)) { // jdk_path += File.separatorChar; // } // java_str = jdk_path + "bin" + File.separatorChar + java_str; // } // } // return java_str; // } private String dbeGetExpParams(final String exp_name) { synchronized (IPC.lock) { anWindow.IPC().send("dbeGetExpParams"); anWindow.IPC().send(exp_name); return anWindow.IPC().recvString(); } } public void loadExpDefaults() { if (collector.isProcRunning()) { return; } if (null != work_dir) { // Set working directory work_dir.setText(Analyzer.getInstance().getWorkingDirectory()); // Still experimental..... } AnUtility.checkIPCOnWrongThread(false); final String[] exp_names = anWindow.getExpName(); // IPC AnUtility.checkIPCOnWrongThread(true); if (exp_names != null && exp_names.length != 0) { // find first non filtered experiment AnUtility.checkIPCOnWrongThread(false); final boolean[] expstats = anWindow.getExpEnable(); // IPC AnUtility.checkIPCOnWrongThread(true); int i = 0; String str_args = null; if (expstats != null) { while (i < expstats.length) { if (expstats[i]) { AnUtility.checkIPCOnWrongThread(false); str_args = dbeGetExpParams(exp_names[i]); // IPC AnUtility.checkIPCOnWrongThread(true); break; } i++; } } if (str_args != null) { final String[] arguments = str_args.split(ipc_str_space); final StringBuffer vargs = new StringBuffer(); final StringBuffer params = new StringBuffer(); final String trg; String trg_jdk = null; i = 0; if (arguments.length > 1) { // Check for java experiment if (new File(arguments[i]).getName().equals("java")) { final File jdk_dir = new File(arguments[i]).getParentFile(); if (jdk_dir != null) { trg_jdk = jdk_dir.getParent(); } else // Default java from $PATH { trg_jdk = ipc_str_empty; } i++; // skip -Xruncollector (it will be set later in collect) if (arguments[i].equals("-Xruncollector")) { i++; } while (arguments[i].startsWith("-") && i < arguments.length) { vargs.append(arguments[i] + ipc_str_space); if (arguments[i].equals("-cp") || arguments[i].equals("-classpath")) { vargs.append(arguments[++i] + ipc_str_space); } i++; } } } trg = arguments[i++]; while (i < arguments.length) { params.append(arguments[i++] + ipc_str_space); } setComponents(trg, params.toString().trim(), trg_jdk, vargs.toString().trim()); } } } // Show error mesg private void showError(final int err_type) { String msg = null; switch (err_type) { case TARG_UNKNOWN_TYPE: msg = AnLocale.getString("Target has unknown file type"); break; case TARG_NOT_EXISTS: msg = AnLocale.getString("Target doesnt't exist"); break; case TARG_IS_NOT_FILE: msg = AnLocale.getString("Target is not a file"); break; case TARG_IS_NOT_READABLE: msg = AnLocale.getString("Target is not readable"); break; } AnUtility.showMessage(work_panel, msg, JOptionPane.ERROR_MESSAGE); } @Override public void actionPerformed(final ActionEvent event) { String col_cmd; Iterator<String> iter; int i; final String cmd = event.getActionCommand(); final String empty = ipc_str_empty; Date date = new Date(); String sdate = date.toString(); if (cmd.equals(empty)) { int theState = event.getID(); // state change event if (theState == Collector.COLLECTING_RUNNING) { if (read_file_thread == null && collect_output_file != null) { // Create thread to read collect output file read_file_thread = new Thread("Read Collector Output Thread") { @Override public void run() { try { File f = new File(collect_output_file); while (collector.getCollectorState() == Collector.COLLECTING_RUNNING || collector.getCollectorState() == Collector.COLLECTING_PAUSED) { sleep(10); if (f.exists()) { break; } } if (!f.exists()) { return; } long len = 0; while (f.exists()) { if (f.length() > len) { BufferedReader in = new BufferedReader(new FileReader(f)); in.skip(len); String line; while ((line = in.readLine()) != null) { writeln(line, getOutLog()); } len = f.length(); in.close(); collector.read_collect_output_file(collect_output_file); } sleep(10); } } catch (Exception e) { printException(e, AnLocale.getString("Collector: Exeption in Read Collector Output Thread:")); } } }; read_file_thread.start(); } if (buttons[0].isEnabled()) { // the collection has just started String current_target_name = target.getText(); if (!profile_running_process && !system_profiling) { current_target_name = new File(current_target_name).getName(); } writeln( sdate + ": " + AnLocale.getString("Running: ") + current_target_name, getOutLog()); set_runtime_buttons(); } else { // the collection has been resumed String p = " (" + AnLocale.getString("process id ") + collector.getProcessPID() + ")"; writeln(sdate + ": " + AnLocale.getString("Data collection resumed" + p), getOutLog()); buttons[2].setText(AnLocale.getString("Pause")); buttons[2].setActionCommand(AnLocale.getString("Pause")); } } else if (theState == Collector.COLLECTING_PAUSED) { String p = " (" + AnLocale.getString("process id ") + collector.getProcessPID() + ")"; writeln(sdate + ": " + AnLocale.getString("Data collection paused" + p), getOutLog()); buttons[2].setText(AnLocale.getString("Resume")); buttons[2].setActionCommand(AnLocale.getString("Resume")); } else if (theState == Collector.COLLECTING_TERMINATING) { writeln(sdate + ": " + AnLocale.getString("Data collection terminating"), getOutLog()); } else if ((theState == Collector.COLLECTING_TERMINATED) || (theState == Collector.COLLECTING_COMPLETED)) { read_file_thread = null; if (theState == Collector.COLLECTING_TERMINATED) { writeln(sdate + ": " + AnLocale.getString("Data collection terminated"), getOutLog()); } if (output_thread != null) { // There is a potential problem - we have to make sure that // the output thread had enough time to copy all messages // from the output Vector to the Text area. // Wait till output_thread is still working int c = 0; while (output_thread != null) { if (c++ > 100) { break; // timeout 1 second } try { Thread.sleep(10); } catch (Exception e) { // continue } } output_thread = null; } collector.removeTempFile(collect_output_file); collector.removeTempFile(temp_file_name); if (collector.getProcessPID() > 0) { writeln( sdate + ": " + AnLocale.getString("Execution completed, exit status is ") + collector.getProcessExitValue(), getOutLog()); } else { writeln(sdate + ": " + AnLocale.getString("Execution failed"), getOutLog()); } writeln(AnLocale.getString("Process ID: ") + collector.getProcessPID(), getOutLog()); String actualExperimentName = collector.getActualExpName(); getBtClear().setEnabled(true); if (collector.getProcessPID() > 0) { if (actualExperimentName != null) { String wd = work_dir.getText(); final String experimentPath = getExperimentPath(actualExperimentName); AnDialog2 openDialog = new AnDialog2(m_dialog, m_dialog, AnLocale.getString("Open Experiment")); final CollectorOpenPanel collectorOpenPanel = new CollectorOpenPanel(experimentPath, wd); final String workingDirectory = wd; openDialog.setCustomPanel(collectorOpenPanel); openDialog.setHelpTag(null); openDialog.setVisible(true); if (openDialog.getStatus() == AnDialog2.Status.OK) { // Not Cancel try { // Wait till the Analyzer workspace has been initialized SwingUtilities.invokeLater( new Runnable() { @Override public void run() { final List<String> exp_list = AnUtility.getExpList(new String[] {experimentPath}); if (anWindow != null) { String configurationPath = collectorOpenPanel.getConfiguration(); boolean alwaysUseThisConfiguration = collectorOpenPanel.alwaysUseThisConfiguration(); anWindow.loadExperimentList( exp_list, false, workingDirectory, true, configurationPath, alwaysUseThisConfiguration); } // Close Collector dialog resetButtons(); m_dialog.setVisible(false); } }); return; // dialog is closed } catch (Exception e) { // e.printStackTrace(); showError(AnLocale.getString("Internal Error: open experiment failed.")); } } } else { // Report error showError(AnLocale.getString("Internal Error: no experiment.")); } } else { // Report profiling error String err = collector.getErrorMessage(); if (err == null) { err = "\nPlease, look at the Process output window for details"; } showError(AnLocale.getString("Error: Data collection failed: ") + err); // Clear old error message collector.setErrorMessage(ipc_str_empty); } resetButtons(); if (null != exp_name) { exp_name.setValue(collector.getNextExpName()); } } } else if (cmd.equals(AnLocale.getString("Run"))) { if (profile_running_process || system_profiling) { // Have to implement: check target, work_dir, exp_dir } else { // check target, work_dir, exp_dir if (target.getText().length() == 0) { tab_pane.setSelectedIndex(0); AnUtility.showMessage( work_panel, AnLocale.getString("The target name cannot be blank"), JOptionPane.ERROR_MESSAGE); return; } if ((work_dir.getText() == null) || (work_dir.getText().length() < 1)) { work_dir.setValue(Analyzer.getInstance().getWorkingDirectory()); } if (!collector.checkWorkDir(work_dir.getText())) { String errorMessage = AnLocale.getString("The working directory does not exist"); if (null != anWindow.getAnalyzer().remoteConnection) { errorMessage = AnLocale.getString("The working directory does not exist on remote system"); } AnUtility.showMessage(work_panel, errorMessage, JOptionPane.ERROR_MESSAGE); return; } if (!checkSignals()) { return; } // THIS CHECK IS NOT CORRECT - commented out (NM) // if (jvm_prof.isChecked()) { // checkJavaVersion(); // } } /* ^profile_running_process */ // Create commands list and invoke collect final ArrayList<String> cmdList = getCmdList(); final String[] cmds = new String[ /*getCmdList()*/cmdList.size()]; col_cmd = empty; // Define a temporary file for collect's output String output_file_name = null; if (!profile_running_process) { // 'collect -P' cannot redirect dbx's output (bug 17885089) if (!system_profiling) { // 'er_kernel -P' is not implemented yet if (!Analyzer.getInstance().isRemote()) { // not remote long t = System.currentTimeMillis(); output_file_name = "/tmp/collect_" + t + "_pid.txt"; } } /* ^system_profiling */ } /* ^profile_running_process */ for (i = 0, iter = /*getCmdList()*/ cmdList.iterator(); iter.hasNext(); i++) { cmds[i] = iter.next(); col_cmd += cmds[i] + ipc_str_space; if ((i == 0) && (null != output_file_name)) { col_cmd += "--outfile" + ipc_str_space + output_file_name + ipc_str_space; } } // Temporary correction of default HWC set if (col_cmd.contains("-h default,")) { String pattern = "-h default,"; int k = col_cmd.indexOf(pattern); String s = col_cmd.substring(0, k); s += "-h "; k += pattern.length(); s += col_cmd.substring(k, col_cmd.length()); col_cmd = s; } preview_cmd.setText(col_cmd); tab_pane.setSelectedIndex(2); // Create a pipe and read stdout try { if (profile_running_process || system_profiling) { // 'collect -P' cannot redirect dbx's output (bug 17885089) // don't use vector, use pipe final PipedOutputStream pos = new PipedOutputStream(); final PipedInputStream pis = new PipedInputStream(pos); collector.setLog(pos); output_thread = new Thread("Collector Panel Output Thread") { @Override public void run() { output(pis, getOutLog()); } }; } else { final PipedInputStream pis = null; final List<String> logVector = new ArrayList<>(); collector.setLog(logVector); output_thread = new Thread("Collector Panel Output Thread") { @Override public void run() { output(pis, logVector); } }; } output_thread.start(); } catch (Exception e) { // pis = null; } String run_cmd = col_cmd; String envs = env_vars.getText().trim(); if (null != envs && envs.length() > 0) { run_cmd = envs + " " + col_cmd; } if (!Analyzer.getInstance().isRemote()) { // Create temporary script if (temp_file_name == null) { try { File tempFile = File.createTempFile("collect", ".tmp"); temp_file_name = tempFile.getCanonicalPath(); } catch (Exception e) { temp_file_name = "/tmp/collect.sh.tmp"; // Use default name } } String contents = "#!/bin/sh\n" + "echo \"% cat -n " + temp_file_name + "\"\n" + "cat -n " + temp_file_name + "\n" + "cd " + work_dir.getText() + "\n" + "echo % pwd\npwd\n\n" + "echo \"% " + run_cmd + "\"\n" + run_cmd + "\n"; AnUtility.checkIPCOnWrongThread(false); anWindow.writeFile(temp_file_name, contents); AnUtility.checkIPCOnWrongThread(true); run_cmd = temp_file_name; } // Clean output window if (null != pioTextArea) { pioTextArea.setText(empty); } if (null != getOutLog()) { getOutLog().setText(empty); } String experimentGroup = ""; if (profile_running_process) { experimentGroup = collectPanel2.getExperimentGroup(); } else if (system_profiling) { experimentGroup = collectPanel3.getExperimentGroup(); } if (profile_running_process) { // fill fake fields target.text.setText(collectPanel2.getProcessID()); target.setText(run_cmd); // This is used to print what is running work_dir.text.setText(collectPanel2.getExperimentDirectory()); work_dir.setText(collectPanel2.getExperimentDirectory()); exp_name.text.setText(collectPanel2.getExperimentName()); env_vars.text.setText(empty); } if (system_profiling) { // fill fields exp_name.text.setText(collectPanel3.getExperimentName()); } collect_output_file = output_file_name; collector.collect( target.getText(), run_cmd, work_dir.getText(), exp_name.getText(), "", env_vars.getText().trim(), output_file_name, experimentGroup); } else if (cmd.equals(AnLocale.getString("Pause"))) { if (collector.pause(AnUtility.getSignalValue(pause_sig.getValue()))) {} tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Resume"))) { if (collector.resume(AnUtility.getSignalValue(pause_sig.getValue()))) {} tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Sample"))) { if (collector.sample(AnUtility.getSignalValue(sample_sig.getValue()))) { writeln(AnLocale.getString("Manual sample"), getOutLog()); } tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Terminate"))) { final String msg = AnLocale.getString("Do you want to terminate the running experiment?"); final int user_choice = JOptionPane.showConfirmDialog( this, msg, AnLocale.getString("Question"), JOptionPane.YES_NO_OPTION); if (user_choice == JOptionPane.YES_OPTION) { collector.terminate_expt(profile_running_process); } } else if (cmd.equals(AnLocale.getString("Preview Command:"))) { col_cmd = empty; for (i = 0, iter = getCmdList().iterator(); iter.hasNext(); i++) { col_cmd += iter.next() + ipc_str_space; } // Temporary correction of default HWC set String pattern = "-h " + ipc_str_hwc_default + ipc_str_comma; if (col_cmd.contains(pattern)) { int k = col_cmd.indexOf(pattern); String s = col_cmd.substring(0, k); s += "-h "; k += pattern.length(); s += col_cmd.substring(k, col_cmd.length()); col_cmd = s; } // Temporary correction of default HWC set pattern = "-h " + ipc_str_hwc_default + ipc_str_space; if (col_cmd.contains(pattern)) { int k = col_cmd.indexOf(pattern); String s = col_cmd.substring(0, k); s += "-h on "; k += pattern.length(); s += col_cmd.substring(k, col_cmd.length()); col_cmd = s; } // Remove "-j on" pattern = "-j " + ipc_str_on + ipc_str_space; if (col_cmd.contains(pattern)) { int k = col_cmd.indexOf(pattern); String s = col_cmd.substring(0, k); k += pattern.length(); s += col_cmd.substring(k, col_cmd.length()); col_cmd = s; } preview_cmd.setText(col_cmd); } else if (cmd.equals(AnLocale.getString("Properties"))) { toAdd = true; HWCEntry entry = hwcList.getSelectedValue(); showHWCPropertyDialog(entry); } else if (cmd.equals(AnLocale.getString("Add"))) { showHWCSelectDialog(); } else if (cmd.equals(AnLocale.getString("Remove"))) { int selectedIndex = hwcList.getSelectedIndex(); deleteCtrFromList(); if (selectedIndex >= (selectedHWCList.size() - 1)) { selectedIndex = selectedHWCList.size() - 1; } if (selectedIndex >= 0) { hwcList.setSelectedIndex(selectedIndex); } } else if (cmd.equals(AnLocale.getString("Add Attribute"))) { addAttribute(); } else if (cmd.equals(AnLocale.getString("Remove Attribute"))) { removeAttribute(); // } else if (cmd.equals(AnLocale.getString("Update"))) { // int selectedIndex = hwcList.getSelectedIndex(); // HWCEntry entry = (HWCEntry) hwcList.getSelectedValue(); // updateCtrList(entry); // hwcList.setSelectedIndex(selectedIndex); // } else if (cmd.equals(AnLocale.getString("Cancel"))) { // closeHWCPropertyDialog(); // } else if (cmd.equals(AnLocale.getString("Available Counters"))) { // String[] availableCounterText = hwc_help; // int noLines = availableCounterText.length; //// tab_pane.setSelectedIndex(2); //// for (i = 0; i < noLines; i++) { //// write(availableCounterText[i], getOutLog()); // Show available list //// } // // AnDialog2 availableCountersDialog = new AnDialog2(this, "Available Counters"); // JPanel panel = new JPanel(new BorderLayout()); // JScrollPane scrollPane = new JScrollPane(); // JTextArea textArea = new JTextArea(); // for (i = 0; i < noLines; i++) { // textArea.append(availableCounterText[i]); // } // textArea.setCaretPosition(0); // textArea.setFont(new Font("monospaced", Font.PLAIN, // textArea.getFont().getSize())); // scrollPane.setViewportView(textArea); // panel.add(scrollPane, BorderLayout.CENTER); // availableCountersDialog.setCustomPanel(panel); // availableCountersDialog.setModal(false); // availableCountersDialog.getCancelButton().setVisible(false); // availableCountersDialog.setPreferredSize(new // Dimension(availableCountersDialog.getPreferredSize().width - 300, 700)); // availableCountersDialog.pack(); // availableCountersDialog.setVisible(true); } else if (cmd.equals(AnLocale.getString("Clear"))) { // pioTerm.clearHistory(); pioTextArea.setText(empty); getOutLog().setText(empty); getBtClear().setEnabled(false); } else { showChooser(cmd); } } protected void showAvailableCountersDialog() { if (availableCountersDialog == null) { String[] availableCounterText = hwc_help; int noLines = availableCounterText.length; availableCountersDialog = new AnDialog2(m_dialog, this, "Hardware Counter Help"); JPanel panel = new JPanel(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(); JTextArea textArea = new JTextArea(); for (int i = 0; i < noLines; i++) { textArea.append(availableCounterText[i]); } textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setFont(new Font("monospaced", Font.PLAIN, textArea.getFont().getSize())); scrollPane.setViewportView(textArea); panel.add(scrollPane, BorderLayout.CENTER); availableCountersDialog.setCustomPanel(panel); availableCountersDialog.setModal(false); availableCountersDialog.getCancelButton().setVisible(false); availableCountersDialog.setPreferredSize(new Dimension(800, 850)); availableCountersDialog.pack(); } availableCountersDialog.setVisible(true); } private String getExperimentPath(String actual_expname) { String experimentPath = actual_expname; if (!actual_expname.startsWith("/")) { String path = path = work_dir.getText(); if (null == path) { path = Analyzer.getInstance().getWorkingDirectory(); } path = path.trim(); if (path.length() > 0) { experimentPath = path + "/" + actual_expname; } else { // BUG: CGetCurDir() may not work properly in remote mode path = Analyzer.getInstance().getWorkingDirectory(); work_dir.setValue(path); experimentPath = path + "/" + actual_expname; } } return experimentPath; } private void setComponents( final String target, final String params, final String target_jdk, final String vm_args) { // System.out.println("CollectPanel:setComponents:" + target); this.target.setText(target); this.args.setText(params); if (target_jdk != null) { this.jvm_prof.setChecked(true); // default java if (target_jdk.equals(ipc_str_empty)) { this.target_jdk.setSelectedIndex(this.target_jdk.getItemCount() - 1); } else { final String java_bin = target_jdk + File.separatorChar + "bin" + File.separatorChar + "java"; if (new File(java_bin).exists()) { this.target_jdk.setValue(target_jdk); } else { this.target_jdk.setSelectedIndex(1); } } if (!vm_args.equals(ipc_str_empty)) { this.vm_args.setValue(vm_args); } } else { this.jvm_prof.setChecked(false); } this.updateTitle(target); } private void showError(String msg) { AnUtility.showMessage(work_panel, msg, JOptionPane.ERROR_MESSAGE); } private String CGetExpName(String str) { return Collector.getExpName1(str); // IPC } public void updateTitle(String target) { m_prov.setTitleStr(title + " [" + new File(target).getName() + "]"); } public String getenv(String name) { return AnUtility.getenv(name); } public int getTargetType(String target_name) { // TODO: Check java class files to ensure that it has a main public method if (target_name == null) { return TARG_NOT_EXISTS; } if (!target_name.startsWith("/") && !target_name.startsWith("./") && !target_name.startsWith("../")) { return TARG_UNKNOWN_TYPE; } AnFile targ_file = new AnFile(target_name); /* NM if (!targ_file.exists()) { final String target_class_name = toJavaClassFileName(target_name); targ_file = new File(target_class_name); if (!targ_file.exists()) { final String work_str = work_dir.getText(); targ_file = new File(work_str, target_name); if (!targ_file.exists()) { targ_file = new File(work_str, target_class_name); if (!targ_file.exists() || !targ_file.isFile()) { return TARG_NOT_EXISTS; } } } } */ if (!targ_file.exists()) { return TARG_NOT_EXISTS; } if (!targ_file.isFile()) { return TARG_IS_NOT_FILE; } /* NM switch (AnUtility.getMimeFormat(targ_file)) { case AnUtility.MIME_ELF_EXECUTABLE: return TARG_ELF_EXECUTABLE; case AnUtility.MIME_JAVA_CLASS_FILE: return TARG_JAVA_CLASS_FILE; case AnUtility.MIME_JAR_FILE: return TARG_JAR_FILE; case AnUtility.MIME_CANNOT_READ_FILE: return TARG_IS_NOT_READABLE; default: */ return TARG_UNKNOWN_TYPE; /* NM } */ } // Log panel for process and collector output public Component getOutputPane() { if (out_log != null) { return null; } out_log = new JTextArea(8, 40); out_log.setEditable(false); out_log.getAccessibleContext().setAccessibleName(AnLocale.getString("Collector output")); out_log.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Collector output")); JScrollPane out_scroll = new AnJScrollPane( out_log, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); out_scroll.setBorder(BorderFactory.createLineBorder(AnEnvironment.SCROLLBAR_BORDER_COLOR)); out_scroll.getAccessibleContext().setAccessibleName(AnLocale.getString("Collector output")); out_scroll .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Collector output")); final JPanel out_panel = new JPanel(new BorderLayout()); JLabel label = new JLabel(); AnUtility.setTextAndAccessibleContext(label, AnLocale.getString("Collector output")); out_panel.add(label, BorderLayout.NORTH); out_panel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); out_panel.add(out_scroll, BorderLayout.CENTER); final JPanel bt_panel = new JPanel(new BorderLayout()); bt_clear = new JButton(AnLocale.getString("Clear")); bt_clear.setMnemonic(AnLocale.getString('l', "MNEM_COLLECTOR_OUTPUT_CLEAR")); bt_clear.setToolTipText(AnLocale.getString("Clear output")); bt_clear.setHorizontalTextPosition(SwingConstants.RIGHT); bt_clear.setActionCommand(AnLocale.getString("Clear")); bt_clear.getAccessibleContext().setAccessibleName(AnLocale.getString("Clear")); bt_clear.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Clear output")); bt_clear.addActionListener(this); bt_clear.setEnabled(false); JPanel clearButtonPanel = new JPanel(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(4, 0, 0, 0); clearButtonPanel.add(bt_clear, gridBagConstraints); bt_panel.add(clearButtonPanel, BorderLayout.EAST); out_panel.add(bt_panel, BorderLayout.SOUTH); pioTextArea = new JTextArea(8, 40); if (!system_profiling) { pioTextArea.setEditable(false); pioTextArea.getAccessibleContext().setAccessibleName(AnLocale.getString("Process output")); pioTextArea .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Process output")); JScrollPane pio_scroll = new AnJScrollPane( pioTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pio_scroll.setBorder(BorderFactory.createLineBorder(AnEnvironment.SCROLLBAR_BORDER_COLOR)); pioPanel = new JPanel(new BorderLayout()); label = new JLabel(); AnUtility.setTextAndAccessibleContext(label, AnLocale.getString("Process output")); pioPanel.add(label, BorderLayout.NORTH); pioPanel.getAccessibleContext().setAccessibleName(AnLocale.getString("Process input/output")); pioPanel .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Process input/output")); pioPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); pioPanel.add(pio_scroll, BorderLayout.CENTER); } else { return out_panel; } JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, out_panel, pioPanel); splitPane.setDividerSize(3); return (splitPane); } private void initButtons() { buttons[0].setText(AnLocale.getString("Run")); buttons[0].setActionCommand(AnLocale.getString("Run")); // buttons[0].setMnemonic(AnLocale.getString('R', "MNEM_COLLECTOR_RUN")); buttons[0].getAccessibleContext().setAccessibleDescription(AnLocale.getString("Run")); buttons[1].setText(AnLocale.getString("Terminate")); buttons[1].setActionCommand(AnLocale.getString("Terminate")); buttons[1].setMnemonic(AnLocale.getString('e', "MNEM_COLLECTOR_TERMINATE")); buttons[1].getAccessibleContext().setAccessibleDescription(AnLocale.getString("Terminate")); // Set size of pause/resume button final Dimension pausePrefSize = buttons[2].getPreferredSize(); final JButton resumebutton = new JButton(AnLocale.getString("Resume")); final Dimension resumePrefSize = resumebutton.getPreferredSize(); final Dimension prPrefSize = new Dimension( Math.max(pausePrefSize.width, resumePrefSize.width), Math.max(pausePrefSize.height, resumePrefSize.height)); buttons[2].setPreferredSize(prPrefSize); buttons[2].setText(aux[0]); // Pause buttons[2].setMnemonic(mnemonic[0]); buttons[2].getAccessibleContext().setAccessibleDescription(aux[0]); buttons[3].setText(aux[1]); // Sample buttons[3].setMnemonic(mnemonic[1]); buttons[3].getAccessibleContext().setAccessibleDescription(aux[1]); buttons[4].setText(AnLocale.getString("Close", "DIALOG_CLOSE")); buttons[4].setMnemonic(AnLocale.getString('C', "MNEM_DIALOG_CLOSE")); buttons[4] .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Close", "DIALOG_CLOSE")); resetButtons(); } // Reset button states private void resetButtons() { buttons[0].setEnabled(true); buttons[1].setEnabled(false); buttons[2].setEnabled(false); buttons[2].setText(AnLocale.getString("Pause")); buttons[2].setActionCommand(AnLocale.getString("Pause")); buttons[3].setEnabled(false); setAutoUpdaterState(1); // resume } public void set_runtime_buttons() { setAutoUpdaterState(0); // pause buttons[0].setEnabled(false); // run button disabled buttons[1].setEnabled(true); // terminate button enabled // pause button if ((null == pause_sig.getValue()) || pause_sig.getValue().equals(ipc_str_off)) { buttons[2].setEnabled(false); } else { buttons[2].setEnabled(true); if (startPaused.isSelected()) { buttons[2].setText(AnLocale.getString("Resume")); buttons[2].setActionCommand(AnLocale.getString("Resume")); } } // sample button if ((null == sample_sig.getValue()) || sample_sig.getValue().equals(ipc_str_off)) { buttons[3].setEnabled(false); } else { buttons[3].setEnabled(true); } } private String[][] getHwcSets(boolean forKernel) { synchronized (IPC.lock) { anWindow.IPC().send("getHwcSets"); anWindow.IPC().send(forKernel); return (String[][]) anWindow.IPC().recvObject(); } } private String[] getHwcAttrList(boolean forKernel) { synchronized (IPC.lock) { anWindow.IPC().send("getHwcAttrList"); anWindow.IPC().send(forKernel); return (String[]) anWindow.IPC().recvObject(); } } private String[] getHwcHelp(boolean forKernel) { synchronized (IPC.lock) { anWindow.IPC().send("getHwcHelp"); anWindow.IPC().send(forKernel); return (String[]) anWindow.IPC().recvObject(); } } private Object[] getHwcsAll(boolean forKernel) { synchronized (IPC.lock) { anWindow.IPC().send("getHwcsAll"); anWindow.IPC().send(forKernel); return (Object[]) anWindow.IPC().recvObject(); } } private int getHwcMaxConcurrent(boolean forKernel) { synchronized (IPC.lock) { anWindow.IPC().send("getHwcMaxConcurrent"); anWindow.IPC().send(forKernel); return anWindow.IPC().recvInt(); } } private List<List<HWCEntry>> getHWCsAllProcess(Object[] obj) { List<List<HWCEntry>> types = new ArrayList<>(); List<HWCEntry> std = new ArrayList<>(); List<HWCEntry> raw = new ArrayList<>(); types.add(std); types.add(raw); int ii = 0; boolean recommended = true; for (List<HWCEntry> current : types) { Object fields[] = (Object[]) obj[ii]; int xx = 0; final String[] i18n = (String[]) fields[xx++]; final String[] name = (String[]) fields[xx++]; final String[] int_name = (String[]) fields[xx++]; final String[] metric = (String[]) fields[xx++]; final long[] val = (long[]) fields[xx++]; final int[] timecvt = (int[]) fields[xx++]; final int[] memop = (int[]) fields[xx++]; final String[] short_desc = (String[]) fields[xx++]; final int[][] reg_list = (int[][]) fields[xx++]; final boolean[] supportsAttrs = (boolean[]) fields[xx++]; final boolean[] supportsMemspace = (boolean[]) fields[xx++]; for (int kk = 0; kk < i18n.length; kk++) { HWCEntry hwcEntry = new HWCEntry( false, i18n[kk], name[kk], int_name[kk], metric[kk], val[kk], timecvt[kk], memop[kk], short_desc[kk], reg_list[kk], supportsAttrs[kk], supportsMemspace[kk], recommended); current.add(hwcEntry); } ii++; recommended = false; } return types; } // Initialize register data for selected counter private String[][] setRegData(String hwname) { final HWCEntry ctr = hwcI18NMap.get(hwname); final int ct; if (ctr != null && ctr.getRegList() != null) { ct = ctr.getRegList().length; } else { ct = 0; } int count = ct + 1; String[][] rdata = new String[2][count]; rdata[0][0] = AnLocale.getString("None"); rdata[1][0] = rdata[0][0]; for (int i = 1; i < count; i++) { rdata[0][i] = Integer.toString(ctr.getRegList()[i - 1]); rdata[1][i] = rdata[0][i]; } // Set combo box with the new set of registers if ((reg_alloc != null) && (reg_alloc.combo != null)) { reg_alloc.combo.setSelectedItem(AnLocale.getString("None")); int n = 1; int max = reg_alloc.combo.getItemCount(); while (n < max) { reg_alloc.combo.removeItemAt(1); n++; } for (int k = 1; k < count; k++) { reg_alloc.combo.addItem(rdata[0][k]); } } return rdata; } public JPanel getHwcPanel(HWCEntry entry) { JPanel basePanel = new JPanel(); basePanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS)); // Create top panel JPanel hwcPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); hwcPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); hwcPanel.setLayout(new BoxLayout(hwcPanel, BoxLayout.Y_AXIS)); hwcPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); hwcPanel .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Counter Selection")); JPanel labelPanel = new JPanel(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); labelPanel.setOpaque(false); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(8, 8, 0, 8); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; JLabel counterLabel = new JLabel(entry.getMetricText()); AnUtility.setAccessibleContext(counterLabel); counterLabel.setFont(counterLabel.getFont().deriveFont(Font.BOLD)); counterLabel.setOpaque(true); counterLabel.setPreferredSize(new Dimension(600, 20)); counterLabel.setHorizontalAlignment(JLabel.LEFT); labelPanel.add(counterLabel, gridBagConstraints); hwcPanel.add(labelPanel); hwc2_prof = new CollectData( hwc1_prof, '0', null, ' ', AnLocale.getString("Counter Name:"), hwc_name_data, JTextField.LEFT, true, true, ipc_str_hwc2_prof); hwcPanel.add(Box.createRigidArea(new Dimension(8, 8))); hwcPanel.add( hwc1_val = new CollectData( hwc2_prof, '0', null, ' ', AnLocale.getString("Profiling Rate:"), hwc_data, JTextField.LEFT, true, true, ipc_str_hwc1_val)); dspace_hwc1 = new CollectData( hwc1_val, '0', null, ' ', AnLocale.getString("Hardware Counter Dataspace :"), hwc_dsp_data, JTextField.LEFT, true, false, ipc_str_dspace_hwc1); hwcPanel.add(Box.createRigidArea(new Dimension(8, 8))); if (!hwcFlatList.isEmpty()) { HWCEntry first = hwcFlatList.get(0); hwc_reg_data = setRegData(first.getI18n()); } hwcPanel.add( reg_alloc = new CollectData( hwc1_val, '0', null, ' ', AnLocale.getString("Hardware Counter Register:"), hwc_reg_data, JTextField.LEFT, true, false, ipc_str_hwc_reg_alloc)); hwcPanel.add(Box.createRigidArea(new Dimension(8, 8))); hwcPanel.add( ctr_attr = new CollectData( hwc1_val, '0', null, ' ', AnLocale.getString("Attribute:"), hwc_att_data, JTextField.LEFT, true, false, ipc_str_hwc_ctr_attr)); // Attr Buttons JPanel attrButtonPanel1 = new JPanel(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); attrButtonPanel1.setOpaque(false); addAttr = new JButton(AnLocale.getString("Add Attribute")); addAttr.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Add Attribute")); addAttr.addActionListener(this); addAttr.setEnabled(false); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(4, 8, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; attrButtonPanel1.add(addAttr, gridBagConstraints); modAttr = new JButton(AnLocale.getString("Modify Attribute")); addAttr.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Modify Attribute")); modAttr.addActionListener(this); hwcPanel.add(attrButtonPanel1); hwcPanel.add(Box.createRigidArea(new Dimension(16, 16))); // Create attribute config panel JPanel attrPanel = new JPanel(new BorderLayout()); attrPanel.setBorder(new EmptyBorder(new Insets(1, 8, 1, 8))); attrPanel.setOpaque(false); // Selected attr label selectedAttrLabel = new JLabel(AnLocale.getString("Selected Attributes:")); selectedAttrLabel.setOpaque(false); AnUtility.setAccessibleContext( selectedAttrLabel.getAccessibleContext(), selectedAttrLabel.getText()); selectedAttrLabel.setAlignmentX(JDialog.LEFT_ALIGNMENT); attrPanel.add(selectedAttrLabel, BorderLayout.NORTH); // Selected list sel_attr = new ArrayList<>(); attrList = new JList<String>(sel_attr.toArray(new String[sel_attr.size()])); attrList.getAccessibleContext().setAccessibleName(AnLocale.getString("Attribute Selection")); attrList .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Attribute Selection")); // list.addListSelectionListener(this); attrScrollPane = new AnJScrollPane(); attrScrollPane.setBorder(BorderFactory.createLineBorder(AnEnvironment.SCROLLBAR_BORDER_COLOR)); attrScrollPane.setViewportView(attrList); Dimension newSize = new Dimension(hwcPanel.getPreferredSize().width - 600, 50); attrScrollPane.setPreferredSize(newSize); attrPanel.add(attrScrollPane, BorderLayout.CENTER); hwcPanel.add(attrPanel); // Attr Buttons JPanel attrButtonPanel2 = new JPanel(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); attrButtonPanel2.setOpaque(false); remAttr = new JButton(AnLocale.getString("Remove Attribute")); AnUtility.setAccessibleContext(remAttr.getAccessibleContext(), remAttr.getText()); // remAttr.setMnemonic(getLocaleStr('R', "MNEM_COLLECTOR_DELETE_ATTRIBUTE")); addAttr.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Remove Attribute")); remAttr.addActionListener(this); gridBagConstraints.gridx = 1; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(4, 8, 0, 0); attrButtonPanel2.add(remAttr, gridBagConstraints); hwcPanel.add(attrButtonPanel2); hwcPanel.add(Box.createRigidArea(new Dimension(8, 8))); setAttrButtons(); setAttributeCombo(); // Create and initialize dialog buttons. buttonPanel = new JPanel(); updateButton = new JButton(AnLocale.getString("Update")); updateButton.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Update")); updateButton.addActionListener(this); cancelButton = new JButton(AnLocale.getString("Cancel")); cancelButton.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Cancel")); cancelButton.addActionListener(this); buttonPanel.add(updateButton); buttonPanel.add(cancelButton); basePanel.add(hwcPanel); // Set dialog to selected counter hwc2_prof.combo.setSelectedItem(entry.getI18n()); return basePanel; } // Initialize GUI components private void initComponents() { final JPanel exp_panel, data_panel, preview, cmd_panel; final CollectUtility.CList list, list_dbx, list_jdk; final JButton button; final JPanel targetPanel = new JPanel(); final JPanel firstPanel = new JPanel(); tab_pane = new JTabbedPane(); AnUtility.setAccessibleContext(tab_pane.getAccessibleContext(), title); // Add target & arguments list = new CollectUtility.CList(false); list_dbx = new CollectUtility.CList(false); // hidden list if (!profile_running_process) { CollectUtility.CList list_target = new CollectUtility.CList(false); boolean required = true; if (system_profiling) { required = false; } target = new CollectExp( CEXP_TARGET, list_target, ipc_str_empty, AnLocale.getString('T', "MNEM_COLLECTOR_TARGET"), CSTR_TARGET, true, '4', required); target.text.setToolTipText(AnLocale.getString("The path name of the target program")); args = new CollectExp( CEXP_NA, list_target, ipc_str_empty, AnLocale.getString('A', "MNEM_COLLECTOR_ARGUMENTS"), AnLocale.getString("Arguments"), false, '0'); args.text.setToolTipText(AnLocale.getString("Target program's command-line arguments")); work_dir = new CollectExp( CEXP_WORK, list_target, Analyzer.getInstance().getWorkingDirectory(), AnLocale.getString('W', "MNEM_COLLECTOR_WORKING_DIR"), CSTR_WORK, true, '7'); work_dir.text.setToolTipText( AnLocale.getString("Full path of the directory where the target program should run")); work_dir.setEditable(true); env_vars = new CollectExp( CEXP_ENV, list_target, ipc_str_empty, AnLocale.getString('V', "MNEM_COLLECTOR_ENVIRONMENT_VARIABLES"), AnLocale.getString("Environment Variables"), false, '0'); env_vars.text.setToolTipText( AnLocale.getString( "Environment variables needed by target program, specified as: NAME1=value1" + " NAME2=value2")); list_target.setAlignmentX(); list_target.setAlignmentY(); TitledBorder titleBorder; titleBorder = BorderFactory.createTitledBorder( new LineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR, 1), AnLocale.getString("Specify Application to Profile")); // titleBorder.setTitleFont(titlefont); targetPanel.setBorder(titleBorder); targetPanel.setLayout(new BoxLayout(targetPanel, BoxLayout.Y_AXIS)); targetPanel.add(list_target); } if (!profile_running_process && !system_profiling) { // Add experiment name/directory/group exp_name = new CollectExp( CEXP_NAME, list, CGetExpName(null), AnLocale.getString('x', "MNEM_COLLECTOR_EXPERIMENT_NAME"), AnLocale.getString("Experiment Name"), false, '0'); exp_name.text.setToolTipText( AnLocale.getString("File name ending in .er to store collected data as an experiment")); } else { if (profile_running_process) { // AnLog.log("analyzer: profiling running process.\n"); targetPanel.setLayout(new BorderLayout()); collectPanel2 = new CollectPanel2(anWindow); targetPanel.add(collectPanel2, BorderLayout.CENTER); } else { // system_profiling // AnLog.log("analyzer: system profiling.\n"); collectPanel3 = new CollectPanel3(anWindow); targetPanel.add(collectPanel3); } if (profile_running_process) { target = new CollectExp( CEXP_TARGET, list_dbx, ipc_str_empty, AnLocale.getString('T', "MNEM_COLLECTOR_TARGET"), CSTR_TARGET, true, '4', true); work_dir = new CollectExp( CEXP_WORK, list_dbx, Analyzer.getInstance().getWorkingDirectory(), AnLocale.getString('W', "MNEM_COLLECTOR_WORKING_DIR"), CSTR_WORK, false, '7'); env_vars = new CollectExp( CEXP_ENV, list_dbx, ipc_str_empty, AnLocale.getString('V', "MNEM_COLLECTOR_ENVIRONMENT_VARIABLES"), AnLocale.getString("Environment Variables"), false, '0'); } exp_name = new CollectExp( CEXP_NAME, list_dbx, CGetExpName(null), AnLocale.getString('x', "MNEM_COLLECTOR_EXPERIMENT_NAME"), AnLocale.getString("Experiment Name"), false, '0'); } list.setAlignmentX(); list.setAlignmentY(); firstPanel.setLayout(new BorderLayout()); firstPanel.add(targetPanel, BorderLayout.NORTH); exp_panel = new JPanel(); exp_panel.setLayout(new BoxLayout(exp_panel, BoxLayout.Y_AXIS)); // exp_panel.add(target_panel); TitledBorder titleBorder; titleBorder = BorderFactory.createTitledBorder( new LineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR, 1), AnLocale.getString("Specify Experiment")); // titleBorder.setTitleFont(titlefont); exp_panel.setBorder(titleBorder); exp_panel.add(list); JPanel exp_panel2 = new JPanel(); exp_panel2.setLayout(new BoxLayout(exp_panel2, BoxLayout.Y_AXIS)); // exp_panel.add(target_panel); TitledBorder titleBorder2; titleBorder2 = BorderFactory.createTitledBorder( new LineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR, 1), AnLocale.getString("Advanced Experiment Settings")); // titleBorder2.setTitleFont(titlefont); exp_panel2.setBorder(titleBorder2); exp_panel2.add( exp_limit = new CollectData( true, ' ', null, '0', AnLocale.getString("Data Limit (MB):"), limit_data, JTextField.RIGHT, false, ipc_str_exp_limit)); exp_limit.text.setToolTipText( AnLocale.getString("Profile the application until the experiment reaches this size")); left_list.add(exp_limit); exp_panel2.add( time_limit = new CollectData( true, ' ', null, '0', AnLocale.getString("Time Limit (Seconds):"), limit_time, JTextField.RIGHT, false, ipc_str_time_limit)); time_limit.text.setToolTipText( AnLocale.getString("Profile the application for this amount of time")); left_list.add(time_limit); exp_panel2.add(Box.createRigidArea(new Dimension(4, 4))); exp_panel2.add( arch_exp = new CollectData( true, ' ', // NM null, '0', getLocaleStr("Archived/Copied into Experiment:"), arch_data, // JTextField.RIGHT, false)); null, '0', AnLocale.getString("Archive Mode:"), arch_data, JTextField.RIGHT, false, ipc_str_arch_exp)); arch_exp.text.setToolTipText( AnLocale.getString("Archive the experiment for analysis on another system")); exp_panel2.add(Box.createRigidArea(new Dimension(4, 4))); left_list.add(arch_exp); if (!profile_running_process) { exp_panel2.add( descendant = new CollectData( true, ' ', null, '0', AnLocale.getString("Follow Descendant Processes:"), desc_data, JTextField.RIGHT, false, ipc_str_descendant)); descendant.text.setToolTipText( AnLocale.getString("Profile the target program and child processes it starts")); exp_panel2.add(Box.createRigidArea(new Dimension(4, 4))); left_list.add(descendant); } if (system_profiling) { exp_panel2.add( prof_idle = new CollectData( true, ' ', null, '0', AnLocale.getString("Do not profile idle CPUs:"), prof_idle_data, JTextField.RIGHT, false, ipc_str_prof_idle)); prof_idle.text.setToolTipText( AnLocale.getString("Do not record profile events from idle CPUs")); exp_panel2.add(Box.createRigidArea(new Dimension(4, 4))); left_list.add(prof_idle); } pause_sig = new CollectData( true, ' ', null, '0', AnLocale.getString("Signal to Pause/Resume Collection:"), sig_data, JTextField.RIGHT, false, ipc_str_pause_resume_sig); pause_sig.text.setToolTipText( AnLocale.getString("Signal you will use to pause and resume profiling the application")); left_list.add(pause_sig); exp_panel2.add(pause_sig); final ButtonGroup group = new ButtonGroup(); group.add(startPaused = new JRadioButton(AnLocale.getString("Paused"), true)); // startPaused.setMnemonic(getLocaleStr('d', "MNEM_COLLECTOR_START_PAUSED")); startPaused.setToolTipText( AnLocale.getString("Begin profiling the application when you send the first signal")); group.add(startResumed = new JRadioButton(AnLocale.getString("Resumed"), false)); // startResumed.setMnemonic(getLocaleStr('m', "MNEM_COLLECTOR_START_RESUMED")); startResumed.setToolTipText( AnLocale.getString( "Profile the application immediately as its process starts and pause when you send the" + " first signal")); final JPanel bg_panel = new JPanel(); start_state = new JLabel(AnLocale.getString("Start state: ")); start_state.setToolTipText( AnLocale.getString( "Whenever the signal is delivered to the process, the Collector switches between paused" + " (no data is recorded) and resumed (data is recorded) states")); bg_panel.add(start_state); bg_panel.add(startPaused); bg_panel.add(startResumed); start_state.setEnabled(false); startPaused.setEnabled(false); startResumed.setEnabled(false); pause_sig.combo.addItemListener( new ItemListener() { @Override public void itemStateChanged(final ItemEvent event) { final boolean selected = !event.getItem().equals(AnLocale.getString("Off")); start_state.setEnabled(selected); startPaused.setEnabled(selected); startResumed.setEnabled(selected); } }); exp_panel2.add(bg_panel); exp_panel.add(new JLabel(ipc_str_space)); // just space exp_panel.add(exp_panel2); pause_sig.setAlignmentX(left_list); sample_sig = new CollectData( /* NM true */ /* NM true */ false, ' ', AnLocale.getString("Manual Samples of Process Resource Utilization"), ' ', AnLocale.getString("Signal:"), sig_data, JTextField.RIGHT, true, ipc_str_sample_sig); sample_sig.check.setToolTipText( AnLocale.getString("Time-stamped samples taken when you send a signal to the program")); sample_sig.text.setToolTipText( AnLocale.getString("Signal you will send to take a manual sample")); // Add data to collect data_panel = new JPanel(); data_panel.setLayout(new BoxLayout(data_panel, BoxLayout.Y_AXIS)); // NM data_panel.setBorder(new javax.swing.border.EmptyBorder(5, 5, 0, 0)); TitledBorder dataBorder; String dataTitale = AnLocale.getString( "Specify the type of data to collect. As you select data types, other incompatible" + " data types are disabled."); dataBorder = BorderFactory.createTitledBorder(new LineBorder(Color.BLUE, 0), dataTitale); // dataBorder.setTitleFont(titlefont); data_panel.setBorder(dataBorder); data_panel .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Data to Collect")); data_panel.add(Box.createRigidArea(new Dimension(4, 4))); // add some space data_panel.add( clock_prof = new CollectData( clkprof_on_by_default, ' ', AnLocale.getString("Clock Profiling"), ' ', AnLocale.getString("Profiling Rate:"), clock_data, JTextField.RIGHT, true, ipc_str_clkprof)); clock_prof.check.setToolTipText( AnLocale.getString( "Record application state at regular intervals to show where time is spent in" + " functions")); clock_prof.text.setToolTipText( AnLocale.getString("Time between Clock Profiling recordings (milliseconds)")); data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add( hwc1_prof = new CollectData( hwcprof_on_by_default, ' ', AnLocale.getString("Hardware Counter Profiling"), '0', null, null, JTextField.LEFT, true, ipc_str_hwcprof)); hwc1_prof.check.setToolTipText( AnLocale.getString("Track the frequency of processor events specified by counters")); if (hwcFlatList.isEmpty()) { hwc1_prof.check.setEnabled(false); } data_panel.add(Box.createRigidArea(new Dimension(4, 4))); initHWCPanel(data_panel); final boolean hwc1_available = hwc1_prof.check.isEnabled(); hwc1_prof.check.addItemListener( new ItemListener() { @Override public void itemStateChanged(final ItemEvent event) { final boolean selected = ((JCheckBox) event.getItem()).isSelected(); if (hwc1_available) { counterLabel.setEnabled(selected); propertyButton.setEnabled(selected); addHWCButton.setEnabled(selected); hwcList.setEnabled(selected); // showButton.setEnabled(selected); updateButtons(); } } }); jvm_prof = new CollectData( javaprof_on_by_default, ' ', AnLocale.getString("Java Profiling"), '0', null, null, JTextField.RIGHT, true /* NM false */, ipc_str_javaprof); jvm_prof.check.setToolTipText( AnLocale.getString("Enable recognition and recording of Java classes and methods")); if (!system_profiling) { data_panel.add(jvm_prof); } data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add( sample = new CollectData( sample_on_by_default, ' ', AnLocale.getString("Periodic Samples of Process Resource Utilization"), ' ', AnLocale.getString("Interval (sec.):"), samp_data, JTextField.RIGHT, true, ipc_str_sample)); sample.check.setToolTipText( AnLocale.getString( "Time-stamped samples that show execution state of the profiled program, used in" + " Timeline")); sample.text.setToolTipText( AnLocale.getString("Number of seconds between samples, normally 1 second")); if (null != sample_sig) { data_panel.add(Box.createRigidArea(new Dimension(4, 4))); // new box data_panel.add(sample_sig); } data_panel.add(Box.createRigidArea(new Dimension(4, 4))); io_trace = new CollectData( false, ' ', AnLocale.getString("I/O Tracing"), ' ', null, null, JTextField.RIGHT, true, ipc_str_iotrace); io_trace.check.setToolTipText(AnLocale.getString("Track input/output operations")); if (!profile_running_process && !system_profiling) { data_panel.add(io_trace); data_panel.add(Box.createRigidArea(new Dimension(4, 4))); } heap_trace = new CollectData( false, ' ', AnLocale.getString("Heap Tracing"), '0', null, null, JTextField.RIGHT, true, ipc_str_heaptrace); heap_trace.check.setToolTipText( AnLocale.getString( "Track memory allocation activity to reveal memory leaks or inefficiency")); if (!profile_running_process && !system_profiling) { data_panel.add(heap_trace); } sync_trace = new CollectData( false, ' ', AnLocale.getString("Synchronization Wait Tracing"), ' ', AnLocale.getString("Minimum Delay (usec.):"), sync_data, JTextField.RIGHT, true, ipc_str_synctrace); sync_trace.check.setToolTipText( AnLocale.getString( "Track delays in calls to thread-synchronization routines in multithreaded programs")); sync_trace.text.setToolTipText( AnLocale.getString("Threshold for recording a thread synchonization wait (microseconds)")); if (!profile_running_process && !system_profiling) { data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add(sync_trace); data_panel.add(Box.createRigidArea(new Dimension(4, 4))); } mpi_trace = new CollectData( false, ' ', AnLocale.getString("MPI Tracing for specified MPI"), ' ', AnLocale.getString("MPI version:"), mpi_data, JTextField.RIGHT, true, ipc_str_MPIexpt); mpi_trace.check.setToolTipText( AnLocale.getString("Track MPI calls for progams that use Message Passing Interface")); mpi_trace.text.setToolTipText(AnLocale.getString("The version of MPI your program uses")); if (mpi_support() && !profile_running_process && !system_profiling) { data_panel.add(mpi_trace); data_panel.add(Box.createRigidArea(new Dimension(4, 4))); } if (!profile_running_process && !system_profiling) { list_jdk = new CollectUtility.CList(true); // The code below will be removed soon target_jdk = new TargetJDK( list_jdk, jvm_prof, AnLocale.getString('T', "MNEM_COLLECTOR_TARGET_JDK"), CSTR_TARGET_JDK, AnLocale.getString('B', "MNEM_COLLECTOR_JDK_BROWSE")); vm_args = new CollectExp( CEXP_NA, list_jdk, ipc_str_empty, AnLocale.getString('V', "MNEM_COLLECTOR_JAVA_VM_PARAMETERS"), AnLocale.getString("JVM parameters"), false, '0', 0, false); } if (profile_running_process) { data_panel.add( dbxsample = new CollectData( false, ' ', AnLocale.getString("Record Sample When dbx Stops Process"), '0', null, null, JTextField.RIGHT, true, ipc_str_dbxsample)); } // Threading errors checking deadlock_trace = new CollectData( false, ' ', AnLocale.getString("Deadlock Detection"), ' ', null, null, JTextField.RIGHT, true, ipc_str_thatrace); deadlock_trace.check.setToolTipText( AnLocale.getString("Detecting dead locks in threads synchronization")); data_race = new CollectData( false, ' ', AnLocale.getString("Data Race Detection"), ' ', null, null, JTextField.RIGHT, true, ipc_str_thatrace); data_race.check.setToolTipText( AnLocale.getString( "Locate competing data access events in instrumented multithreaded programs")); // Function/Instruction Counts count_data = new CollectData( false, ' ', AnLocale.getString("Function/Instruction Counts"), ' ', AnLocale.getString("Instrumentation:"), count_types, JTextField.RIGHT, true, ipc_str_count); count_data.check.setToolTipText( AnLocale.getString( "Counting Function calls and Instructions. This option cannot be used with other" + " profiling options")); // if GUI is started as RDT, deselect clock-based profiling by default String cmode = AnUtility.getenv("SP_ANALYZER_CONFIG_MODE"); if (cmode != null && cmode.equals("R")) { clock_prof.check.setSelected(false); } // if GUI is started as RDT, select associated checkboxes by default if (cmode != null && cmode.equals("R")) { sample.check.setSelected(false); sample.check.setEnabled(false); data_race.check.setSelected(true); deadlock_trace.check.setSelected(true); } // Check if data_race can be set String val = ipc_str_race; String err = Collector.setCollectorControlValue(data_race.name, val); // IPC call if ((null != err) || profile_running_process || system_profiling) { data_race.check.setSelected(false); data_race.check.setEnabled(false); data_race.available = false; } else { data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add(data_race); } if (!data_race.check.isSelected()) { Collector.unsetCollectorControlValue(data_race.name); // IPC call } // Check if deadlock_trace can be set val = ipc_str_deadlock; err = Collector.setCollectorControlValue(deadlock_trace.name, val); // IPC call if ((null != err) || profile_running_process || system_profiling) { deadlock_trace.check.setSelected(false); deadlock_trace.check.setEnabled(false); deadlock_trace.available = false; } else { data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add(deadlock_trace); } if (!deadlock_trace.check.isSelected()) { Collector.unsetCollectorControlValue(deadlock_trace.name); // IPC call } // Check if count_data can be set val = ipc_str_on; err = Collector.setCollectorControlValue(count_data.name, val); // IPC call if ((null != err) || profile_running_process || system_profiling) { count_data.check.setEnabled(false); count_data.check.setSelected(false); count_data.available = false; } else { data_panel.add(Box.createRigidArea(new Dimension(4, 4))); data_panel.add(count_data); } Collector.unsetCollectorControlValue(count_data.name); // IPC call data_panel.add(Box.createRigidArea(new Dimension(4, 4))); // add some space sample.setAlignmentX(data_list); if (!profile_running_process && !system_profiling) { firstPanel.add(exp_panel); } else { data_panel.add(exp_panel2); } tab_pane.add(AnLocale.getString("General"), firstPanel); // NM tab_pane.add(AnLocale.getString("Data to Collect"), data_panel); cmd_panel = new JPanel(new BorderLayout()); cmd_panel.add(tab_pane, BorderLayout.CENTER); // if (!profile_running_process) { // Preview command button = new JButton(AnLocale.getString("Preview Command:")); button.setMargin(CollectUtility.buttonMargin); Dimension d = new Dimension(160, 14); button.setPreferredSize(d); button.setMaximumSize(d); button.setMnemonic(AnLocale.getString('P', "MNEM_COLLECTOR_PREVIEW_COMMAND")); button.setToolTipText( AnLocale.getString("Shows the 'collect' command that will be run using your selections")); button.addActionListener(this); button.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Preview Command:")); preview_cmd = new JTextField(40); AnUtility.setAccessibleContext( preview_cmd.getAccessibleContext(), AnLocale.getString("Preview Command:")); preview_cmd.setEditable(false); preview_cmd.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); preview = new JPanel(new BorderLayout()); preview.add(button, BorderLayout.WEST); preview.add(preview_cmd, BorderLayout.CENTER); /* preview_cmd = new JTextArea(1, 40); preview_cmd.setEditable(false); preview_cmd.getAccessibleContext().setAccessibleName(getLocaleStr("Preview collect command")); preview_cmd.getAccessibleContext().setAccessibleDescription(getLocaleStr("Preview collect command")); final JScrollPane preview_cmd_scroll = new AnJScrollPane(preview_cmd, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); preview_cmd_scroll.getAccessibleContext().setAccessibleName(getLocaleStr("Preview collect command")); preview_cmd_scroll.getAccessibleContext().setAccessibleDescription(getLocaleStr("Preview collect command")); preview = new JPanel(new BorderLayout()); preview.setBorder(new TitledBorder(getLocaleStr("Preview collect command"))); preview.add(button, BorderLayout.WEST); preview.add(preview_cmd_scroll, BorderLayout.CENTER); */ cmd_panel.add(preview, BorderLayout.SOUTH); // tab_pane.add("3. " + getLocaleStr("Input/Output"), getOutputPane()); tab_pane.add(AnLocale.getString("Output"), getOutputPane()); // } tab_pane.setVerifyInputWhenFocusTarget(false); // for (int i = 0; i < tab_pane.getTabCount(); i++) { // tab_pane.setMnemonicAt(i, new Integer(i + 1).toString().charAt(0)); // } // numbers are removed - new mnemonics are needed // work_panel = new AnJScrollPane(); // work_panel.setViewportView(cmd_panel); work_panel = new JPanel(new BorderLayout()); work_panel.add(cmd_panel, BorderLayout.CENTER); } public void initHWCPanel(JPanel data_panel) { hwcSelectDialog = null; selectedHWCList = new ArrayList<>(); hwcPanel = new JPanel(new BorderLayout()); hwcPanel.setBorder(BorderFactory.createEmptyBorder(0, 16, 6, 8)); counterLabel = new JLabel(AnLocale.getString("Selected Hardware Counters:")); counterLabel.setEnabled(false); counterLabel.setToolTipText(AnLocale.getString("List of hardware counters to profile")); hwcPanel.add(counterLabel, BorderLayout.NORTH); hwcList = new JList<HWCEntry>(selectedHWCList.toArray(new HWCEntry[selectedHWCList.size()])); // Set tooltip hwcList.addMouseMotionListener( new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent evt) { ListModel<HWCEntry> model = hwcList.getModel(); int index = hwcList.locationToIndex(evt.getPoint()); if (index >= 0) { HWCEntry entry = model.getElementAt(index); String ttText = entry.getDescriptionText(hwcNameMap); hwcList.setToolTipText(ttText); } } }); // Handle Enter key hwcList.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { if (propertyButton.isEnabled()) { propertyButton.doClick(); e.consume(); } } if (e.getKeyChar() == KeyEvent.VK_DELETE || e.getKeyCode() == 8) { if (removeButton.isEnabled()) { removeButton.doClick(); e.consume(); } } } }); // Handle double-click hwcList.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (propertyButton.isEnabled()) { propertyButton.doClick(); e.consume(); } } } }); hwcList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); AnUtility.setAccessibleContext( hwcList.getAccessibleContext(), AnLocale.getString("List of hardware counters to profile")); // list.addListSelectionListener(this); hwcListScrollPane = new AnJScrollPane(); hwcListScrollPane.setViewportView(hwcList); hwcListScrollPane.setBorder(new LineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR, 1)); Dimension newSize = new Dimension(data_panel.getPreferredSize().width - 600, 70); hwcListScrollPane.setPreferredSize(newSize); hwcPanel.add(hwcListScrollPane, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(4, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; addHWCButton = new JButton(AnLocale.getString("Add")); addHWCButton .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Add hardware counters")); addHWCButton.setToolTipText(AnLocale.getString("Add counters to profile")); addHWCButton.setEnabled(false); addHWCButton.addActionListener(this); addHWCButton.setMnemonic(AnLocale.getString('A', "CollectPanel.addHWCButton")); buttonPanel.add(addHWCButton, gridBagConstraints); gridBagConstraints.gridx = 1; gridBagConstraints.insets = new Insets(4, 4, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; propertyButton = new JButton(AnLocale.getString("Properties")); propertyButton .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Set counter properties")); propertyButton.setToolTipText(AnLocale.getString("Change counter properties")); propertyButton.setEnabled(false); propertyButton.addActionListener(this); buttonPanel.add(propertyButton, gridBagConstraints); gridBagConstraints.gridx = 2; gridBagConstraints.insets = new Insets(4, 4, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; removeButton = new JButton(AnLocale.getString("Remove")); removeButton .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Remove counter")); removeButton.setToolTipText(AnLocale.getString("Remove selected counter")); removeButton.addActionListener(this); buttonPanel.add(removeButton, gridBagConstraints); // gridBagConstraints.gridx = 3; // gridBagConstraints.insets = new Insets(4, 0, 0, 0); // gridBagConstraints.anchor = GridBagConstraints.EAST; //// gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; // gridBagConstraints.weightx = 1.0; // showButton = new JButton(getString("Available Counters")); // showButton.getAccessibleContext().setAccessibleDescription(getString("Available // Counters")); // showButton.setToolTipText(getString("Show all hardware counters that can be profiled // on the current system")); // showButton.setEnabled(false); // showButton.addActionListener(this); // buttonPanel.add(showButton, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(4, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; errorLabel = new JLabel(); errorLabel.setForeground(Color.red); buttonPanel.add(errorLabel, gridBagConstraints); hwcPanel.add(buttonPanel, BorderLayout.SOUTH); updateButtons(); data_panel.add(hwcPanel); } // Set all HWC related controls public void updateButtons() { hwcList.setListData(selectedHWCList.toArray(new HWCEntry[selectedHWCList.size()])); if ((selectedHWCList.isEmpty()) || (!hwc1_prof.check.isSelected())) { removeButton.setEnabled(false); propertyButton.setEnabled(false); hwcListScrollPane.setEnabled(false); } else { hwcList.setSelectedIndex(0); removeButton.setEnabled(true); propertyButton.setEnabled(true); hwcListScrollPane.setEnabled(true); } hwcListScrollPane.revalidate(); hwcListScrollPane.repaint(); // Check for errors setErrorText(null); // Check max numbers of counters if (selectedHWCList.size() > maxHWC) { setErrorText( String.format( AnLocale.getString("The maximum number of counters allowed is %d"), maxHWC)); } if (getErrorText().length() == 0) { // Check for identical entries for (int i = 0; i < selectedHWCList.size(); i++) { HWCEntry entry1 = selectedHWCList.get(i); String collectorString1 = entry1.getCollectorString().replaceAll("/.*", "").replaceAll(",.*", ""); for (int j = i + 1; j < selectedHWCList.size(); j++) { HWCEntry entry2 = selectedHWCList.get(j); String collectorString2 = entry2.getCollectorString().replaceAll("/.*", "").replaceAll(",.*", ""); if (collectorString1.equals(collectorString2)) { setErrorText( String.format( AnLocale.getString("Identical counters in list: \'%s\' and \'%s\'"), entry1.getCollectorString(), entry2.getCollectorString())); break; } } } } autoUpdate(); } private void setErrorText(String errorText) { if (errorText != null && !errorText.isEmpty()) { errorLabel.setText(errorText); errorLabel.setVisible(true); } else { errorLabel.setText(""); errorLabel.setVisible(false); } } private String getErrorText() { return errorLabel.getText(); } // Set all HWC attribute related controls public void setAttrButtons() { attrList.setListData(sel_attr.toArray(new String[sel_attr.size()])); if (sel_attr.isEmpty()) { remAttr.setEnabled(false); modAttr.setEnabled(false); attrScrollPane.setEnabled(false); } else { attrList.setSelectedIndex(0); remAttr.setEnabled(true); modAttr.setEnabled(true); attrScrollPane.setEnabled(true); } attrScrollPane.revalidate(); attrScrollPane.repaint(); } // Set Attribute comboBox depending on type of counter public void setAttributeCombo() { String select_ctr = (String) hwc2_prof.combo.getSelectedItem(); if (!hasAttributes(select_ctr)) { sel_attr.clear(); setAttrButtons(); attr_warn = false; ctr_attr.combo.setEnabled(false); addAttr.setEnabled(false); attrScrollPane.setEnabled(false); ctr_attr.field.setEnabled(false); } else { String select_attr = (String) ctr_attr.combo.getSelectedItem(); // Get selected attribute and disable/enable buttons based on that if ((select_attr != null) && (select_attr.equals(AnLocale.getString("None")))) { if (hwc_att_data[0].length == 1) { ctr_attr.combo.setEnabled(false); } else { ctr_attr.combo.setEnabled(true); } addAttr.setEnabled(false); attrScrollPane.setEnabled(false); ctr_attr.field.setEnabled(false); } else { addAttr.setEnabled(true); ctr_attr.combo.setEnabled(true); attrScrollPane.setEnabled(true); ctr_attr.field.setEnabled(true); } } } // check if counter has attributes public boolean hasAttributes(String ctr_name) { // machine has no attributes if (hwc_attr_list.length == 0) { return false; } HWCEntry hw_type = hwcI18NMap.get(ctr_name); if (hw_type == null) { return false; } return hw_type.supportsAttrs(); } // Add JDK path combobox with Browse button public final class TargetJDK extends CollectUtility.AnComboBox implements CollectUtility.Browseable, ItemListener { final JPanel panel; final JCheckBox check; final JButton button; final JLabel text; public TargetJDK( final CollectUtility.CList list, final CollectData cdata, final char mnemonic, final String label, final char browser_mnem) { super(50); this.check = cdata.check; String str, head; final List<String> headers = new ArrayList<>(6); headers.add(AnLocale.getString("Path:")); headers.add("$JDK_HOME"); headers.add("$JAVA_PATH"); headers.add(AnLocale.getString("Installed Java")); headers.add(AnLocale.getString("Current JVM")); headers.add(AnLocale.getString("Default (PATH based)")); add(CollectUtility.AnComboBox.COMBO_TEXT, headers.get(0), ipc_str_empty, true); for (int i = 1; i < 6; i++) { head = headers.get(i); // process environment variables if (head.startsWith("$")) { str = getenv(head.substring(1)); if (str != null && str.equals(ipc_str_empty)) { head += ":"; add(CollectUtility.AnComboBox.COMBO_TEXT, head, str, false); } } else if (head.equals(AnLocale.getString("Installed Java"))) { head += ":"; String os_name = System.getProperty("os.name"); if (os_name.equals("Linux")) { str = "/usr/java/j2sdk1.4.2_06"; } else { str = "/usr/jdk/j2sdk1.4.2_06"; } add(CollectUtility.AnComboBox.COMBO_TEXT, head, str, false); } else if (head.equals(AnLocale.getString("Current JVM"))) { head += ":"; str = System.getProperty("java.home"); add(CollectUtility.AnComboBox.COMBO_TEXT, head, str, false); } else if (head.equals(AnLocale.getString("Default (PATH based)"))) { str = ipc_str_empty; add(CollectUtility.AnComboBox.COMBO_ITEM, head, str, false); } } this.setSelectedIndex(1); // select one of JDK pathes text = (JLabel) CollectUtility.getItem(label + ":"); text.setDisplayedMnemonic(mnemonic); text.getAccessibleContext().setAccessibleName(label); text.getAccessibleContext().setAccessibleDescription(label); text.setLabelFor(this); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(this); button = new JButton(AnLocale.getString("Browse"), AnUtility.open_icon); // button.setMnemonic(browser_mnem); button.setMargin(CollectUtility.buttonMargin); button.addActionListener(CollectPanel.this); // button.addActionListener(this)--; button.setActionCommand(label); button.setToolTipText(AnLocale.getString("Browse...")); // button.setMnemonic(browser_mnem); panel.add(button); list.add(text, panel); if (check != null) { check.addItemListener(this); } text.setEnabled(cdata.isChecked()); button.setEnabled(cdata.isChecked()); setEnabled(cdata.isChecked()); setEditable(cdata.isChecked()); } // Set value @Override public void setValue(final String path) { final String java_bin = path + File.separatorChar + "bin" + File.separatorChar + "java"; if (!(new File(java_bin).exists())) { showError(java_bin + AnLocale.getString(" doesnt't exist")); } else { setSelectedIndex(0); this.setText(path); } } @Override public String getValue() { return getText(); } // Enable/disable setting @Override public void itemStateChanged(final ItemEvent event) { if (event.getSource() == check) { setEnabled(check.isSelected()); setEditable(check.isSelected()); text.setEnabled(check.isSelected()); button.setEnabled(check.isSelected()); vm_args.text.setEnabled(check.isSelected()); vm_args.setEnabled(check.isSelected()); } } } // Add label/text_field with browser public final class CollectExp extends CollectUtility.CText implements FocusListener, CollectUtility.Browseable { final int type; String value; final JLabel text; final JPanel panel; public CollectExp( final int type, final CollectUtility.CList list, final String value, final char mnemonic, final String label, final boolean browser, final char browser_mnem, final int width, boolean required) { super(value, width, JTextField.LEFT); this.type = type; this.value = value; setEditable(true); addFocusListener(this); if (required) { text = (JLabel) CollectUtility.getItem(label + ": *"); } else { text = (JLabel) CollectUtility.getItem(label + ":"); } text.setDisplayedMnemonic(mnemonic); text.getAccessibleContext().setAccessibleName(label); text.getAccessibleContext().setAccessibleDescription(label); text.setLabelFor(this); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); panel.add(this); // Need file browser if (browser) { final JButton button = new JButton("..."); // button.setMargin(CollectUtility.buttonMargin); button.addActionListener(CollectPanel.this); button.setActionCommand(label); button.setToolTipText(AnLocale.getString("Browse...")); // button.setMnemonic(browser_mnem); panel.add(button); } list.add(text, panel); } public CollectExp( final int type, final CollectUtility.CList list, final String value, final char mnemonic, final String label, final boolean browser, final char browser_mnem) { this(type, list, value, mnemonic, label, browser, browser_mnem, 60, false); } public CollectExp( final int type, final CollectUtility.CList list, final String value, final char mnemonic, final String label, final boolean browser, final char browser_mnem, boolean required) { this(type, list, value, mnemonic, label, browser, browser_mnem, 60, required); } // Set value @Override public void setValue(final String path) { if (checkValue(path)) { setText(path); } } @Override public String getValue() { return getText(); } // Check value public boolean checkValue(final String path) { String exp_name_suffix = ".er"; switch (type) { case CEXP_TARGET: updateTitle(path); break; case CEXP_NAME: if ((path.length() != 0) && !path.endsWith(exp_name_suffix)) { showError(AnLocale.getString("The experiment name must end in the string .er")); value = path + exp_name_suffix; return false; } break; case CEXP_DIR: String en = exp_name.getValue(); if (null != en && en.endsWith(exp_name_suffix)) { // do nothing, user specified the correct experiment name } else if (null != en && en.length() > 0) { // user specified invalid experiment name - add ".er" en = en + exp_name_suffix; exp_name.setText(en); } else { // experiment name is null or empty AnUtility.checkIPCOnWrongThread(false); exp_name.setText(CGetExpName(path.length() == 0 ? "." : path)); AnUtility.checkIPCOnWrongThread(true); } break; case CEXP_GROUP: if ((path.length() != 0) && !path.endsWith(".erg")) { showError(AnLocale.getString("The group name must end in the string .erg")); return false; } break; } value = path; return true; } // Lost focus @Override public void focusLost(final FocusEvent event) { if (event.isTemporary()) { return; } if (!checkValue(getText())) { setText(value); } } // Gain focus @Override public void focusGained(final FocusEvent event) {} } // TEMPORARY SOLUTION // This flag indicates that the error dialog is shown, // but the problem is not fixed yet. boolean errorCollectorControlValue = false; // For collect data public final class CollectData extends JPanel implements ItemListener { final JCheckBox check; final JButton button; JLabel text; JComboBox<String> combo; JTextField field; final String name; final String[][] data; CollectData parent, child; String cust_val; boolean add_child_data; boolean available; // Constructor for the 1st row public CollectData( final boolean set, final char mnemonic, final String title, final char mnemonic_r, final String label, final String[][] data, final int alignment, final boolean do_align, final String name) { this.name = name; this.data = data; parent = null; child = null; button = null; add_child_data = false; available = true; setLayout(new FlowLayout(FlowLayout.LEFT, 4, 0)); // Enable or disable CheckBox if (title != null) { check = new JCheckBox(title, set); check.setMargin(CollectUtility.buttonMargin); if (mnemonic != ' ' && mnemonic != '0') { check.setMnemonic(mnemonic); } check.getAccessibleContext().setAccessibleDescription(title); add(check); } else { check = null; } // Extra options if (data != null) { setOption(set, mnemonic_r, label, alignment); } else if (check != null) { check.addItemListener(this); // NM } if (title == null) { if (mnemonic != ' ' && mnemonic != '0') { text.setDisplayedMnemonic(mnemonic); text.setLabelFor(combo); } text.setEnabled(set); } else if (text != null && combo != null) { text.setLabelFor(combo); text.setEnabled(set); } if (do_align) { data_list.add(this); } } // Constructor for the 2nd row if any public CollectData( final CollectData parent, final char mnemonic, final String title, final char mnemonic_r, final String label, final String[][] data, final int alignment, final boolean do_align, final boolean add_child_data, final String name) { final JPanel head_panel; this.name = name; this.data = data; this.parent = parent; child = null; parent.child = this; parent.add_child_data = add_child_data; check = parent.check; setLayout(new FlowLayout(FlowLayout.LEFT, 4, 0)); // Show button if (title != null) { button = new JButton(title); button.setMargin(CollectUtility.buttonMargin); if (mnemonic != ' ') { button.setMnemonic(mnemonic); } button.addActionListener(CollectPanel.this); button.getAccessibleContext().setAccessibleDescription(title); head_panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); head_panel.setOpaque(false); head_panel.add(button); add(head_panel); } else { button = null; // add(new JPanel()); } // Extra options setOption(check.isSelected(), mnemonic_r, label, alignment); if (do_align) { data_list.add(this); } if (check != null) { check.setOpaque(false); } if (button != null) { button.setOpaque(false); } if (text != null) { text.setOpaque(false); } if (combo != null) { combo.setOpaque(false); } if (field != null) { field.setOpaque(false); } setOpaque(false); } // Extra options public void setOption( boolean set, final char mnemonic, final String label, final int alignment) { final String[] list; final String init_val; add(text = (JLabel) CollectUtility.getItem(label)); text.getAccessibleContext().setAccessibleName(label); text.getAccessibleContext().setAccessibleDescription(label); if (mnemonic != ' ' && mnemonic != '0') { text.setDisplayedMnemonic(mnemonic); } if (data[0].length == 0) { check.setEnabled(false); text.setEnabled(false); set = false; list = new String[1]; list[0] = init_val = cust_val = AnLocale.getString("N/A"); } else { list = data[0]; if (data[1] == null) // text value = combo { init_val = cust_val = data[0][0]; } else if ((parent != null) && (parent.data != null) && (parent.data[0].length == 0)) { // not available if (button != null) { button.setEnabled(false); } text.setEnabled(false); init_val = cust_val = data[1][0]; } else { // text value = data[1] init_val = data[1][0]; cust_val = data[1][data[1].length - 1]; } } add(combo = new JComboBox<String>(list)); add(field = new JTextField(init_val, 8)); combo.setEnabled(set); // combo.setSelectedItem(list[0]); final JLabel lab = ((JLabel) CollectUtility.getItem(label)); lab.setLabelFor(combo); lab.getAccessibleContext().setAccessibleName(label); lab.getAccessibleContext().setAccessibleDescription(label); combo.getAccessibleContext().setAccessibleName(label); combo.getAccessibleContext().setAccessibleDescription(label); field.getAccessibleContext().setAccessibleName(label); field.getAccessibleContext().setAccessibleDescription(label); field.setEnabled(set && (data[1] == null)); field.setHorizontalAlignment(alignment); if (check != null) { check.addItemListener(this); } combo.addItemListener(this); } // Get the value public String getValue() { final String value; if (check == null) { return field.getText(); } if (!check.isSelected()) { return null; } if (field == null) { return ipc_str_on; } value = field.getText(); if (child == null || !add_child_data) { return value; } return value + ipc_str_comma + child.getValue(); } // Get the check value public boolean isChecked() { if (check == null || !check.isSelected()) { return false; } return true; } // Set checkbox public void setChecked(final boolean checked) { if (check != null) { check.setSelected(checked); } } // Enable/disable setting @Override public void itemStateChanged(final ItemEvent event) { final Object src = event.getSource(); final int state, size; String item; synchronized (globalSem) { if (inItemStateChanged) { return; // no recursion } inItemStateChanged = true; if (src == check) { state = event.getStateChange(); if (state == ItemEvent.SELECTED) { if ((src == count_data.check) || (src == deadlock_trace.check) || (src == data_race.check)) { // Disable conflicting controls if (src == count_data.check) { clock_prof.check.setEnabled(false); clock_prof.check.setSelected(false); clock_prof.combo.setEnabled(false); clock_prof.text.setEnabled(false); hwc1_prof.check.setEnabled(false); hwc1_prof.check.setSelected(false); // hwc1_prof.??.setEnabled(false); // hwc1_prof.??.setEnabled(false); sample.check.setEnabled(false); sample.check.setSelected(false); sample.combo.setEnabled(false); sample.text.setEnabled(false); sample_sig.check.setEnabled(false); sample_sig.check.setSelected(false); sample_sig.combo.setEnabled(false); sample_sig.text.setEnabled(false); } sync_trace.check.setEnabled(false); sync_trace.check.setSelected(false); sync_trace.combo.setEnabled(false); sync_trace.text.setEnabled(false); io_trace.check.setEnabled(false); io_trace.check.setSelected(false); heap_trace.check.setEnabled(false); heap_trace.check.setSelected(false); if ((src == deadlock_trace.check) || (src == data_race.check)) { count_data.check.setEnabled(false); count_data.check.setSelected(false); } else { deadlock_trace.check.setEnabled(false); deadlock_trace.check.setSelected(false); data_race.check.setEnabled(false); data_race.check.setSelected(false); } mpi_trace.check.setEnabled(false); mpi_trace.check.setSelected(false); jvm_prof.check.setEnabled(false); jvm_prof.check.setSelected(false); if ((target_jdk != null) && (target_jdk.check != null)) { target_jdk.check.setEnabled(false); target_jdk.text.setEnabled(false); } if ((vm_args != null) && (vm_args.text != null)) { vm_args.text.setEnabled(false); } if (vm_args != null) { vm_args.setEnabled(false); } } else { count_data.check.setEnabled(false); count_data.check.setSelected(false); // NM deadlock_trace.check.setEnabled(false); // NM data_race.check.setEnabled(false); if ((null != heap_trace) && (null != jvm_prof)) { if (src == jvm_prof.check) { heap_trace.check.setEnabled(false); heap_trace.check.setSelected(false); } if (src == heap_trace.check) { jvm_prof.check.setEnabled(false); jvm_prof.check.setSelected(false); } } } // NM combo.setEnabled(true); String val = ipc_str_on; if (text != null) { text.setEnabled(true); } if (combo != null) { combo.setEnabled(true); // Enable it if it is 'Custom' item = (String) combo.getSelectedItem(); field.setEnabled((data[1] == null) || item.startsWith(AnLocale.getString("Custom"))); if (item.startsWith(AnLocale.getString("Custom"))) { if (text != null) { val = field.getText(); // Correct? } } else if (data[1] == null) { val = item; } else { val = field.getText(); // Correct? // find value // size = data[0].length; // for (int i = 0; i < size; i++) { // if (item.equals(data[0][i])) { // //field.setText(data[1][i]); // val = data[1][i]; // break; // } // } } } String err = null; String cur_name = name; if ((ipc_str_hwc1_val.equals(name)) || (ipc_str_hwc2_prof.equals(name)) || (ipc_str_dspace_hwc1.equals(name)) || (ipc_str_hwc_reg_alloc.equals(name)) || (ipc_str_hwc_ctr_attr.equals(name))) { // TEMPORARY: use ipc_str_hwcprof cur_name = ipc_str_hwcprof; if (((hwc1_prof.getValue()) != null) && (selectedHWCList.size() > 0)) { String ctrlist = selectedHWCList.get(0).getName(); for (int i = 1; i < selectedHWCList.size(); i++) { ctrlist = ctrlist + ipc_str_comma + selectedHWCList.get(i).getName(); } val = ctrlist; } } if (ipc_str_on.equals(val) && (ipc_str_MPIexpt.equals(cur_name))) { val = "CT"; // TEMPORARY: "-M" is not properly implemented yet } if (ipc_str_hwcprof.equals(cur_name) && (ipc_str_on.equals(val) || val.startsWith(ipc_str_hwc_default))) { // skip this call (TEMPORARY: "-h on" is not implemented yet) // err = null; // We come here when user clicks on "Hardware Counter Profiling" } else if ((ipc_str_zero.equals(val) || ipc_str_None.equals(val) || ipc_str_off.equals(val)) && (ipc_str_hwcprof.equals(cur_name))) { // skip this call (HWC value is not selected yet) } else { err = Collector.setCollectorControlValue(cur_name, val); // IPC call } if (err != null) { // Check if this error is already on the screen if (errorCollectorControlValue) { // Let user fix this problem } else { errorCollectorControlValue = true; // Show error/warning dialog // System.err.println("Error 1: setCollectorControlValue(" + cur_name + ", " + val + // ") returned: " + err); // DEBUG AnUtility.showMessage(work_panel, err, JOptionPane.ERROR_MESSAGE); // Get value String cur_value = Collector.getCollectorControlValue(cur_name); // IPC call // System.err.println("getCollectorControlValue(" + cur_name + ") returned: " + // cur_value); // DEBUG if (ipc_str_MPIexpt.equals(cur_name) || (ipc_str_hwcprof.equals(cur_name))) { // TEMPORARY: skip update } else if (null != field) { item = (String) combo.getSelectedItem(); if (item.startsWith(AnLocale.getString("Custom"))) { field.setText(cur_value); } } } } else { errorCollectorControlValue = false; } } else if (state == ItemEvent.DESELECTED) { if ((ipc_str_hwc1_val.equals(name)) || (ipc_str_hwc2_prof.equals(name)) || (ipc_str_dspace_hwc1.equals(name)) || (ipc_str_hwc_reg_alloc.equals(name)) || (ipc_str_hwc_ctr_attr.equals(name))) { // TEMPORARY: skip unset } else { Collector.unsetCollectorControlValue(name); } if (combo != null) { combo.setEnabled(false); } if (text != null) { text.setEnabled(false); } if (field != null) { field.setEnabled(false); } if ((null != heap_trace) && (null != jvm_prof)) { if (src == jvm_prof.check) { javaprof_not_changed_by_user = false; heap_trace.check.setEnabled(true); } if (src == heap_trace.check) { jvm_prof.check.setEnabled(true); jvm_prof.check.setSelected(javaprof_not_changed_by_user); } } if (src == sample.check) { sample_not_changed_by_user = false; } if (src == clock_prof.check) { clkprof_not_changed_by_user = false; } if ((src == count_data.check) || (src == deadlock_trace.check) || (src == data_race.check)) { if (!(count_data.check.isSelected() || deadlock_trace.check.isSelected() || data_race.check.isSelected())) { // Enable all other controls clock_prof.check.setEnabled(true); clock_prof.check.setSelected(clkprof_not_changed_by_user); clock_prof.combo.setEnabled(clkprof_not_changed_by_user); clock_prof.text.setEnabled(clkprof_not_changed_by_user); sync_trace.check.setEnabled(true); hwc1_prof.check.setEnabled(true); sample.check.setEnabled(true); sample.check.setSelected(sample_not_changed_by_user); sample.combo.setEnabled(sample_not_changed_by_user); sample.text.setEnabled(sample_not_changed_by_user); sample_sig.check.setEnabled(true); io_trace.check.setEnabled(true); heap_trace.check.setEnabled(true); if (count_data.available) { count_data.check.setEnabled(true); } if (deadlock_trace.available) { deadlock_trace.check.setEnabled(true); } if (data_race.available) { data_race.check.setEnabled(true); } mpi_trace.check.setEnabled(true); jvm_prof.check.setEnabled(true); jvm_prof.check.setSelected(javaprof_not_changed_by_user); } } else if (!(clock_prof.check.isSelected() || sync_trace.check.isSelected() || hwc1_prof.check.isSelected() || sample.check.isSelected() || sample_sig.check.isSelected() || io_trace.check.isSelected() || heap_trace.check.isSelected() || mpi_trace.check.isSelected() || jvm_prof.check.isSelected())) { if (count_data.available) { count_data.check.setEnabled(true); } if (deadlock_trace.available) { deadlock_trace.check.setEnabled(true); } if (data_race.available) { data_race.check.setEnabled(true); } } } } else if (src == combo) { if (text.getText().equals(AnLocale.getString("Attribute:"))) { setAttributeCombo(); attr_warn = true; } if (text.getText().equals(AnLocale.getString("Counter Name:"))) { String select_ctr = (String) hwc2_prof.combo.getSelectedItem(); setAttributeCombo(); hwc_reg_data = setRegData(select_ctr); } if (text.getText().equals(AnLocale.getString("Hardware Counter Register:"))) { field.setText((String) combo.getSelectedItem()); } item = (String) combo.getSelectedItem(); // Save the custom value for later use if (item.startsWith(AnLocale.getString("Custom"))) { final int sidx = combo.getSelectedIndex(); cust_val = data[1][sidx]; } item = (String) event.getItem(); // Enable it if it is 'Custom' if (item.startsWith(AnLocale.getString("Custom")) || text.getText().equals(AnLocale.getString("Attribute:"))) { field.setEnabled(true); field.setText(cust_val); String val = cust_val; if (val.isEmpty()) { val = "0"; // default value for empty string if ((src == exp_limit) || (src == exp_limit.combo)) { val = "none"; // default value for unlimited size } } if (ipc_str_descendant.equals(name)) { descendant.field.setToolTipText( AnLocale.getString( "Specify regular expression to match base name of the executable to follow")); } boolean need_check = true; if (ipc_str_hwc2_prof.equals(name) && val.startsWith(ipc_str_hwc_default)) { need_check = false; // TEMPORARY: skip check - CLI cannot check the default HWC set yet } if ((ipc_str_hwc1_val.equals(name)) || (ipc_str_dspace_hwc1.equals(name)) || (ipc_str_hwc_reg_alloc.equals(name)) || (ipc_str_hwc_ctr_attr.equals(name))) { // TEMPORARY: skip check - need new API to check these details need_check = false; // TEMPORARY: Need new API } if (need_check) { String err = Collector.setCollectorControlValue(name, val); // IPC call if (err != null) { // System.err.println("Error 2: setCollectorControlValue(" + name + ", " + val + ") // returned: " + err); // DEBUG AnUtility.showMessage(work_panel, err, JOptionPane.ERROR_MESSAGE); } } inItemStateChanged = false; return; // End of critical section } else if (data[1] == null) { field.setText(item); // ??? String err = Collector.setCollectorControlValue(name, item); if (err != null) { // System.err.println("Error 3: setCollectorControlValue(" + name + ", " + item + ") // returned: " + err); // DEBUG AnUtility.showMessage(work_panel, err, JOptionPane.ERROR_MESSAGE); } inItemStateChanged = false; return; // End of critical section } else { field.setEnabled(false); } // Update value size = data[0].length; for (int i = 0; i < size; i++) { if (item.equals(data[0][i])) { field.setText(data[1][i]); String val = data[1][i]; if (val.isEmpty()) { val = "0"; // default value for empty string if (src == exp_limit.combo) { val = "none"; // default value for unlimited size } } // Check value if (ipc_str_hwc2_prof.equals(name) && ipc_str_hwc_default.equals(val)) { break; // TEMPORARY: CLI cannot check the default HWC set yet } if ((ipc_str_hwc1_val.equals(name)) || (ipc_str_dspace_hwc1.equals(name)) || (ipc_str_hwc_reg_alloc.equals(name)) || (ipc_str_hwc_ctr_attr.equals(name))) { // TEMPORARY: skip check - need new API to check these details break; // TEMPORARY: Need new API } AnUtility.checkIPCOnWrongThread(false); String err = Collector.setCollectorControlValue(name, val); // TEMPORARY AnUtility.checkIPCOnWrongThread(true); if (err != null) { // System.err.println("Error 4: setCollectorControlValue(" + name + ", " + val + ") // returned: " + err); // DEBUG JOptionPane.showMessageDialog( (AnWindow.getInstance()).getFrame(), err, AnLocale.getString("Information"), JOptionPane.INFORMATION_MESSAGE); } AnUtility.checkIPCOnWrongThread(false); err = Collector.getCollectorControlValue(name); // TEMPORARY AnUtility.checkIPCOnWrongThread(true); break; } } } inItemStateChanged = false; } // End of critical section } // Align label/combo-box public void setAlignmentX(final ArrayList<CollectData> data_list) { int i; for (i = 0; i < 4; i++) // 1.check 2.label 3.option 4.text { setAlignmentX(i, data_list); } } public void setAlignmentX(final int index, final ArrayList<CollectData> data_list) { int width, max_width; CollectData cd; JComponent cmp; Dimension psize; Iterator<CollectData> iter = data_list.iterator(); max_width = 0; // Find the maximum width while (iter.hasNext()) { cd = iter.next(); if (index >= cd.getComponentCount()) { continue; } cmp = (JComponent) cd.getComponent(index); width = cmp.getPreferredSize().width; if (max_width < width) { max_width = width; } } // Set the maximum width iter = data_list.iterator(); while (iter.hasNext()) { cd = iter.next(); if (index >= cd.getComponentCount()) { continue; } cmp = (JComponent) cd.getComponent(index); psize = cmp.getPreferredSize(); psize.width = max_width; cmp.setPreferredSize(psize); } } } // Set visible @Override public final void setVisible(final boolean set) { super.setVisible(set); if (!set) { return; } // Make the most interesting part, the end, visible if (!profile_running_process && !system_profiling) { target.setVisibleAlign(CollectUtility.TEXT_RIGHT, true); } exp_name.setVisibleAlign(CollectUtility.TEXT_RIGHT, true); work_dir.setVisibleAlign(CollectUtility.TEXT_RIGHT, false); } /** * Class CollectChooser creates AnChooser using AnWindow.getAnChooser() method and provides * methods: getFile setDialogTitle */ final class CollectChooser { AnChooser ac = null; public CollectChooser(final int chooser_type) { String dir = null; ac = anWindow.getAnChooser(title, chooser_type, dir); } /** * Sets Dialog Title * * @param title */ public void setDialogTitle(final String title) { ac.setDialogTitle(title); } /** * Gets file name from the file chooser and returns value via text.setValue(name); * * @param cmd */ public void getFile(final String cmd) { final CollectUtility.Browseable text; AnFile path_file; // NM replace String path; if (cmd.equals(CSTR_TARGET)) { text = target; path = text.getValue().trim(); if (path.equals(ipc_str_empty) || !path.startsWith("/" /*File.separator*/)) { path = work_dir.getText(); if (!path.equals(ipc_str_empty)) { path_file = new AnFile(path); } else { path = "./"; path_file = new AnFile(path); } } else { path_file = new AnFile(path); if (path_file.isFile()) { path_file = (AnFile) path_file.getParentFile(); } } ac.setFileSelectionMode(AnChooser.FILES_ONLY); } else if (cmd.equals(CSTR_WORK)) { text = work_dir; path_file = new AnFile(text.getValue()); // NM replace ac.setFileSelectionMode(AnChooser.DIRECTORIES_ONLY); } else if (cmd.equals(CSTR_TARGET_JDK)) { text = target_jdk; if (text.getValue() != null) { path_file = new AnFile(text.getValue()); // NM replace } else { path_file = new AnFile("/usr/j2se"); // NM replace } ac.setFileSelectionMode(AnChooser.FILES_AND_DIRECTORIES); } else { return; } ac.setCurrentDirectory(path_file); if ((ac.showOpenDialog(work_panel) == AnChooser.APPROVE_OPTION) && ((ac.getSelectedFile()) != null)) { path_file = new AnFile(ac.getSelectedFile().getAbsolutePath()); String name = path_file.getAbsolutePath(); /* if (!Analyzer.getInstance().isRemote()) { // remove .class and full path for java targets if (cmd.equals(CollectPanel.CSTR_TARGET) && AnUtility.getMimeFormat(path_file) == AnUtility.MIME_JAVA_CLASS_FILE) { if (name.endsWith(".class")) { name = name.substring(0, name.lastIndexOf(".class")); } final int sep_ind = name.lastIndexOf(File.separatorChar); if (sep_ind != -1) { name = name.substring(sep_ind + 1); } } } */ text.setValue(name); } } } // end of Class CollectChooser // public interface Provider { public void setTitleStr(String title); } /*------------------------------------- CONSTANTS --------------------------------------------------------*/ public static final String[] aux = {AnLocale.getString("Pause"), AnLocale.getString("Sample")}; public static final char[] mnemonic = { AnLocale.getString('u', "MNEM_COLLECTOR_PAUSE"), AnLocale.getString('S', "MNEM_COLLECTOR_SAMPLE") }; public static final String title = AnLocale.getString("Profile Application"); public static final String title1 = AnLocale.getString("Profile Running Process"); public static final String title2 = AnLocale.getString("Profile Kernel"); // target types and possible errors static final int TARG_ELF_EXECUTABLE = 0; static final int TARG_JAVA_CLASS_FILE = 1; static final int TARG_JAR_FILE = 2; static final int TARG_UNKNOWN_TYPE = -1; static final int TARG_NOT_EXISTS = -2; static final int TARG_IS_NOT_FILE = -3; static final int TARG_IS_NOT_READABLE = -4; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectorOpenPanel.java������������������������������������0000644�0001750�0001750�00000013112�14744453367�021766� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.ConfigurationPanel; import java.awt.BorderLayout; import javax.swing.BorderFactory; public class CollectorOpenPanel extends javax.swing.JPanel { private ConfigurationPanel configurationPanel; public CollectorOpenPanel(String experimentPath, String workingDir) { initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); configurationOuterPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); label1.setText( AnLocale.getString("Data collection is complete. Do you want to open the experiment?")); experimentLabel.setText(AnLocale.getString("Experiment:")); pathTextField.setText(experimentPath); pathTextField.setToolTipText(experimentPath); // pathTextField.setFont(pathTextField.getFont().deriveFont(Font.BOLD)); pathTextField.setBorder(BorderFactory.createLineBorder(pathTextField.getBackground(), 5)); // pathTextField.setBorder(null); configurationOuterPanel.setLayout(new BorderLayout()); configurationPanel = new ConfigurationPanel(false); configurationPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); configurationOuterPanel.add(configurationPanel, BorderLayout.CENTER); AnFile file = new AnFile(experimentPath); if (file.exists()) { configurationPanel.initConfigurationChoices(file); configurationPanel.setWorkingDirectory(workingDir); } } public String getWorkingDirectory() { return configurationPanel.getWorkingDirectory(); } public String getConfiguration() { return configurationPanel.getConfiguration(); } public boolean alwaysUseThisConfiguration() { return configurationPanel.alwaysUseThisConfiguration(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label1 = new javax.swing.JLabel(); experimentLabel = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); configurationOuterPanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); label1.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; add(label1, gridBagConstraints); experimentLabel.setText("jLabel3"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(experimentLabel, gridBagConstraints); pathTextField.setEditable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(pathTextField, gridBagConstraints); javax.swing.GroupLayout configurationOuterPanelLayout = new javax.swing.GroupLayout(configurationOuterPanel); configurationOuterPanel.setLayout(configurationOuterPanelLayout); configurationOuterPanelLayout.setHorizontalGroup( configurationOuterPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); configurationOuterPanelLayout.setVerticalGroup( configurationOuterPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 12, 0); add(configurationOuterPanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel configurationOuterPanel; private javax.swing.JLabel experimentLabel; private javax.swing.JLabel label1; private javax.swing.JTextField pathTextField; // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectPanel3.java�����������������������������������������0000644�0001750�0001750�00000122762�15044710303�020656� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.PsParser; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.PopupMenuEvent; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; /** Creates first page for Collector GUI to profile a running application */ public class CollectPanel3 extends JPanel { private final String STR_ACTION_UPDATE = AnLocale.getString("Refresh"); private final String STR_ACTION_SORTBY = AnLocale.getString("Sort by"); private final String STR_ACTION_COPY_ALL = AnLocale.getString("Copy All"); private JPanel workPanel; private AnWindow anWindow; private AnMenuListener menuListener; private String processID; private String processName; private String[] tableColumns = new String[6]; /** * Creates new form CollectPanel3 * * @param aWindow */ public CollectPanel3(final AnWindow aWindow) { workPanel = this; this.anWindow = aWindow; initComponents(); postInitComponents(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel2 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jButton1 = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); processesTable = new javax.swing.JTable(); jPanel3 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); jComboBox4 = new javax.swing.JComboBox(); jLabel6 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); jPanel2.setLayout(new java.awt.GridBagLayout()); jLabel2.setLabelFor(processesTable); jLabel2.setText("Select the Process to profile"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel2.add(jLabel2, gridBagConstraints); jLabel1.setLabelFor(jComboBox1); jLabel1.setText("Filter:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); jPanel2.add(jLabel1, gridBagConstraints); jComboBox1.setEditable(true); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); jPanel2.add(jComboBox1, gridBagConstraints); jButton1.setText("Refresh"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); jPanel2.add(jButton1, gridBagConstraints); processesTable.setAutoCreateRowSorter(true); processesTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null} }, new String [] { "User Name", "PID", "PPID", "Start Time", "CPU time", "Command" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false, false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); processesTable.setToolTipText("Select the process to profile"); processesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS); processesTable.setMaximumSize(new java.awt.Dimension(32768, 32768)); processesTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane2.setViewportView(processesTable); processesTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel2.add(jScrollPane2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 12); add(jPanel2, gridBagConstraints); jPanel3.setLayout(new java.awt.GridBagLayout()); jTextField1.setColumns(20); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); jPanel3.add(jTextField1, gridBagConstraints); jLabel3.setLabelFor(jTextField1); jLabel3.setText("Target PID:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel3, gridBagConstraints); jComboBox2.setEditable(true); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ktest.1.er" })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox2, gridBagConstraints); jLabel4.setLabelFor(jComboBox2); jLabel4.setText("Experiment Name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel4, gridBagConstraints); jComboBox3.setEditable(true); jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox3, gridBagConstraints); jLabel5.setLabelFor(jComboBox3); jLabel5.setText("Experiment Directory:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel5, gridBagConstraints); jComboBox4.setEditable(true); jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " })); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jComboBox4, gridBagConstraints); jLabel6.setLabelFor(jComboBox4); jLabel6.setText("Experiment Group:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); jPanel3.add(jLabel6, gridBagConstraints); jTextField2.setEditable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); jPanel3.add(jTextField2, gridBagConstraints); jLabel7.setLabelFor(jTextField2); jLabel7.setText("Target Name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); jPanel3.add(jLabel7, gridBagConstraints); jButton2.setText("..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jButton2, gridBagConstraints); jButton6.setText("..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); jPanel3.add(jButton6, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12); add(jPanel3, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton6; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTable processesTable; // End of variables declaration//GEN-END:variables /** Initialize combo boxes with default values */ public void postInitComponents() { AnUtility.setTextAndAccessibleContext(jLabel2, AnLocale.getString("Process")); AnUtility.setTextAndAccessibleContext(jLabel1, AnLocale.getString("Filter:")); jLabel1.setDisplayedMnemonic(AnLocale.getString('F', "MN_PROFILE_RUNNING_PROCESS_Filter")); jLabel1.setLabelFor(jComboBox1); AnUtility.setTextAndAccessibleContext(jLabel3, AnLocale.getString("Target PID:")); AnUtility.setTextAndAccessibleContext(jLabel4, AnLocale.getString("Experiment Name:")); AnUtility.setTextAndAccessibleContext(jLabel5, AnLocale.getString("Experiment Directory:")); AnUtility.setTextAndAccessibleContext(jLabel6, AnLocale.getString("Experiment Group:")); AnUtility.setTextAndAccessibleContext(jLabel7, AnLocale.getString("Target Name:")); AnUtility.setAccessibleContext(jButton1.getAccessibleContext(), AnLocale.getString("Refresh")); jButton1.setMnemonic(AnLocale.getString('R', "MN_PROFILE_RUNNING_PROCESS_Refresh")); AnUtility.setAccessibleContext(jButton2.getAccessibleContext(), AnLocale.getString("Browse")); AnUtility.setAccessibleContext(jButton6.getAccessibleContext(), AnLocale.getString("Browse")); AnUtility.setAccessibleContext( processesTable.getTableHeader().getAccessibleContext(), AnLocale.getString("Process Table")); processesTable.getSelectionModel().addListSelectionListener(new SelectionHandler()); jComboBox1.setSelectedItem(""); // Filter String user = System.getProperty("user.name"); jComboBox1.addItem(user); // Filter jComboBox2.setSelectedItem("test.1.er"); // Experiment name // jComboBox2.addItem(empty_str); // Experiment name jComboBox3.setSelectedItem(""); // Experiment directory // jComboBox3.addItem(empty_str); // Experiment directory jComboBox4.setSelectedItem(""); // Experiment group // jComboBox4.addItem(empty_str); // Experiment group jButton1.addActionListener(new RefreshActionHandler()); // Refresh jButton2.addActionListener(new ExpDirActionHandler()); // Experiment directory browser jButton6.addActionListener(new ExpGroupActionHandler()); // Experiment group browser // Init column names tableColumns[0] = AnLocale.getString("User Name") + " (UID)"; tableColumns[1] = AnLocale.getString("Process ID") + " (PID)"; tableColumns[2] = AnLocale.getString("Parent Process ID") + " (PPID)"; tableColumns[3] = AnLocale.getString("Start Time") + " (START TIME)"; tableColumns[4] = AnLocale.getString("CPU Time") + " (CPU TIME)"; tableColumns[5] = AnLocale.getString("Process name") + " (COMMAND)"; // Popup menu menuListener = new AnMenuListener(this, processesTable); processesTable.addMouseListener(menuListener); KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; processesTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); processesTable .getActionMap() .put( ks, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { JPopupMenu popup = initPopup(processesTable); if (popup != null) { JTable src = (JTable) ev.getSource(); Rectangle cellRect, visRect; visRect = src.getVisibleRect(); cellRect = visRect; if (cellRect.width > 0) { // calculate a good place to show the menu cellRect.x += cellRect.width / 4; } if (cellRect.height > 0) { cellRect.y += cellRect.height / 4; } popup.show(src, cellRect.x, cellRect.y); } } }); jTextField2.setColumns(50); } /** Copy all lines to the system clipboard */ protected void copyAll() { String text = ""; int rows = processesTable.getRowCount(); int columns = processesTable.getColumnCount(); int collen[] = new int[columns]; // Print table header for (int j = 0; j < columns; j++) { if (tableColumns.length > j) { String s = tableColumns[j]; text += s; collen[j] = s.length(); } if (columns - 1 == j) { break; } text += " | "; } text += "\n"; // Print table rows for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { String s = processesTable.getValueAt(i, j).toString(); text += s; // Try to format the string if (columns - 1 == j) { break; } int k = collen[j] - s.length(); while (k > 0) { text += " "; k--; } text += " | "; } text += "\n"; } // copyToClipboard(text); StringSelection data = new StringSelection(text); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(data, data); } public void update() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { updateTable(); updateSelection(); updateTextFields(); } }); } private void updateTable() { AnUtility.checkIfOnAWTThread(true); final String f = "/bin/ps -ef"; AnUtility.checkIPCOnWrongThread(false); String p = Collector.getRunningProcesses(f); // IPC call String o = Collector.getOSFamily(); // IPC call AnUtility.checkIPCOnWrongThread(true); PsParser psParser = PsParser.getDefault(o); psParser.setPsOutput(p); List<String> th = psParser.getData(true).header(); // Headers // Customize column names for (int i = 0; i < th.size(); i++) { String s = th.get(i); if ("STIME".equals(s)) { th.set(i, "START TIME"); } if ("TIME".equals(s)) { th.set(i, "CPU TIME"); } if ("CMD".equals(s)) { th.set(i, "COMMAND"); } } java.util.regex.Pattern re = java.util.regex.Pattern.compile("."); String filter = getFilter(); if (!"".equals(filter)) { re = java.util.regex.Pattern.compile(".*" + filter + ".*"); } List<List<String>> tp = psParser.getData(true).processes(re); // Processes // Convert List<List<String>> to Object[][].... List<Object[]> tpList = new ArrayList<>(); for (List<String> object : tp) { tpList.add(object.toArray()); } Object[][] tpArray = new Object[tpList.size()][]; int index = 0; for (Object[] x : tpList) { tpArray[index++] = x; } ((DefaultTableModel) processesTable.getModel()).setDataVector(tpArray, th.toArray()); // Set coulumn widths (available space goes to last column) for (int i = 0; i < processesTable.getColumnCount() - 1; i++) { processesTable.getColumnModel().getColumn(i).setPreferredWidth(80); processesTable.getColumnModel().getColumn(i).setMaxWidth(300); } } /** * Get Filter * * @return String filter */ private String getFilter() { String filter = ""; if (null != jComboBox1.getSelectedItem()) { filter = jComboBox1.getSelectedItem().toString(); } return filter; } /** * Get Process ID * * @return String PID */ public String getProcessID() { String PID = ""; processID = jTextField1.getText(); if (null != processID) { PID = processID; } return PID; } /** * Get Process Name * * @return name */ public String getProcessName() { String proc = ""; processName = jTextField1.getText(); // TEMPORARY if (null != processName) { proc = processName; } return proc; } /** * Get Experiment Directory * * @return String directory */ public String getExperimentDirectory() { String expdir = ""; if (null != jComboBox3.getSelectedItem()) { expdir = jComboBox3.getSelectedItem().toString(); } if (expdir.length() < 1) { // XXX should it be here? expdir = CGetCurDir(); // IPC call } return expdir; } /** * Set Experiment Directory * * @param expdir */ public void setExperimentDirectory(String expdir) { jComboBox3.setSelectedItem(expdir); } /** * Get Experiment Name * * @return String directory */ public String getExperimentName() { String expdir = ""; if (null != jComboBox2.getSelectedItem()) { expdir = jComboBox2.getSelectedItem().toString(); } return expdir; } /** * Get Experiment Group * * @return String group */ public String getExperimentGroup() { String group = ""; if (null != jComboBox4.getSelectedItem()) { group = jComboBox4.getSelectedItem().toString(); } return group; } /** * Set Experiment Group * * @param expdir */ public void setExperimentGroup(String group) { jComboBox4.setSelectedItem(group); } /** * Get Current Directory * * @return */ private String CGetCurDir() { return Analyzer.getInstance().getWorkingDirectory(); } /** * Get Preview Command * * @return String command */ public String getPreviewCommand() { String col_cmd = "er_kernel"; String pid = getProcessID(); // jTextField1.getText(); if ((null != pid) && (pid.length() > 0)) { col_cmd += " -F =" + pid; } col_cmd += " -o " + getExperimentName(); // jComboBox2.getItemAt(0); System.out.println(col_cmd); // DEBUG return col_cmd; } private void actionPerformed2(final ActionEvent event) { // final Iterator iter; int i; final String cmd = event.getActionCommand(); final String empty = ""; final String slash = "/"; if (cmd.equals(empty)) { int theState = event.getID(); // state change event if (theState == Collector.COLLECTING_RUNNING) { // if (buttons[0].isEnabled()) { // the collection has just started // writeln(AnLocale.getString("Running: ") + new File(target.getText()).getName(), // getOutLog()); // set_runtime_buttons(); // } else { // the collection has been resumed // writeln(AnLocale.getString("Data collection resumed"), getOutLog()); // writeln("(" + AnLocale.getString("process id ") + m_collector.getProcessPID() + ")", // getOutLog()); // buttons[2].setText(AnLocale.getString("Pause")); // buttons[2].setActionCommand(AnLocale.getString("Pause")); // } } else if (theState == Collector.COLLECTING_PAUSED) { // writeln(AnLocale.getString("Data collection paused"), getOutLog()); // writeln("(" + AnLocale.getString("process id ") + m_collector.getProcessPID() + ")", // getOutLog()); // buttons[2].setText(AnLocale.getString("Resume")); // buttons[2].setActionCommand(AnLocale.getString("Resume")); } else if (theState == Collector.COLLECTING_TERMINATING) { // writeln(AnLocale.getString("Data collection terminating"), getOutLog()); } else if ((theState == Collector.COLLECTING_TERMINATED) || (theState == Collector.COLLECTING_COMPLETED)) { if (theState == Collector.COLLECTING_TERMINATED) { // writeln(AnLocale.getString("Data collection terminated"), getOutLog()); } // NM if (output_thread != null) { // NM Thread stopped = output_thread; // NM output_thread=null; // NM stopped.interrupt(); // NM } // writeln(AnLocale.getString("Process ID: ") + m_collector.getProcessPID(), getOutLog()); // writeln(AnLocale.getString("Elapsed Time: ") + m_collector.getElapsedTime() + " ms", // getOutLog()); // writeln(AnLocale.getString("Execution completed, exit status is ") + // m_collector.getProcessExitValue(), getOutLog()); // final String actual_expname = m_collector.getActualExpName(); // getBtClear().setEnabled(true); // resetButtons(); // exp_name.setValue(m_collector.getNextExpName()); } } else if (cmd.equals(AnLocale.getString("Refresh"))) { if (anWindow != null) { update(); } else { // TEST refreshPS(processesTable); updateSelection(); updateTextFields(); } } else if (cmd.equals(AnLocale.getString("Pause"))) { // if (m_collector.pause(AnUtility.getSignalValue(pause_sig.getValue()))) { // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Resume"))) { // if (m_collector.resume(AnUtility.getSignalValue(pause_sig.getValue()))) { // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Sample"))) { // if (m_collector.sample(AnUtility.getSignalValue(sample_sig.getValue()))) { // writeln(AnLocale.getString("Manual sample"), getOutLog()); // } // tab_pane.setSelectedIndex(2); } else if (cmd.equals(AnLocale.getString("Terminate"))) { } else if (cmd.equals(AnLocale.getString("Preview Command:"))) { System.out.println(getPreviewCommand()); } else if (cmd.equals(AnLocale.getString("Cancel"))) { } else { // showChooser(cmd); } } private void updateSelection() { AnUtility.checkIfOnAWTThread(true); String last_pid = processID; // jTextField1.getText(); if ((last_pid != null) && (last_pid.length() > 0)) { // Check if selection is still correct int row = processesTable.getSelectedRow(); int count = processesTable.getRowCount(); if (count < row) { row = -1; } if (row >= 0) { String s = processesTable.getModel().getValueAt(row, 1).toString(); if (!last_pid.equals(s)) { row = -1; } } if (row < 0) { // Find last_pid in the table for (row = 0; row < count; row++) { String s = processesTable.getModel().getValueAt(row, 1).toString(); if (last_pid.equals(s)) { if (row != processesTable.getSelectedRow()) { processesTable.setRowSelectionInterval(row, row); } return; } } // Not found - select first row row = 0; } // New selection if (row < count) { processesTable.setRowSelectionInterval(row, row); return; } } if (null == processID) { // first time processesTable.clearSelection(); } else { int count = processesTable.getRowCount(); if (count > 0) { // select first row int row = 0; processesTable.setRowSelectionInterval(row, row); } } } private void updateTextFields() { AnUtility.checkIfOnAWTThread(true); int rows = processesTable.getRowCount(); if (rows <= 0) { return; } int row = processesTable.getSelectedRow(); if (row < 0) { return; // No selection by default } if (rows < row) { row = 0; } int lastCol = processesTable.getColumnCount() - 1; if (lastCol > 0) { // Get process ID String p = processesTable.getValueAt(row, 1).toString(); jTextField1.setText(p); // Process ID processID = p; // Get process name String s = processesTable.getValueAt(row, lastCol).toString(); int spaceind = s.indexOf(' '); if (spaceind > 0) { s = s.substring(0, spaceind); } jTextField2.setText(s); // Process name } } private final class SelectionHandler implements ListSelectionListener { @Override public void valueChanged(ListSelectionEvent evt) { updateTextFields(); } } /** Refresh Action handler */ private final class RefreshActionHandler implements ActionListener { @Override public void actionPerformed(final ActionEvent event) { processID = jTextField1.getText(); update(); } } /** * "Choose Experiment Directory" action handler Call file chooser and update Experiment Directory */ private final class ExpDirActionHandler implements ActionListener { AnChooser ac = null; String dir = null; @Override public void actionPerformed(final ActionEvent event) { String title = AnLocale.getString("Experiment Directory"); if (null == ac) { ac = anWindow.getAnChooser(title, AnChooser.DIR_CHOOSER, dir); } if ((ac.showOpenDialog(workPanel) == AnChooser.APPROVE_OPTION) && ((ac.getSelectedFile()) != null)) { dir = ac.getSelectedFile().getAbsolutePath(); setExperimentDirectory(dir); } } } /** "Choose Experiment Group" action handler Call file chooser and update Experiment Group */ private final class ExpGroupActionHandler implements ActionListener { AnChooser ac = null; String dir = null; @Override public void actionPerformed(final ActionEvent event) { String title = AnLocale.getString("Experiment Group"); if (null == ac) { ac = anWindow.getAnChooser(title, AnChooser.EXP_GROUP_CHOOSER, dir); } if ((ac.showOpenDialog(workPanel) == AnChooser.APPROVE_OPTION) && ((ac.getSelectedFile()) != null)) { dir = ac.getSelectedFile().getParent(); String group = ac.getSelectedFile().getName(); setExperimentGroup(group); } } } /* * Generic action for context menu items. * Action name is passed as String. */ class UpdateAction extends AbstractAction { String actionName = null; public UpdateAction(String name) { super(name); this.actionName = name; } public UpdateAction(String name, String actionName) { super(name); this.actionName = actionName; } @Override public void actionPerformed(ActionEvent ev) { // Use AWT thread to perform some actions if (actionName.equals(STR_ACTION_UPDATE)) { update(); return; } if (actionName.equals(STR_ACTION_COPY_ALL)) { copyAll(); return; } // if (actionName.startsWith(STR_ACTION_SORTBY)) { for (int i = 0; i < tableColumns.length; i++) { if (actionName.contains(tableColumns[i])) { processesTable.getRowSorter().toggleSortOrder(i); return; } } // } } } private JPopupMenu initPopup(JTable table) { AccessibleContext ac; JMenuItem mi; JPopupMenu popup = new JPopupMenu(); String txt; boolean row_selected = false; int row = table.getSelectedRow(); if (row >= 0) { row_selected = true; } // Add "Update List of Processes" action txt = STR_ACTION_UPDATE; mi = new JMenuItem(new UpdateAction(txt)); mi.setMnemonic(AnLocale.getString('R', "MN_PROFILE_PROCESS_Refresh_MENU_ITEM")); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // String hotkey = "CTRL_R"; // KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK, // false); // table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, hotkey); // UpdateAction act = new UpdateAction(txt); // table.getActionMap().put(hotkey, act); // mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK)); mi.setEnabled(true); popup.add(mi); // Add "Set Metric" action txt = STR_ACTION_SORTBY; UpdateAction sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (tableColumns.length <= 1) { mi.setEnabled(false); popup.add(mi); } else { JMenu submenu1; submenu1 = new JMenu(txt); for (int i = 0; i < tableColumns.length; i++) { txt = tableColumns[i]; sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(STR_ACTION_SORTBY + ":" + txt); mi.setEnabled(true); submenu1.add(mi); } popup.add(submenu1); } // Add separator popup.addSeparator(); // Add menu item "Copy All" txt = STR_ACTION_COPY_ALL; UpdateAction cs = new UpdateAction(txt); mi = new JMenuItem(cs); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); return popup; } // ------- Private classes to implement popup menu items ------- // private class AnMenuListener extends MouseAdapter { private boolean debug; CollectPanel3 cp; JTable ptable; AnMenuListener(CollectPanel3 collectPanel, JTable table) { this.cp = collectPanel; this.ptable = table; debug = false; } // Experimental code, mostly "quick and dirty hack" public JPopupMenu initPopup(MouseEvent event) { return cp.initPopup(ptable); } /** Check for double click to performs default action */ @Override public void mouseClicked(final MouseEvent e) {} @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } // ================================= UNIT TESTING ===================================== // // For unit testing public static void main(final String[] args) { final int size; String str_args; if (args != null) { size = args.length; if (size > 0) { str_args = ""; for (int i = 1; i < size; i++) { if (i != 1) { str_args += " "; } str_args += args[i]; } } } CollectPanel3 cp = new CollectPanel3(null); cp.Test(cp); } public void Test(CollectPanel3 cp) { final JFrame mframe = new JFrame(); // CollectPanel2 cp = new CollectPanel2(); cp.jButton1.addActionListener(new ActionHandler()); // cp.jButton5.addActionListener(new ActionHandler()); // Preview JScrollPane work_pane = new JScrollPane(cp); work_pane.setMinimumSize(new Dimension(AnVariable.WIN_SIZE)); mframe.add(work_pane); processesTable.setColumnSelectionAllowed(false); processesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); processesTable.getSelectionModel().addListSelectionListener(new SelectionHandler()); jTextField1.setText("25457"); refreshPS(processesTable); updateSelection(); processesTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); // jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); processesTable.doLayout(); mframe.pack(); mframe.setVisible(true); } // Action handler private final class ActionHandler implements ActionListener { @Override public void actionPerformed(final ActionEvent event) { if (anWindow == null) { // TEST refreshPS(processesTable); } actionPerformed2(event); } } private static String[] ps = { "tester 25258 25257 14:46:37 0:00 /bin/bash", "tester 11582 893 Nov_20 0:00 /bin/sh /bin/firefox", "tester 4664 2140 Nov_28 0:00 vertool" }; static boolean resized = false; // Window handler private void refreshPS(JTable t) { int ps_index = 0; String filter = ""; if (null != jComboBox1.getSelectedItem()) { filter = jComboBox1.getSelectedItem().toString(); } for (int i = 0; i < t.getRowCount(); i++) { char space = ' '; String s1, s2, s3, s4, s5, s6; String s = ""; if ((i < ps.length) && (ps_index < ps.length)) { for (; ps_index < ps.length; ps_index++) { s1 = ps[ps_index]; if (filter.length() > 0) { // Apply filter if (s1.indexOf(filter) < 0) { continue; } } s = s1; ps_index++; break; } } if (s.length() <= 0) { t.setValueAt(s, i, 0); t.setValueAt(s, i, 1); t.setValueAt(s, i, 2); t.setValueAt(s, i, 3); t.setValueAt(s, i, 4); t.setValueAt(s, i, 5); continue; } int p1 = 0; int p2 = s.indexOf(space); // user name s1 = s.substring(p1, p2); t.setValueAt(s1, i, 0); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // PID s2 = s.substring(p1, p2); t.setValueAt(s2, i, 1); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // PPID s3 = s.substring(p1, p2); t.setValueAt(s3, i, 2); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // Start time s4 = s.substring(p1, p2); t.setValueAt(s4, i, 3); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.indexOf(space, p1); // CPU time s5 = s.substring(p1, p2); t.setValueAt(s5, i, 4); while (s.charAt(p2) == space) { p2++; } p1 = p2; p2 = s.length(); // Command s6 = s.substring(p1, p2); t.setValueAt(s6, i, 5); } if (!resized) { resized = true; // Resize jTable1 TableColumnModel tcm = t.getColumnModel(); TableColumn tc = tcm.getColumn(0); int w = tc.getWidth(); tc.setPreferredWidth((w * 2) / 3); tc.setWidth((w * 2) / 3); tc = tcm.getColumn(1); w = tc.getWidth(); tc.setPreferredWidth(w / 2); tc.setWidth(w / 2); tc = tcm.getColumn(2); w = tc.getWidth(); tc.setPreferredWidth(w / 2); tc.setWidth(w / 2); tc = tcm.getColumn(3); w = tc.getWidth(); tc.setPreferredWidth(w / 2); tc.setWidth(w / 2); tc = tcm.getColumn(4); w = tc.getWidth(); tc.setPreferredWidth(w / 2); tc.setWidth(w / 2); tc = tcm.getColumn(5); w = tc.getWidth(); tc.setPreferredWidth(w * 4); tc.setWidth(w * 4); } } } ��������������gprofng-gui-2.1/org/gprofng/mpmt/collect/Collector.java���������������������������������������������0000644�0001750�0001750�00000103144�15044710303�020145� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import static java.lang.Thread.sleep; import org.gprofng.mpmt.AnFile; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextArea; /** Wrapper class for standalone Collect Dialog. */ public class Collector { public static final int COLLECTING_RUNNING = 3; public static final int COLLECTING_PAUSED = 4; public static final int COLLECTING_TERMINATED = 5; public static final int COLLECTING_COMPLETED = 6; public static final int COLLECTING_NONE = 7; public static final int COLLECTING_TERMINATING = 8; // Collection types public static final int PROFILE_APPLICATION = 0; public static final int PROFILE_RUNNING_APPLICATION = 1; public static final int SYSTEM_PROFILING = 2; private String finaldir, curr_exp_name; private String experimentGroup; protected JPanel pioPanel; protected JTextArea pioTextArea; private AnWindow window; private ShellCommand shellCommand; private Collector collector; protected OutputStream logStream; protected BufferedWriter logStreamWriter; protected List<String> logVector; protected List<String> stderr_stdout; private int collectorState; protected List<ActionListener> collectingStatusListenersList; private long elapsedTime = 0; private int exitValue = -1; private long processID = -1; private String errorMessage = null; private final String eol = "\n"; private final String empty_string = ""; private int shortDelay = 10; // 10 milliseconds public long getElapsedTime() { return elapsedTime; } public long getProcessPID() { return processID; } public long setProcessPID(long p) { return processID = p; } public String getErrorMessage() { return errorMessage; } public void setErrorMessage(String m) { errorMessage = m; } public int getProcessExitValue() { return exitValue; } public void setActualExpName(String exp) { curr_exp_name = exp; } private int profiling_type = 0; // XXX Replace with a named const! /** * Constructor * * @param aWindow */ public Collector(final AnWindow aWindow) { this.window = aWindow; collector = this; collectorState = COLLECTING_NONE; collectingStatusListenersList = new ArrayList<>(); } /** Get Profiling Type */ public int getProfilingType() { return profiling_type; } /** Set Profiling Type */ public void setProfilingType(int profiling_type) { this.profiling_type = profiling_type; } public void addCollectingStatusListener(ActionListener al) { collectingStatusListenersList.add(al); } public void removeCollectingStatusListener(ActionListener al) { collectingStatusListenersList.remove(al); } private void fireCollectingStatusChanged(final int eventId) { // through all listeners for (Iterator<ActionListener> it = collectingStatusListenersList.iterator(); it.hasNext(); ) { it.next().actionPerformed(new ActionEvent(0, eventId, empty_string)); } } public int getCollectorState() { return collectorState; } private void setCollectorState(final int newSt) { collectorState = newSt; fireCollectingStatusChanged(collectorState); } public void setPioPanel(final JPanel aPioPanel) { this.pioPanel = aPioPanel; } public void setPioTextArea(final JTextArea aPioTextArea) { this.pioTextArea = aPioTextArea; } public void setLog(final OutputStream outLog) { logStream = outLog; logStreamWriter = new BufferedWriter(new OutputStreamWriter(logStream)); } public void setLog(final List<String> outLog) { logVector = outLog; } public boolean pause(int signum) { if (sendSignal(signum, AnLocale.getString("Pause"))) { setCollectorState(COLLECTING_PAUSED); return true; } else { return false; } } public boolean resume(final int signum) { if (sendSignal(signum, AnLocale.getString("Resume"))) { setCollectorState(COLLECTING_RUNNING); return true; } else { return false; } } public boolean sample(final int signum) { return sendSignal(signum, AnLocale.getString("Sample")); } public boolean terminate_expt(boolean SIGINT) { int signal = 9; // SIGKILL if (SIGINT) { signal = 2; // SIGINT } if (sendSignal(signal, null)) { setCollectorState(COLLECTING_TERMINATING); return true; } return false; } public boolean checkWorkDir(final String work_dir_str) { if (work_dir_str.length() > 0) { AnFile curDir = window.getAnFile(work_dir_str); // IPC call if (curDir.exists()) { if (curDir.isDirectory()) { return true; } } } return false; } // Invoke collect command public void collect( final String target, final String exec_cmd, final String work_str, final String exp_name, final String exp_dir, final String env_vars, final String collect_output_file, final String experimentGroup) { final Thread worker; this.experimentGroup = experimentGroup; setProcessPID(-1); // Not started yet if (null == window.getAnalyzer().remoteConnection) { // checkWorkDir does not support remote yet if (!checkWorkDir(work_str)) { String err = AnLocale.getString("Collector error: cannot access working directory:\n" + work_str); AnUtility.showMessage(window.getFrame(), err, JOptionPane.ERROR_MESSAGE); return; } // Check experiment directory String full_exp_dir = exp_dir; boolean check_full_exp_dir = false; if (full_exp_dir == null) { full_exp_dir = empty_string; } else { full_exp_dir += "/"; } if (exp_name != null) { full_exp_dir += exp_name; } if (full_exp_dir != null) { if (full_exp_dir.endsWith(".er")) { int len = full_exp_dir.length(); for (int i = 4; i < len; i++) { // Is it an autoadjusted name? int c = full_exp_dir.charAt(len - i); if (('0' <= c) && (c <= '9')) { continue; } if (c == '.') { if (i > 4) { break; // autoadjusted name: "*.[0-9].er" } } check_full_exp_dir = true; // not of form "*.[0-9].er" break; } } } if (check_full_exp_dir && checkWorkDir(full_exp_dir)) { String err = AnLocale.getString( "Collector error: experiment directory already exists:\n" + full_exp_dir); AnUtility.showMessage(window.getFrame(), err, JOptionPane.ERROR_MESSAGE); return; } } curr_exp_name = exp_name; worker = new Thread("Collector Process Thread") { @Override public void run() { boolean collect_failed = false; try { stderr_stdout = new ArrayList<>(); AnUtility.setLibPath(); String remoteConnection = window.getAnalyzer().remoteConnectCommand; String remoteShell = window.getAnalyzer().remoteShell; String remoteHost = window.getAnalyzer().remoteHost; String cmd = exec_cmd; String dir = work_str; // System.out.println("Collector: cmd = " + cmd); // DEBUG ShellCommand sc = new ShellCommand(); shellCommand = sc; sc.setRemoteConnection(remoteConnection, remoteShell, remoteHost); if (null == remoteConnection) { sc.run(cmd); } else { sc.runRemoteCmd(dir, cmd); } setCollectorState(COLLECTING_RUNNING); final String STDIN_WRITER = "Collector Stdin Writer"; final String STDOUT_READER = "Collector Stdout Reader"; final String STDERR_READER = "Collector Stderr Reader"; // Create StreamThread STDIN_WRITER StreamThread tr0 = new StreamThread(); tr0.setName(STDIN_WRITER); tr0.setTask(tr0.WRITE_STDIN, sc); tr0.start(); // Create StreamThread STDOUT_READER StreamThread tr1 = new StreamThread(); tr1.setName(STDOUT_READER); tr1.setTask(tr1.READ_STDOUT, sc); if (logVector == null) { stderr_stdout = new ArrayList<>(); } else { stderr_stdout = logVector; } tr1.setOut(stderr_stdout); tr1.start(); // Create StreamThread STDERR_READER StreamThread tr2 = new StreamThread(); tr2.setName(STDERR_READER); tr2.setTask(tr2.READ_STDERR, sc); // NM1 Vector stderr = new Vector(); tr2.setOut(stderr_stdout); tr2.start(); // Remote connection if (null != remoteConnection) { // ConnectionChooser cc = window.connect; // if (null == cc) { // System.err.println("Collector: ERROR: remote connection is not established // yet"); // } else { // cc.setVisible(true, window.getWindowID()); Analyzer parent_analyzer = Analyzer.getInstance(); try { parent_analyzer.startRemoteCollect(collector, null /*cc*/); } catch (Exception e) { sc.interrupt(); } // cc.setVisible(false, window.getWindowID()); // } } // Read standard output long time = System.currentTimeMillis(); if (logVector == null) { String line; // NM1 boolean shouldWait = false; while ((sc.isRunning() == true) || (stderr_stdout.size() > 0)) { // copy output to the log file try { // NM1 line = sc.readOutput(shouldWait); // NM1 if ((null != line) && (line.length() > 0)) { // NM1 writeln(line); // NM1 } else { // copy stderr_stdout to the log file while (stderr_stdout.size() > 0) { // NM1 line = stderr_stdout.get(0).toString(); stderr_stdout.remove(0); writeln(line); } // NM1 } } catch (Exception e) { // reply="# Exception: " + e; // Ignore exception } } // NM1 shouldWait = true; } elapsedTime = System.currentTimeMillis() - time; exitValue = sc.exitValue(); setCollectorState(COLLECTING_COMPLETED); removeTempFile(collect_output_file); } catch (/*IO*/ Exception e) { collect_failed = true; // e.printStackTrace(); // printException(e, AnLocale.getString("Collector.collect: I/O exception 2")); // System.err.println("Collector.collect: command failed: " + exec_cmd); } if (collect_failed) { // Try to get error message ShellCommand sc = shellCommand; String err = AnLocale.getString("Collector command:\n\n" + exec_cmd + "\n\n"); writeln(err); boolean closed = false; String prev_line = null; while (!closed) { try { boolean shouldWait = true; // false; String line = sc.readError(shouldWait); if (null == line) { break; } if (line.length() > 0) { writeln(line); if (line.equals(prev_line)) { continue; // Sometimes identical line appear several times } else { prev_line = line; } if (line.contains("Run collect with no arguments for a usage message")) { continue; // Not useful a part of the error message } err += line + eol; } } catch (Exception e) { closed = true; break; } } setErrorMessage(err); // AnUtility.showMessage(window.getFrame(), err, JOptionPane.ERROR_MESSAGE); } shellCommand = null; } }; worker.start(); } /** * Read Collect Output File * * @param collect_output_file */ protected void read_collect_output_file(String collect_output_file) { if (null == collect_output_file) { return; } try { File f = new File(collect_output_file); if (f == null) { return; } if (f.exists()) { // open file, read, try to find process ID String line; BufferedReader br = new BufferedReader(new FileReader(f)); while ((line = br.readLine()) != null) { String pattern1 = "Creating experiment directory "; int idx = line.indexOf(pattern1); if (idx >= 0) { String substr = line.substring(idx + pattern1.length()); idx = substr.indexOf(" "); if (idx > 1) { String expname = substr.substring(0, idx); // test.*.er setActualExpName(expname); } String pattern2 = "(Process ID: "; int n = line.indexOf(pattern2); if (n >= 0) { n += pattern2.length(); long p = 0; int d = 0; while ((d >= 0) && (d <= 9)) { p = p * 10 + d; d = line.charAt(n) - '0'; n++; } if (p > 0) { setProcessPID(p); return; } } } String pattern3 = "Target `"; if (line.startsWith(pattern3)) { String pattern31 = "' not found"; int n = line.indexOf(pattern31); if (n > 0) { setProcessPID((long) -2); setErrorMessage(line); return; } } String pattern4 = "Unable to create directory "; if (line.startsWith(pattern4)) { String pattern41 = " -- File exists"; int n = line.indexOf(pattern41); if (n > 0) { setProcessPID((long) -4); setErrorMessage(line); return; } } String pattern5 = "The HW counter configuration could not be loaded:"; if (line.startsWith(pattern5)) { setProcessPID((long) -3); setErrorMessage(line); return; } } // sleep(shortDelay); // sleep 10 milliseconds } } catch (/*IO*/ Exception e) { // e.printStackTrace(); printException(e, AnLocale.getString("Collector.collect: I/O exception 4")); System.err.println("Collector.collect: cannot read file " + collect_output_file); } } /** * Remove Temporary File * * @param temp_file_name */ protected void removeTempFile(final String temp_file_name) { if (temp_file_name != null) { try { // Remove temporary file File f = new File(temp_file_name); if (f.exists()) { f.delete(); } } catch (/*IO*/ Exception e) { // Ignore it } } } // Output protected void write(final String line) { try { logStreamWriter.write(line); logStreamWriter.flush(); // ?? logStream.flush(); } catch (IOException e) { // don't print "Read end dead" message printException(e, AnLocale.getString("Collector.write: I/O exception 5")); } } // Output with new line protected void writeln(final String line) { write(line + eol); } // Handle pause/resume signal private boolean sendSignal(final int signal, final String cmd) { if (processID < 2) { // Process lost String err = AnLocale.getString( "Error: cannot send signal. Process ID is not correct (" + processID + ")."); AnUtility.showMessage(window.getFrame(), err, JOptionPane.ERROR_MESSAGE); return false; } String result = sendSignal(processID, signal); if (null == result) { return true; } else { return false; } /* ShellCommand sc = new ShellCommand(); sc.setRemoteConnection(window.getAnalyzer().remoteConnection); String exe_cmd = "kill -" + signal + " " + processID; try { sc.run(exe_cmd); } catch (Exception e) { return false; } return true; */ } /** * Gets Current Process Output * * @return String output */ public String getCurrentOutput() { String output = empty_string; if (shellCommand != null) { output = shellCommand.output; } return output; } /** * Write one character to process input and flush * * @param s */ public void writeInputChar(char c) throws Exception { shellCommand.writeInputChar(c); } public boolean isProcRunning() { // terminate button is enabled return (getCollectorState() == COLLECTING_RUNNING); } private static void printException(final Exception e, final String annot_msg) { if (annot_msg != null) { System.err.println(annot_msg + ": " + e.getMessage()); } else { System.err.println(e.getMessage()); } } public String getActualExpName() { final String slash = "/"; if (curr_exp_name.startsWith(slash) || (null == finaldir)) { return curr_exp_name; } return (finaldir + slash + curr_exp_name); } public String getNextExpName() { return Collector.getExpName1(finaldir); } public String getExperimentGroup() { return experimentGroup; } /*------------------------------------- INNER CLASSES ----------------------------------------------------*/ /** * Class ShellCommand executes an external program and supports input/output functions * * <p>Main functions: run a program write to stdin read from stdout read from stderr return exit * status */ class ShellCommand { private BufferedReader processOutput; private BufferedReader processError; private PrintStream processInput; private Runtime rt; protected boolean interrupted; protected Process thisProcess; protected String shArgs; protected String errors; protected String output; protected String remoteConnection; protected String remoteShell; protected String remoteHost; // NM protected static ByteArrayOutputStream lastOutput; /** Creates a new instance of ShellCommand */ public ShellCommand() { processOutput = null; processError = null; thisProcess = null; rt = Runtime.getRuntime(); interrupted = false; remoteConnection = null; shArgs = null; errors = empty_string; output = empty_string; } /** * Set the remote connection * * @param args - connection */ public void setRemoteConnection(String rc, String rs, String rh) { remoteConnection = rc; remoteShell = rs; remoteHost = rh; } /** * Set the arguments * * @param args - arguments */ public void setShellArgs(String args) { shArgs = new String(args); } /** Interrupt and destroy the process */ public void interrupt() { interrupted = true; thisProcess.destroy(); thisProcess = null; } /** Return exit status */ public int exitValue() { if (interrupted) { return (-1); } try { thisProcess.waitFor(); } catch (Exception e) { return (-2); } return (thisProcess.exitValue()); } /** Check if the process is running */ public boolean isRunning() { try { int ev = thisProcess.exitValue(); } catch (IllegalThreadStateException ie) { return (true); } catch (Exception ie) { return (false); } return (false); } /** * Read from a stream * * @param reader - a stream */ private String readStream(BufferedReader reader) throws Exception { String ret = null; try { if (!reader.ready()) { int ev = thisProcess.exitValue(); ret = reader.readLine(); if (ret != null) { ret += eol; } return (ret); } ret = reader.readLine(); if (ret != null) { ret += eol; } } catch (IllegalThreadStateException ie) { return (empty_string); } return (ret); } /** * Gets Current Process Output * * @return String output */ public String getCurrentOutput() { return output; } /** * Read from standard output stream * * @param shouldWait - a flag (if true, wait while read is done) */ public String readOutput(boolean shouldWait) throws Exception { String ret; if (shouldWait) { ret = processOutput.readLine(); } else { ret = readStream(processOutput); } if (ret != null) { output += ret; } return (ret); } /** * Read from standard error stream * * @param shouldWait - a flag (if true, wait while read is done) */ public String readError(boolean shouldWait) throws Exception { String ret; if (shouldWait) { ret = processError.readLine(); } else { ret = readStream(processError); } return (ret); } /** * Write to standard input stream * * @param str - a message */ public void writeInput(String str) throws Exception { processInput.print(str); processInput.flush(); } /** * Write one character to standard input stream * * @param c - a character */ public void writeInputChar(char c) throws Exception { processInput.print(c); processInput.flush(); } /** * Run a program * * @param dirname - working directory * @param cmnd - command line */ public void run(String dirname, String cmnd) throws Exception { if (null != dirname) { cmnd = "cd " + dirname + " && " + cmnd; } run(cmnd); } /** * Run a program * * @param cmnd - command line */ public void run(String cmnd) throws Exception { String[] ss = new String[3]; ss[0] = "sh"; // NM ss[0] = "/bin/sh"; ss[1] = "-e"; ss[2] = cmnd; interrupted = false; try { // System.err.println("DEBUG:run rt.exec(): " + ss[0] + " " + ss[1] + " " + ss[2]); // DEBUG // (perf test) thisProcess = rt.exec(ss); InputStream os = thisProcess.getInputStream(); InputStream os_err = thisProcess.getErrorStream(); OutputStream is = thisProcess.getOutputStream(); processOutput = new BufferedReader(new InputStreamReader(os)); processError = new BufferedReader(new InputStreamReader(os_err)); processInput = new PrintStream(is, true); } catch (Exception ee) { String msg = "Command \"" + cmnd + "\" failed:\n" + ee.toString(); throw new Exception(msg); } } /** * Run a program * * @param cmnd - command line */ public void runRemoteCmd(String dir, String cmnd) throws Exception { String ss = remoteConnection + " sh -ec \"("; if (dir != null) { ss += "cd " + dir + " && "; } ss += cmnd + ")\""; interrupted = false; try { thisProcess = rt.exec(ss); InputStream os = thisProcess.getInputStream(); InputStream os_err = thisProcess.getErrorStream(); OutputStream is = thisProcess.getOutputStream(); processOutput = new BufferedReader(new InputStreamReader(os)); processError = new BufferedReader(new InputStreamReader(os_err)); processInput = new PrintStream(is, true); } catch (Exception ee) { String msg = "Command \"" + ss + "\" failed:\n" + ee.toString(); throw new Exception(msg); } } } /* End of class ShellCommand */ class StreamThread extends Thread { private ShellCommand sc = null; /* Tasks */ public final int WRITE_STDIN = 0; public final int READ_STDOUT = 1; public final int READ_STDERR = 2; public final int NO_TASK = -1; private int task = NO_TASK; /* Connection */ public final int DISCONNECTED = 0; public final int CONNECTED = 1; private int connect = DISCONNECTED; private long total_time = 0; private boolean tosleep = true; private boolean todie = false; private int shortDelay = 10; // 10 milliseconds private int mediumDelay = 100; // 100 milliseconds private int longDelay = 1000; // 1000 milliseconds (1 second) /** Creates a new instance of StreamThread */ public StreamThread() { long t = System.currentTimeMillis(); } public int setTask(final int TASK, ShellCommand sc) { task = TASK; // Q: check TASK ? this.sc = sc; return (task); } public int checkConnection() { return (connect); } public String writeInput(String request) { if (request == null) { return null; // Nothing to send } String reply = null; request = request + eol; logMessage(request); try { // log.severe("sc.writeInput("+request+");"); // FIXUP (remove) sc.writeInput(request); } catch (Exception e) { reply = "# Exception: " + e; // FIXUP (i18n) reportEvent(reply); } return (reply); } public int readOutput(boolean shouldWait) { String output; int len = 0; try { output = sc.readOutput(shouldWait); len = output.length(); if (len > 0) { reportEvent(output); } } catch (Exception e) { // reply="# Exception: " + e; // Ignore exception } return len; } public int readError(boolean shouldWait) { String output; int len = 0; try { output = sc.readError(shouldWait); len = output.length(); if (len > 0) { reportEvent(output); } } catch (Exception e) { // reply="# Exception: " + e; // Ignore exception } return len; } @Override public void run() { // String output; boolean shouldWait = false; /* Variables for time in milliseconds */ // long time0, time1, time2; // DEBUG (Performance test) // time0 = System.currentTimeMillis(); // time1 = time0; // time2 = time0; while (true) { if (sc != null) { if ( /*sc.isRunning()*/ task != NO_TASK) { connect = 1; if (task == WRITE_STDIN) { // NM writeInput(parent.getCommandToSend()); } int len = 0; if (task == READ_STDOUT) { len = readOutput(shouldWait); } if (task == READ_STDERR) { len = readError(shouldWait); } try { if (len <= 0) { // empty line if (!sc.isRunning()) { break; } } if ((len <= 0) // empty line || (task == WRITE_STDIN)) { // DEBUG (Windows) sleep(shortDelay); // a short delay } } catch (InterruptedException tie50) { // sleep 50 milliseconds } continue; // } else { // break; // stop task } // shouldWait = true; if (task == READ_STDOUT) { /* Try to read last messages */ readOutput(shouldWait); } if (task == READ_STDERR) { /* Try to read last messages */ readError(shouldWait); } } break; } // NM parent.reportProcessExited(); // time2 = System.currentTimeMillis(); // total_time = ((time2-time0)/1000); } private List<String> out = null; // NM1 new Vector(); // private Boolean out_sync = true; // NM1 public void setOut(List<String> out) { this.out = out; } private void reportEvent(String message) { // NM parent.reportEvent(message); if (null != out) { // NM1 // synchronized (out_sync) { // NM1 out.add(message); // } } } private void logMessage(String message) { // NM parent.logMessage(message); } } /* End of StreamThread */ /** * Sends signal to the process specified by process id * * @param pid Process ID * @param sig Signal number * @return result */ public static final String sendSignal(long pid, int sig) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("sendSignal"); anWindow.IPC().send(pid); anWindow.IPC().send(sig); return anWindow.IPC().recvString(); } } /** * Get experimentsDisp name specified by directory name * * @param dir_name * @return result */ public static String getExpName1(final String dir_name) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getExpName1"); anWindow.IPC().send(dir_name); return anWindow.IPC().recvString(); } } /** * A generic method to get Available Collector Options. * * @param collectorOptions - array of arrays of Strings * @return availableCollectorOptions - array of arrays of Strings */ public static Object[] getAvailableCollectorOptions(final Object[] collectorOptions) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getAvailableCollectorOptions"); anWindow.IPC().send(0); anWindow.IPC().send(collectorOptions); return (Object[]) anWindow.IPC().recvObject(); } } /** * A method to get list of running processes. * * @param format - format of output, e.g. "/bin/ps -ef" * @return String - list of processes */ public static String getRunningProcesses(final String format) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getRunningProcesses"); anWindow.IPC().send(format); return anWindow.IPC().recvString(); } } /** * A method to get OS family. * * @return String - OS family, e.g. "Solaris" or "Linux" */ public static String getOSFamily() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getOSFamily"); return anWindow.IPC().recvString(); } } /** * A generic method to get Collector control value. * * @param control - String * @return value - String */ public static String getCollectorControlValue(final String control) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getCollectorControlValue"); anWindow.IPC().send(0); anWindow.IPC().send(control); return anWindow.IPC().recvString(); } } /** * A generic method to set Collector control value. * * @param control - String * @param value - String * @return result - String */ public static String setCollectorControlValue(final String control, final String value) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); anWindow.IPC().send("setCollectorControlValue"); anWindow.IPC().send(0); anWindow.IPC().send(control); anWindow.IPC().send(value); String s = anWindow.IPC().recvString(); AnUtility.checkIPCOnWrongThread(true); return s; } } /** * A generic method to unset Collector control value (restore the default value). * * @param control - String * @return result - String */ public static String unsetCollectorControlValue(final String control) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); anWindow.IPC().send("unsetCollectorControlValue"); anWindow.IPC().send(0); anWindow.IPC().send(control); String s = anWindow.IPC().recvString(); AnUtility.checkIPCOnWrongThread(true); return s; } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectUtility.java����������������������������������������0000644�0001750�0001750�00000040161�14744453367�021213� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.analyzer.AnEnvironment; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Insets; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.accessibility.AccessibleContext; import javax.swing.BoundedRangeModel; import javax.swing.BoxLayout; import javax.swing.ComboBoxEditor; import javax.swing.DefaultListCellRenderer; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; public final class CollectUtility { private static final int TEXT_LEFT = 1; // public final static int TEXT_CENTER = 2; public static final int TEXT_RIGHT = 3; public static final Font text_font; public static final Color text_color; private static final Color LABEL_COLOR = Color.black; private static final int sizeLabel = 4; private static final Border labelBorder = new EmptyBorder(0, sizeLabel, 0, sizeLabel); public static final Insets buttonMargin = new Insets(1, 1, 1, 1); static { Font org_font = UIManager.getDefaults().getFont("TextField.font"); text_font = new Font("Monospaced", org_font.getStyle(), org_font.getSize()); if (AnEnvironment.isLFNimbus()) { text_color = AnEnvironment.NIMBUS_TEXT_BACKGROUND; } else { text_color = new Color(UIManager.getDefaults().getColor("TextArea.background").getRGB()); } } protected static final class CLabel extends JLabel { public CLabel(final String text, final int alignment) { super(text, alignment); final float falignment; if (alignment == RIGHT) { falignment = RIGHT_ALIGNMENT; } else if (alignment == LEFT) { falignment = LEFT_ALIGNMENT; } else { falignment = CENTER_ALIGNMENT; } setAlignmentX(falignment); setForeground(LABEL_COLOR); setBorder(labelBorder); } } protected static final class CList extends JPanel { private final boolean resizable; private final JPanel label, value; // Constructor public CList(final boolean resizable) { this.resizable = resizable; label = new JPanel(); label.setLayout(new BoxLayout(label, BoxLayout.Y_AXIS)); value = new JPanel(); value.setLayout(new BoxLayout(value, BoxLayout.Y_AXIS)); if (resizable) { setLayout(new BorderLayout()); add(label, BorderLayout.WEST); add(value, BorderLayout.CENTER); } else { add(label); add(value); } } // Add label public JComponent addLabel(final JComponent item) { return (JComponent) label.add((item != null) ? item : new JPanel()); } // Add value public JComponent addValue(final JComponent item) { return (JComponent) value.add((item != null) ? item : new JPanel()); } // Add label and value public void add(final JComponent litem, final JComponent vitem) { setAlignmentY(addLabel(litem), addValue(vitem)); } // Align labels and values vertically public void setAlignmentY(final JComponent litem, final JComponent vitem) { final Dimension lsize, vsize; Dimension msize; lsize = new Dimension(litem.getPreferredSize()); vsize = new Dimension(vitem.getPreferredSize()); if (lsize.height < vsize.height) { lsize.height = vsize.height; } else { vsize.height = lsize.height; } // Set labels size if (resizable) { msize = litem.getMaximumSize(); msize.height = lsize.height; litem.setMaximumSize(msize); } else { litem.setMaximumSize(new Dimension(lsize)); } litem.setMinimumSize(new Dimension(lsize)); litem.setPreferredSize(new Dimension(lsize)); // Set values size if (resizable) { msize = vitem.getMaximumSize(); msize.height = vsize.height; vitem.setMaximumSize(msize); } else { vitem.setMaximumSize(new Dimension(vsize)); } vitem.setMinimumSize(new Dimension(vsize)); vitem.setPreferredSize(new Dimension(vsize)); } // Align Labels and Values vertically public void setAlignmentY() { final Component[] labels = label.getComponents(); final Component[] values = value.getComponents(); final int size = Math.min(labels.length, values.length); for (int i = 0; i < size; i++) { setAlignmentY((JComponent) labels[i], (JComponent) values[i]); } } // Align items horizontally public void setAlignmentX(final Component[] items) { final int size; int width, max_width; Dimension psize; size = items.length; max_width = 0; for (int i = 0; i < size; i++) { width = items[i].getPreferredSize().width; if (max_width < width) { max_width = width; } } for (int i = 0; i < size; i++) { psize = items[i].getPreferredSize(); psize.width = max_width; ((JComponent) items[i]).setPreferredSize(psize); } } // Align the Values only horizontally, usually the Labels does not need // further alignment public void setAlignmentX() { setAlignmentX(value.getComponents()); } // Clean up @Override public void removeAll() { label.removeAll(); value.removeAll(); } } // General textfield protected static class CText extends JTextField { int text_align; public CText(final String text, final int columns, final int alignment) { super(text, columns); text_align = TEXT_LEFT; setFont(text_font); setBackground(text_color); setEditable(false); setHorizontalAlignment(alignment); setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); setCaret( new javax.swing.text.DefaultCaret() { public void focusGained(final FocusEvent event) { if (getComponent().isEnabled()) { setVisible(true); } setSelectionVisible(true); // Don't use selectAll which will move Caret to the end. if (text_align == TEXT_LEFT) { setDot(getDocument().getLength()); moveDot(0); } else { // Same code as selectAll setDot(0); moveDot(getDocument().getLength()); } } public void focusLost(final FocusEvent event) { super.focusLost(event); setDot(text_align == TEXT_LEFT ? 0 : getDocument().getLength()); } }); } public final void setVisibleAlign(final int text_align, final boolean delay) { final BoundedRangeModel visibility; this.text_align = text_align; if (delay) { setCaretPosition(text_align == TEXT_LEFT ? 0 : getDocument().getLength()); } else { // Don't use setCaretPosition which caused flash visibility = getHorizontalVisibility(); visibility.setValue( text_align == TEXT_LEFT ? visibility.getMinimum() : visibility.getMaximum()); } } } protected static class AnComboBox extends JComboBox implements ActionListener { public static final int COMBO_TEXT = 0; public static final int COMBO_ITEM = 1; private AnComboBox.ComboObj current_obj; private final int width; public AnComboBox(final int width) { current_obj = null; this.width = width; setRenderer(new AnComboBox.AnComboRenderer()); setEditor(new AnComboBox.AnComboEditor()); setEditable(true); // setBorder(new EtchedBorder(EtchedBorder.LOWERED)); setBorder(new LineBorder(new Color(150, 150, 150), 1)); // setBorder(null); } public AnComboBox() { this(14); // default width } // Add item public final void add( final int type, final String header, final String str, final boolean changable) { addItem(new AnComboBox.ComboObj(type, false, header, str, changable)); } public final void setText(final String str) { final AnComboBox.ComboObj obj = (AnComboBox.ComboObj) getEditor().getEditorComponent(); if (obj.getType() == COMBO_TEXT) { obj.setText(str); if (current_obj.changable) { current_obj.setText(str); } } } // Get result public final String getText() { final AnComboBox.ComboObj obj = (AnComboBox.ComboObj) getEditor().getEditorComponent(); if (obj.getType() == COMBO_ITEM) { return null; } return obj.getText(); } // Get header text public final String getHeader() { final AnComboBox.ComboObj obj = (AnComboBox.ComboObj) getEditor().getEditorComponent(); return obj.getHeader(); } // Get editor's editable textfield public final Component getEditorText() { return ((AnComboBox.ComboObj) getEditor().getEditorComponent()).getTextField(); } // Get location of the Editor's textfield public final Point getEditorLocation() { return ((AnComboBox.AnComboEditor) getEditor()).getTextLocation(); } // Enter in the textfield public final void actionPerformed(final ActionEvent event) { final Object src = event.getSource(); if (src instanceof JTextField) { current_obj.setText(((JTextField) src).getText()); } } // Internal data object private final class ComboObj extends JPanel { private final boolean editor, changable; private int type; private String header; private final JLabel label; private final JTextField text; public ComboObj( final int type, final boolean editor, final String header, final String str, final boolean changable) { final BoxLayout layout; this.editor = editor; this.type = type; this.header = header; this.changable = changable; setLayout(layout = new BoxLayout(this, BoxLayout.X_AXIS)); setBorder(new EmptyBorder(0, 1, 0, 0)); label = new CLabel(header, JLabel.LEFT); label.setFont(label.getFont().deriveFont(Font.PLAIN)); final AccessibleContext context = label.getAccessibleContext(); context.setAccessibleName(header); context.setAccessibleDescription(header); text = new JTextField((type == COMBO_TEXT) ? width : 0); text.setFont(text_font); text.setBorder(null); this.add(label); this.add(text); setText(str); layout.layoutContainer(this); } public final int getType() { return type; } public final void setType(final int type) { this.type = type; } public final String getHeader() { return header; } public final void setHeader(final String header) { this.header = header; label.setText(header); } public final String getText() { return text.getText(); } public final void setText(final String str) { text.setText(str); text.setEditable(editor && (type == COMBO_TEXT)); } public final JTextField getTextField() { return text; } public final void selectAll() { text.selectAll(); text.requestFocus(); } public void addActionListener(final ActionListener l) { text.addActionListener(l); } public final void removeActionListener(final ActionListener l) { text.removeActionListener(l); } // Set background @Override public final void setBackground(final Color bg) { super.setBackground(bg); if (text != null) { text.setBackground(bg); } if (label != null) { label.setBackground(bg); } } // Set foreground @Override public final void setForeground(final Color fg) { super.setForeground(fg); if (text != null) { text.setForeground(fg); } if (label != null) { label.setForeground(fg); } } } // Renderer for AnCombo private final class AnComboRenderer extends DefaultListCellRenderer { @Override public final Component getListCellRendererComponent( final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final AnComboBox.ComboObj obj = (AnComboBox.ComboObj) value; if (isSelected) { obj.setBackground(list.getSelectionBackground()); obj.setForeground(list.getSelectionForeground()); } else { obj.setBackground(list.getBackground()); obj.setForeground(list.getForeground()); } return obj; } } // Editor for AnCombo private final class AnComboEditor implements ComboBoxEditor, FocusListener { private final AnComboBox.ComboObj editor; private final JTextField text; public AnComboEditor() { editor = new AnComboBox.ComboObj(COMBO_TEXT, true, "", "", true); editor.setBorder(null); text = editor.getTextField(); text.addFocusListener(this); } // Return the component @Override public Component getEditorComponent() { return editor; } // Set the item that should be edited. @Override public void setItem(final Object anObject) { final AnComboBox.ComboObj obj = (AnComboBox.ComboObj) anObject; final int type; if (obj != null) { current_obj = obj; type = obj.getType(); if (type == COMBO_TEXT) { text.requestFocus(); } editor.setType(type); editor.setHeader(obj.getHeader()); editor.setText(obj.getText()); } } // Return the edited item @Override public Object getItem() { return editor; } // Get location of the textfield public Point getTextLocation() { return text.getLocationOnScreen(); } // Ask the editor to start editing and to select everything @Override public void selectAll() { editor.selectAll(); } // Add an ActionListener. An action event is generated when the edited // item changes @Override public void addActionListener(final ActionListener l) { editor.addActionListener(l); } // Remove an ActionListener @Override public void removeActionListener(final ActionListener l) { editor.removeActionListener(l); } // Lost focus @Override public void focusLost(final FocusEvent event) { if (event.isTemporary()) { return; } if (current_obj.changable) { current_obj.setText(text.getText()); } else { text.setText(current_obj.getText()); } } // Gain focus @Override public void focusGained(final FocusEvent event) {} } } protected interface Browseable { public void setValue(String path); public String getValue(); } protected static JComponent getItem(final String text) { return new CLabel(text, JLabel.RIGHT); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/CollectPanel3.form�����������������������������������������0000644�0001750�0001750�00000051724�14744453367�020723� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.6" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,108,0,0,5,-53"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="jPanel2"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="10" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="jLabel2"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="processesTable"/> </Property> <Property name="text" type="java.lang.String" value="Select the Process to profile"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox1"/> </Property> <Property name="text" type="java.lang.String" value="Filter:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox1"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value=" "/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="jButton1"> <Properties> <Property name="text" type="java.lang.String" value="Refresh"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="jScrollPane2"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="4" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTable" name="processesTable"> <Properties> <Property name="autoCreateRowSorter" type="boolean" value="true"/> <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> <Table columnCount="6" rowCount="24"> <Column editable="false" title="User Name" type="java.lang.String"/> <Column editable="false" title="PID" type="java.lang.String"/> <Column editable="false" title="PPID" type="java.lang.String"/> <Column editable="false" title="Start Time" type="java.lang.String"/> <Column editable="false" title="CPU time" type="java.lang.String"/> <Column editable="false" title="Command" type="java.lang.String"/> </Table> </Property> <Property name="toolTipText" type="java.lang.String" value="Select the process to profile"/> <Property name="autoResizeMode" type="int" value="4"/> <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor"> <TableColumnModel selectionModel="1"> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> <Title/> <Editor/> <Renderer/> </Column> </TableColumnModel> </Property> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[32768, 32768]"/> </Property> <Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor"> <JTableSelectionModel selectionMode="0"/> </Property> <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> <TableHeader reorderingAllowed="true" resizingAllowed="true"/> </Property> </Properties> </Component> </SubComponents> </Container> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanel3"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="12" insetsRight="12" anchor="15" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JTextField" name="jTextField1"> <Properties> <Property name="columns" type="int" value="20"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel3"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jTextField1"/> </Property> <Property name="text" type="java.lang.String" value="Target PID:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox2"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value="ktest.1.er"/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="4" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel4"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox2"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox3"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value=" "/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel5"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox3"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Directory:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="jComboBox4"> <Properties> <Property name="editable" type="boolean" value="true"/> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <StringArray count="1"> <StringItem index="0" value=" "/> </StringArray> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="3" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel6"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jComboBox4"/> </Property> <Property name="text" type="java.lang.String" value="Experiment Group:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="jTextField2"> <Properties> <Property name="editable" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="0" gridWidth="4" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="jLabel7"> <Properties> <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="jTextField2"/> </Property> <Property name="text" type="java.lang.String" value="Target Name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="jButton2"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="5" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="jButton6"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="5" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="13" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> </SubComponents> </Form> ��������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/HWCEntry.java����������������������������������������������0000644�0001750�0001750�00000015615�15044710303�017667� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.collect; import org.gprofng.mpmt.AnLocale; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; public class HWCEntry { private int no; // Just an entry counter private final boolean set; // Is a set ('default', ...) private final String i18n; // some printable string, does not include short_desc text private final String name; // alias name, or raw hwc name private final String intName; // hwc specification private final String metric; // very short description for std ctrs (aliases) private final long val; // default overflow rate private final int timecvt; // 0:not cycles. !=0:cycles that can be converted to time private final int memop; // hwcentry.h enum describing capabilities (like memspace) private final String shortDesc; // one-liner describing counter (or null) private final int[] regList; // which registers support this counter private final boolean supportsAttrs; // supports attributes private final boolean supportsMemspace; // supports memoryspace profiling private final boolean recommended; // Recommended (std) counter private String collectorString; HWCEntry( boolean set, String i18n, String name, String intName, String metric, long val, int timecvt, int memop, String shortDesc, int[] regList, boolean supportsAttrs, boolean supportsMemspace, boolean recommended) { this.set = set; this.i18n = i18n; this.name = name; this.intName = intName; this.metric = metric; this.val = val; this.timecvt = timecvt; this.memop = memop; this.shortDesc = shortDesc; this.regList = regList; this.supportsAttrs = supportsAttrs; this.supportsMemspace = supportsMemspace; this.recommended = recommended; collectorString = null; } public HWCEntry copy() { int[] regListDeepCopy = null; if (regList != null) { regListDeepCopy = new int[regList.length]; for (int i = 0; i < regList.length; i++) { regListDeepCopy[i] = regList[i]; } } HWCEntry copy = new HWCEntry( set, i18n, name, intName, metric, val, timecvt, memop, shortDesc, regListDeepCopy, supportsAttrs, supportsMemspace, recommended); copy.setNo(no); copy.setCollectorString(collectorString); return copy; } public String getI18n() { return i18n; } public String getName() { return name; } public String getIntName() { return intName; } public String getMetric() { return metric; } public long getVal() { return val; } public int getTimecvt() { return timecvt; } public int getMemop() { return memop; } public String getShortDesc() { return shortDesc; } public int[] getRegList() { return regList; } public boolean supportsAttrs() { return supportsAttrs; } public boolean supportsMemspace(Map<String, HWCEntry> hwcNameMap) { if (!isSet() || hwcNameMap == null) { return supportsMemspace; } else { boolean supportsMemspace = false; List<String> setNames = getSetNames(); for (String name : setNames) { HWCEntry entry = hwcNameMap.get(name); if (entry != null) { if (entry.supportsMemspace(hwcNameMap)) { supportsMemspace = true; break; } } } return supportsMemspace; } } public boolean isRecommended() { return recommended; } public boolean supportsTime(Map<String, HWCEntry> hwcNameMap) { if (!isSet() || hwcNameMap == null) { return timecvt != 0; } else { boolean supportsTime = false; List<String> setNames = getSetNames(); for (String name : setNames) { HWCEntry entry = hwcNameMap.get(name); if (entry != null) { if (entry.supportsTime(hwcNameMap)) { supportsTime = true; break; } } } return supportsTime; } } public boolean isRaw() { return !isRecommended(); } public int getNo() { return no; } public void setNo(int no) { this.no = no; } public boolean isSet() { return set; } public List<String> getSetNames() { List<String> list = new ArrayList<>(); if (isSet()) { // Parse String[] names = getIntName().split(",,"); int index = 0; for (String name : names) { if (name.startsWith("+")) { names[index] = name.substring(1); } index++; } list = Arrays.asList(names); } return list; } @Override public String toString() { return getI18n() + " [" + getCollectorString() + "]"; } /** * @return the string (including attributes, ...) used by collector */ public String getCollectorString() { if (collectorString != null) { return collectorString; } else { return name; } } public void setCollectorString(String collectorString) { this.collectorString = collectorString; } public String getMetricText() { if (isSet()) { return AnLocale.getString("Default Set"); } if (isRecommended()) { return getI18n(); } if (isRaw()) { return getI18n(); } return "???"; } public String getCounterText() { if (isSet()) { return getIntName(); } if (isRecommended()) { String format = "%s [%s]"; return String.format(format, getName(), getIntName()); } if (isRaw()) { return getName(); } return "???"; } public String getDescriptionText(Map<String, HWCEntry> hwcNameMap) { if (isSet()) { return AnLocale.getString("Default set of counters"); } if (isRecommended()) { if (getShortDesc() != null) { return getShortDesc(); } else { HWCEntry mappedEntry = hwcNameMap.get(getIntName()); if (mappedEntry != null && mappedEntry.getShortDesc() != null) { return mappedEntry.getShortDesc(); } else { return getI18n(); } } } if (isRaw()) { return getShortDesc() != null ? getShortDesc() : ""; } return "???"; } } �������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/collect/HWCSelectPanel.form����������������������������������������0000644�0001750�0001750�00000037073�14744453367�021035� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="infoLabel"> <Properties> <Property name="text" type="java.lang.String" value="info..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="filterPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="filterLabel"> <Properties> <Property name="text" type="java.lang.String" value="Filter"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="6" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="checkBoxPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="recommendedIconLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="recommendedCheckBox"> <Properties> <Property name="text" type="java.lang.String" value="Recommended"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="recommendedCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="timeIconLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="timeCheckBox"> <Properties> <Property name="text" type="java.lang.String" value="Time"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="timeCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="memoryIconLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="memoryCheckBox"> <Properties> <Property name="text" type="java.lang.String" value="Memory"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="memoryCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Component class="javax.swing.JLabel" name="includeLabel"> <Properties> <Property name="text" type="java.lang.String" value="Include"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="includeComboBox"> <Properties> <Property name="editable" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="excludeLabel"> <Properties> <Property name="text" type="java.lang.String" value="and exclude"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="8" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="excludeComboBox"> <Properties> <Property name="editable" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="refreshButton"> <Properties> <Property name="text" type="java.lang.String" value="Refresh"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="4" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="8" insetsBottom="4" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="listLabelPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="listLabel"> <Properties> <Property name="text" type="java.lang.String" value="Available Counters:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="maxListLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="tablePanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Container> </SubComponents> </Form> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/�������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015102� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/ExclusiveOrInclusivePanel.java�������������������������������0000644�0001750�0001750�00000011424�15044710303�022772� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.TransferHandler; public class ExclusiveOrInclusivePanel extends JPanel { private MetricPanel metricPanel; private String labelText; private AttributePanel[] attributepanels; public ExclusiveOrInclusivePanel( MetricPanel metricPanel, AnTable anTable, final MetricLabel[] metricLabels, String labelText, ImageIcon imageIcon, String tooltip, int column, int count, HeaderMouseHandler headerMouseHandler) { // System.out.println(txt + " " + index + " " + count); this.metricPanel = metricPanel; this.labelText = labelText; setLayout(new GridBagLayout()); setOpaque(false); setToolTipText(tooltip); addMouseListener(headerMouseHandler); addMouseMotionListener(headerMouseHandler); // What label JLabel whatLabel = new JLabel(labelText); AnUtility.setAccessibleContext(whatLabel.getAccessibleContext(), whatLabel.getText()); whatLabel.setFont(AnTableHeaderPanel.verySmallFont); if (imageIcon != null) { whatLabel.setIcon(imageIcon); } GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, 2, 0, 2); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; add(whatLabel, gridBagConstraints); // Attribute panel JPanel attributePanelOuter = new JPanel(new GridBagLayout()); attributePanelOuter.setOpaque(false); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(attributePanelOuter, gridBagConstraints); attributepanels = new AttributePanel[count]; int gridX = 0; for (int i = 0; i < count; i++) { AttributePanel attributePanel = new AttributePanel( metricPanel, anTable, metricLabels, this, column + i, headerMouseHandler, tooltip); attributepanels[i] = attributePanel; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(1, 0, 0, 0); attributePanelOuter.add(attributePanel, gridBagConstraints); } // DnD addMouseMotionListener(new MouseDraggedListener()); } class MouseDraggedListener extends MouseMotionAdapter { @Override public void mouseDragged(MouseEvent e) { JComponent c = (JComponent) e.getSource(); ExclusiveOrInclusivePanel exclusiveOrInclusivePanel = (ExclusiveOrInclusivePanel) c; MetricPanel metricPanel = exclusiveOrInclusivePanel.getMetricPanel(); TransferHandler handler = metricPanel.getTransferHandler(); handler.exportAsDrag(metricPanel, e, TransferHandler.COPY); } } public MetricPanel getMetricPanel() { return metricPanel; } public String getLabelText() { return labelText; } protected AttributePanel findAttributePanel(int x) { int start = 0; for (int i = 0; i < attributepanels.length; i++) { if (x >= start && x <= start + attributepanels[i].getSize().width) { return attributepanels[i]; } start += attributepanels[i].getSize().width; } return null; } List<JMenuItem> getSortByMenuItems() { List<JMenuItem> list = new ArrayList<>(); for (AttributePanel attributepanel : attributepanels) { list.add(attributepanel.getSortByMenuItem()); } return list; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/HeaderMouseHandler.java��������������������������������������0000644�0001750�0001750�00000007315�14744453367�021407� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public final class HeaderMouseHandler extends MouseAdapter { private MetricPanel metricPanel; private AttributePanel mouseOverAttributePanel = null; public HeaderMouseHandler(MetricPanel metricPanel) { this.metricPanel = metricPanel; } @Override public void mouseEntered(MouseEvent e) { // System.out.println("mouseEntered " + e.getComponent()); metricPanel.mouseEntered(e); } @Override public void mouseExited(MouseEvent e) { // System.out.println("mouseExited " + e.getComponent()); metricPanel.mouseExited(e); if (mouseOverAttributePanel != null) { mouseOverAttributePanel.mouseExited(null); mouseOverAttributePanel = null; } } @Override public void mouseClicked(MouseEvent e) { // System.out.println("mouseClicked " + " " + e.getX() + " " + e.getComponent()); if (e.getButton() == MouseEvent.BUTTON3) { metricPanel.showPopup(e); } else { AttributePanel attributePanel = findAttributePanel(e); // System.out.println(attributePanel != null ? attributePanel.column : "-"); if (attributePanel != null) { attributePanel.mouseClicked(null); } } } @Override public void mouseMoved(MouseEvent e) { // System.out.println("mouseMoved " + " " + e.getX() + " " + e.getComponent()); AttributePanel attributePanel = findAttributePanel(e); // System.out.println(attributePanel != null ? attributePanel.column : "-"); if (attributePanel != null) { if (attributePanel != mouseOverAttributePanel) { if (mouseOverAttributePanel != null) { mouseOverAttributePanel.mouseExited(null); mouseOverAttributePanel = null; } } attributePanel.mouseEntered(null); mouseOverAttributePanel = attributePanel; } } private AttributePanel findAttributePanel(MouseEvent e) { int x = e.getX(); AttributePanel attributePanel = null; if (e.getComponent() instanceof AttributePanel) { attributePanel = (AttributePanel) e.getComponent(); } else if (e.getComponent() instanceof ExclusiveOrInclusivePanel) { ExclusiveOrInclusivePanel exclusiveOrInclusivePanel = (ExclusiveOrInclusivePanel) e.getComponent(); attributePanel = exclusiveOrInclusivePanel.findAttributePanel(x); } else if (e.getComponent() instanceof MetricPanel) { ExclusiveOrInclusivePanel exclusiveOrInclusivePanel = metricPanel.getExclusiveAndInclusivePanel().findExclusiveOrInclusivePanel(x); if (exclusiveOrInclusivePanel != null) { // Non Name metrics int offset = metricPanel.getExclusiveAndInclusivePanel().findExclusiveOrInclusivePanelOffset(x); attributePanel = exclusiveOrInclusivePanel.findAttributePanel(offset); } else { // Name metric attributePanel = metricPanel.getExclusiveAndInclusivePanel().findAttributePanel(); } } return attributePanel; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/ExclusiveAndInclusivePanel.java������������������������������0000644�0001750�0001750�00000026625�15044710303�023125� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; public class ExclusiveAndInclusivePanel extends JPanel { private List<ExclusiveOrInclusivePanel> exclusiveOrInclusivePanelList; private AttributePanel attributePanel; public ExclusiveAndInclusivePanel( MetricPanel metricPanel, AnTable anTable, final MetricLabel[] metricLabels, boolean wrapMetricName, int column, int count, HeaderMouseHandler headerMouseHandler) { // setBackground(AnEnvironment.TABLE_HEADER_BACKGROUND_COLOR); setOpaque(false); setLayout(new GridBagLayout()); // Add Exclusive/Inclusive panels int[][] columnWidth = anTable.getColumnWidth(); int exclusiveCount = 0; Integer exclusiveIndex = null; int exclusiveWidth = 0; ImageIcon exclusiveIcon = null; int inclusiveCount = 0; Integer inclusiveIndex = null; int inclusiveWidth = 0; ImageIcon inclusiveIcon = null; int attributedCount = 0; Integer attributedIndex = null; int attributedWidth = 0; ImageIcon attributedIcon = null; int staticCount = 0; Integer staticIndex = null; int staticWidth = 0; ImageIcon staticIcon = null; int nameCount = 0; exclusiveOrInclusivePanelList = new ArrayList<>(); for (int i = column; i < column + count; i++) { AnMetric anMetric = metricLabels[i].getAnMetric(); if (anMetric.getSubType() == 2 || // Exclusive anMetric.getSubType() == 16) { // Machine model metrics? exclusiveCount++; if (exclusiveIndex == null) { exclusiveIndex = i; } exclusiveWidth += columnWidth[i][0]; exclusiveIcon = metricLabels[i].getIcon(); } else if (anMetric.getSubType() == 4) { // Inclusive inclusiveCount++; if (inclusiveIndex == null) { inclusiveIndex = i; } inclusiveWidth += columnWidth[i][0]; inclusiveIcon = metricLabels[i].getIcon(); } else if (anMetric.getSubType() == 8) { // Attributed // System? (Callers-callees) attributedCount++; if (attributedIndex == null) { attributedIndex = i; } attributedWidth += columnWidth[i][0]; attributedIcon = metricLabels[i].getIcon(); } else if (anMetric.isNameMetric()) { // Name nameCount++; } else if (anMetric.isStatic()) { // Static (Size, ...) staticCount++; if (staticIndex == null) { staticIndex = i; } staticWidth += columnWidth[i][0]; staticIcon = metricLabels[i].getIcon(); } else { System.out.println("ERROR " + anMetric.getSubType()); } } // System.out.println(metricLabels[index].getAnMetric().getUserName() + ": " + count // + " " + exclusiveCount + " " + inclusiveCount + " " + attributedCount); int gridX = 0; if (exclusiveCount > 0) { String name; ImageIcon icon; if (anTable.getAnParent().showOnlyValuesInTables()) { name = AnLocale.getString("VALUES"); icon = null; } else { name = AnLocale.getString("EXCLUSIVE"); icon = exclusiveIcon; } String toolTip = name + ": " + metricLabels[column].getAnMetric().getUserName(); ExclusiveOrInclusivePanel panel = new ExclusiveOrInclusivePanel( metricPanel, anTable, metricLabels, name, icon, toolTip, exclusiveIndex, exclusiveCount, headerMouseHandler); if (inclusiveCount > 0) { if (AnWindow.getInstance().getExperimentGroups().length == 1) { panel.setBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, AnEnvironment.TABLE_VERTICAL_GRID_COLOR)); } else { panel.setBorder( BorderFactory.createMatteBorder( 0, 0, 0, 1, AnEnvironment.TABLE_VERTICAL_GRID_ATTRIBUTE_COMP_COLOR)); } } panel.setPreferredSize(new Dimension(exclusiveWidth, panel.getPreferredSize().height)); panel.setMinimumSize(new Dimension(exclusiveWidth, panel.getPreferredSize().height)); panel.setMaximumSize(new Dimension(exclusiveWidth, panel.getPreferredSize().height)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(panel, gridBagConstraints); exclusiveOrInclusivePanelList.add(panel); } if (inclusiveCount > 0) { String name = AnLocale.getString("INCLUSIVE"); String toolTip = name + ": " + metricLabels[column].getAnMetric().getUserName(); ExclusiveOrInclusivePanel panel = new ExclusiveOrInclusivePanel( metricPanel, anTable, metricLabels, name, inclusiveIcon, toolTip, inclusiveIndex, inclusiveCount, headerMouseHandler); panel.setPreferredSize(new Dimension(inclusiveWidth, panel.getPreferredSize().height)); panel.setMinimumSize(new Dimension(inclusiveWidth, panel.getPreferredSize().height)); panel.setMaximumSize(new Dimension(inclusiveWidth, panel.getPreferredSize().height)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(panel, gridBagConstraints); exclusiveOrInclusivePanelList.add(panel); } if (attributedCount > 0) { String name = AnLocale.getString("ATTRIBUTED"); String toolTip = name + ": " + metricLabels[column].getAnMetric().getUserName(); ExclusiveOrInclusivePanel panel = new ExclusiveOrInclusivePanel( metricPanel, anTable, metricLabels, name, null, toolTip, attributedIndex, attributedCount, headerMouseHandler); panel.setPreferredSize(new Dimension(attributedWidth, panel.getPreferredSize().height)); panel.setMinimumSize(new Dimension(attributedWidth, panel.getPreferredSize().height)); panel.setMaximumSize(new Dimension(attributedWidth, panel.getPreferredSize().height)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(panel, gridBagConstraints); exclusiveOrInclusivePanelList.add(panel); } if (staticCount > 0) { String toolTip = metricLabels[column].getAnMetric().getUserName(); ExclusiveOrInclusivePanel panel = new ExclusiveOrInclusivePanel( metricPanel, anTable, metricLabels, "VALUE", null, toolTip, staticIndex, staticCount, headerMouseHandler); panel.setPreferredSize(new Dimension(staticWidth, panel.getPreferredSize().height)); panel.setMinimumSize(new Dimension(staticWidth, panel.getPreferredSize().height)); panel.setMaximumSize(new Dimension(staticWidth, panel.getPreferredSize().height)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(panel, gridBagConstraints); exclusiveOrInclusivePanelList.add(panel); } if (nameCount > 0) { if (anTable.getType() != AnDisplay.DSP_Source && anTable.getType() != AnDisplay.DSP_SourceV2 && anTable.getType() != AnDisplay.DSP_Disassembly && anTable.getType() != AnDisplay.DSP_DisassemblyV2 && anTable.getType() != AnDisplay.DSP_SourceDisassembly) { if (anTable.getNames()[1] != null) { JLabel label = new JLabel(anTable.getNames()[1]); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 4, 0, 0); add(label, gridBagConstraints); } } attributePanel = new AttributePanel( metricPanel, anTable, metricLabels, null, column, headerMouseHandler, null); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(attributePanel, gridBagConstraints); } } public List<JMenuItem> getSortByMenuItems() { List<JMenuItem> list = new ArrayList<>(); for (ExclusiveOrInclusivePanel exclusiveOrInclusivePanel : exclusiveOrInclusivePanelList) { list.addAll(exclusiveOrInclusivePanel.getSortByMenuItems()); } return list; } protected ExclusiveOrInclusivePanel findExclusiveOrInclusivePanel(int x) { int start = 0; for (int i = 0; i < exclusiveOrInclusivePanelList.size(); i++) { if (x >= start && x <= start + exclusiveOrInclusivePanelList.get(i).getSize().width) { return exclusiveOrInclusivePanelList.get(i); } start += exclusiveOrInclusivePanelList.get(i).getSize().width; } return null; } protected AttributePanel findAttributePanel() { return attributePanel; // Only for Name metric } protected int findExclusiveOrInclusivePanelOffset(int x) { int start = 0; for (int i = 0; i < exclusiveOrInclusivePanelList.size(); i++) { if (x >= start && x <= start + exclusiveOrInclusivePanelList.get(i).getSize().width) { return x - start; } start += exclusiveOrInclusivePanelList.get(i).getSize().width; } return 0; } } �����������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/MetricPanel.java���������������������������������������������0000644�0001750�0001750�00000046263�14744453367�020120� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DragSource; import java.awt.dnd.DragSourceDragEvent; import java.awt.dnd.DragSourceDropEvent; import java.awt.dnd.DragSourceEvent; import java.awt.dnd.DragSourceListener; import java.awt.dnd.DropTarget; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.TransferHandler; public class MetricPanel extends JPanel implements Transferable { static { DragSource.getDefaultDragSource().addDragSourceListener(new MetricPanelDragSourceListener()); } private AnTableHeaderPanel anTableHeaderPanel; private AnMetric anMetric; private AnTable anTable; private MetricLabel[] metricLabels; private int maxMetricNameLabels = 16; private ExclusiveAndInclusivePanel exclusiveAndInclusivePanel; private JLabel removeIconLabel; private JLabel configureIconLabel; private int column; private int count; private JPanel iconNamePanel; private JLabel[] metricNameLabels = new JLabel[maxMetricNameLabels]; public MetricPanel( AnTableHeaderPanel anTableHeaderPanel, AnMetric anMetric, AnTable anTable, final MetricLabel[] metricLabels, boolean wrapMetricName, final int column, int count, Color backgroundcolor) { this.anTableHeaderPanel = anTableHeaderPanel; this.anMetric = anMetric; this.anTable = anTable; this.metricLabels = metricLabels; this.column = column; this.count = count; String metricName = anMetric.getUserName(); setOpaque(false); setOpaque(true); setBackground(backgroundcolor); setLayout(new GridBagLayout()); setBorder( BorderFactory.createMatteBorder( 0, 0, 0, 1, AnEnvironment.TABLE_VERTICAL_GRID_METRIC_COLOR)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); // Mouse events HeaderMouseHandler headerMouseHandler = new HeaderMouseHandler(this); addMouseMotionListener(headerMouseHandler); addMouseListener(headerMouseHandler); // // Sort metric or not? // boolean sortedByThisMetric = false; // if (anTable.canSort()) { // for (int i = 0; i < count; i++) { // if (metricLabels[index + i].getAnMetric().isSorted()) { // sortedByThisMetric = true; // break; // } // } // } iconNamePanel = new JPanel(new GridBagLayout()); iconNamePanel.setOpaque(false); // if (sortedByThisMetric) { // Color moreBluish = new Color(backgroundcolor.getRed() - 6, // backgroundcolor.getGreen() - 6, backgroundcolor.getBlue()); // iconNamePanel.setOpaque(true); // iconNamePanel.setBackground(moreBluish); // } // Configure icon if (!metricLabels[column].getAnMetric().isNameMetric()) { configureIconLabel = new JLabel(AnUtility.hamburgerBlankIcon); configureIconLabel.setToolTipText(AnLocale.getString("Configure this metric")); AnUtility.setAccessibleContext( configureIconLabel.getAccessibleContext(), configureIconLabel.getToolTipText()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(1, 1, 0, 2); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; iconNamePanel.add(configureIconLabel, gridBagConstraints); configureIconLabel.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { showPopup(e); } @Override public void mouseEntered(MouseEvent e) { configureIconLabel.setIcon(AnUtility.hamburgerFocusedIcon); removeIconLabel.setIcon(AnUtility.removeIcon); } @Override public void mouseExited(MouseEvent e) { configureIconLabel.setIcon(AnUtility.hamburgerIcon); } }); } // Metric name // Use metricNameLabels[0] as default // metricNameLabels[1-9] are for wrapped metric names if (!metricLabels[column].getAnMetric().isNameMetric()) { metricNameLabels[0] = new JLabel(metricName); AnUtility.setAccessibleContext( metricNameLabels[0].getAccessibleContext(), metricNameLabels[0].getText()); metricNameLabels[0].setHorizontalAlignment(JLabel.CENTER); String ttText = metricName; if (anMetric.getShortDesc() != null) { ttText += " - " + anMetric.getShortDesc(); } setToolTipText(AnLocale.getString("Metric") + ": " + ttText); } else { if (anTable.getType() == AnDisplay.DSP_Source || anTable.getType() == AnDisplay.DSP_SourceV2 || anTable.getType() == AnDisplay.DSP_Disassembly || anTable.getType() == AnDisplay.DSP_DisassemblyV2 || anTable.getType() == AnDisplay.DSP_SourceDisassembly) { String labelText = anTable.getNames()[0]; labelText = labelText.replaceFirst(".*: ", ""); labelText = labelText.replaceFirst(" \\(.*", ""); metricNameLabels[0] = new JLabel(labelText); AnUtility.setAccessibleContext( metricNameLabels[0].getAccessibleContext(), metricNameLabels[0].getText()); } else { metricNameLabels[0] = new JLabel(anTable.getNames()[0]); AnUtility.setAccessibleContext( metricNameLabels[0].getAccessibleContext(), metricNameLabels[0].getText()); } setToolTipText(anTable.getNames()[0]); } metricNameLabels[0].setFont(AnTableHeaderPanel.smallBoldFont); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; if (metricLabels[column].getAnMetric().isNameMetric()) { gridBagConstraints.insets = new Insets(0, 4, 0, 0); } gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; iconNamePanel.add(metricNameLabels[0], gridBagConstraints); for (int i = 1; i < maxMetricNameLabels; i++) { metricNameLabels[i] = new JLabel(wrapMetricName ? "" : ""); AnUtility.setAccessibleContext( metricNameLabels[i].getAccessibleContext(), metricNameLabels[i].getText()); metricNameLabels[i].setFont(AnTableHeaderPanel.smallBoldFont); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = i; iconNamePanel.add(metricNameLabels[i], gridBagConstraints); } // Remove icon if (!metricLabels[column].getAnMetric().isNameMetric()) { removeIconLabel = new JLabel(AnUtility.removeIconBlank); removeIconLabel.setToolTipText(AnLocale.getString("Remove this metric")); AnUtility.setAccessibleContext( removeIconLabel.getAccessibleContext(), removeIconLabel.getToolTipText()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(1, 2, 0, 1); gridBagConstraints.anchor = GridBagConstraints.NORTHEAST; iconNamePanel.add(removeIconLabel, gridBagConstraints); removeIconLabel.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .set(this, metricLabels[column].getAnMetric().getComd(), false); } @Override public void mouseEntered(MouseEvent e) { removeIconLabel.setIcon(AnUtility.removeFocusedIcon); configureIconLabel.setIcon(AnUtility.hamburgerIcon); } @Override public void mouseExited(MouseEvent e) { removeIconLabel.setIcon(AnUtility.removeIcon); } }); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(iconNamePanel, gridBagConstraints); // Add Exclusive/Inclusive panel exclusiveAndInclusivePanel = new ExclusiveAndInclusivePanel( this, anTable, metricLabels, wrapMetricName, column, count, headerMouseHandler); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(2, 0, 0, 0); add(exclusiveAndInclusivePanel, gridBagConstraints); // DnD addMouseMotionListener(new MouseDraggedListener()); setTransferHandler(new DADTransferHandler()); setDropTarget(new DropTarget(this, new MetricPanelDropTargetListener())); } /** * @return the anTableHeaderPanel */ public AnTableHeaderPanel getAnTableHeaderPanel() { return anTableHeaderPanel; } /** * @return the anMetric */ public AnMetric getAnMetric() { return anMetric; } class MouseDraggedListener extends MouseMotionAdapter { // @Override @Override public void mouseDragged(MouseEvent e) { JComponent c = (JComponent) e.getSource(); TransferHandler handler = c.getTransferHandler(); handler.exportAsDrag(c, e, TransferHandler.COPY); } } private static DataFlavor dadDataFlavor = null; public static DataFlavor getDADDataFlavor() throws Exception { if (dadDataFlavor == null) { dadDataFlavor = new DataFlavor( DataFlavor.javaJVMLocalObjectMimeType + ";class=org.gprofng.mpmt.table.MetricPanel"); } return dadDataFlavor; } // @Override @Override public Object getTransferData(DataFlavor flavor) { DataFlavor thisFlavor; try { thisFlavor = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return null; } if (thisFlavor != null && flavor.equals(thisFlavor)) { return MetricPanel.this; } return null; } // @Override @Override public DataFlavor[] getTransferDataFlavors() { DataFlavor[] flavors = {null}; try { flavors[0] = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return null; } return flavors; } // @Override @Override public boolean isDataFlavorSupported(DataFlavor flavor) { DataFlavor[] flavors = {null}; try { flavors[0] = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return false; } for (DataFlavor f : flavors) { if (f.equals(flavor)) { return true; } } return false; } class DADTransferHandler extends TransferHandler { public DADTransferHandler() { super(); } // @Override() @Override public Transferable createTransferable(JComponent c) { if (c instanceof MetricPanel) { Transferable tip = (MetricPanel) c; return tip; } return null; } // @Override() @Override public int getSourceActions(JComponent c) { if (c instanceof MetricPanel) { return TransferHandler.COPY; } return TransferHandler.NONE; } } protected void mouseEntered(MouseEvent e) { if (removeIconLabel != null) { removeIconLabel.setIcon(AnUtility.removeIcon); } if (configureIconLabel != null) { configureIconLabel.setIcon(AnUtility.hamburgerIcon); } } public void mouseExited(MouseEvent e) { if (removeIconLabel != null) { removeIconLabel.setIcon(AnUtility.removeIconBlank); } if (configureIconLabel != null) { configureIconLabel.setIcon(AnUtility.hamburgerBlankIcon); } } protected void showPopup(MouseEvent event) { MetricLabel metricLabel = metricLabels[column]; JPopupMenu popup = new JPopupMenu(); AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricsPopupMenus(popup, metricLabel.getAnMetric(), anTable, getSortByMenu()); popup.show(event.getComponent(), event.getX() + 5, event.getY() + 5); } private JMenu getSortByMenu() { JMenu sortByMenuItem = new JMenu(AnLocale.getString("Sort This Metric By")); if (anTable.canSort()) { if (metricLabels[column].getAnMetric().isNameMetric()) { JMenuItem menuItem = new JMenuItem(metricLabels[column].getAnMetric().getUserName()); menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .setSortMetricByDType(this, column, anTable.getType()); } }); sortByMenuItem.add(menuItem); } else { List<JMenuItem> list = exclusiveAndInclusivePanel.getSortByMenuItems(); for (JMenuItem menuItem : list) { sortByMenuItem.add(menuItem); } } } else { sortByMenuItem.setEnabled(false); } return sortByMenuItem; } private int labelWidth(String text) { AnTableHeaderPanel.testLabel.setText(text); return AnTableHeaderPanel.testLabel.getPreferredSize().width; } protected int splitMetricNameIntoMultipleRows(int maxPanelWidth) { // System.out.println("splitMetricNameIntoMultipleRows: " + maxPanelWidth); int maxLabelWidth = maxPanelWidth - 25; // subtract icon widths and spacing String metricName = metricNameLabels[0].getText(); // metricName = // "cpu_clk_thread_unhalted.ref_xclk~msr_offcore=0~edge=0~umask=0~anythr=0/0"; // metricName = // "cpu_clk_thread_unhalted.ref_xclk~msr_offcore=0~edge=0~umask=0~anythr=0/0 // xxx\\xxxx\\xxxx\\xxxx\\xxxxdsa 1111 222 33333 44444 55555"; // metricName = // "br_inst_exec.all_indirect_jump_non_call_ret~edge=0~inv=0~in_tx=0~system=0~msr_offcore=0/1,on"; String[] split = metricName.split(" |_|\\.|~|-|\\\\"); if (split.length == 1) { // do nothing return 1; } int masterIndex = -1; Character splitCharNextLine = null; for (int i = 0; i < split.length - 1; i++) { masterIndex += split[i].length() + 1; char splitChar = metricName.charAt(masterIndex); // System.out.println(splitChar); if (splitCharNextLine != null) { split[i] = splitCharNextLine + split[i]; splitCharNextLine = null; } if (splitChar != '~') { split[i] = split[i] + splitChar; } else { splitCharNextLine = splitChar; } } int row = 0; int start = 0; while (start < split.length) { int count = 0; StringBuilder sb = new StringBuilder(); while (true) { if ((start + count) >= (split.length)) { break; } if (labelWidth(sb.toString() + split[start + count]) >= maxLabelWidth && count != 0) { break; } if (count > 0 && split[start + count].toString().charAt(0) == '~') { break; } sb.append(split[start + count]); count++; } start = start + count; metricNameLabels[row].setText(sb.toString()); if ((row + 1) >= maxMetricNameLabels) { metricNameLabels[row].setText(metricNameLabels[row].getText() + "..."); row++; break; } row++; } return row; } protected void adjustMetricNameRows(int rows) { for (int i = 1; i <= rows - 1; i++) { if (metricNameLabels[i].getText().isEmpty()) { metricNameLabels[i].setText(" "); } } } /** * @return the iconNamePanel */ public JPanel getIconNamePanel() { return iconNamePanel; } /** * @return the exclusiveAndInclusivePanel */ public ExclusiveAndInclusivePanel getExclusiveAndInclusivePanel() { return exclusiveAndInclusivePanel; } public String dump() { return metricNameLabels[0].getText() + metricNameLabels[1].getText() + metricNameLabels[2].getText(); } static class MetricPanelDragSourceListener implements DragSourceListener { // @Override @Override public void dragDropEnd(DragSourceDropEvent dsde) { // System.out.println("DragSource:dragDropEnd: " + // dsde.getDragSourceContext().getComponent()); if (dsde.getDragSourceContext().getComponent() instanceof MetricPanel) { MetricPanel metricPanel = (MetricPanel) dsde.getDragSourceContext().getComponent(); metricPanel.getAnTableHeaderPanel().setDropPosition(-1); } } // @Override @Override public void dragExit(DragSourceEvent dse) { // System.out.println("DragSource:dragExit: " + dse); if (dse.getDragSourceContext().getComponent() instanceof MetricPanel) { MetricPanel metricPanel = (MetricPanel) dse.getDragSourceContext().getComponent(); metricPanel.getAnTableHeaderPanel().setDropPosition(-1); } } // @Override @Override public void dragEnter(DragSourceDragEvent dsde) { // System.out.println("DragSource:dragEnter: " + dsde.getLocation()); } @Override public void dragOver(DragSourceDragEvent dsde) { // System.out.println("DragSource:dragOver: " + dsde.getLocation()); if (dsde.getDragSourceContext().getComponent() instanceof MetricPanel) { MetricPanel metricPanel = (MetricPanel) dsde.getDragSourceContext().getComponent(); metricPanel.getAnTableHeaderPanel().setDropLocation(dsde.getLocation().x); } } @Override public void dropActionChanged(DragSourceDragEvent dsde) {} } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/AnTableHeaderPanel.java��������������������������������������0000644�0001750�0001750�00000022027�15044710303�021260� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Rectangle; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; public class AnTableHeaderPanel extends JPanel { protected static final Font smallFont = new JLabel().getFont().deriveFont((float) new JLabel().getFont().getSize() - 1); protected static final Font verySmallFont = new JLabel().getFont().deriveFont((float) new JLabel().getFont().getSize() - 2); protected static final Font boldFont = new JLabel().getFont().deriveFont(Font.BOLD); protected static final Font smallBoldFont = boldFont.deriveFont((float) boldFont.getSize() - 1); protected static final Font verySmallBoldFont = verySmallFont.deriveFont(Font.BOLD); protected static final JLabel testLabel = new JLabel(); static { testLabel.setFont(boldFont); } private final List<MetricPanel> metricPanels; private final List<Integer> startColumns; private final List<Integer> columnCounts; private final List<Integer> panelWidths; private int dropPosition = -1; public AnTableHeaderPanel(AnTable anTable, MetricLabel[] metricLabels, boolean wrapMetricName) { metricPanels = new ArrayList<>(); startColumns = new ArrayList<>(); columnCounts = new ArrayList<>(); panelWidths = new ArrayList<>(); int[][] columnWidth = anTable.getColumnWidth(); setBackground(AnEnvironment.TABLE_HEADER_BACKGROUND_COLOR_1); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; int panelCount = 0; int gridX = 0; int startColumn = 0; while (startColumn < metricLabels.length) { int count = 1; while (startColumn + count < metricLabels.length && metricLabels[startColumn + count - 1] .getAnMetric() .getComd() .equals(metricLabels[startColumn + count].getAnMetric().getComd())) { count++; } int panelWidth = 0; for (int i = startColumn; i < startColumn + count; i++) { panelWidth += columnWidth[i][0]; } Color backgroundcolor; if (panelCount % 2 == 0) { backgroundcolor = AnEnvironment.TABLE_HEADER_BACKGROUND_COLOR_1; } else { backgroundcolor = AnEnvironment.TABLE_HEADER_BACKGROUND_COLOR_2; } if (metricLabels[startColumn].getAnMetric().isNameMetric()) { MetricPanel metricPanel = new MetricPanel( this, metricLabels[startColumn].getAnMetric(), anTable, metricLabels, wrapMetricName, startColumn, count, backgroundcolor); // metricPanel.setPreferredSize(new Dimension(panelWidth, // metricPanel.getPreferredSize().height)); gridBagConstraints.gridx = startColumn; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(metricPanel, gridBagConstraints); metricPanels.add(metricPanel); startColumns.add(startColumn); columnCounts.add(count); panelWidths.add(panelWidth); } else { MetricPanel metricPanel = new MetricPanel( this, metricLabels[startColumn].getAnMetric(), anTable, metricLabels, wrapMetricName, startColumn, count, backgroundcolor); // metricPanel.setPreferredSize(new Dimension(panelWidth, // metricPanel.getPreferredSize().height)); gridBagConstraints.gridx = startColumn; add(metricPanel, gridBagConstraints); add(metricPanel, gridBagConstraints); metricPanels.add(metricPanel); startColumns.add(startColumn); columnCounts.add(count); panelWidths.add(panelWidth); } startColumn += count; panelCount++; } // Deal with long metric names if (wrapMetricName) { int noMetricNameRows = 0; for (int i = 0; i < metricPanels.size(); i++) { MetricPanel metricPanel = metricPanels.get(i); JPanel iconNamePanel = metricPanel.getIconNamePanel(); int column = startColumns.get(i); int columnCount = columnCounts.get(i); int actualColumnWidth = 0; for (int n = 0; n < columnCount; n++) { actualColumnWidth += columnWidth[column + n][0]; } boolean nameTooLong = iconNamePanel.getPreferredSize().width >= actualColumnWidth; // System.out.println(column + ":" + columnCount + ": " + // iconNamePanel.getPreferredSize().width + " " + actualColumnWidth + " " + (nameTooLong ? // "*" : "")); if (nameTooLong) { int rows = metricPanel.splitMetricNameIntoMultipleRows(actualColumnWidth); if (rows > noMetricNameRows) { noMetricNameRows = rows; } } } if (noMetricNameRows > 0) { for (int i = 0; i < metricPanels.size(); i++) { MetricPanel metricPanel = metricPanels.get(i); metricPanel.adjustMetricNameRows(noMetricNameRows); } } } // Set width... for (int i = 0; i < metricPanels.size(); i++) { MetricPanel metricPanel = metricPanels.get(i); metricPanel.setPreferredSize( new Dimension(panelWidths.get(i), metricPanel.getPreferredSize().height)); } } public static int getMinimumColumnWidth() { JLabel label = new JLabel(AnLocale.getString("EXCLUSIVE")); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(AnTableHeaderPanel.verySmallFont); return label.getPreferredSize().width + 26; } @Override public void paint(Graphics g) { super.paint(g); if (dropPosition >= 0) { paintDropPosition(g, dropPosition); } } private void paintDropPosition(Graphics g, int dropPosition) { int lineCenter = 0; if (dropPosition == 0) { lineCenter = 0; } else { for (int i = 0; i < dropPosition; i++) { lineCenter += panelWidths.get(i); } lineCenter -= 1; } int h = getHeight(); g.setColor(AnEnvironment.DROP_LINE_COLOR); g.drawLine(lineCenter - 1, 0, lineCenter - 1, h); g.drawLine(lineCenter, 0, lineCenter, h); g.drawLine(lineCenter + 1, 0, lineCenter + 1, h); g.drawLine(lineCenter - 3, 0, lineCenter + 3, 0); g.drawLine(lineCenter - 2, 1, lineCenter + 2, 1); g.drawLine(lineCenter - 2, h - 2, lineCenter + 2, h - 2); g.drawLine(lineCenter - 3, h - 1, lineCenter + 3, h - 1); } public void setDropPosition(int dropPosition) { if (dropPosition != this.dropPosition) { this.dropPosition = dropPosition; repaint(); } } public void setDropLocation(int xOnScreen) { int x = xOnScreen - getLocationOnScreen().x; // Relative to anTableHeaderPanel int dropPosition = 0; if (x < panelWidths.get(0) / 2) { dropPosition = 0; } else { int startX = panelWidths.get(0) / 2; int totalPanelWidth = panelWidths.get(0); dropPosition = 1; for (int panelNo = 1; panelNo < panelWidths.size(); panelNo++) { if (x >= startX && x < totalPanelWidth + panelWidths.get(panelNo) / 2) { break; } startX = totalPanelWidth + panelWidths.get(panelNo) / 2; totalPanelWidth += panelWidths.get(panelNo); dropPosition++; } } setDropPosition(dropPosition); Rectangle visibleRectangle = getVisibleRect(); if (x < visibleRectangle.x + 50) { scrollRectToVisible(new Rectangle(visibleRectangle.x - 50, 1, x, 1)); } else if (x > visibleRectangle.x + visibleRectangle.width - 50) { scrollRectToVisible(new Rectangle(visibleRectangle.x + 50, 1, x, 1)); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/AnTableScrollPane.java���������������������������������������0000644�0001750�0001750�00000012553�14744453367�021201� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.event.MouseInputAdapter; public abstract class AnTableScrollPane extends AnJScrollPane { private Image addtablecolumnsImage = AnUtility.addColumnIcon.getImage(); private static final String metricsIconToolTip = AnLocale.getString("Click to select colums to display..."); private static int imageXGap = -1; private static final int imageYGap = 2; private boolean hasColumnButton; private int dtype; private JPopupMenu metricsSelectorpopup = null; public AnTableScrollPane(int dtype, boolean hasColumnButton) { this.dtype = dtype; this.hasColumnButton = hasColumnButton; init(); } protected void init() { if (hasColumnButton) { addMouseListener( new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if (!e.isPopupTrigger()) { int startX = e.getX(); int startY = e.getY(); // Handle mouse click over data presentation icon AnWindow anWindow = AnWindow.getInstance(); if (anWindow.getSettingsAction().isEnabled()) { int width = getSize().width; if (startX >= width - (addtablecolumnsImage.getWidth(null) + imageXGap) && startX <= (width - imageXGap) && startY >= imageYGap && startY <= (addtablecolumnsImage.getHeight(null) + imageYGap)) { showMetricsConfigurationPopup( AnTableScrollPane.this, startX + 5, startY + 5, dtype); } } } } }); addMouseMotionListener( new MouseMotionAdapter() { @Override public void mouseMoved(MouseEvent e) { super.mouseMoved(e); int startX = e.getX(); int startY = e.getY(); // Handle tooltip data presentation icon AnWindow anWindow = AnWindow.getInstance(); if (anWindow.getSettingsAction().isEnabled()) { int width = getSize().width; if (startX >= width - (addtablecolumnsImage.getWidth(null) + imageXGap) && startX <= (width - imageXGap) && startY >= imageYGap && startY <= (addtablecolumnsImage.getHeight(null) + imageYGap)) { setToolTipText(metricsIconToolTip); } else { setToolTipText(null); } } } }); } } public void showMetricsConfigurationPopup(Component component, int x, int y, int dtype) { metricsSelectorpopup = getmetricsSelectorPopup(dtype); metricsSelectorpopup.show(component, x, y); } private JPopupMenu getmetricsSelectorPopup(int dtype) { JPopupMenu popup = new JPopupMenu(); AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricsPopupSelector(popup, dtype, true); return popup; } @Override public void paint(Graphics g) { super.paint(g); int vsbw = getVerticalScrollBar().getWidth(); // 17 int vsbh = getVerticalScrollBar().getHeight(); // many+ boolean vsbv = getVerticalScrollBar().isVisible(); int hsbw = getHorizontalScrollBar().getWidth(); // many+ int hsbh = getHorizontalScrollBar().getHeight(); // 17 boolean hsbv = getHorizontalScrollBar().isVisible(); g.setColor(AnEnvironment.SCROLLBAR_TRACK_COLOR); g.fillRect(getWidth() - vsbw, 0, vsbw, getHeight() - vsbh - (hsbv ? hsbh : 0)); g.setColor(AnEnvironment.SPLIT_PANE_BORDER_COLOR); if (hsbv) { g.drawLine(getWidth() - vsbw, 0, getWidth() - vsbw, getHeight() - vsbh - hsbh - 1); g.drawLine( getWidth() - vsbw, getHeight() - vsbh - hsbh - 1, getWidth(), getHeight() - vsbh - hsbh - 1); } else { g.drawLine(getWidth() - vsbw, getHeight() - vsbh - 1, getWidth(), getHeight() - vsbh - 1); } if (hasColumnButton && getVerticalScrollBarPolicy() == JScrollPane.VERTICAL_SCROLLBAR_ALWAYS) { g.drawImage( addtablecolumnsImage, getWidth() - (addtablecolumnsImage.getHeight(null) + imageXGap), imageYGap, null); } } } �����������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/AttributePanel.java������������������������������������������0000644�0001750�0001750�00000030611�14744453367�020626� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnCompDisp; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnTable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.TransferHandler; public class AttributePanel extends JPanel { private MetricPanel metricPanel; private AnTable anTable; private ExclusiveOrInclusivePanel exclusiveOrInclusivePanel; private String compareLabelText = null; private JLabel sortIconLabel; private int column; private ImageIcon sortIcon; public AttributePanel( MetricPanel metricPanel, AnTable anTable, final MetricLabel[] metricLabels, ExclusiveOrInclusivePanel exclusiveOrInclusivePanel, int column, HeaderMouseHandler headerMouseHandler, String toolTip) { this.metricPanel = metricPanel; this.anTable = anTable; this.exclusiveOrInclusivePanel = exclusiveOrInclusivePanel; this.column = column; setLayout(new GridBagLayout()); setOpaque(false); JLabel label; GridBagConstraints gridBagConstraints; int gridX2 = 0; addMouseListener(headerMouseHandler); addMouseMotionListener(headerMouseHandler); setToolTipText(toolTip); if (anTable.canSort()) { boolean sortedByThisColumn = false; if (anTable.getSortColumn() == column) { sortedByThisColumn = true; } if (sortedByThisColumn) { setOpaque(true); setBackground(AnEnvironment.TABLE_HEADER_SELECTED_COLOR); } } JPanel attributePanel = new JPanel(new GridBagLayout()); attributePanel.setOpaque(false); MetricLabel metricLabel = metricLabels[column]; if (metricLabel.getClock() != -1.0) { label = new JLabel(AnLocale.getString("sec.")); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(AnTableHeaderPanel.smallFont); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX2++; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; int width = anTable.getColumnWidth()[column][1]; label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(width, label.getPreferredSize().height)); label.setMinimumSize(new Dimension(width, label.getPreferredSize().height)); label.setMaximumSize(new Dimension(width, label.getPreferredSize().height)); attributePanel.add(label, gridBagConstraints); } if (metricLabel.getUnit() != null) { String unitText = metricLabel.getUnit(); if (!metricLabel.getAnMetric().isNameMetric() && unitText.length() == 0) { if (metricLabel.getAnMetric().getAux() != null && !metricLabel.getAnMetric().getAux().equals(metricLabel.getAnMetric().getComd())) { unitText = AnLocale.getString("sec."); } else { unitText = "#"; } } label = new JLabel(unitText); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(AnTableHeaderPanel.smallFont); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX2++; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; int width = anTable.getColumnWidth()[column][2]; label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(width, label.getPreferredSize().height)); label.setMinimumSize(new Dimension(width, label.getPreferredSize().height)); label.setMaximumSize(new Dimension(width, label.getPreferredSize().height)); attributePanel.add(label, gridBagConstraints); } if (metricLabel.getTotal() != -1.0) { label = new JLabel("%"); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(AnTableHeaderPanel.smallFont); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridX2++; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; int width = anTable.getColumnWidth()[column][3]; label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(width, label.getPreferredSize().height)); label.setMinimumSize(new Dimension(width, label.getPreferredSize().height)); label.setMaximumSize(new Dimension(width, label.getPreferredSize().height)); attributePanel.add(label, gridBagConstraints); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(attributePanel, gridBagConstraints); // Add compare group and border if in compare mode if (!metricLabels[column].getAnMetric().isNameMetric()) { String[][] groups = AnWindow.getInstance().getExperimentGroups(); int numberOfGroups = groups.length; if (numberOfGroups > 1) { int nameColumn = anTable.getNameCol(); int adjColumn = column > nameColumn ? column - 1 : column; int counter = adjColumn % numberOfGroups; if (anTable.getType() == AnDisplay.DSP_SourceV2 || anTable.getType() == AnDisplay.DSP_DisassemblyV2) { // Treat Source view special. Source view has one seperate table per compare group and not // alternating columns. AnDisplay currentAnDisplay = AnWindow.getInstance().getViews().getCurrentViewDisplay(); if (currentAnDisplay instanceof AnCompDisp) { AnCompDisp currentAnCompDisp = (AnCompDisp) currentAnDisplay; counter = currentAnCompDisp.getTableIndex(anTable); } } String compareModeText = ""; if (AnWindow.getInstance().getSettings().getCompareModeSetting().get() == CompareMode.CMP_DELTA || AnWindow.getInstance().getSettings().getCompareModeSetting().get() == CompareMode.CMP_RATIO) { compareModeText = " (" + AnWindow.getInstance().getSettings().getCompareModeSetting().get().toString() + ")"; } if (counter == 0) { compareLabelText = AnLocale.getString("Baseline"); setToolTipText(AnLocale.getString("Comparison Baseline") + ": " + getToolTipText()); } else if (counter > 0) { if (AnWindow.getInstance().isExperimentGroupsSimple()) { compareLabelText = AnLocale.getString("Exp. ") + counter + compareModeText; setToolTipText( AnLocale.getString("Comparison Experiment") + " " + counter + ": " + getToolTipText()); } else { compareLabelText = AnLocale.getString("Group " + counter + compareModeText); setToolTipText( AnLocale.getString("Comparison Group") + " " + counter + ": " + getToolTipText()); } setBorder( BorderFactory.createMatteBorder(0, 1, 0, 0, AnEnvironment.TABLE_VERTICAL_GRID_COLOR)); } else { compareLabelText = ""; } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; JLabel compareLabel = new JLabel(compareLabelText); AnUtility.setAccessibleContext(compareLabel.getAccessibleContext(), compareLabel.getText()); compareLabel.setFont(AnTableHeaderPanel.verySmallFont); add(compareLabel, gridBagConstraints); } } // Sort icon if (anTable.canSort()) { if (column == anTable.getSortColumn()) { sortIcon = metricLabel.getSortIcon(); } else { sortIcon = AnUtility.smallArrowBlankIcon; } } else { sortIcon = AnUtility.smallArrowBlankIcon; } sortIconLabel = new JLabel(sortIcon); AnUtility.setAccessibleContext( sortIconLabel.getAccessibleContext(), AnLocale.getString("Sort Icon")); if (!metricLabels[column].getAnMetric().isNameMetric()) { gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = GridBagConstraints.SOUTHEAST; gridBagConstraints.insets = new Insets(0, 0, 3, 3); add(sortIconLabel, gridBagConstraints); } else { gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 3, 3, 0); add(sortIconLabel, gridBagConstraints); } // DnD addMouseMotionListener(new MouseDraggedListener()); } class MouseDraggedListener extends MouseMotionAdapter { @Override public void mouseDragged(MouseEvent e) { JComponent c = (JComponent) e.getSource(); AttributePanel attributePanel = (AttributePanel) c; MetricPanel metricPanel = attributePanel.getMetricPanel(); TransferHandler handler = metricPanel.getTransferHandler(); handler.exportAsDrag(metricPanel, e, TransferHandler.COPY); } } public MetricPanel getMetricPanel() { return metricPanel; } private void changeSortIcon(ImageIcon newIcon) { if (true || column != anTable.getSortColumn()) { if (sortIcon != newIcon) { sortIcon = newIcon; sortIconLabel.setIcon(sortIcon); } } } public void mouseEntered(MouseEvent e) { // System.out.println("AttributePanel.mouseEntered " + column); if (anTable.canSort()) { if (column == anTable.getSortColumn()) { if (sortIcon == AnUtility.smallArrowDownIcon) { sortIconLabel.setIcon(AnUtility.smallArrowUpFocusedIcon); } else { sortIconLabel.setIcon(AnUtility.smallArrowDownFocusedIcon); } } else { sortIconLabel.setIcon(AnUtility.smallArrowDownFocusedIcon); } } } public void mouseExited(MouseEvent e) { // System.out.println("AttributePanel.mouseExited " + column); if (anTable.canSort()) { if (column == anTable.getSortColumn()) { sortIconLabel.setIcon(sortIcon); } else { sortIconLabel.setIcon(AnUtility.smallArrowBlankIcon); } } } public void mouseClicked(MouseEvent e) { // System.out.println("AttributePanel.mouseClicked " + column); anTable.sortTable(column); } public JMenuItem getSortByMenuItem() { String text = ""; text = exclusiveOrInclusivePanel.getLabelText(); if (compareLabelText != null && compareLabelText.length() > 0) { text += " " + compareLabelText; } JMenuItem menuItem = new JMenuItem(text); menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .setSortMetricByDType(this, column, anTable.getType()); } }); return menuItem; } } �����������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/MetricPanelDropTargetListener.java���������������������������0000644�0001750�0001750�00000006210�14744453367�023606� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.mpmt.AnWindow; import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; public class MetricPanelDropTargetListener implements DropTargetListener { public MetricPanelDropTargetListener() {} // @Override @Override public void dragEnter(DropTargetDragEvent dtde) {} // @Override @Override public void dragOver(DropTargetDragEvent dtde) {} // @Override @Override public void dropActionChanged(DropTargetDragEvent dtde) {} // @Override @Override public void dragExit(DropTargetEvent dte) {} @Override public void drop(DropTargetDropEvent dtde) { DataFlavor dadPanelFlavor = null; Object transferableObj = null; Component targetComponent = null; Transferable transferable = null; try { dadPanelFlavor = MetricPanel.getDADDataFlavor(); transferable = dtde.getTransferable(); DropTargetContext c = dtde.getDropTargetContext(); targetComponent = c.getComponent(); if (transferable.isDataFlavorSupported(dadPanelFlavor)) { transferableObj = dtde.getTransferable().getTransferData(dadPanelFlavor); } } catch (Exception e) { } if (transferableObj == null) { return; } MetricPanel droppedPanel = (MetricPanel) transferableObj; MetricPanel targetPanel = (MetricPanel) targetComponent; // System.out.println("droppedPanel: " + droppedPanel.dump()); // System.out.println("targetPanel: " + targetPanel.dump()); // System.out.println("location: " + dtde.getLocation()); String metricNameDropping = droppedPanel.getAnMetric().getComd(); String metricNameTarget = targetPanel.getAnMetric().getComd(); boolean before = dtde.getLocation().x < targetPanel.getPreferredSize().getWidth() / 2; // System.out.println("metricNameDropping: " + metricNameDropping); // System.out.println("metricNameTarget: " + metricNameTarget); // System.out.println("targetPanel.getPreferredSize(): " + // targetPanel.getPreferredSize()); // System.out.println("before: " + before); AnWindow.getInstance() .getSettings() .getMetricsSetting() .setMetricOrder(this, metricNameDropping, metricNameTarget, before); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/table/AnJTable.java������������������������������������������������0000644�0001750�0001750�00000006670�14744453367�017333� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.table; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JTable; import javax.swing.JTextPane; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; public class AnJTable extends JTable { public AnJTable(TableModel dm, TableColumnModel cm) { super(dm, cm); init(); } private void init() { setupSelectionDragHack(); AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Table")); } private final class AnJTableMouseAdapter extends MouseAdapter { private final MouseListener[] list; private final AnJTable table; public AnJTableMouseAdapter(final MouseListener[] ls, AnJTable t) { list = ls; table = t; } private void editCell(final MouseEvent e) { if (!JTextPane.class.isAssignableFrom(e.getSource().getClass())) { return; } table.editCellAt(table.getSelectedRow(), table.getSelectedColumn()); } private void stopCellEditing(final MouseEvent e) { if (!JTextPane.class.isAssignableFrom(e.getSource().getClass())) { return; } if (table.getCellEditor() != null) { table.getCellEditor().stopCellEditing(); } } @Override public void mousePressed(final MouseEvent e) { for (final MouseListener l : list) { l.mousePressed(e); } if (table.getCellEditor() != null) { table.getCellEditor().stopCellEditing(); } } @Override public void mouseClicked(MouseEvent e) { for (final MouseListener l : list) { l.mouseClicked(e); } } @Override public void mouseReleased(MouseEvent e) { for (final MouseListener l : list) { l.mouseReleased(e); } // xxxx may be enabled if we want some interaction after the cell is selected. // table.editCellAt(table.getSelectedRow(), table.getSelectedColumn()); table.requestFocusInWindow(); } @Override public void mouseEntered(MouseEvent e) { stopCellEditing(e); for (final MouseListener l : list) { l.mouseEntered(e); } } @Override public void mouseExited(MouseEvent e) { stopCellEditing(e); for (final MouseListener l : list) { l.mouseEntered(e); } } } private void setupSelectionDragHack() { // Bracket the other mouse listeners so we may inject our lie final MouseListener[] ls = getMouseListeners(); for (final MouseListener l : ls) { removeMouseListener(l); } this.addMouseListener(new AnJTableMouseAdapter(ls, this)); // this.addMouseMotionListener(new AnJTableMouseMotionAdapter(mls, this)); } } ������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/�������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015126� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compare.png��������������������������������������������������0000644�0001750�0001750�00000001112�14517772113�017201� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���tEXtSoftware�Adobe ImageReadyqe<��IDATxbd@PZE5? `4�3!Ҥmj_5WO\rXQEf0%0%[0!C ʘmclrR"+ 3XebRB~|0eL ƞYV5qWcHJ_>24^  LLL ]dؿy{Hbrh|f&P|:gr*NX@4(w` 6lKs`` # w 7B]"(!a0߿  <Jp͸_  � � ĩ@v&9%%%xϟ c05g3 F߿~�Sb,h<:=!}ĭcha]} Y۶ٵg?zRfϟB>܀aNe&nj:i&F"3@0�)����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/gear.png�����������������������������������������������������0000644�0001750�0001750�00000001714�14517772113�016501� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��^IDATxb?:2�ĵW1`�3`N cHL eqJ1dx:þ%gY/ag2,eY0�DgLS lpe2׏020e6Դ1qb{lLzC� ތW|h0K13e`f&FFOo1|asoՂu@�w3<goR/ N`yz;UM],<EV@�t3 q1;<zϯ 7NbX6kǝw gd甞ʩSNQxX3 q1:U jZᑥqB@ A|8H}�bJDXA/??^pv;+I2nWAՃ$w ]ex)߿T \A@A� X|fXpT6^.>mS[g[1= Ķ1ĂĿ}y0{b+Ç߮°�ĴÂw)j003a041d̬T1D q<HH=Hu�NIƌW*?2H0efb`d:÷w}e ڛ; I�N>3l<gúmnܸː #wS0hh(3ژ1?y>�6`me?t_L;9^z"{\qc'/{ΰq=0�*@C�'C$;3Ͽ >|gX~<P3�Ĉ-; *�PMeg��Xn2)����IENDB`����������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_down_focused.png���������������������������������������0000644�0001750�0001750�00000000216�14517772113�021426� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������Sk���tEXtSoftware�Adobe ImageReadyqe<���0IDATxblll@�01S�g1p)�. r#@�D%,����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/circleGreen.gif����������������������������������������������0000644�0001750�0001750�00000000100�14517772113�017752� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89a � ��q{! ��,���� � ��kྞL:~wQX1�;����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compareRatio.png���������������������������������������������0000644�0001750�0001750�00000000364�14517772113�020210� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������������bKGD�̿��� pHYs�� �� ����tIME  ����tEXtComment�Created with The GIMPd%n���\IDAT(c`?*?++\, ~4PM4D&ga7 8K? L Í ~aJzP�H %�w����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/filter.png���������������������������������������������������0000644�0001750�0001750�00000001111�14517772113�017037� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������sO/���tEXtSoftware�Adobe ImageReadyqe<��IDATxb+c^i,X0.g~=Ó'ON>`ffưt s8#fiiՏ>}pEMMMŹ99?{چ/4o 7n\gf9w!w@z>: [._:W]WȈ|p%)3f3ܹy[+Azt&bCSm=p\vL]L^LXho5 hЏgNoyaAAq)EK^|Qq*K w}>۩,bhfH8|g*`^d4A z:x~@H80�4$~h? z&t~333�K,A6q&l01|'ـO>3z OMMgĦ"N.XhGm�0d8 @uO�`�./gԌ����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/down.png�����������������������������������������������������0000644�0001750�0001750�00000001000�14517772113�016516� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?Ú< d�b10 Y&�hH6� N }�6/uT� AhLn ؀Y6#6u�B\"3~dD棫Y�@L ƥǿ2xvA'm ><H=H@�@0՞3CC->�n %`M0pV>}@� �Аd; u 涤tTC5ϛ9拿Us}  IPgnK*Yn[f@��3$Ί=ChHfN"P1j^t'\3��t 1l A|8Z�j�̐(sZ__ f /{H)}g#��Mh2 %����IENDB`gprofng-gui-2.1/org/gprofng/mpmt/icons/add.png������������������������������������������������������0000644�0001750�0001750�00000001505�14517772113�016311� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?`0^t ɀ ͂q�d�+Ofs0S?x'X}g|8LBGN??vK40#+ ȡ/bF u:@� xA0}�7OaX5wb1L3�˟ D$20120rq# @EQM`Μ08?iK"b &@,L@ L3?}A$w=+~/cR䶬 aNFƳ-_~_'~YD]dmfò X`c01qMw2֖/_P/$/ke~?})=O۔ *c z8^B10p0nn� ѢO!Nf10Ƿ`�7�8 w>݅_2||z/ �Ą_>}\}i7n1{sc )ß>2?0<{돿 �ĂL?Oo?ⷾ:2|y0A}W>ޮy�bDJ oɨKȦsp02 Տo_}x;W.�0C@@̊%;B-@� �^Um ����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/panhand.png��������������������������������������������������0000644�0001750�0001750�00000001406�14517772113�017172� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?.\8 He9 znt5�Ĉl@pb~>T:Hz{0w]bbbɭ?q5H@�1 �းl;߿)Eb|`6H՛ ?~NSax5C+ò5~ '' T?6)%�3�h:/99<5߿_ڤ@`kb &Ϙ ߾dX=wLAcdlkP3П߿|iexo-g1? �6_5ENkMae;u1W.�@`7Ym?br&|i_ _>[5w 0ppq1Z @ap1- p4?g3+ӥv:Z `n߽pUNl &h7nk;ڽu@@tpe_?\4α߿]p[ ƅ&21a{_ FLSrƶl!y͗o>s�@ز3 %# _+ @�."hҶ����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_right.png����������������������������������������������0000644�0001750�0001750�00000000260�14517772113�020063� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������ ������bKGD������ pHYs�� �� ����tIME 4X:���=IDATu �0W'p'cZ^p w/@� qU Po3vS$_ ^B����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/addtablecolumns.png������������������������������������������0000644�0001750�0001750�00000000242�14517772113�020717� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������H-���bKGD������ pHYs�� �� ����tIME8g8���/IDAT(c`07--m/>62`Ab;&r]8@D"�� ����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/open.png�����������������������������������������������������0000644�0001750�0001750�00000001514�14517772113�016522� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?C~mbTdbsi,�@, ߿1N `7o3l߽d A�% !,.Wh(P?.S+A4@�8)) CAB|<N[͛g1,\aߑ �$�dpvvf%ʐӧ} 00311y՛ ߿+~ÍQ4j2H0<{l@� `k 2#\1HsN2xA؊ai eA�bf&0(**1|Fx4 Q0`�Ab7oZ @�1�4{ b ?_0�c l<O_~~fx[V\ 2\zADT7PA׏o /``0Va`+C_s6ÍsG:>h@jچ ba`cc?{ژAOUE@_ >dxA. `:p]=+PxMφ J| ^` ܇$d ivk~2z} ]wN޼O@�vNl   qƿ 2|cctWs�U@L:]ZKJJzBAz��2qAK�F����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/removeFocused.png��������������������������������������������0000644�0001750�0001750�00000000373�14517772113�020371� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���tEXtSoftware�Adobe ImageReadyqe<���IDATxblll@"`O>e$V&4. nGk 6A7"+@@ $eW�1$ M0 @I%zdELXʌgCW#HNmǥICۢ*_xyXX5Ebd`�. u����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/reset.png����������������������������������������������������0000644�0001750�0001750�00000001220�14517772113�016675� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��"IDATxb? L 6b^ 'xu1`�3/LFI=AR^ e8sÓ{ʷnZ߅n�@�1 p J*| >H$RR dȏ?<4%DyX"A|8H�"~eʭk1A�lϟ?8R[a�H$R.@,@ӗ/\ 5}\2(o  X@E%kwn\32`2�}~ Y3� _>^l4y99%5M&&F3|G @y:tj gw6ޫ^~ >H\PP𿵵h AV@@ PW ⳳ;88@^(b> fE�z5�k23_ư~F�b@w@\r K�8 B7 H2�` Fh% � d `�uqa����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hollowArrowDown.png������������������������������������������0000644�0001750�0001750�00000000523�14517772113�020727� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ������sRGB����bKGD������ pHYs����S���tIME3 �|���tEXtComment�Created with GIMPW���IDATӅ 0FQ*jO(̑}0.cDMCqUD8R EIwO/}@y;PJaB4uc I]Mڝ`C]"8:ma %0,3TUsnZwR>]99F^gCEn����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/errorWarningNew.png������������������������������������������0000644�0001750�0001750�00000000712�14517772113�020711� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME;2��WIDAT8˕?Ha 54-AkqC8 Qk[SDRMDTtXPGRm82N}~|*Z@MPyDdY.zɈHF#F44J 5 'ykL+/dRF=޷#G' fu'g'�=W%MʥAHAzʤo(�Eށ�L3c|`fȿA2n m[Wе!\6&V҇%^"D=RJu-�]A3W[{0r�Gy23o����IENDB`������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/exe_elf.png��������������������������������������������������0000644�0001750�0001750�00000001741�14517772113�017172� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��sIDATxb?:*2�V1`�2`vTH[IZ0<}aCo1VfƅP5'@jR羿2� X@_cŔ .[0 , V VN 7ػ- `%" ($3_!IeȦ  ~}b[�gw/taS[nie<]` ނ � ƶP0<\<̰|fˎ;;t%; 6c?ndPgx u8Ё*W}Z@ 5~<Go_?;ahKND41fwߟ{WE�@�1JZNAߟ n\`v; d`#ݏgh/p8�o.ܻ|œ dEM9 =p&_ Ռu�:*y Jf0h;0?s,6ύPa 23\̠Q@L\- l &V 5JZ;ٿh~Ut3 Џm9~|-ʠ`bnZ] 6�N;u~m-mmV3\x!ALՇ aP � w^3or6vF_oft8g`bp`P D3H/@�3###;- gj1\, ?0\,�X#C݇ �@ز3@1 %Ġ#k��Nw*;����IENDB`�������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/back_filter.png����������������������������������������������0000644�0001750�0001750�00000001422�14517772113�020024� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxbL*?1/i M�?upQv68_ _~a>}pE333י�S<z7̈ۏ |c;G  }pM=}= 3wG�W h� �c_ af4o-;7@z>|> @?q (ϟ o`PQQa虵+O^] _�b�b### pux#gO~g2@� b..0ajO3Xƕ 3nb~p!0� &dа n "n2  &t}L`Cc a-~<90 c@W 6- O0DTcvwïW~l�bİvCjbϙ~c� &�] 4@arm4\dH<�݀^д`ԉe2H�Հ@/|hO%#/Szr P غ/⎅߯WsSZ�j�0A�)q5b%t��GXg5����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/previousview.png���������������������������������������������0000644�0001750�0001750�00000001232�14517772113�020325� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������ͣ9���tEXtSoftware�Adobe ImageReadyqe<��<IDATxڔKHTQ\njyfjڢQJ h!HrJ"1&"-\"’E+Ipd(41M6ΝszoJʾ<w mz -L]_f-*0uޫqk*Z,Ѹ B[;-dA]z)VWs{MP$\^ޘiN`I6סaۜFGGk=.#E`EJ(>//gH:vr;r P(a٧@A,!)^|;j7 uvc,!,B(dxz:]]j71HڊR^򙰛pw<y¶j:BkޱOYna/A2NrFN+_{iuQG*v~ZUFM J} IL\虢Rkùc(`$ 4PRԸ6+c8Jڠ@ģST]}&!?'G`*'?�,b����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/forward.png��������������������������������������������������0000644�0001750�0001750�00000001167�14517772113�017231� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<�� IDATxb?Êl h b[F$ %�@ f. Ab @;p #4W,N Gw�@� 5#�|~!v;ؐ(�؀?� >gg«׃VIF@g3 pS?`\_1#^�l@� ÿNwmp3V-Y19/ �m| �{MOY}pOO1$Հ  ^ ^J"LKPLfO=@�]`` u` } _ZxL�bȈ sX3L~;V-9kЋn�3336~<`_ 1��x[k =Ug~5�@� �ge� xs}=7֠i�be"7vط'#LU �6�@XrY${4�@�p/f����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/save.png�����������������������������������������������������0000644�0001750�0001750�00000001073�14517772113�016517� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxڜKANv҃UKJ`N&-BIK)WoxcJBC jAT@/ I6uޑ@ eay~;;&^.%E--6xU_}j&`<lsvR1jk˾r:;oA.8GՁlOA̙`m2eh;"q߀h�e0MpP XE82.mwaY׷O^K6(rq! S{[~b!y+_CQT}X7di/%_r H ew^�lxLO$1j5Iuz6ꎁɌf~nbREL-Ʌ@}#{b1I<1 EWD2ĒCnoGLm]Έ^S5rڹ��/CԈ}����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/apply_mtrs.png�����������������������������������������������0000644�0001750�0001750�00000001171�14517772113�017752� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<�� IDATxb? L 6b^ 'xu1`�3/LFI=AR^ e8sÓ{ʷnZ߅n�@�1 p J*| >H$RRdȏ?<M KDEC5(^ 2PSkn)d`ddD1$Rn8@� '77X@_[X1A h߾},?  y:F4 0 +*)_s㚉(ЯQā ߾9ށ� ^esT6u00a?&f :t9�b(*((4__4omm=``8TD�bD0|D13 �Pfff1\~a t'!/e �  pP!tC�$ �bDV�0@��7pJ����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/more_icon.png������������������������������������������������0000644�0001750�0001750�00000001265�14517772113�017536� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���tEXtSoftware�Adobe ImageReadyqe<��WIDATx|S˫Q&Ox5B.+ w[H,js!%ȤBТhe6E$?|fwfG"C]!~"RP(_pH߰l@(BӁztzHE ? pLChg‹@�;L&vZ׃B�JYrhza3\| BlB$d2.jl V*ʭT*UC>t ּ͆Vr6DO87q<C߇lD[NP՘]&FD&Lw 6KX,R)mOHDpH4tRh4 >r8fQTY.0 IeX E50`YT>VE  ‚柰X,"D"l6KJ|p8y}Oz=Ve?!V"J7XJ|Y.0% M(C<zz.qzt:reCϣ*c?GqGr];ڹJb#>ҡ�6Dw����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/forward_filter.png�������������������������������������������0000644�0001750�0001750�00000001432�14517772113�020571� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxbL*?1/i�?upQv68_ _~a>}pE333י�S<z7̈ۏ |c;G  }pM=}= 3`k <gfazC/W6FFPg0ܽ{ACCa5 .z^!�R|-7.+og`ddD~d} CϬ n])}rJ2�3Ի?~w<]쁚 <<< f?QCÇ^?q FvIR0@2FПiy>g ?g?3DM~ X+ fɕeb{{ۗ]@�Ąn}󇁉 ?~<9 0vX1 I*@_ Kl�ï~P{"ׁ+6?__1`b>ʅ �� N[ Ofw@�`5?f~"�bxv̞2ΫUK@X ‡O_0v__ýV5}@ 0q[kCUkkGVbqr`A� �LDg����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/goforward.png������������������������������������������������0000644�0001750�0001750�00000001235�14517772113�017553� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������ͣ9���tEXtSoftware�Adobe ImageReadyqe<��?IDATxڌRmHQ~CmN7 eD45VIX4T}Տ(1D9J$.EJ},2`9u߫w{a;{s7٘ (o1hK*Nlu'hIXjBEBB$ؚx]_$>;P_f*8D*4SkzOʍ;zNLD4- 2!! ]%LUf,D]y4~ΐ3xEϾ=ߙ!Jo@RZ!"77z]MT]&&[1^uX'zuʖA8jDmN%ߌ|uZMFsVwPfHv0!,Ŗ/nKI M~х3M0lг!# ‹:0Xj'F$+8Ucois1ɏ�쩰O:1G̗KwXЛ&pk,<}}m_C.] ߋQ;<_ %0C].r岴` >SoWe[nu+9Gx,97)[x|/igGm`�幫 W����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/class.png����������������������������������������������������0000644�0001750�0001750�00000001333�14517772113�016665� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a��� pHYs�� �� ����gAMA��|Q��� cHRM��z%��������u0��`��:��o_F��QIDATxb?CǴ%p1011h�SՀ?~0\z!ˑaڦ,ʉ@L0^}xǯ l ) M- � 2012?ax;0{��{?L(Nh'Ï} LVaXv=<###30@ o1ۖ`Wx˾L% z:`lb6f@a`4 _05`<q 0c`a8D� �͝ A/CW6CpX>X~o&&T r>H-@� f&߿~20|pq.ÞL]bN$z� h�]�4׏ 7^~gxC;(`3`u � 203w$+l 'a0WSa8yXH= � l`, e`da8n_0X �1bb#1��YX�@�@ LƤj;  �W@k6����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/fileResolved.png���������������������������������������������0000644�0001750�0001750�00000001275�14517772113�020210� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME./M+��JIDAT8˥OHq?sj˙1dLBǠ?' !eb(`:!402<2yht 4.P_xy_>"HG u �@��^'�$! 0$Y$Y%V3Wyaaf46;RtsL9_rդ܏ʹO&=kvG28X [lox=b9\Գj]]" GΓK3UȠH�;ccchfҏy}_�m0zL ͮ 3 G=Tf.z nBXƐ+.=jP% N?/ZU5g=iI5kn{HsC@ct =>˄+]ӇL{dvQ-[~9}m=L&ma4�8:TM7Z.fbNؽL&,a\Xڊ6, [,L�pop3FN^ow8o)zKj[TtW jjZ;woC6%����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/godown.png���������������������������������������������������0000644�0001750�0001750�00000000731�14517772113�017056� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������ ���G\���bKGD������ pHYs�� �� ~���tIME fR��fIDAT(m=/Ca4 ؕr& 1] "zH# e{w`pҊ.mINqܕRQ)*BK78veN%\M1Al $04>=n)F7WDy1BH(1BH>KWjo\xS!*cgA}�r-ˆWcCVC"&.JN9˖䦆>?X79U@ߜSβ%T[Z@*9˖$qGT= X-I^_a�˶ �|Ɩp����IENDB`���������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/races.png����������������������������������������������������0000644�0001750�0001750�00000001437�14517772113�016662� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?Êl8B 6� @1"$K @�1.LT] a;2|x~;>n;!҅p ?jZ12|L q�˯?tDxY~w/?Hǧ >|{ѭ Lp a Go?rx; ;:[7m? F y^�b fK3E13 y!pDpM r$0mia [_zҕ~O @5?/*@j@jAz@zϟ5?j7n4&'3: ?=c$ mP='?_2|~AlHK = �t3OOؒ@߷o +| ;�^�bT..jS?˿ ,"ÿ.�z۷S &f\I,>_ huH¹4`ݻ  ǼgNM FPfbddf. jCw%J4@v=PG� q9 E͍w}8@�a�3h5�@�Ķ����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hollowArrowUp.png��������������������������������������������0000644�0001750�0001750�00000000477�14517772113�020414� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ������sRGB����bKGD������ pHYs����S���tIME30���tEXtComment�Created with GIMPW���IDATӅ 0E߹t>K$dy 3h�nF i"RbL $ 8 0)rԟ"])yYSUm/e!cuޏq+}�J,N�✋mۢf0 }Hڤ/i+I);~q9pxP����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/removeBlank.png����������������������������������������������0000644�0001750�0001750�00000000202�14517772113�020017� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���bKGD������ pHYs�� �� ����tIME&9ZL���IDAT(c```��|�dX����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hamburgerBlank.png�������������������������������������������0000644�0001750�0001750�00000000202�14517772113�020476� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���bKGD������ pHYs�� �� ����tIME&9ZL���IDAT(c```��|�dX����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compareAbsolute.png������������������������������������������0000644�0001750�0001750�00000000425�14517772113�020706� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������������bKGD�̿��� pHYs�� �� ����tIME T���tEXtComment�Created with The GIMPd%n���}IDAT(c`v?C pqG~|~졚 |GÃ,G2!IDgǦ�< `M(>y">~3 �f,)����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/expgroup.png�������������������������������������������������0000644�0001750�0001750�00000001657�14517772113�017442� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��AIDATxb? 5OR `̮,, ��2�S?x'X}g|8:d @L0Ӈkf_Ġ`Ϡ�A�@(\|^Ͼ};'Ԁ$p� X{_0߿ L@;26=0 &d\%%e0? o_f!<ԄA^J7߿ BST^fXh~[NvvSbk /?�뢣cuuu~__2{#+oky2~�f322FgUX-=@,αwpJg;'~1<}tɽ ܜ@ -e1 .O_� 0в\12b9 <f01tg�Gٻ ?~b8BAJ%� E2gPb`g021A fH/?| c�< . dߗ ?~g`tW6? ff`Kx%|b?@�1H) 0`e  Ϝ ^cIAO{ a`zsh++Ç Wo?e�bfexr_!-Vc޾?ۏ?n^8$7wau~ yy'@�7l:##;c ff<|VLsn= @@@̊8A`YJ@_� �� ����IENDB`���������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compareDelta.png���������������������������������������������0000644�0001750�0001750�00000000362�14517772113�020161� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������������bKGD�̿��� pHYs�� �� ����tIME/7~���tEXtComment�Created with The GIMPd%n���ZIDAT(c`O1 (OB|&2bя_ Y ~7A41\ "ƂM8p!.X2D �vɊh����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/find_prev.png������������������������������������������������0000644�0001750�0001750�00000001405�14517772113�017534� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb? L 6b^ 'xu1`�3/LPBSā_L _=as�˷nZ߅n�@� pTXk` #+_+1zؖ ?޵}+K� D#_…\W@AϿ`A]�@`~eɠ(_ Ƀԡ�@, ϟܼ<`a +<H8@�11߾}? 7w1N?~c8H��bE%k\7aٮV_&G0jx2<x(k�/?/?ф<C ?dȜyab&Ͽ~*2l^: �jWn6)~ dfp>39� #Cu~1A|E3ٳ �FAWY --(A?- Z(�4LظЖ5p ġ@\33;88 \⳿~$ ӧO c%M(V0_3sv=2E uFF! ĝ �b�PRH# uC@b�0�6~8����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hamburgerFocused.png�����������������������������������������0000644�0001750�0001750�00000000243�14517772113�021044� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���tEXtSoftware�Adobe ImageReadyqe<���EIDATxblll@"`O>e$V&$^ )D%P:qy8ˤ$#��ؐ(O6r����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hot.png������������������������������������������������������0000644�0001750�0001750�00000000461�14517772113�016353� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���Kpl_���tEXtSoftware�Adobe ImageReadyqe<���IDATxb?`d_FbBRP 3`(602k�q&rQ 6b! N{  6H *R# 9@kMjNbdT'/00  9PM3A�# AՀ�s4?HJJP j3DP PvC`9:FRc �{Vu9����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/color.png����������������������������������������������������0000644�0001750�0001750�00000001640�14517772113�016677� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��2IDATxb?:t�R@ ??  HV6cƠ-o[n==\d�b_~>Aa>ŹY>˰[O9n~w @�1!8-%K?\~k0Ab 9d=�Ă翛ë1 9dq�{ayRM[U9(r0bx>g @>]͢、 �86<Y\U})6g׮2\<s. /<X `I��A�@#$4MN� ���� �� �����Noq : "x0~ ?ó+>>f.Ƞ8�b㇛(y>An.n320 X%fNN700Qo@,>>vu5¿3|y 9X &ç<';;I>fM?h՗zZL៰ `S1<{ ��A� ?� �����$� ����ÃκE99,AN~.*o_|:7�O@CxA Il q @�^L3^����IENDB`������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/base2.png����������������������������������������������������0000644�0001750�0001750�00000000401�14517772113�016547� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME 9w���IDAT8͒!Q D_7?,j @ C@ t:p^͉* YNujM �r}=rф 6~�˙>m2fP�A6&In\�|Ky����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/delete.png���������������������������������������������������0000644�0001750�0001750�00000001411�14517772113�017017� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?2H/ocR>}߿Zc|S^z4�@0L&&&F18> #'oΪ, DgU5765313202<? |gx3,ϟ~ư~j!Kud�ѱ ܜ \ _`x3o}72;r�r*vVVVF?pdg@�](͝?`;_~7�d7v]� ,N`mi ,$Ơ )�R "�f�_\g 013</ b 0�@~y  fcHij�@��?BÃfDq@� ,a(X{ )w �@H.Pag�@,H.`\OfO2^ >}cx'0>7/(!0 � " B \J ܜ@o!篼4 0Er@� 3KC�?]c<7Se '$��+*~����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/sample.png���������������������������������������������������0000644�0001750�0001750�00000000714�14517772113�017043� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��^IDATxb?CYˤ' iWM O X@J'{׀O 3TAbw/Ā>@S�Cf]  ?P?a `( vC�Հ?P�n�{X!l  ޾F37*<@�A |7 ~c7��p.UA&T@ � xoKwE/]~Ͽ`�& |FK(Q~*@W XWk!++$Z<@�13##͊].0�UV_}Η����IENDB`����������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/func_item.png������������������������������������������������0000644�0001750�0001750�00000000533�14517772113�017532� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<���IDATxb?><@�11�+@ ^y�b9#a] [tp XG&7d-+؀߿2<d@�bϟ %�>�/H7� @�...2 hYT 022�yxxٱc 3~7/�y  ^�5|��+Mܻ[����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hwc.png������������������������������������������������������0000644�0001750�0001750�00000001233�14517772113�016340� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��-IDATxb?Cpx3C&t > @�x#[Cխ[r^�b7/"<OC]-S_O/SUUAUEۡo xC]MÍW\ @`Μ= )%W{ efPVRQRR#zx ck7ß?lVVV0۷ bۚ; 0 zz?`;we>ڽ{>  22 g>e kddz@|�bfpUj/H-HH ϟ( Z X1{1AEx5ԀRF��,i)a@p10y s  ""@L.�Sc#0F@p/}-`ZNZ '��b߇|gcccPVT@$,lfZ )QdŬ3"  Aq q(3~kޗ�� !����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/oldexperiment.png��������������������������������������������0000644�0001750�0001750�00000001353�14517772113�020441� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��}IDATxb?:(--2A߿3aɌ X�@�`_f}}=ŋ^|Ȱ}�6>|fΜ9 jjj lll 4�@�1@.77'^?L<((]-@�10џ?^zd t�Հ\eee111+V DvvDd�Ĉ R@FOO/3""/_fx5C\\%IIIԄym�n@||<?�ϟ?޿sP2�$$$[pG�{!6]BBg;Ó'O.i?;z X �ܗ/_>~ceee`AQ @V��$a 899~$ X`Bؿ~{>@*,,d|܀O>z Ç޾}7)))AMMM`Cɛd8X=H ౠa,))Y‚" @� Nw^~=ƍgn�0ðc!3[9 0zرcPo�BIH C(�1+Z> UJlAA|��FL9~3{����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/blank.png����������������������������������������������������0000644�0001750�0001750�00000000300�14517772113�016640� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���sBIT|d��� pHYs�� �� ~���tEXtCreation Time�04/11/08a���tEXtSoftware�Adobe FireworksON���IDAT8c?%"ݣ0j 2��c<4����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/warningNew.png�����������������������������������������������0000644�0001750�0001750�00000000515�14517772113�017700� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���sBIT|d��IDAT8!O@k #$  ~_CRC1I8f�AHp$Hlm_z+'9>#*]<şZЄs#n4Aiw%ՅEL2[U=zG`F>t?ft͜(u0>Fo[|2 5[` b</FVQ``tć3Xļl_mH0`AU/oQQ:k ﰽZ]~{|?<����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/tab.png������������������������������������������������������0000644�0001750�0001750�00000000665�14517772113�016335� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������AĔ���sRGB���� pHYs����S���tIME ); i���tEXtComment�Created with GIMPW��"IDAT(un1D߮Gr 4DB?* By7q DVg#U=T �9@64\n{3TOtg;5햶`g\ҶG''P "}3}`#xdZlh_ߨ�?vşH%ܝr֊fft]Ǽ]@"D{z\0347"`e(v;J)* ! >7MCJi\@N)%jfAå;Diu-&aiNJ:mYdJΉoTw2N����IENDB`���������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/percent.png��������������������������������������������������0000644�0001750�0001750�00000000676�14517772113�017231� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���r|���bKGD������ pHYs�� �� ����tIME'I2 ��KIDAT(Ͻ!KCaS0"cedAvp4XAMa`[ Cۊ\wV͋aX bY`%'>2"J|&pUUYʀj7XlVg!`"�}N$r`%MU}^Oj*;R՞$l& �BpK8S_AKGD61'Fc]D1U\Z.sQ&Nu<pm*"rX<RqM@U;@+^%o99R#0 ƘW`Oo/%rp4����IENDB`������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_down.png�����������������������������������������������0000644�0001750�0001750�00000000224�14517772113�017715� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������Sk���tEXtSoftware�Adobe ImageReadyqe<���6IDATxb466@�01#5L0.`m&&&pΙ3gA1ȍb��L" kM����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/circleOrange.gif���������������������������������������������0000644�0001750�0001750�00000000131�14517772113�020131� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89a � ��Ò!Created with The GIMP�! ��,���� � ��kྞL:~wQX1�;���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compareHamburger.png�����������������������������������������0000644�0001750�0001750�00000000327�14517772113�021045� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������7���bKGD�̿��� pHYs�� �� ����tIME0 ���tEXtComment�Created with The GIMPd%n���?IDAT(Ͻλ Eѳkb$k #37}_p{7{"v#?~(pFnkx.:~����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/find_next.png������������������������������������������������0000644�0001750�0001750�00000001350�14517772113�017535� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��zIDATxb? L 6b^ 'xu1`�3/LPBSā_L _=as�˷nZ߅n�@� pTXk` #+_+1zؖ ?޵}+K� D#_…\W@AϿ`A]�@`~eɠ(_ Ƀԡ�@, ϟܼ<`a +<H8@�0_qmfrsBSj_1�~~ ?R |ѝ&l׷17`r0�g5d �@`/|y楳M|$\o1<z(V�P'UV`5 33br>V/P��z7e6~<;2]y Mɰ~F�GW UY(aO<d prr2hjj18:: a"PYh8A y 2 �6�fCe đ@p`x1T2Ț"  ѢN@U@X0##= �O2����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hollowArrowRight.png�����������������������������������������0000644�0001750�0001750�00000000443�14517772113�021076� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ������sRGB����bKGD������ pHYs����S���tIME2A<���tEXtComment�Created with GIMPW���~IDAT}ϱ 0 ލ 44DM<�Sp _O֚@sHsQJɼ;<gA#8A(Z+.;'$i,9/Z7'uו����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/zoom_in.png��������������������������������������������������0000644�0001750�0001750�00000001233�14517772113�017231� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��-IDATxb? L 6b^ 'xu1`�3/LFI=AR^ e8sÓ{ʷnZ߅n�@�1 p J*| >H$RR dȏ?<4%DyX"c4Ƀԡ;� X@_5Tx٘~ A y:t�lϟ?8JӛVe�Ƀԡ�@,@ӗ/\ -E`>8Ͽ @y߿}u�(*)_s㚉%6t @yo߿_C �/?/_6gOİe0 A u^� B3ݽ/۸{zL qAAѣ  9nnZ3@_A@4ξ߿b@�1"{ >@J A dff1\~a =�Ā$$18!p�Npʇn@�d�!@hJ�U �~hIR����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/caller.png���������������������������������������������������0000644�0001750�0001750�00000001104�14517772113�017016� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?%� X`ܚi@*/ܒoyH) @.�ab ZX1H .42-Ù_Z 1߾~:V} @h0Ć@NII93g$�7߿ `N?~{: �DЀW^1c ^�"hׯ_ݻ�@�!`0222̜9<<< � K@p�@sΕZwQ X2W͟P 6@^V!,1dhz d9"@�1{; w^i$JmM^�m} IY}ݝ ӻ#&d 0Dm܋E*>q>kڨ_|� C?i `�@9Ȏ����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/attributed.png�����������������������������������������������0000644�0001750�0001750�00000000672�14517772113�017734� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME&|��GIDAT8˥Kqh@BH hH(%(%ZZQ5PȈ%hkU$;QUz =1Uxm EkFۊ_><wrz`(B*1“ ۪j^ڗl@kՊ\UDZ%BA \wĉA;ƽ|�` T83s&�̾q�nl*G|C�4ն) \Inf 4  ?<yW/Q?DUEDpTZ*tAƉ-5Cl^a j5V����IENDB`����������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/connect.png��������������������������������������������������0000644�0001750�0001750�00000000632�14517772113�017212� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������ ���v4A���tEXtSoftware�Adobe ImageReadyqe<��<IDATxbdJ{ f ) .? h|nM;P y: /^~Ƀa(%PWQd Bt1:`į_04먀1Xϟq߿ɳ^POXS` ._h޽n:sDE?(b/_eصf:,oAcǰ] ^^vS)3a ]s^nE?\3wO^@Gv A6q� �@^!����IENDB`������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/nextview.png�������������������������������������������������0000644�0001750�0001750�00000001235�14517772113�017432� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������ͣ9���tEXtSoftware�Adobe ImageReadyqe<��?IDATxڌRmHQ~CmN7 eD45VIX4T}Տ(1D9J$.EJ},2`9u߫w{a;{s7٘ (o1hK*Nlu'hIXjBEBB$ؚx]_$>;P_f*8D*4SkzOʍ;zNLD4- 2!! ]%LUf,D]y4~ΐ3xEϾ=ߙ!Jo@RZ!"77z]MT]&&[1^uX'zuʖA8jDmN%ߌ|uZMFsVwPfHv0!,Ŗ/nKI M~х3M0lг!# ‹:0Xj'F$+8Ucois1ɏ�쩰O:1G̗KwXЛ&pk,<}}m_C.] ߋQ;<_ %0C].r岴` >SoWe[nu+9Gx,97)[x|/igGm`�幫 W����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/gobackward.png�����������������������������������������������0000644�0001750�0001750�00000001232�14517772113�017662� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������ͣ9���tEXtSoftware�Adobe ImageReadyqe<��<IDATxڔKHTQ\njyfjڢQJ h!HrJ"1&"-\"’E+Ipd(41M6ΝszoJʾ<w mz -L]_f-*0uޫqk*Z,Ѹ B[;-dA]z)VWs{MP$\^ޘiN`I6סaۜFGGk=.#E`EJ(>//gH:vr;r P(a٧@A,!)^|;j7 uvc,!,B(dxz:]]j71HڊR^򙰛pw<y¶j:BkޱOYna/A2NrFN+_{iuQG*v~ZUFM J} IL\虢Rkùc(`$ 4PRԸ6+c8Jڠ@ģST]}&!?'G`*'?�,b����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/compareReverse.png�������������������������������������������0000644�0001750�0001750�00000000440�14517772113�020540� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������7���bKGD�̿��� pHYs�� �� ����tIME-[���tEXtComment�Created with The GIMPd%n���IDAT(ϵ1@_b.$xmy$X[�j)\#L& 2ye.Z |(@K�W/ @]}âڻa�+ @ SYA@Nh�I9/n*7n ����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/badexperiment.png��������������������������������������������0000644�0001750�0001750�00000001431�14517772113�020406� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?:H/k20]Y��2�7u{Ox΂ qt�Ąn#|~45uԴ@|8HY=@�auU7qbA HB]-@�0` f h,{8B�j@xZI20mbbɐZ$\ d  FXM)R5zzaa c'X{'f=;mY=H &ٝ1麺 ?c/Ów?~_8)3�ŕ_?@p/;)]^ _ _e<,qV+.lgd x4-E/+y֫ 3ij2;s]]Al/�w߿%A(S J L ?b_gx=ÇcXY>~ X X`? s}w j͖lP$� q3nܸy3�O߿{{tzlH ౠa`,")_ob#[2<_}!Y^%>|pÇ4��l:##$l o#p[O00, 2@, ĬHB@|s��j.R$K}����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/fileUnResolved.png�������������������������������������������0000644�0001750�0001750�00000065344�14517772113�020522� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���sBIT|d��� pHYs�� �� B4���%tEXtSoftware�Macromedia Fireworks MX 2004v��%prVWxM0@W41P bif: @.*f]J@ȞgECvM%W/գZ5+X +".bf1<jq+;M|m:EC؛h\['zھ%LTUkQDhX���������lI1dIN}}K?,sui9rJ'!"~cJSv>s^ͳy;uʗi-�����������+;{yG}\:}]m/7W z���HmkBF�������������������������������������������������������������������)3��UmkTSx][sƒǑ,vr*/ڧNQEI1%1$eyq aD|tK,`p%6DCbp|eݙLYɴ62=N;Te͛7AnϛKÜu{'xtcNѿYݾ6:kg5U֔*2VD9B:C/lmᢍm6;FtxW6f.kQ_oF66^QsOۢ>jзV#יLg}v~]䐝58#:kkiԴ`Y.dSlk |:v\A!1v_=)']+TlL8UFQSqFG3<π0x3u~ go;ǀ5 C>�_p�w P T .gL81[ihr)hZ kmK u0?pHd>�LtqK§6ʴZ)g.n mF1{^nEtrڗ>l$c,NV+% `6bѺG<B>7 tQB=$0W\Ri0V'}8mJqW3R&Y !!d(/kXb0Y i`Gy j4K58ct!kTʠQ4*FeШh684۠A�P!|lD�9f @ۅ  !!d2L>k$۠t6ϛ^ݰ/I 90-y,>Ss wF%A`r^fQM5ۭ2$I/-{ZpxmhإtmĠs\xAaV%.dE; V7Hˑ>zVNTW߀&W3biC4Z24bC3ʶEr !lD8b+Kh]V_].C= 0@  M8_KMw)~-k12sJ+GqXE2`&1ȉ=nFP�>ÇFB1+=s nΠcN,ZCJnbGp=3G%4w n ś-Zk~7(>t%@^32Y45dM6ý.%%95t6f [Fa b,ݏj6}t?(i. 0r$I7ѷ Ί>ݰ2- (dgIA\Nzi24/JgYP=PV bE:MA$ :}0I[X/-+y-5SB |ïӔtG|V9k.bs׈/Oȧh|rޗ 1KfN̒i 9E**@lbVnYOM6ON|ӜqϿs<%K47QbĠ2:, ]׏IF1g别q+Ppt[O\ĖL _0{43>b r@)UJA0Pu ވ'+,j5a|ˁu㇮!|NAݮyLO 7Fr�tBcd.ÞZZB(E8Le�k :q)U/SR`|))QEWj)f1p}4/ @=)~3U>\׽045e)A-> mtj%>]h˩G5OJO9oǼ B <Ke#Q螥X*`~;%,%I>X${Q ʃ] +oɌ0 <PF?% ;2ܼnDI{W/{tP> w+N 25dQ=PS[ *;ʬ-=B^NA-昉 c%'ݙ2b =qfv(Bb yȑÞu}d)A>Laҿɧ#kP,`̙<b)h5n5 }[3Dxy <ϽpEJW !$EI$F8bde-9e H6bt(;2kYEXs 2<¬IU2voc~)8a= �vN?ġ4fYZxyjLF4& %#3]9NQg:bRomhci F|Xǖe+rZo vE?@zoOOItO"';]:L*;L5C:)O$x f(OޢD0z�G3;.29tr&Ӧ0kY2ŲZ~RxM ѹ'q.Tݢ\ "$[WlȔB}!d4O@Ka/ܳ '@Bu$'ZF*_-,Zݗ5ݧbPy -^-OT # j(odp ۯI\Dd`{ ֳCz판/(.u00ؚ)u':IQȕ,_0]a}|nf1JƂҬnN[p=A v#JAD/ HB9IBh1Z,8h[okuKYsͬ؀ј C $Ά^007xň`3*Z{v+VT7 ui~ >J/ɚP_[WpO9LnF%"rr2.-VO d$$>$:`T-"q.�p r3JrelIK/NiHt[ ^'$l/'.˪UFZ "гOB' IƤUUFZ-BdKe$a{9i9LZN%"zʥ˟EDNr8ܣ,LJEd˲A3W<<vX\&'S9 {{Ą|SNf#&Q%2^ -Ǽ|Ir3i+iI;rta$<&9/2@Pi(>PܟoF?/7HWzmj!D[M=͈|3#xl ؕi)9@o-6,^먎w5-׶={W:kVeCH࿸D/[Ff3m]V>6<˂Y=ZA2ݜҚ Oe"˂wۣ:ݒ QH`Sǟ$ ZCc%Xmǩan1HA@pԜ_< Rw~EqÝ1.X$Rydԗ'#Zձ/K 5VNo),aj3wRLq3ϕ.,_�g/ Aw. /,793Ē%e,U5.̿>%PN;RbD^.Hfښ`�F`�ÑZ5y1FCwrl_KODZY6s߁kzM&)66=JPr{0vU-I'ѕs=\~A\+bzR/γ,ZPKײ�K^iW1sEw[n+49&h3G~+'yq~\v;isg"U<zh?1g@}9^s41Lڊ?+g'6Dcў5A~E6G|Fůs=zZGiho%DK8f H/g獡1=TtUp9b^ux&Z!7` `4g;3,!-ʼcBQ&ŞRQ=9nҳZ(v~ 'RI?pƩI6‘=zqDw!;24r]@KdsY׈ /fG0Z Qb ]H5t*2Qc#ׂ#E_@0&Gqɥq 8e/:yA vCUw+ĹD%عKkW\󽳳Us;`絀ozhsCW } mW ]1tb{ghk+bhCgh?-R8l슳+뜳'芣͊+8@#CW } mT ]1tCK4\yU\kgv.w;;W+*v9;{+*^VU ]1tvVU ]b< ]8{58ZyWqvy8[\yWq*pt芣T>wCCW+*zM ?$ཉh]de[]1gsZ,@#Gg^<gSI:WK8G VDWꞿ{oNlauq5F/X6 7uƆ1ɱXwr#Q>VHTlDycΧ!]„Z5+bVX~:Se"RܢbZ,Gu<p-:S6ݣzVSmYN-I~?zh>nDδzţ�?F 51aZX^eIxW#TDuo8qCžiπewp;W)rb+~;\<`xL Ws6`OdP$hO~ 6fHwA0@ wR穃mhuxLS8o6bыb,+k~Ѓ2w2Lԅ1G bjDwxJOC#x~M`'#iw??*'_)ӯ"}ѻp%EIGƷ)A!ϤHړ9|t"FmJȾz J6"&{,`VP6F;#_%ޖqk1v~7mU1tCW E00r įXOaeb|.A7tZjy|N5qF !TF.7 r9}r<R4ۡܒ|'BPx5E:i{p[tb[L`"J =Ɯz'>S.@ۍvnn<zfjuY[ԥz(~Ű_o^6\H_M4k2YPFDfi֐̍%1he9⳽kM-dR~[<چ?a zem̀ߨ.& [EV=܏$1͒:σYheJu>[$$_c9%AGdT_j]:ϕ=82 m{$İ7|^R=H~I:cD<͗ _6VNRK)s؇]?;|;@TeGځr CԀ:_ݏD:7ѿP,iS,4vL͈A>!4 YߤHy^? k@t;?*$;RS(ѡH& B$(ƅٔ/; ޏK3Kr ?P ~J<zQ|0"o"]&4y#]Q,f' iLׄ`-BRz5".}#.QDZ<x=[ ğxG3W|"bllsN/m k[<qؼKbvYV˞gJAD0ѭ+ȹT-^UST\YJuY'c)uh|)lSԾ5It8r왏~y`FoE$O䒤 }\oc4< cт$YȞ( *'/'Ȣ;vL3dpD3d}B\'R=EVTO}=O9-ؑ#:?=1qy ⯏?IO%q4U'jݠN58ʇS:cHXJ~z`}ǖsyN:eX fuɩNs!44h<%]2ٌhT(FeP0Ч#߇|u)HFU56EUB&q aD2lod?Z웪o@r?Pݗ%8 ,Nj '=p 7&춨N:|Oڬm..g)6iv.(sW7Qg~].ɴLOE�Ŝh{ڹx ;.66Ig@n;'W�BmwڬQÚ&5=8l{xNuk¶Ǿ e_x_{ µݡ;ɚv?zKizxC<`߿7& ZZ7;mpNiisCv &S{F5@AC5`6v9<]00[TI#_;P;Rq5=pjt;m]<+ܾ>e9ܻhE<kIm46W'5uAobpeHq@ '4Ȱag_DYl/.'v^y;;>EpRӃo [2T#@{M^c"%B=6,{,���mkBSx]0{5|Q_V ؄&MfЃ{&;;ujh>u5z/LcFT яjVc{AZڔ^p u9ZҀ ن؛=ؓmOM6s[ YN\f_sgzUN wRm#%+% cVC~:LBL :\:m�� mkBT�W��������������������������������������������������������������������x흍8 FSHI!)$FRHnw HYx3ꇤ�saaaaxIǏ'U{o_ھgW9 o'GW {>~Jlo߾)*/N\ϱov[iZ_ձaJΝ/:6O- 92b?Tlk%?_21B sY5>:>�c=1Ow y^- ڶ,Xz�usM#גU]>H_yYv!ۉ_mi Rus]Xm_g)YY)m]y,m z1aaaxEߓGקo/Y\k6xjgH|yu.\aæM&wk#ϐ$?]Mo\Ⱦ,/ڥQ@~6s?)}, l gX #vQg Bٙ^uのuhm?}{].~}v_J;xogJY]޳@.)oqC?}>@Xߘ'-�(W? źvƔOʙRv[K?[A}?-wmՑ}<GcK1}uxLzަU0 0 Pc[<>g\=c}M ggg DŽ-B^k_g?F? v0||؎=ǧHPgs/hؑI t~{n^}ZyD5XWvO)"c0vY Z|~_%/,p\ɹyΰZ/;/xs_9?Pܯ5ݻ\[y|č8g�ʱL{? 0 0 _k3>z_\S |<)b|7aaaxn.ta?l^Cvkؽ#~e)3<3^kdlc&jK+o"e<.ʞ`^(3zu l+6v<ï k7]/lc[`On}򚄫 G뎱zt^v2)?;Wmr5ocIz?Ozx{&!ez."ѯ 1Gg{+ҏlw<=}GݽFƨ^)zIpG K�֜{{e G12ۭqiumf>.}~a? 0 0 [u+7Svq֭y΅ ?ނ}XwŶv?ߩDZۓ-q/?߳=<~#>Fk"qzrQo 9r,nY[;o:)@-`ק-7({߯S@µK9֠ɸ>:n3 _[_*mtcmC>qSL<?<nѯn!>=<6;ǫsaaa{xˌ\ފpx?0׋#5zяc]x^l򼠕(f:~٣^lin59W~\;?vn6erUbS~v^U O7O(|;+SG4|?f*?rW~2oNٟS9~daևmH6mX[J~s.ym4ٶO|Bd/b5ɿyU? 0 0 0 0 0 0 0.P~*1@G\⟿KrKXs2(ߥ纎J8'>X@▼QQbqwx b)_K|v 1M6kee-2Ǜ59?K^E~9ϱQﱮYF8N?~;:=J<-t�ĒyNAgC \NXKs)'^Kg\~2}6}Գ)n]Or^j~"{p29w6/.z-v:+M{WJYZ굢`% Ҥl9ힶկ#OUz+U?;sd~vND7*.Y+v:ye;8}~|+ÑޅN9}{Bƞ#txխsXɿkSV/uJ=o G<ջL'L:D]6jfgLz/+ؽ[{rCMYq~[{yy czA;w9zszWHVax3� %��mkBT���������������������������������������������������������������������x흍) q ĉ8D^>׻gI@XjjgiЃ`0 `0 ?ϟ|:s�eQ3|ӧO|:2|.};7eGFO6_Qv]T]^ˮg{>pjzkuo{yye?{-x/ D:3D&򈼹e^Hyi#/OGzϪ߯_~ :sMe#M3Y#=2 QЙ[\s=E8}E>GȩT ڲTg-}VfoSVwzV}./>~<Vrv@>!?U1<#}=F[ ~QڋBN..+푹^edLo+[\-k dW(}6q$#?z6Bөi?L7!3O_Q}Пuo[=tkȋM!'}/Ƈdr2_Cﲨ: `0 :8o=+8-4}۞cĥXdq{bUq©ήm!ƶg*ΪU\z[GA=^+ru{LV U?)V>ғ)x|Yҁgi\yi^cUo*= !TY?rfgWsʽVn*VX#=Fϫ+[F~yH\L~[O҇h5ݵTow|Sfӟ+);F;:x )/OS yUo2e)Ve3'wgGg=J^`0  ľu kU,Ksؑ5nY,bXw{ w&3QהNQev ]ƷgcH˞i{A3I8hwduwUIWq8I>+@pQşGcZ\ƪUߝ]/:3d;ɫ:gB9R|GW~w2;fz<AǏߊg_ly=Uy3= [6_3]U_k]]ײ2;j->t|+i5nΟgZY|<1NyŬ|E7k?z/k><=Α}N΅>uWydʬdz `0 *\?W8GY:Dgcg< 2+'W6qn؟{ru"w<Tk.\rnO>U쏘~c#T?+y{Q,,^qF/Xv8.֩g3}ȸOP ~n%hUG4(_sn|W}Tg&x^c,Fѭ+ <#+}/Uw8BRh_|33!mr\7U9m({ѝpvew[xG]߱?g;,nҽow8]וb?OV=Z_#ve?vN_WrYLo;1g9pV^G~>[_vNOS3 `0Q[ veO\k^8�֔v<Zbz\Opbn$~}oz3ј mK vU]^iNWA#x딫jt q :E= z%օq)CcYEqyRG-+u (K\hP'*^ء^q=m=y|Kvūe\rȊ4={W1;=ݷxp;o@>ȘT\Ԏ+C=*ɫ|GJOCW]x1.ﵠ9_Eб Vq)v(ʑ}[GwǺ{-oSdו_˞׃2;iT&w*w:g׭SOsj%Z[~_˯d֮+w]7 `0]kIu+eL]ւoA^;=GR?�v쯱;<y o$N1紈=:ߥPVu< <&3KyC/4r)i=*/|Ύ^]QNН1qGw>ù{ <FVr2nlo؍ا|mo'qbӋr`eef6 0lzsA_x7췣*U}R%+C_ ڟ~I\Q~ky#_jo~DyU^`5pko?:ˮCw>?Kv:A}E:_n+{u=rq͓̳]>>d}+|L01`0 leg:׺񶊝`W,3O?]\9P~[kOWiGc~)-<w.3q}'vuw$Vnv(r52S;Wk_Kϔ8B/hEՠ'9w?K;x:x<|@cϽVyc@ۖSw8Bq]=2lBe6V}eR( VeZT4ade2ޒ+nYBTqSߔ<[&=f[|szP)G}{Zׅ3n7jpWwftEw[ǽ;`l? `0 `0 `{~i`oLy>uoi\qK|}�7Svu9G쯿c¾#>,jow{ՆݲL=mW2u_8دjo?kD߱mw>#}E:OۡO;<sy}ڛk}~|M'8CTo+[WUQr'\'tTYwz.D=W|~q=_�yMǏktbS=2|ұyN_}Oe摽ۏtLS6q`Cjf3#ܰ?z1 H]\"W]O;2'@@~tG:{u7m1Q]PWV2Sz]ϥzs3]vxwҞ:ڗ>y`$jw��mkBT���������������������������������������������������������������������xֱJq#K{+H"a#A| lVX]"ADba3; W|o,"\" Se\`v/ޗ85.[LΙ׾NLާLj99gU|}5=}#ndţyh׾,-qw1:sF'Uﯛ<Dp?%8oVGUyΙ׾zkYJֽi6W^o;KY \?���������������������������������������������������������? P;��ymkBT�6��������������������������������������������������������������������x횉m0]HI!)$FR?6c<lHٱd tC"+RJ)RJkJ߃L_SUn7ss~uU-Uyy9c/Juz?i>>>~�sm+vuՑνYu8uN?WP>1JsWiV_uKEϸ/rˆ_gKW]ױEYcl,[TYHT}xL#}A GV7^}>iҞ-i;}LJX&TP3T#ߨgJl e'=?͘ona|7>?ǐU%;/mN/IfQփz{<d6dn;Qm{{5$iѦxg<$"^%=RJ)Ste/֔ a};k_y?9Ԛlz}m#GKk!k(9G1z,Q&liV濊#_<3Ξm$^9g {9&w&:˙uf֚R:ֽL+mWW^z%I2loZf?k4W-# ?V/c^!!{u̵ʴUٷAGe>G}?v✽3X~j{zTAO^ʰ>?sy|G)P</11~2ў׆R/7�Ӿsmsr"(2cϹ;~u-)}<U1g:apb5{3(k!m'mʞ2.~[)}GκbXELp–aԃ77Fy0@ߋL?󞕹Khi@=RJ)RJ)RJ]M;;j;��SmkBT���������������������������������������������������������������������xi`Qqqqq ! COMlS$I$I$I$I$I$IqO9˵wOo]ss,Խu˲<^0 tc}av=7_{V9z}ٿ^s_y~?}ez۶@wE՟k$I$I$I�����������������������������������������@? R*f��*mkBT��������������������������������������������������������������������x}+(H,"H$"#X$,QԈZs>U{ ..T}6�ڳ-F`p]k�߅~b  О$wݓٱ|sCo�A+q3lOx@(0a+? T,_7s\Ϙ^Bl1)C+k(FyN"8dPC_9>O0&l4Im+nwGrŰ<Qq  +H} eq~~[).5c6,muO9p\<//?N:M›p) Ĝ-2p'uKq`_/64<~� 77SNBQ맨uM{5%.BNɊ k: kNm9*uU|2%;]Faג) RE%HWc0Mg>)/tihf ѸX>E)<,6s45zb?J\<OM%O#(76:= ӋYAƒH Ls6MXBcX&ǘJte. 3.je(?<?-1$pO=�x ]<Jt¡Vg`|I,<丕}FQj]o%[Pa6XY<?Yoh�F067ၭ6JFG[wv)7?,@w nMǦmk>?Lj=%wZizFTx$kP8Em jAOހ>~؆B9 ֤8UKCvjbL Cy ;mj P. DkwUE€3ܨ8xUJs\ɟ+;}sFQ(KIXݛƨ 1 +KdX];Jģcx$D׷X`i @l̏rnm$^9΄zBGϞQ=nfkDe; <a>,⢞jk0B[p($�Ǡp4 nq`XƓ vϵ.xHnorJ5Hu뇗 f a[Z:><M@J9$q]�}=H k3鲺tQ=, 7߻s >36[g RL؍?( &w.7C#~B{] UW 71jk~ecGrD.=K@WDZM0倐0\xvqNZ ># BE )&yA}t?B Ym(WIpɱ |2+\2 )l8tl@Z.Be񅋍RSƃm>dIl'N adĢG3%#)?$s _5=YBR#-k"qGP-e"f%֩-ϓ378M9ϊ,_*n;HEBƱcl~ ˝[/sagIE2,z1t:kLș壋G){7ond{@rP>kwk׽ #kXfyEAB9uM4P=_lgW؇N#_nGpp ,ZUu6ȓVӰ0EK7*|]{75F\ԶzQz! uH>upT٣o3P)[^6` -d&*=%fY<^ط`_6|h3ء>2 Pq7ώ ,NsjF=B` 큳CiU)R鐏@LҮǧmb<2FHRqùFXi䎲OmGA}:*u f:@ʫRH.66jcGOpO- 6HKJU:Jǃv<gz 1F*qm-; I�7 ?O(Yr de F ѥrHaۡ>�,3DZEƮqq7p?ȌK%ȧ$;?Qr6pP7`a^=R_)m>D3#£ _' Iɭu͋C-Rne㯄ssL<ȭ/R)|Lt_1<u}E Dzl$H+N_2scۯ-rHV.֏'(} o :]謧6Fhlw@z{6P_?  Eh߹vK /B"Mh;бo)gRm $5, Ex(?:gU뵅F4 ߹E4!q?lAYvs:mR(GZyGq+w0)NzuY-&"Y ='I8{mL/~!.BA=缱Y |z:f#¬oh2XjǼI|1i3A(|vf1 NKLͫ.?r]qBS^#o.l%z⁋ Y~i䔃P�qu&7(U;Bl zFx׎M ,|Pf V֠k'Nb̔/$EN HAiQ =u-/TQAD9gW%YZ\aԥ5Ojru"9Bzp̬vll= ɸYyܾ5t mEz+M>Lk=rr 4/gEr~PnB[\g[{gYvRW' {Fem1{ wL;7&$xc0 n&u@5sCCձm8Heft <PJZ@4K|#`}akRN'~IU!kWLZDNK̡U ;gL~a(]!Bjv(f\B}AuHR�gM <7 O:[m6uv;3=wwn3pKM{.�t "nt?dibC6=E ,ѮO 0hvG;=MV%ʪr�4H 8rK썀xA:2 e.ݟ0N<g'6%G1ַm}^jnҽS0 CzLX3UM;^^~XcavGHu" 1kNKT?,r=܎X}6CBW6ۻ�F\3m{4!]9ửJ4n5Jsw^ Dhz8P]z1x~�J8#c%ϾcF{do@w0QsP_́ ?3yB2Đ{|5}>x{q(aтa?Q%l4ςxmWI׆GC1kQ3iJh,KRO`ʲ<![NwaZx\Rtv^ZJa\(ZPE 1ޣhy0S�L!yQP̞#R@ӱ&4a9'2ċIE8XIr 4*yb˼/# x;2R~�O7h՘U^k (侠,2)C:(ِ;Q3>4)%b6B8\�pe<S+jsp%<&t{3?|N)p7b?aiDWlXZ>;u)ko)#WSncRx{[sXv195_0Kՙ7>�Tp5ٴl3S"؝LX睫[5m Q�="u}pϘ*xbՉ#iM+@Z! Ϯ~jYݬ$?5mtu] %@݅:4h8ۃtu3; ΑO1A/r R*5i&j#Y2:$Z(ad@>'z L뇶6Z8|`6"X1_z' F-я?X^ A:?1;h/KVB' vOnFS ƤQ{=kh7MwXQp\v͓O/. N3HKRlK"q^Wh1wt h@3e6N|I;y?8t[[! $,ήLe"z%IކAkRl!3u8ځy?_W)AbCO!rza5Sn֗#<43y6"R߃CQ&>[# B�Hǽ{vekOTlq(UH͵h ݔ8,@tՂL{p/*L"d_y k,4 G̖bD>,.ok"D;|7[.DCA#ilϟI֬Dq]+eE _-- ڰc^Lq1~CCC9gNH8BkhJ#Z-`VoMa 9r$�պZ-hkh ?C$ ^tď9d(8P݅]ڶw[wl;dn׆oKd Hބ(DInI M_(�5)6H/Y1 QRk,nXHʉ?>df&6^EJmt{CCc`0ʅv5x<\9Yc}106"״!֏9dl:' 1H"<HN&] 569!I1;"YxAK-ym|h d "]U.akgbbw24j- Q�Od-:N dG˥MI VG=W!r6wH3p"ۋ #g6*x9k{H<WBQߍOMV{Kh^<FW <L:w$|oY-Q]<ʫ!!垹Fq@}3fR%oĿMrD+N|YY6jr11k4i'Xf\:e޼ ~P91ߍ &78Qape5 9osMy K-uu9Bdx7HV&_!ClgL 04yS}|qٳkbs:f'/㼳@!]%z#=Js`3W ez<PIGC0@4 55gxcTGU#RCC?tdxL`Ɓ8dgsT?M6}, _ \k٬lt΄ls:m"25be\]\ ˛{xaLoQlPwK7?M�^a,_lb(1?3݌^7:ރ^usϚqB8*hGxYCm5M~{Sg9nRXC}[hOtC1#W3*:;&_Gۂ&H|5L<4Ƀ\bD?]fM{V6*S<e0,! AؾKmmߍrOoC2 #p'$F˿@!{0VYWoe,'H'`r1#ͿMRSYZBh|xH@ 6YziWlwQ }yqs!`~y#-O ՑIXmy|*0o@]ۓ^(`Pqƒvefv'OA=B݂pCJ#  ֞q5 RwV&) ԩn@po]{3v: Yf*aW_&' Jk0nDx \/HD uqZ\ڌG+啵X ZT>z'7QqɌ#KR./CVgQȬ\ `?d1yuM6Ƶ8ZX]8^pwQE &1frRKi$GݜЕh3'{;;~FK37ku<pdʎ+C RMzƏ7)n�Ҁ lEGyl:̑IoB<A\\6dFqϡɅQ[1<kN>S%|ЕsTulebA}Aʹ10A{KʘӺtjdLI=r PRg_LbR Şl?␔)![Fo wi&k^CV(t@pW2{hxHGRn͉eCbxԉ6GQd27\ثdS=\Ff*0ۣ�OP5(rZߙxQZ>~GAeN-jY7Ҿn;n?ӹ"Px}/N�W:݊&׾:x" ꭥу;R펔 c䛅љElmG§a= h¨BG_uYnZ쫭FYs U"zM&:Gnu.DX5Xn;}ԫ%XO?~2&Frjj8 yA*W I9/ub)Zl: s 85J>~iI<k¶ ٤^Sx[sGD(�+"EHnֆA_\F Z%?4`w_{7"0Y@f}PEjmv:QrN[wz*5c?jf7?K_P', sZ(oT |Ó\-%蔒hy\ cK/ ˧YGԻڐz&c" *(,yEq(y[q`a7Xļ~R/{hh"g=wݠ՗?̶uNh{g?tqm,u[Yot+!hf.2]ݹ?&wARFľ붾Ue%dliqMs&6Xw-&Y3(G9{cׁ֬ǿM;vn"b)<׾e_1p}11F#YXpq]s,[%*&@DfҹAٙfs ,>3Yԕ;:#hELם[ROd^GA˩f~Y!En0~/A Km>^WYq"<цF*c:xw|͞w%ehRgd9̕v3v Dgh>>?3hYDkgC(ʹƒԕSԜ| 2Q94(?OGQ34 fccPopTYaW(>@tX4`LGٞpɄaŰl\[9c26U M6f,�'C4i<Dn#xг Hz5[ _QtmvNC_`x~ Mb s�PEx؇;cW*n\?׿v:O3@fR&em[mٜC5f( MNiYXxШ=4 yHO<0|3[B :d1"ZO$+Kxi̒=sJg ~i[Rz'G#v}>?W~psϠ?kAKrŵk@I|>^xs?\`,D̒5W^w DMXf_8<%|�8_왉pP1Wlm߃f?4:́_Ԕv M;k:p_sj؎qw]$F}y ,b'N=o0, ~M YR46+!}@~ujctCP.Y(x׎z?70WXFܣo3z0c8RGg0 TU򄽻w"/4֏CQ`[{Ocn]+{{ N!3<Vyx,!C b.lf'\ ןgu,μw-/3ۥNX(c oMDsa##0{c %uDWCBZAZ6,؏x (Z%wHbhTb2<$*cnk_א#{D+B<!S/gÏ`9.^]ßC+>3+5]qpj' r9FDȬ)~: 9Gmx2-?sraG"yvUpa;Ră A\& ?#n 0eed~oq嶭!�!DzP^H)>oȑ.ļԶ=Hy7S-M ?8ycߧq|#5"2Б lm#UeΤVbM͘jAc7Z ]> 4gb s 2WRsKg6 's8qzTT[R[w�)I95xWj #!nN+zPڔ KgTE,?{^RDݥ=Ru^zîc&D'i74SJߔ&HUG[crͦ<׿~4}څh;lpAZ%XZ;tQ?yk1+Ƴu6[ Dc4Ɯ*dB#!}e>samhG3c^8u9󼵕⸈߂UyB;f "Yi=D =4&|C3g]~WgjhSIXU"1A5Fr4{AljwTt6</N \Rta| i>T.Wo>>xϯY{緷�m,J{gg}v~)]s!?wXGFl!7U|Cnfﳅ:.@mq%臔Ru?.:aBֺE#Gg'yXDuSWNJD)21ѵVagWPqȒ s?¶@g")s\T{f3go^w:^"�{d#!φt},nyWFKv„X4|<B+8i=-;X 5l=/xlwn] +SӼ,{՞�/ДV�+<< o ԇeNp^OOv qR wHF3݁=o;`~kRwCu¦kjE|qϩKV, *?xk}QxU/M= հp=犐^xBˏKx@[IYB]T➐Kq.ὀPwAG\Wϋ92SA\Y\y=ǨGjբM@tԂvDz+Bĺ\լ6k6LʦR_rnl|UAϯ< |!;8_1gsލC >VB~,˘_&fjp/Wԍwa�O H 3I`u1ͤ+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_W|+_Wݚw)��AIDATxœKBQ71-ֿ L[Wl9:]!-A+-z8ww;GNQp*9JTjZ㒣U "[Z$ ҇BDP|&[DD|on" 9]3M$@.r ^bDGv@P|u+>?Oi"?t`k]\[cCD8ڬՀcm3gj0ZYH[P\5pp:,#mb 쯱"Em1q�w?����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/values.png���������������������������������������������������0000644�0001750�0001750�00000000657�14517772113�017067� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME4K��<IDAT8˥Ja3 ѥDMP #ZYBAwFn $Dh"B0L A@.BgPơ9aX2RUUk �I<w确P-͚b6# kj>"J֋c&'L7DdeYض=117@l#O]N8;u(ǩu� @c96q?&AL&<+)[t[% bB�y?ģӁRk6x1P*wxor9CtGk~�o}.q����IENDB`���������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/experiment.png�����������������������������������������������0000644�0001750�0001750�00000001410�14517772113�017734� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?:H/k20]Y��2�7u{Ox΂ qt�Ąn#|~45uԴ@|8HY=@�auU7qbA HB]-@�0` f h,{8B�j@xZI20mbbɐZ$\ d  FXM)R5zzaa c'X{'f=;mY=H ﺰp1|7 [!U2 �smř@?~ IK֜!o:H=H@��hY.zDExDx^1|AO2Kht10p0nn @pWD2?ٙ~%/ހ?} &X7Z@[~gp]8%ǧ�R@L˧/9p-o3|}ós >|`Gpԃ< ^?{0e<qC|BWG//1&3<ǰ|5o? x:�MFE@XB6LJh~|3ܹr@�$$!pba fŒHA!`f�@�]m����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/zoom_out.png�������������������������������������������������0000644�0001750�0001750�00000001216�14517772113�017433� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<�� IDATxb? L 6b^ 'xu1`�3/LFI=AR^ e8sÓ{ʷnZ߅n�@�1 p J*| >H$RR dȏ?<4%DyX"A|8H�"~e_ WA ur�6ϟ\ NJ0` y:t9�ba--o|`eh-0Ͽ @y߿}u�(*)_s㚉%6f�3|f� p ~y9^>?f&&Vf0 A u@QAAm½Wo A|kk@77w ggg߿wpp@1  Q %|@ Ġ8� b~Az�IH.bDq%@C. 0T�"�tC Ѣ(� +!z 6@�QuBô����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/base1.png����������������������������������������������������0000644�0001750�0001750�00000000363�14517772113�016555� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME /Hvv���IDAT8cd``` a 01PX ?C^RFR5Oΐl!ay>?#4 d Z_N€tD:H*$SK0000k��A6����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/cancelProcess.png��������������������������������������������0000644�0001750�0001750�00000000744�14517772113�020351� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���˰���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��vIDATx�%�EFF̙||_~�w �J000011\r X> ʝ;wPUUeff~!-##d�ׯ~3q۷o߻w�rYYYYXX �b;z" 3fHHH�@.v�b?T 0`  @hK@@@FFq 4D'@�aV-@@7߾}2�ן@E@�] tP>@0@M@Jn4@�1޻w?b,� �BT/����IENDB`����������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/analyzer64.png�����������������������������������������������0000644�0001750�0001750�00000005562�14517772113�017567� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���@���@���iq���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<�� IDATxb? TwNGp1h-dYEQ <<㟿|a蛹 E X}񋁕 �@�1�8��Ą0X" 0'0}q3KuCI7t�@ ۷,��V �CBwr&& I p�¨ 62k"ӦMV&U7�Ă^2P nB î&7TF�*`p�@�0!}4 -r#HO9"k�?!Yj� W#2� ,)�QWJPGn eMa�@ !pA.^^^Ԉj?y/"jgj1/1B�QEk-Mh Y۷F0B6" eDd!T!##,UMa�"&qx5D$`T }gC<<*j?c@  p�| +"k))L1]=5=?%_ 9�g&&a6V^?@ Rwg`D[!CT@a@*!fGP ZB+0�tDm)!j&W�DE=QR(g`bd�; `�?c#B �-Oxyj] Ȃ?2 P?" �4ipS M  X`, uArAEllD^>&$pB;C,�KG�M<@(&!ʒYBDWE0{4Я ?�+! ه!5w'W#O^ x�>ud,`eD� x �g`^zCk_� A&64 )ꃍBOQ�� Hހ�>d&ʒ i7p{�,�A�) c� �)� P�)-/J3 � ^c6B*@,b,MϐRRRhF=Gx00|H/%@ 7q-?_Aa9 )_Y@L�@B  !H6@0lp�/  x� WKD� J+ _\vx &Fc�,2i0,G@)�e`pf#idаbP1Rsf #|x"~}mV�< x1蛚c?#CG]XP nblU K4� �`rQ I2022T53T{ <r]Cm_o0;T]?@�'+fP4$ZBaPzō V514dï/=l6C$��B1P/ڂ$f~AN0YQ? ?߿9  xo`R \J2bgz? 1T2y2|Tb`P=sۧ0N^e`=zF+@,/p@ h10U �ys _^=Fs9#<R3B?g�_1ExQԻ'wp0gWO1|zcl[R �@#0'ڝ/ȉu0iƁN0;ooGox[JJ!4H4Հ < vn#`y}!!q0opt\<;O�!z(ZA.aьH@da@҃ChVGnbψe(I 9A "�@BA?nFi Q& QUCQ8C2wpFDBW0@�BbH$Cx ^_ǣh O߽,xXCCᰒ J), "' `,�BjAGKQ&b?RȢ$EFhYʂXv#32ANF LL L "B+ POP?A FP0B8 7IgD K3S�B֏#՟Ѐ( ##% Xll, �Pcb�H?PR,3@:#j-/pEd�BMXCK]yPco29˶QcGzz֪c~�mҕm�y @�d?Rx%$y1@BX/qZ%?ΈPX1" =h%P6 � "KCᢨ$fC5Z ɈuTq<#ZdCj F!ȀȚpi9� sADVm` qj5daZsJv *Y$;"i>/$, ?g/QYF?fD1ZC<Dkė`{ {9z" &p �,h:}Na`b?ds2,+��`Y$z ����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_left.png�����������������������������������������������0000644�0001750�0001750�00000000260�14517772113�017700� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������ ������bKGD������ pHYs�� �� ����tIME =���=IDATm �1 œ ;OUi#�HbJ] ;>`( G=7%����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/backward.png�������������������������������������������������0000644�0001750�0001750�00000001211�14517772113�017331� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?."[8DS2d�64C(zw?0  6 mo9 h@|�0`A XsD__�@(Ih]ߏ(�7`F�Xs\ ONpZ?0� &cr _VV-f8ÿxɌ6+ONuHP \A|�bH_^SpΞpڙO;:j@|�ڳ?SQdSsg(Q@`1hHՌ}p@nZ eqk0w H� &hbz2>?Pضdb09 )E_r׌/Vu3033N0q -Y_~׌[@C:: ~ Kxw^jnia``eeyL0 #`K0S߷'c;b�bėA�)%j� �bLu=����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/data.png�����������������������������������������������������0000644�0001750�0001750�00000000653�14517772113�016475� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���bKGD������ pHYs�� �� ����tIME��8IDAT8˥1KBQ $$ bX n-B%BZB*@܂B!.w Z4q;y5Zk�uJ&YG?ȹ*MrŁv(d$WޫRnb6>{?\�'-w)dLND6|Lr�ՆKCPWpqy{FݽwII}2,t t=N(xbJ% 2փ G_F6!v}aN 620ca _ʑdv93yTZh~H 8㽳5b?%o%dt2����IENDB`�������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hamburger.png������������������������������������������������0000644�0001750�0001750�00000000224�14517772113�017532� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���tEXtSoftware�Adobe ImageReadyqe<���6IDATxbIKKc 015x^l~�.ς$9<z8$��0$__x ����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/error.png����������������������������������������������������0000644�0001750�0001750�00000001332�14517772113�016710� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��lIDATxb?2#$3.-q�ـ]P& ?b\Li)7!�7`;LsC÷7o =g1pqp0p0 4 @͂1_lXX-_1~EXdA y:z>�hqb"+W~~zm A@A�do7n0F_\od|oϟ�l+ `�sD<<4÷o( @�? a|,'4ϟ �@p/`�Ŀw-' << �@L0/=`GW@L08P� }&v0@X�gϯ_;XXXNc#/4Ƀԁԃ8%222rٱ-g Ph|�O _^^@5os@�@ h:,N(0s]c8wVf>�bA3O^37j #zvyHiaA� �t_/*xH����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/nav_bar_arrow.png��������������������������������������������0000644�0001750�0001750�00000000716�14517772113�020406� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ���������tEXtSoftware�Adobe ImageReadyqe<��pIDATxb?Cۄ }UA t=YOr 1mxd ~0(&-|3yFo߷lfd`ќnb]؁p.LgaeW?l߿oΜ (w gZ߿/5}m_iUPSəy" wdM?|X`B?~0�]$!,*\z:###L#E?|w_`WjF?P<ׯ-f@y^=XǏ=vN@9AstrxQJ=c0J1X9s4 kxbP#i0 ĉ �ٻuW6f����IENDB`��������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/synctrace.png������������������������������������������������0000644�0001750�0001750�00000001577�14517772113�017565� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?dTL @<}Ɣ P/\ � HIϞk`wδe̜ ̀�clBr^CwSCi]gp_>Իj�\S+QQF&&?~i$eϟ?@x͚5_Ƿ"?4�bCT>~˺@eee [/lllxxxj�SzW?A^b> V:4\\\˻o֝ص>#>5? LZ�Oί014ё ��A�!("')��#'��,.2�&+.q=BH047�"%)C\1**eUUUK999(߿Wۤkܦ_  4h�6ف'?72=/.; @h|4! >,CM ܂ OLbضmے?�:OOOvp~ ߾}y@L@Թ7 Z!>v&n` qi4�@�g lll\o(o]4#,7€ϟ?^paP0pհ۷ 0 �i�R/@䁔r $`� 5����IENDB`���������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/hollowArrowLeft.png������������������������������������������0000644�0001750�0001750�00000000475�14517772113�020720� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ������sRGB����bKGD������ pHYs����S���tIME27tj���tEXtComment�Created with GIMPW���IDATm10 @OԽw`bN{r"EArVt�\JT4’ٖeyKǠb Ls0KAdcZ@M\$tTZXk 8 s.o۶MM7.SkC����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/remove.png���������������������������������������������������0000644�0001750�0001750�00000000360�14517772113�017054� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���7���tEXtSoftware�Adobe ImageReadyqe<���IDATxb?Czz:`̙ L d�tM]@܎&X@\įjwVt@MPvCӀyH-40D WCGڎK7 E7 U 9$  *��Q+&7����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/number.png���������������������������������������������������0000644�0001750�0001750�00000000517�14517772113�017053� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���r|���bKGD������ pHYs�� �� ����tIMEts���IDAT(ϽѱJQO{ AXP,)6ڤY;Q|�R|AQ:ڬU SidQD,9oupS.SInM`s8kүq6~V,˧8hicE DUU /LwXW2󾙴8 F~NQk9SgOL:irLF\����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/i_o_usage_16.png���������������������������������������������0000644�0001750�0001750�00000001304�14517772113�020016� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���tEXtSoftware�Adobe ImageReadyqe<��fIDATxڄohRQƟ+w2Ffk bDD-cJ 1UP0*ؗ}haXՇ T&(bIRܜzڹ׼y{\� J<Z}:d4/rK!z1nDG]9?qkt: #$ovt}m2 K`8m,]/00fd  X[XXEI �~%dj6̓ciTiJbդa=W?NA|�Lh] ;Umc]bG~$HmH0dG57H s0,7 ?AZGzl;zw3ص}+&H 8fI_lw"s ~`=Q6?FQTnaEcJ#{"H�TLR^K e1t~_K_s L&űEXSvTԱ;6yKMŒvRX~$ ׍Dr>NVӮ9N8mfh{?R2F鼧&pu+KT0?��f')rrR����IENDB`����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/welcomeBackgroundShadow.png����������������������������������0000644�0001750�0001750�00000207564�14726067021�022374� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��^�������`iCCPICC Profile��(mKPO?U.E RSBP-cJDĭ vqQP 8 Y4Z5pcZ@M|t}c3zEC,"b(h߽~o}1x);_RMUJa87G Zsg_gY[a"r^⚶|zazj XDn!`3(RF{':`2*ȝ!AJ 'N!I%gie` y.h}OUIT@߱/BMuN@'wdyF���beXIfMM�*�����������i�������&������������P������^����������ASCII���Screenshot ��=iTXtXML:com.adobe.xmp�����<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"> <exif:PixelYDimension>640</exif:PixelYDimension> <exif:UserComment>Screenshot</exif:UserComment> <exif:PixelXDimension>862</exif:PixelXDimension> <tiff:Orientation>1</tiff:Orientation> </rdf:Description> </rdf:RDF> </x:xmpmeta> 3#��@�IDATx ^U&\RkdY,[llj8{=B 2�Ͱ CXf2lvH/,[dSORЖ}*[UVߓsTu̢,@"$@"$@"$sݙw8HD HD H 0($@"$@"$@"-x-=HD HD H\g HD HD HF Wԟ$@"$@"$ L#�$@"$@"$\#\#D HD HD`#ׂD HD HD k2kS"$@"$@",x2Z@$@"$@"$s@&^spOD HD H@&^ H�D HD HD`kN@"$@"$@"k? @"$@"$@"5x5©?HD HD H<x-G HD HD HF F8'@"$@"$G $�@"$@"$@"0d5D HD HD Xd HD HD HLԟ$@"$@"$ L#�$@"$@"$\#\#D HD HD`#ׂD HD HD k2kS"$@"$@",x2Z@$@"$@"$s@&^spOD HD H@&^ H�D HD HD`kN@"$@"$@"k? @"$@"$@"5x5©?HD HD H<x-G HD HD HF F8'@"$@"$G $�@"$@"$@"0d5D HD HD Xd HD HD HLԟ$@"$@"$ L#�$@"$@"$\#\#D HD HD`#ׂD HD HD k2kS"$@"$@",x2Z@$@"$@"$s@&^spOD HD H@&^ H�D HD HD`kN@"$@"$@"k? @"$@"$@"5x5©?HD HD H<x-G HD HD HF F8'@"$@"$G $�@"$@"$@"0d5D HD HD X !p_m.@"$@"$@"/ݳڞUVD HD HD`#9D HD HD xj9$@"$@"$F |s@"$@"$@" SsZID HD H@&^ D HD HDA 紒$@"$@"$ Lϩ'@"$@"$S@&^O i%HD HD H0x-SOD HD HLJ"$@"$@",`s@"$@"0.ev,Į$|\ߒ)C5w;xP/9#| Q=90}%חE / O&@"$?,S )r 麵`x173a +O:lDVQ 4Y �5".\6-͸2m z60,a+ _ :P[ĸat)4S` L7hhkuMqRI^n {gfvIe<;fnjv :w4#\XSDjj766: yq[ft\[W;"#vC<'V{w :^2Z7?$@"%EgyA Fd=9p; z dٷ� LL#(JX'z&ccq5TR]/'*[9'Lw � .<͕ KL8]FQf,hg'fa"'iԛ(2< m龝"̻y^ @,Ѷ'GgHX|CfTfR[)�Ċў o nWA?YZF\APMwWQ E':׼;ֳ[)6aP!!HD HA^ `y0T1(ƭ v v"bMm TGX{…(܂[nȀ z( V{]0S%bJء Ң5i^zG_::N=\qC!k,̢>ϋ=D)1xM3Tk+_$$DgB |1]Ն'8'LT%Ԫ #;:1EsFÐGgDMzMAFPlmI8|T<qq./h0r@"$@"/�0b5ah1203)H(4E(N1iFZQGUtr tD |QNhEYһ%̅D`;E6xf`*Uu:YW>2Gk:ErM8(21ݷ7jr#qf# z!R`n�+b ]JHKwLKX5ƊjM+Y7;*aq*IF2w=Czt=um4?Zu&^ D HG@a"/r7fbU H6Ynh/1Ҥ}dF|o@ [ЧCv"e':&rQhd]$+R4Jb<`1N/am;?Wzbzj"XWζиg)P[i"RjjUVہ6 ]| pLaxhAC$fb:^KBPc6CFB-k]0焆Ums7[?p=dde̎7C i-D HD)@AhJx3ю 8[<V_)py*r56uG.R:n'MwZ,ҷ xkiK3^V!JʴtZ)#UHh fZAfx!G$6tm&hI�w1Yeت fM<&DaOcV'I4ZFBu?} R!oNM6H>դnpi4qktm,)[v+A9 -F[](D HD`nPAѐS Be5;{Rׅ!W80x?Χ>H.p57O yWX*uf ?4p0v!gN2[ar 4$[;m5^1 r-b}:z 2A*%te)إ:潙 Jꆒx~uF7Vf̋^p3x{G !K:x_ 0螚6#TJ,:Bw7HD H6.)[TLe"4~xuAr& V5 7c2(^Go+V 4XȺP7yuj h5 {YX@A2Qj.H՞O܃nՋC.FՍԈMd 1(Ƙ)a?#r<&OL�U)ݸh!|Lgjeי !2rSQ` ~;ɸg! 7 , ,@"$@"#p4@Jb: -9aPW: AZ Q[xL_bT1cMa`?0WL݅HM (Gw}-r2u&߲p0vd|0E.*[CC͙|AnǨj~јOl@& q‚ø1CcctY$հvqu&JFr!NQ=zJlenkɫE~Y'IU@� c;4EӁi-X׍[>'KD HW"Rݟ|9wNą6lBEJ>uhTyQN^ CC|M\y4:eF7Tα^DçfȢJ#בMSwOXc(=njI|i |oP|>VL0hnGo\uHB޵B鴖ϡG0uz,BqڍF߼i5.2=|ʌCWԙ³3{~3$@"$g!f�_(Xi58KP{Mۡ:a(Je @xC,*>č `Ws^u2yzI`m M)xzi y}S -dN2eR;3 C !;mt!?,5P>1O@ZnK 2GU*$_ b1GMLGЩ9Q+VRtPcG=Xm*mnPk'biu7LF\8z?Δs@"$@" �1VtA+ RI1G { `ٍKP'gV =zQؐVާA|Nk9(I Sh턾{t>V C1tdG4K \n(d(;EM!×3S2jg g1JQTҍp=r>rc/(NSV9]ehۂc�u*I޵SA҅Yфj$ʌL"aDƮx;2[bnwts@"$@"pV�˂KDZFE\ Ne;~CH6<Cפ"TF GDbmYa+FyMJ.jZ{ءI}c}P!PaKUՅÝ8yR֥Q#ZW/Davlٟ>7d2xq,hwX0w;C=HȹjДpmP{b&ƽ \ 0ؓ0%RUsI 17MTbXjr!ivr`,>2@P1+U968tdC >@$@"$0V E!X ֞D̗#BgSk|M=tS bw>։k?1z'/8;rFxD =Di v``pBB^Jot+=Yx*ݐؙU"Z$ =5g&_g;d>. IxP<胤o 2e=)8=pgŅ uٷ/j'674IZ],0&.C= WP5mJU~ q) !,B/G�LNc&eḼΉ&@"$O1hӋ \)ַni&Rt?{4MF#ix:q$< իUKX$i$SL8i,QMM @}թM?XK7N'c_ٕ,s0p:B2'y~a0iҐVbAPc1%p~#hd 06ČLֆ /b2B4mf)ua.۰oJթ1@1B?CRQ7FBy)2({c_㐊&9)OBM&: kj"$@"pV`1b3uua9:*Dcкr GET6@$O8*0FC.j\.Q;٘!CwmU-'pEjr m=[&Ob �0"j`%# 6A'i eW?QK@JWգB&1QԀ$jQ@(j7~'d�XwF&dCX1^-Z4P#96,q0'ӚWǞ0 [8-9WF cdeU?;pVn[oPǩlA&cQ81Fs;4y_e5oqN0HD 8xt؍bP�"[)X㺫iKi0JE!Z" ௓8FJgMOE&UMuTP&X1~U.|(8:2ъ@C7cx^bA{/JRORMFeG&H *@D(?�]4i3!0ҕ@vG|7 F[*8W7m&!+B41&֩|N=4r2&m}*k ztVt|`E͊>*!͘gqJ*{osf@"$G c= /N TM@M1Wق2h_*18ƠIE!b:[XRr5[&h!ȷy*ɢ_+6խ3( 9Я"TCFpiQ%8rf4 }CBWzc"M!:nX0$)'EڲzX*ت Jk&J ,Q2_bg}oT: \+]r�v um)|P3n]JQWі\F&^D H�,nD4c,f">\bAcW+I>߶BADf-i8h}{w]gc.݊V#:.dWUDtpIlm;$\,mt XkVZ�5DѮ)jvA후T}C1[A[A]"Nka6q@5n\z,zwgHqBNI5uIG޸E&&m|"z! Hh A b.:S@:+cCX[ ktVBdVCָ<Tيb~Iԧl^`ɉB!#iEkzuYKVN()N9Ttɪ.>y_g5oqN0HD x #z S(p`C^q&/x Jvſ+Q"U,zw{2ʙ!20TdZBtOΔq*wtC,JX6uA +Go1Ј>XW:- ﺘEiA+u]FՂ돃Se6FL6cmzc.&0RKx@Q 5C I.ft,y $92xL,4ٲ`ܦȿX .pI ;/T~ۺ[QWL~ftjVgz�Z7X9,'7-Ȧy^3񚷷6'$@"m\18A)Sڐ.#?K[ʤˊ')[@JeC]}l %]Rj yI8l`, I5(6"J6R$pL"5$j#Sj2g*Ѱ2A�O !E閘}\@4hRh}6TXi 뒮P|bq0 ;y3 KF'D3Ȫ a_SG͗ߒ,.Y7D(58W7,m07'6x|&=n d5n-HD 8X/Ρf6(�-�cH)qxۋ4IDZD'XDDa _RP%͖h|G2-8a։ l?<sf*b@ɘ}tj$4/@IZU[A57j<[-D8aQquޓ\U]mƩ&.Rc\`\ɴ>?w` OV+-S;> 4A"oci+g}=9GV 0@EP>,X߉)\Ckgšt-)qƪJ3@GxAJXY؈K~՚4DUveogs@"$`=`ctKY M-4x)>2AfKLn*~u] F� Z� i T5?hVĸM%FD7m$xv14 x!? Hlҝni ϱFirT%|~C?kP:h%Ѳl6{"ݨ-B҂I$Ӡ`222cq` nX-;R6u`U\ @"=czީWEmvOS^NQ<1#X(Kz]L=59!Gl'KEJ$ +A'V|i(vsEZSE3ƣ?Lͩ%@"$g"y)`P?ᴂ<kp=#Ŧƣ۰+r`daxW"iY9EՎ:g G^gM%F-0[ L3ȖO6Js4[Rbl>Ũ<dJƆYҫABd-xË֭oLˣvɛ_W.UȎi,Qy&4@ (7qh.TB^]y` yO۶H&Ul9m/V¸%[>Lz8j *_BIJ'BF+2} Šk;(1ONx㡾i#yzcsZ@"$F@[X ( utXuj"?oTDΑX ڮ669A $~C8Iu|/y]]ҒlAũ Q/D钌PQ253ݷ" ?>6uzDM0\hA4Rpx8sN H2z1 Y8΍ gq:PG>ZWٹg_qCX}퟿>rxpDxZ%`Q;χwpV{&bYꩉ|,Ex%GZQ–VsZpKzDMgI6ylWl4"v5wV7{tAk~ΛUt%u?s6@"$ `A)CeE܂3;0}*,<<0jE!U1Ze�-2p X tA:cv% BG2zn uN2P/:s\Z;ǜ.;n!a,UxC}dݩcdF:fs+D > .ha,/?)GŋqDۚqLx[Z^ZC�>aYB \Sz|'X'o�(YO3RN =�+'[4S ou>c67F�B �O�jn !w(<276$@"<` Aj"a vA)zBDjfkit&Ff8c'5M }sQxǨs"y tOA{X0J.yRC:BJM< ;MrB~+7&-LV{XBp5 &2:^7<;y$;0frqFa!-W)G֕;^x}hU& 4~шvx[\ϖU,%  ulY05<宵`q98VÆl`|/ 4"/3zxB<2Z|rmV~J͚㧷j<9D HD鄀tiE藱hp . 3h9:VVJ0:ScXoY/14dr(Ʀz1k+tZI \mۤyNѶ%y?λi>@һ*CJſ5];U z~ZI&QgZ,5ˑt #;=,*5~w+ݷ;p,_ FjZ3B[ck{YCAUZeH8@.+i'ig#,5ƚ&N,lıÃe騭龀ک&Nlr( [NK[hfb~چV ց}1?ǣP;oL͉%@"$Oʃ x4^}@1* v,:qQZPWJ>Et!]S\ Xj֧FNgOfW*)Z#&]lUuzC֒H(4aÄj3a4W!ލHæPI c\ ϖ;y8rǮH~k_Q^~ӋuʚJf絣H=![vL ] ŕH%:AK1y<>\ :H|VVq8UܥCe `.^7U/BYhrL $ CYKGCJj>_2w7$@"e,\-bvp"G `#PX"'`O`;$[HU cM1q;E)j(l0N賹uf൰2,*CXD<Ȉ 2!MMM̴''ܒ?r\ СI%YAią6Yo@*?M=8ԂrqiffJ>EIH4/0\ZYyK ɩue`v˗h5BtA@3~[D 熄5ge&V1qY jghɾ9q# m pqP V]�bbF6\Uj] ?=yt؆8S*ꉩޯj/0RI! ƧmHnMQX[ԐkL=&@"$g ́&Ӄ7)tc4&wcd6G } -OvH  6#tt;xFҠ_"4e0,|A("_xeH1Gtʮݻ#<\m}l߱Gs/)K,9s6Pvo²| 8q;vLX,w}{۟(ˊ 6}e8Xd&Gux9J}\ Lɓ/q9$/L<FEpr|ܵG'SF6lPVZ$ _CqւM&7#}{؂,""9Xv܍z--˖-XȂ8K,l#y+eǮ]e;\tхeʕS8ij6?S-呭Cx6_U쒲nZW{ܵeƍ1.{W(ψ\1Nse"x8`!.EL.wjbM%)öGϠX8~MQEHkf"$@"pW ,-BBKdSEq1NA V\�X Jm?RLEc hkW-m  14E?|KG?f< xT _ј&lKPV^Oˇ?zDdٴisWe\~E˳oA a'--?S?Q{!-_r??\^~=ޛ!Ÿ>9Y>u>U^lCgw�ff+/K2|EAA+<(~'ͭuq+hG.?~q)]uoU_)G5I׿{]:Q]xӆmM%/~O}3r/@[B|I!lLw|7X& +Uݟm޷_ l5 }j) | +`KH( '�_ڢgrڑbl7ɥ}Mg57ox[KD H0cahm #-Xd clcGqFvjU >?t>xLavXWYؘ1El=U4 R"Q$]7~pL:&S̭ ⇑xˢ w%˹li;~@ /)^?` =<kY~]YH,a{t} 4dah%Vϔۿ_vYѫXڸql۪"z'q}Pec;|;*?Wp/y޵/Z2 <8W . MW^q9gu}na^W^U}o;nuxУO]~d}yϟރɦ1c;[Jd4?{.85Q|+.RS"34'v l W-6bW?Jc%H&3rv* L ,6>)8#Bɧ9w_278$@"])d+)jFXj[Ft2PqlHxMCy?X4ΆtА4vL2G[)4<tqK,.<E/,G*~6lC`pl5^}e/|a]2fȭyr?ȕ24;f8CG?{ϟ.a38/J-[K�2ĪϞ;˯ꯕߢ+~!2½HU~'>Ѓ~bȀ}[&{ &Hsbxk!wlߡwH MaAX?|_}<9CfHmlq{` .v\[?]~ %3dlqyxW_QNb0 o=%;v,SLfqI E ֪` nEj X;)~Ɍ3#q2AM;H[i#yzcsZ@"$FdrG)"4ƈ`щ�245{8CG earam ʖ7FL<qT 0H2#>s-<BPc?Zo(ƉG>I$_[~?w>ד۷q�{NԎ'wrWW'w<Q|;n&D<E*]ghrp܎;ʉco�+']XڃU$b=$e+m׬C1f O!( W^V֬>CR#pIgr /|!?[EP&KF민#ZMxgmLƸ"֭XͱU󖿹<e$We裏]]5Y=8֙!?9_RNL ڰ/FCu7gK/,2qB#^ ~$MOZ$d`meN6dL 7 S7;JjB˙*7xa~'a\:n#ZPu:&!Z tH%yy[sR@"$ _ ߷ONqWZ=CܠQ* BȀ1 <B&_YGR#@ Mr̋xѮ# V0!ծ{O-1y"|ktOLbeel!h‰DX!˱ -8n&lE2gm݋<c?^Y2|rGGpAc5/|Kym(Ǒ?\U%o/߫͹jkx3e#n;$=sKw|<-<odyK^Znz+ˮ',?? ,a-~G-V?Ćcj?<ȳ�Ïo)7UeQ} <䋾@^l:1Y羇m$h U^W-%B ˒K8;p䄶48%8#a7֗FKhKE#MKg#+0:!wI!֑+Ə1DN{\F0NzRudɧ㒉<9D HD#@ .XSlWmm2>KX"lqy!{DZE0O3`XŭuD CsuAV,d"8$*DatŚ6{섨͏ ҥc랉U0G\(͍lsEf;wd||\^CIL]%7GFU*{n@¤a edW$sVկ)tM8`cZI#I˛^[ o^K_Wnۿ7~Kb͐En{s@~:[6%HN2́Z04o܌^tEee7M}L.jΝ;ucFRg_/`O(3ؾ eyBg0ؔ` IBVKRZݶ :sȈ(UcQK޻eHư u1-mI+˦JWJwmCfZTK&^D H�B/^j!PV^@) >GfI\L�Ŗ+ Rv$ Wb={V3 sn\ Y}vDU:-<ݏA;>Qҗ-[$Fl\;wVW`ʫ_jx1H_2z 5|8~)7zǿK0AyfpC5^k)oFC(BbNbD3xԻhdT$cEG_+! .2@xAlWġ ys tϘPĩIϚ5u}N8|')L GNqmT&kWuznc@80&2.* Rc*xCY*:v5MXȏ[剩_0H BrATF{O}9D HD 80Bi~ )xU7"6n=˞C3ZCVdag:*5zdIi,ׅ(8B) {[.rcWS $ CཤG$B<꫑܉/W%v]O[U^o5A3413S��@�IDATWԾFx?_mߩr1q[o`}7[]5˸箻 7\[֟w>VѸ'lu* `%vA(^| xx^p{VC<!xqYop :x<;ks|lٲu%gsQМ>ؒ[?+׬*\}`mA<Vt %@'j.!i OΖ}fX2r|rpU0BF1WЂdyb^N/'$@"$gF$&ʸZ -Dy <`?xDArM(VPQg>ڱ%*qcJ¸XttWu&H(.$#`^"l]n+ ׿ܱr Gx/+,('2гǔԷS n7L@VY ^Đć܎-H`b\1暫˥]Un yC7Z,YT6ŏ?Qo%X )3!:}b'F%`mEـfql~[xÇ.l jXysoN'޽qdz5kR5>n"6~lzR vX00喏K/ڈ*{p_l߽gjƷ MBFtO=y &].yӣ@ zYǰﱂ~e5dd^{0XT>G(#䇧ݳ \8 r,Ҭ1K&^ D H�/E]5 W>Xg$#1ƒGB =q+t"b9E'CjH4aZl}^Q4N1>rWP+FL>xˇo޳ ,u^\uz`8M�Vgc'[ O&ldG=[]Rgr* z.&eLDp{"ڈH##_.u{!3 X^gsVaR ?.g8wƮRlêT=ٹs7vi#U .+n3ƻU'pjG{KxuW`LH׮[Wהw{]<T~G^6;{̊M-}nM57*!Ǫ.DEbk?d؛K{(984r#U.:&d~2YSYo^-霯y%@"$YD�Y -b(#ZGҁ#8xm-LSVB*Xv.-n %jQL4K*RCwSvE Q_C+ה;Sw.q&6Or WT㻾<+-/ G#{|GSk GrpK&(9/$:\nMـIǭO /]T6ol\-mx$,<fe9gE'0 6}׽kb-\wuЖG٩wF|wl`$Hģ8cjspɅT~tue]z٥H2K~�ͯy DZJC5ОJ,Vyg.ɳOL<P}G?Y$M"ڪ+&>';G4Ƌ3olN8UrS6g@QB +^ ^LD HPɨW QN\Lُh)u!j\ FOSSm46ԱQUu k!&i=j B9"dno۽s{y2b|[-ñ˲x7꼲 ˍ7>\}3%(t ! ۷g9v'SԳhd16* x}eA*ڵ^W9g>qr0>mr$H,t;Hh\؆G?F0r }{?|0Upp >|xs'pB!|X7ȏaU |3K76n4i۷m\}ϾFϖ~X@zrlZI(D iW >< k!$]3Hוl*}uWH&v,x9]j: C_gbP "16q\$#\K4ǁq VBgfuynʥP_nN1HD H*)m*W6$l+/RH+�hU0R j;YҟH졢7{"Ed x fq<mIo{Y8<Ie^R~,[K|�d+:K =,Ǐܚ8h1 c+ ~(y(_#7>9]U}rNlG-yaBG/_\k ,&X#?t0Q;VcL̨t_܊*0Iʥ\퐖X${\ݖDZ%m,S,p#1*`=q *ۈw|rd{eW_u1^>G{~'"eG{v9/ދ楘bctQ+XpC 2�ē#J)%J )$z5 gZ"~ A/,Zk! #xSXckUABra g#<?gJD Hm? N }X:> 4Wao,d VQ*:]AW`7!I+QCxU ;VkՙF2�>zE+2ԹeM8bu[Aޱe+tYE@jO $tA~sg1))Xv4d]vg^daRL߾;$L$ q߽mMnj!bb޻6H8O-o0NCASmD}� ~x/)Kq̀Cꝴ6]Z֬dKb:Pc>L7{N9w-G�5r<wZy-B"ɏ\`jrCHVG$_dt%Vח.<=A"7*Շ!ҌquԷ}f+jpg6@j.y+ .H;|a^.#Kyϫ`F Dmy{y{ksb@"$�w18uaeL;:[+w0:e,P]O"FhCAAtfŬLNVuWXp;_ �y Ξ={8}w_Eeڷ^+k׮NJWh%xTxܼ$?8~kYwʖGP,YmoRKtL?h]=###g\e+Ld !51y勘G&Lpn,?'Xg zá.̭w@r4^i7K# IUW^U,{7ʵC}fx@ Q`sG LvqEX ?~\w5e9q98c}9suMcd#mEU>x8Z_\XKrpY3+JTjQif |rTQ$_\֔o\]{9j' \L<f5opN/HD 8kX| A3-@mVHݏwFM(\su/ "xcXr* Ր c~Oq=V>QGlxcHvLu 8|Nb%MGq7?\ک\b$E0r p >/-ZM$]tb� ׼M9} y�!!Ȟ [B"X{ы_\nߖ<x=Drw`~3zk҅eز�rn<]2?G\ +twcqrQ &xVZ7$H8ʞŻ`غknLL.X-),0uۮGc%g,Ar~m>}y[^W^C4 U,p> A {Z> -?yq3BCQn胯iZ'xb I7_KG&_ð?8xĐ]>'_�o�RFKY%@"$YB 8j[AYW#@+K EFQ$i:;_hQA}S_Ũ9k#u>vS㬝]lܫ^y{qr -F<LO__.}w}߉\w=$"f5^+nz)4D$?\a,�3cu Z9`~`8t">6oPV^ |:?,.$C -vw;xkDȢa8߷ګO/I2@uϽ[HgMJ =+){Uw<lKL-W\Yn2Y!>ضǁG0[m<6ghW`;nzčg+Kq^W:R [nrrDCiNp6ľX9Ǽ#E2A\kAdT ytrK͜.1S%\]a:6{JϨQڤuKjh_rkܜZ"$@"p6M[c,H@ vԶΑ.fMBc?iQ 1(< JC *D_YG8~pG>Rnm8c^sg,HAFy(WnAb2x.UeVHj[1 E׼ }nUV1x_, q$r\z #.֊\L)0TMN./` e`a~_C4^7fl\-d .pu82۰~-?q=yeơ beѾ=@َǐŅ<}>GX|1?n)Nj&9e^0i&Lq׾eK.vs <k?I+ǘQ=߰-P# ڝF]JZ9~[!?y!lw2Ԋ7ƈJFsLM)&@"$g{5]e?. !^Ymaibm᥺N.,l 0|SoXr EV3N;SQ~wyϽoH+Q/~Kr))y =ra0 m3<11=%$OV,cHf~|/Xk9[.:4C|N /'g7rx5oQ~ I[#II~|;]{dD0S.]w-^p>ޏZլ�P t bw-;|[WdǔbnOZT)XM qp%f'N"㞭]Z"9Y$b?]/?Tc5 Mͯ\uՕuG9|!.A$4հGGq_/�v4m>3,*\ o)&{\rһ^[V 1Ky>Le jZ/%0M;_vY <FMs|)1Bk!c"$@"p6P,K1g~&1RW4z*ذ!)–d+F6:J !.@<?a;Hp B0ŻQC0^WooIz1x0RoG> wr~~$h>,Y\"NN"7qݵg^KN`K6_sQcq*%N>n!sE'bqym%H#!`4Z *Dbض'ukYM矫DZ*~3qPJDL7Lf`,ÑW^GL8zvzD IUW^"Hٴm1I|-<*?36DSOxz#0}4 Y/d@;aBkpa[egjj\*] O5c@Y?QD'Wbĭ<d5OolN+HD x: @/5opA0ʸm} Y49nml F t͓7K:A ˨\$E OPrUDbP͂r8Ƕ;[,־WFP�~~S2w`Ո>tڮ02[>gڌgI$>8u& {pNyb&\0!NGPz4o c&6ncOߡ~g_ ̘]9;A$.%:W͓Y5÷alF"OL8|| l489Z E]UXѣEvm;ȤT?xh1ĉB+7 `%DyqnKX-Aն`&5KI56!)L=&@"$g|,wWff.ҋ7ZI׈cNov"zNTU` 3{azsqX($g]8R%\{E\995SS[|ضhg=Zo5*;qt ]9˵LJ$0l>&\忴; 8k=kPc!;ko>rg?w<r ' ^v%W2gir99r6D2t<"GHO;3W.?ؼxtQŮEa8m^'_\u/Av88ɛCjOZ(?մgM7$Ȣ O6t)@SM\sN^؎ [=G>/%Hc.Յ-1C <?L}Y%@"$O"c 2`t./DAHZvA[:ְ)JXc JY y#+CIu 6&jsi#YTֶ+tRm-?*{9� |yGÏݡ 1̹k) 6 ؾ +Dbgu|_N}Kl7c.&^*NS<x|YOǁ,钂Wb$e, ś|X �ePĕ/V7o\Wv؁l7>ﺲf*%Y1{we=p5Dv * @'30~15b$*AMu J1hiu4C 6 7Ǧam"-B>#L.gKE&#y~k^"$@"pMG\#BA #cL@Nclua20(25>UI-z Yz]7qNSH6H�=yc2ڷ@Zp]-ns;wx"$p 5VoS.|b{8jnBК}"[kpvpϛ%(ҁ+kU\=KXx毹+_ٍD j '^GMwmwso~k.}HP  -O}|p81dN`aEO!!D\E tPW6,̶ܥ?=(ྫ>&"+x 𷏿IVt{?KstH;7PV`W0jܕ|.x绛sKD H&)1B婐e;1ff!boq\\G&f] DC'6\] X $l-{mɾTdԓܕ6%q@?Q8b⛿[;߸Vuqt9P yB5xwQ^.jDŽ>mjW,_,Sk'0c\G Q5IR0�9hzA 5!3T4rFɴ-C@-'ׅXI%΢٥jsq ~wl;sg'xcw~{޲{>@Bi$cv ?w.|^}SyqTD6pzѕ  ?'>m1n;dUڰRWK8BU !?ƱtϨ'ӈ9D HD#` X x1p;6Τ)1hT<>%x*\͂W0c(>v+&HjK P)hKH2|AFa^}w}'({p̯Z>#Wcry\|6$ڻ?mbC46c5l*lRN-x|tjbmERqHcvhIҥKK_zcyGˮ=Ml,_y%N~|eٸ$]<;U] u#&;/+7t<1[~{γ/Ȗ-e߅#a%sVeNn|uW~иPj]~P9[`~[1߹ 87Ƕ 61(ծMXS+?6xd%a<ċGbŐHyq$|û"ݥ7LD H*h#_7]x(805,6#C}* W ;<C!)2ApHoa*V\O7Uj#!זmG?1~qaH xtVOŋ(YOL[T''#ZI'Hi?ZVX1A+1Ƀ[K]rvڧ $ŠA{mel(Ni\ lf&$l¬!3[9A[ �4=$ex91E-^S'GQB9#ܵŊϠD-<,`tDrn_&gEx�ZLUm>g$XT06:XV^4Ja㽱\++:Luo@OD H7Lyg"-zG�U܃M'+H|=";u $v3Sc} /jc+sLv`<,DUv )mN,\l1~iRl՚ )>x8 ֮]W%^n9*|L %S-g?D]3Ud S*Y .M:&�P(Wy$h }j2?LR}g;q&12|MST ?<o eeaFUqO'y/KCVh4i"Jv"2N4IΖuR1lV@ mKNLe>Bimyf>[H|,Xk\ J&^ 6$D H�@J,";#Rp@[zб#T L͢j)QV1>*iW䬪z 1uR}]S*Pfr64qU &/Lx1Mt\q<5vLOObq+3xGh9z0VcGm[Š  /z8$8|ŊrGr9~lylle]:VdleVŃL/Q,ߑ{i8`c)Λ߉3:?M E9=TǞ2xcLjwDAES-(l~N09Q*4z.Z@$xodVwEIZPS7gid7 Y܊Bpa xBHƊud5o.HD 8xD(P�ҡWpԂ8<cg~I, vcD@x1i핡r`q/z:5G4Bk I<*/-S'D_WK؊q1~&WJvac" :r`9x�چvˡGQ?ʉ.9eL9rx[wIշeĸDgc(>0<<S8Q&,S:9\6lEE &h |l>|mFbIA"ǹXKn֨ݸhR$qc[d [a�1p{5"N=<L ح>񐩯4rPn2Xhhb0i^5I}'q:QL#Fmf>COM?zҏ?|qzj5 g#y_sV@"$ Dx<i2>c]g"�..2%O.zhf\;Y7$ E!cW&[;4/(UmYEri7aa0@PDŬ *k@\\T s|9_Uy yu΅nuW'uJmѹ3Z:,̅-pWk[47nZٵ^6] O@VC9%�dIkge!r/gKc ~}ER<g%ijȶV&̀c!SO|xBZ�n sMaI 5�4!82D "[H=iX}U8&W˖[AITVVJqiz=C�xh*Jb9{^嬨/Cl‹`>g"ۘ8]}GQ8c>Ό^oԱƴ(ot2w A3j2l܍]]oӻ/9?+ \r hzKO;x44444'h 2U(k$tƙ*_rġ,ojo_Ęm4Iu�kKb EL$`yDbKR1Vt:WqG1vS,M dUyKXF#/XS*cSd�~R%Ŗ$LU-$jQ*aSӫHLE'6܍(w-j#eddY%hD**s�@EyUQe"5gXz:eqw^t `>Ojw IMu"`Aa[0_|'IQqz(z_aPHY_[k5^c]$jޱ/#h]}B3Z/}ˣƽ81kɞޛ,' 9V=\Y'k=h'Ev6L,h h h h h`O@ke3hnwi ؘ|/Vl@o[_b^3zϙ$5;Vﯾ;uV8Z{Aqof �:@Cjj%6kIͲ |_}d g̓r�ID?(e oԔlêH$&Z&R `Z!Zc gM^KYI,L*ʗ)X TTdfk'*@xl爳͠N>ޮ5GfZzub)eceeUi ԆdZ>2c\FxʪXX DCQ7[jbFqռEQϗ:@WvŜd9ʄ 9A0E!FFJe}wF9}"_, R�^{Ss xS5@Ӟhi:!U!/5-n|"Zb\[yi f6dmh׫؂ڦG%# L5"Yƀؗ!YU-ucٺy55ȶ+iP()~wn}2cV |iOzFU[ff.IjKcc MH.S܆%i^ۂ`)y95uK7Kni+s⬫IR6yLU^,+|򑒞^2 0CuuwΫ${8Fq~A_a6Iw}w*&͂e)e9�bSq@dRȡawfw j(7!6 �`bzfC 0E*e[sLf}[gh wQ{ss4n lp&O|.$w xgf44444Ghx9^L2IjfC2v[aw̃ͤ 8(3 PX+=Q]YAX+'s1xje;@֎dˆ}A$2�R=}L2Kr # g}eK�~hh0bY6ǧ'|z>xwonD4nD;. ާ^˔|Uϖ\xKVX7g!2wQTL)̒,Ȳs$^9p:i>|KLoOgE$/?l^^-oٰN7b'sê4zTN gRM�b#i\)U$Xh1H�W 6S87vEg eѱD^/f7@ַ().OQ6X򮳍؈EA4x8qJxq [5` ƞZXfr!ڮ!ƨ7 yGb_66m9<'kZcyI^xVQ?*bEW Evnήv^,$a>N]?an_}�$;#Kf�d͙P]pTHy]c,Jݽz&iZ ]N(8X\[Eٺm,}Y ,+2lrO~LHJ$/ W3)<C/m}ݏiIqJoOFYryUִK3ޯ4+,C/͐Ys#b>ɺ? a)z6%Q,iy|^? l56nMuz?sDcLTfg; e%8sS(OCԸ1d#Phu_?}feAAAAAA $<^= ihG^FЌC^I7SRI(-fhj#Xddn$w3זCqϐO`1YrD 6lkFp 6xK J!J.riGk= �l麿hCd})g̙ =SmSn@K|/pޞ.̭On]+[ıa3guJff̝=^2c,4$Ϥp[3)ؑ%\dzɀ355cy6b s0)HKyq7go�W$`D~/eQlА+3՜,!pFm۲A־lzyy"%y &ɑ- o"C'xRQ+]wUf2V{f$d(?h@h/9ԱR;nKc=ٕGUA0 ?,`DaUg=�@{�^�%AAAAAof1=�_z/ C"ōI-<8%iͦH.ihy3ɨF"6BsK:Y  �h`)^sNi&8l bJ<q:�/@J)_|K6#FKknZihdys,?s?`\T %!.G9}:/mͻiy ˄ ,X$5S'ɬYs07G 4ܸqtdk{ΓeRZUiO )�RiRc$DllAž"m�-iϞ6K 1Owg�0�)2uvTUyR9 ze/Ɨ׬ /ucֻGêe)߁,KGT|8]eb؅uVZho2вP?'Gr7+xwE<#2flIxEG&Em)�=@bhrf@sF�֨%KI}Ppծ02F#K]'RɈ~.D ܀�\220U0O:G&Lrނ\l( Y1稼JA٬Y`OGXxc�Z@6p� rص _K aHYi̝3WJ*H�xP.&$hjj.o1rlGЌ:M|xwmyy�uC�~ԓ^ ᎇxBxDCwʮ|52[SV4dUJ'kRea)2a@Z x;~6ٹy~ya?\V,9yro2}Qe1yeQqg}rSnn>t;,<| rG_12ͳh Pǀ|#G_$6Vi-w,jsPHT)/ԑ<^<^G['m�^B7X/?8jx;`a�V0\7npt1N>j @vM w}y%oc}#j dL:[=tѣBvmmu/˚UH'ȼ9!߁XJX"&LRXi^ 7rt#`{AuuuI+Btb*] �ʔyAr-ML; 0с%8~ccs׉2TtwHGW @‰K6A:Fvm1}k;=)W$KH�q9XWbddֆex ܰ17*>" c@*N ($UM6ӧJѨ;{nA89eGMʔ� ՕRX4()%`' �(8~>{ܵm+XR PʗQ)f&vʙ9 GKVAPX'܄%eҔ%2yJ54xXK}{4lL,M`TuDzhr,|0&jDQ[qnox- TE4444444OЀ5ܯ:o,`1LIV \+~J=e,|m'!>󒙕*ݲޫ@Ƴs>(l2c"ٶDY0d͝c0̻d׮N=Rہ2+/P*˧`ybrC~,XO{oAp\Mc@P0Ϛ2L̯SL>xq!jٹkWm0/ cKKK C*.>= �|� xerU1 gt!�|vdbHzjk| a<DXCCK#9@I2{fh{IF=r<TLVMC�/d.쎽[YYdWv�k0��@�IDAT7^7n\Ytgyy9@Q*N�s0TcddcLQ" /&|WY`TCzm;Z2tҚ�}R�/#cwk2%+^|\z/P+s-}_:8_V=jᄑB C欃܆AnxT NjUIle{T2X.lC.Y3S�^      fZZ* .fzŅw}QɦD'ZeV,zÓAQ4 l u>[&M@hd͚z^er؏ Cwcx\|w^![7S8ZqC3t{V{J�@Tb`}U$5�\ :y�!!<F�3 A-� +Rpٸ3<#$QƦ*8a2AbYy�4G-`J<'LaYEU aR7|3r*t'芌oͦA92 'Wg)Q@0~|ӦMK/{rキHYgS1g�և|Tn@!G9 kJ; I=Q\QK]<,)Qy(I%M'9Cd۶R('tAx(I b?djY:tqx<Yؾ �y>e/<)/>ګH2Z/ ~=/;t6ƒâHd9Y]9m4W1B}(gǀ 0kgFuwN~=0=CϭxAZ,C ۱2ˌy<}F6n$a06g]׫ ςw+Α&ݭ�'$G>uGꔌ{H=8�#)"_~E9+j'PH4{.d4^'!8G*KڛᩪC4BxIN<L9`E%�JA ~&7 ga9`LEX@yg+PL'p�"w�l)F@M0�Yt1FK%“ gH0rVEfwF:?/wq{sOHٽ0Җm{\r;y̷'o,jF}lM@ )..�d}}�=Q!{a@{!)2 c]E/*A6"IiQ / s2Ɍ!þʐsQ`ֿ5+ קV$%TBsS0R5+(O5:exYs`02x/DlO ʕ qEJ`?q2?.<_y'}DO^xXyzaRq2EgguC^x&KgwzO&}TT}C}m-?PWii /S*/zfA#0+*+ynԗ 1B=o boI۰ J=`,M_p NSG .CRwr7ˉo=AKlR4Z.ze/#Kuk;YB� �V<\5P)ӧ/SO~tС/] Er񗯖53C cJf@W%oGwel5z;zf8~ajAAAAAo̪Rlfq%W6 <,A~Vqi]_TO 9Ӯ%O`h%&cpLZN/?\J/c>I/Ѵ;bR.˒G* Ӯ_%n|6_c\RLx̤"|}ضJ.Op#v7 )rŗs>herb, &�}\5y6 dEhXCrGlSt?`SMzXu9/&WL0}͞u|))}rqʝwR~!yϻO.sǮV˲w«Vx9dBA,M w mwL~*w|y|ȗS[�/-`|wY%7{Exؑ7OX7z1֑|}%ƗGRaAAAAAoc5"P놓S `7;9+5ps\ 38;eEeV,k@,,sNLZ-029=6z4M~yO\/R^GÉO^n_O,x׋aѱmKϜ׏&˩/ͭ E艩palYzH(qҥ!T~4 a[NeboZ.'ǫr쐴.9CObmWMKw? W\q|+>^9.?cRO#d9M}׍*jQh""yn9]ɟ ~N6m!Ïɚ߆W_rH)xl|s].: _\xٷe~rO4{e*z}<*L4U qk\>07_4IU~4iHBFRwR3[R Y+;GhИҸa,!98qAt-SJFd #@介 ~�oѥ$Fۯ j(+[wlmz(1{d|ik׭ŞR),}am6vF E#o{3žOG÷IA,7UJd8`/A>'7?z;X5I?7ovkJ>}.k| ac@mQ! eJgt|NsNy'<^-Yx%"`S+1/,0ʥ](;vN`>*7Q1b\'_AP?|c]q榫ϟ+J9c-Էr/n^/Ph<ڗF4Q<0uH<sȤqWk=0=G "Z>(W)?gt:k> Sη;FzElHJJ) |W�]<׊$"z?ªsJ*edO3F0[/Jɩ'H;̨Gv[p[z#ya9E&w0&u\T##MRYL_x*@�m߾އ,2?\ZHsoBJJϕٓ|0!'C7wŸ7KgeHql쑫08RGv|)cYg-9 !sLN 2oA|3?8fܼ\/.pmnGz⋐^R=3Hu޶t޴cKΒf L0ylYrL2nZ r/dˬٗKSM؋EiDx"@MFjmmM򲫥uxOps됫}>H_o_ vR$謒d9(*r\Q_|60K,]۴z]g4L'h h h h h`OҀUyZY*׫kFvɼ]=W'-mI�G~090lDaGp@0ΨB̋’o̔7°瘖: ۧLġXޕC`S׉Ā<#3>(hԱ~35Sc}OJ૳C[jjTU `eڢ!5c—�:Bx.0�9Z'Dwoa�D5@9.4Ail}tw]�?K&M~[ dͺ垻?G eҤxw�$a' q}s8V@\rˏw q]oZ8ّ;.ٍ%�!Y:�/K#_YdG(ys%u Qp>Α]/D`\rfGɧK/.W^Y%7=Gy~&Z-Ez3+C~|R#F>M~Q絛w.P094X8ǔQS8*voJxMO;5h h h h hրh{9fQh|p-G6D9A訠%2/VMТ,3.xz! A�B>UȚW~#� ?�O'.Kl@EÌ:Y!0dbĮ1\z CDž;Nr\ CUpjCЅ4 EF2ҤSS0OGL3ðj#ܯ-Jc<_>QrϽw x]c8LW<�/UpQ}rϮKaxG\�sَ{ 4X;.yPJ<ij+yL+akk%zi'lNp "0=ؗzK쐇 A[fk2ܼdN̸g/O]}?&�* ׻u*AϯI~pO)-)MM9rW?\"^p_1 [1t`t窯2BrTSY&b|h 87fAo~n&a<�en[K_59^, Qat`p͓X]K:M[k0D!$? b/@U,Z^A(X'�hPi\FCx=I܏� 0c9ueM (*vs:QHÕ٦K{Ʉ S/M+qp2a&Yb џ5o}L)).^ P$M~%p[8~vvrF=E3O-x.;?ꙟʉ^6=%vzk$ <kU\(jx h8N<,/!tt .u !vi45AO;o{0z<O^ZV%3g-Dn*"z Pw p@׎Քʯ_(sXʹ[F># �V~˛d> >.O=0^&s�NGG>K^/."++1%%.&-., <@ʇe&ģX^q kxaAAAAAouZ<ÔX_ynS psZt<3jLNd-:=r?+F�/6 rXvwƷиwlpą*PаDLET XغOM"¾ - �3Ohx;.W "!a̞`/QG8hj~;.�meӕaݯ]ieܹ`߁J5FMecKeA:+d֜Ãv2¦_Ї}b}'߉90}q>7,/}l5kUDf! "OcT><d tz{`wz|*l<Lz9$bH~& ë "::Z, (gCH;PU�e:u(g;Cy͙2`}G0>ʑ£uwַ >3+\kSÏ-q#Q!O=},ZUb_ ҈%% 8{"/+o@|e"*{r(.1)Ow{x=:4h h h h hM�/jjz=nY;i6L 5|c,(qڨy5Nݮ:V*9{oL`0 =v"r5Z,U(TF; ײ?uʴtaY4a1T}q!� toli/Xp8|~yS{g׀ߠ1�"Eae�l.�&bߧ>}|g*xoWrʉ v6o?>ړ!w}[-rϾ�H'VIQ/tJQŸg�xe*0""XҧJG>,$`̓k."tfi<Iן-ٖN /}]=4md+KRP2@|Ͻ蔙r.2RijܱL w u6S8Qql5Yr~/*dN/mq�3 {`yIķw/tj@@@@@4RK2͜ K< +`�J#=_0`vge1֗xjĘj^!Q{\m6<>ax䔓?*?e2'e:Y' yxJ'j++s �Ώ zLɓg,6.ŋOGe�i a+�ύ^ff⬮d˖mrA1Y$U^^)˻q>K_FT!+&#]+W| q+yHOO1)X؅ewsp~6vhD&)~|Xw.!ǐ^BN~,Ø_n²F!iM&m-�ѫ{W /RnNTbfZ=o�rfNS>&*.|5p4x\0܅i?)++Lԯ~qX^srdsG<ǿ,|*<jae& \�yW#)yq>v'P}"^$:.3qO:x44444h��3 M3ɖ #a*_SՐ^`'AO9)K6V2JP ^VN;r!GCT#r'-JR/y?" h'l4Xߨ;vlw�tUcX*9GA'`U9dٲhQƯ4a7A"+˿)mq|ںZ9 6ڵ[^@Bn/@z95V*-Gm 5uFfP t�aZ]lټQ s!ܱ_KO,�B0ȑݎ5G]P/\&<=S÷S%޴J{Hql%剾yμr)7ogt-ِ qN\jC3wBV٦oB[k#Î8AU7%!c. v k$ЄMJӂ11)�ᇩ     52Ϯ4*{DH v�f)CwT&A/QJfu0PC~0O=3r?,>zp<38n.2Ї^ >6?V::;d?£2Fh?a@ ub|b򧤹PNρ Bs_^x@mۈ34BAKNC�pȷe1glw �#(ƓV/-ʦs?$˵B:ej(_{gwاu}b)�:)]IͅbΎ&]b}{-@ZيV2"yYK*[v#R_g % O2RҥkKiXFʴ^6Y MZ;Kك+).l7k2}70jFy0qg ylRyO{z3'K_ Wk~ �^YR[6׮O֯{{Zf<]h+Й6^|XEW!"yXZE,u=lpB1c�Xk�^      pVo5O; qb.NHȳku0̼cxߘ !"S50 8Z-y\d֌Q#ӯ'?|{!w44WP#'`aaAX�2,<\UkJU/>׏sLooK~Eӎ `@)YyRtk"eǧ+Ex>dN1w}#Rڟ[~._̟#ɧK < roG"{g[zpCk0-{1wnDd8w;<#ڛ�:_je^Fh %5s �^ JA'{i%w= u}sIi?2}g?x>׆NꖮuzMr�dֱ_&0 Xyq@ D �O^n̛7[~.޺</־8<vViok.] m,8{tIy%:`"BpMM\YÑrjj7]F%0؛S�^{sx5C oB$ř=:�_]#҆i�פV 1sE`նx%Jk-l8#/<^˗t FPs>7H{mФn4@t?—U4 ƸLj{+iwP .c|@{g0cq HZڏEƋo^"I`cXS<+:F 8w.c~%eeU,^ 𶽨:}TOYgyr C=끱;2rީ)ua/VիZp6� ͑YsT,pe(HX7I_?BNPއaH: BcI 4�(׃UhxFֽ\L 3Q&Kw&ed͕r:<LI]1e�ߓd? q}g??k|+%h ҆sI1K_NzV0` S{UHyi:Ec/%.[3*ɖ.jSDx5jS@@@@v3*Ǎ.ovJAC�0f*%Ƙ'3E9dyK~YDSߑ|9䤷-wqGԹҌpaHYx@% p@nqPa^ �1>,i#� �(zFx27d#ǟ(3V4WCO(7޸Xrх�+8(zCPG_ߖ* 假W {L%{ P AL9ŒVx^ڥ@XnئO Ӎe˱U֬$+W8eɎ8x<\|+ЃgJ5h`Z,.04d鞮Ҳ|"r""3 <~�I-޼yBoW/bK{ .Ye!|,ij)S"+xL:dtmYsX|9蕏}\j_Z*<[,4 7ֿ]Ɯ}ہ~g�vGe_ָ]\@G>q+qU"kݞ2�Cאok^$Jh^O6+h h h h h`ӀZ#a-%g$ LQ$FrV O,B`FB& &GM2Hel'߾p ˻}F;찷c)J_D\l6YVSn~b,̐|b�R)G<)Er:Ff\5PX3̴!Af ~2^A%z[ϒqVD<�/]:-wȾ2Z }[ʐ 7F3fcy2W&t oٵ 2Fr cY�^b'1G&}|m;(}sU �W7B״ZNڪTqlS/h.CSTiWãZgz>.ArF+zq`GAnX4vKk ^rp߾XxL> Ɉ`jBŁ[>_ſPvǾ&kmm7s</~X;^ˆ xW#Rc}ܩo}{#Uu}r;r)XJ=QGi}Qi||;IX;.S�^I     Eahɛp^^o,5ߤw3hJ>Eպl8oWnZy Ҽ,G?"}=}=eJդiRsJ.݈6X)`(Sᬪ4xGp`zJJ*pS ER &�8#}/;; &* @ٳo` ɯ!o椱[ 65w!|'C�" mկ 3�fhЧaPgg'�Q[B xMsgǼ3uOs/tHΧeKOpxL[Nd~)2k C@G%k@C잌x>6g`_UfYrˌKawK/@o-"Z?B.5Q:p\8/߯o_0O<4.ի7jXCON/`/~8UN(8�$/@N~r "rN>[𬠋q*R،N%*Y!ש�K ZFQxFLJ2yYR]�f44444&i-.K%y!k4 HKruNu(gX:po/ǡrȑg쀾Zp͊dÚFxVaOpS7?GiZGCm; ?@XҘ>\X 4 J<l!9/pocNbrg#8-X:yzt^1Iƺ^z�r<so'Y~K O9ii]RY51^߂ ]�&jt ?^:3 '\zEe]Sqyĉ L:8$9o -?Lm~\^4ע6"�<ZZ4`[-Ǿ=�ecU.{ y/lfx8K/;In%؍K}xVGa,@ reGyR[Yd3q9_\']w*|fߋԉ2KЀ~cTDꤲHH<kstRvי^(QV_><5p^@@@@Zb�M 3ZjUp0gr(ǀR)EX뼬 х1f`XnAɮjZG�N2  X̏^.W<!Kt3؋҈|IiT'V> -`\FTlEd7H}6L2:$ -nɁGɳ܏C \GE8Gftziًn|QCD]CEpU{Pn6S5yDYׂLr֜2C=x%jjA8Ax칪fOM0hF,3}3q ;ơn'` x۔{o!Ơr<a{\~K`ޮ<_)X<C oho~{8:!gU&,+\j#V^!uuO?ɋ` -͆d1u0) Y"%ܿIf^+4Ǩ*%QQ ݚߩ|4}afAAAAA{B:Q̌WدF4q6#/% !!�X_tt K\c&fh*3o)L~Lkh98\o�C0;!�HG,9 [ʪB�-}OC#E2RK1~Б'1'Of[ !eЍaÈޓ<0C:"qo{{|t3"&ga�t9s;%cwǼ?y*I8پmv C`r ՉCkkW�^)TYf,Z\u!F2-Wg~$*tx?iodބ%|5 ff ?!|fk3J4Iksns&10B @ ||׃ OPCLo"rea?X&eagqY1eAQ᰽x!uKGTā!+Vg. ϪK$V</O?q?�^CI(gww7y5xR@5yrޏ{?I, Ğ2x&U5HC6ZIS䅲>을  "p8'e{RaL1+,.ҿgV1444444k5 !,m}7%&pj)05:Ң$2aޣg~wcY�XĞVQ# UMďb 50Qrh5EjcO*"!N|sNٹe n CT�q�DO^Z>E&M)͖ da0 DҪZ!9UQBYWna+_;oF|N=ҳJ+ero*SNZ|[�!LUU{�@k{`.?eV={#a>-->"B~C?.h]6#j_,{qOC48+ uMW+Q"/@^'#޹"ݓpeXn c) jꃢٚ"Ӳ{Hnxn,*Yl|!'8G Ap>ttt�6JSC-b׬8rvl..�fǴ9sw2} x@;y8 ٱ'Kԑ`>ޭ|D,�Klgb/0H6_ S]6hpAIw ѿV _yie4zIR{S 3IOhF-$KH-Ko FAo P3y_B,F (N&1qm`E(p_0 f.ISd-$IhK�|b;J1Y}%Q'F%\<һBM.:0W?sfJ3:466Kmm"W'@R&J8}y|ߒo\͈Uu9So+HcIa݉0�Z UM�E<,O!!&"H*,,=o0(Z OK/O\jA |@Lr*H@;Ŧ8MFdUwW "mqcx@7p) 8N29\pdOss{d(VQ֢_L�.zQ)B.þQr22QNH뛘gEzR�^G['mx ݂` : [Ka%P! KlƝz<]ˆ#&#8iXzLd6ʸc\Ggf!J&3mk#%g]AUQL3&8.Kr~ۏRuw_<8rdTyނ 䱥OJ" 099Ur{?.7OF/_4r^:L!yV&U90g~:eBR]eh0B <BB% 0% aʪTZ@qvE^F}%LֹZk1U$"%qD? L*+:sEϱu7x_U镍E^X%�^N�NŅnAAAAAoYcaaO%6W,jr%.h4 zm"n^\"ݣuf#@$ zGN�f v%2bE0fAI=2|#Jx3A ж1QcCGu\'�pF]'?<jٺ<8C u£_.wv(EzkjfL\"|=^;߲m<tc8y%d%$fÞ+/ ).KExzr40)@cxei//= Nj2Ng,IJ ܼjS:=dWD,lJ͜ksxsKc 9ϞpCCc|1Ԑuس>8hksേ= N@@@@hW$C5W3a9hem'RNQ+2#i2|![.7HCC(ZD4r`L<F(NufI#QQ}0Eϋ$X&7.{cwi,|e|YYi? ^C蜙#:Jο;6BK7jWm^~\ӛ9eID6Vh{Ԟ7Z;}Q^5Qm9>?Obktmw~EDЌ4=m7 c%xA,}EZҾ>嵱ڃF%h h h h h54x%ŭ3Z|D#M:_OZjzl/¨4�b</ٮTDgwHp0ؘgJmsKv_^lG6yOg-S)xaGjM! `k,~zە,}P$ rzi.Zvn^ e{:d0 18OB`"w,YV\1HRyz_D*ܔU窓Dar2b]/cE-9b}ܳ{땻aC[XUoeJ&6&l<pLv#VQ#٭-N^9ϳhq*BpH#{V&�=yi^MxړEh .ts= 'o11ظk/<b M3Sry mjEqXXVaUq<MEo1X(+uPcX&tLTFCq1@-Fn¾0g֍`Y^�6ʥb VjЍaNj3m~vOHҵ~$V+"ed+>kuG`�wzq r ZaUfT@^LBv=ƒc0S��@�IDATc7?=^cI?4D7)^fxQ{^ k{&A40JVG}H]8^/mtIYo` +Fo!OA?.EDT졎So*DZ. V 1<B=<sQ;AMQ@qϨ47&h�۳"P$Cy#Ej_#Ly6%(;_Ի*}1/ VYJ0V=D>Ӂןyq=@F<#dtcDed8C�c(Q^&\"cѱ5z5 6n]Ղ Z[W8@ރp 'jp0T({ZˑDj<Zzܐ"o7 ~S&Za" cmH)X1�0hN>?>C7q,8y F31quj+Z\Rw_B㦴%_;`^A^i}H%3bQ'&aH1D]}<QBݍ6eW&:i1:2i//*'~tđt6Bp0i΍+8OB/|X><wN :QkI`@:I[ x^қȄ9�ZXWȲ 44*G,v) .J~`L 1tseek=nQ k|?07WRCYwfni "C7ËHȉv9[ Dt Jet+ e]yQ և! SO9ʜEtj zFqvSUHAfVFD2eyJh'7>mr5m(O_`Gci0 Si좲{ G"ܰfA'5%Pj|UלAbJQrN'3 `ܨ %Y�[9nq<r`OBٱ2q屨T 1ɒm~𤦤 d*ZPf־_FM6 x'44444fj֖Z\j{$[,g<';%vJKHo|x# Mϸ(~ t%~0 `0#kS8f jkAO(||6Z*͸Nq. *9JXFS``q5DC 񏸪1zJcTi5DB*CR93J?^ȑ&V舩c !&fb!�"k =pwf=-ڎf1;c}Z/iZ֍ӹs4l'V{xx5n[@@@@uӼ5J@G`K↙i]a 8θ&\hٔͮIEtQ;Kr`7sI"t6 kU.#z,d&Z0*s$ etIO\DsRaQvDt@ =>^xncDzcY֓9дhlG.Fj5v2敟K%mO"ʧzTjWz:m\\-B$bw9Zy<]N<=sYsNBqc':tFtʢ>-L6}J1d9X../dX1肂%/nLHVd3x'44444fk fy%3o-^;%IL0F+ALzY-aR$E# roj3 :Do YU땞X<KQR>xh8MnlH 2 QU\ l&i_Gc@ujxhedcC5IVl�S.*Z,U�7r9\կU3dGU39չ pDh&I|g£ť\BhXA Nx$�_q}9F7{̑r *6V}|'eDrHL-൷=0ߠ7Rj],/da6c7K"GA} W%ibӠߍ7W]-Cl>laYiF~6A|؇hP%Id5B#ESPJ姢ѬޞˆIb6&g8KNDXz"e H}4zJMzKJ.=~?dYUleh1|*¨g<Yd)ga-J>ęZGixIpK1ʨ)F¬.vU@*c5S)N]$WUW�&44444huyߓ!JM{m2Sd=[)�`ʱ|"C[XRWR^w{v2`i3A�`8 C-2%�sduDDڵUo5џ6<F /Y"h<%+@M9:t"}]Y;sHOkɁO)h'LJx?3~?,՗+gje�\Pcf MD.wܷq:lj*09Im&]{\Y3#e`;z^/+G%/ռ۞xo@@@@Wq.!pb,@3| F&Z`55mhl#"̻fwf䍌WpFFl##ADlݽZkb@% PRdYF*l]?mܜPPw簛̨hfhԮ-Pa\*.)Dv<PMoejuA-ɓ*~xz!B j/B2 ؟mL3eJjЁ}"%0NX32zwpd4x\I�'44444Fk nnj.Zf4hbjѱh4&g"-<&zenZuOsNRNl hFl|1K!cAxU`6L!<@ekDzM$P{y ?Mv_4>)J2@`6njYb&fyfDZ_QIg2/`FUyav)F&߀;E_z$S8l0;yIŐC/&?]eUPFa~:xU,olDFn#O^dpY3@?}7crG~\5o\@@@@v[z,ƍ0%QOׅ%`ɖ/5h=12N(cI[[ՌD7^ncޯݬO[ _zLIጲ`qYDPW EA-6"%\v:3D}^Ȩeb$Z+SH^q\}<g|.,%g#rEΗ٬yG#�3y81vft|ER4pʋ HN?WYUEd6DM.N wBG(c<TN8q$bJݖHcePeU:'m8~ajAA{Id7ϓ4kO GDfUr$+#?෪  +:qSYƤ!m'UQf[UR=�\q2e4:PX9}]Z㿷F}Α2iˢ8jp9~;]<G3rnث`=DB@=eghƊ~Tq#ϫ~!-uӉcS:3S?+d5 Xm(?UlM |&!kiTSU/w__Hʳ ;K2L2jrT;,cƤt6؏b-;@<+zFE꺟1D~\s?a}9d59טr^ϹG3kgգMN*E�)uϤ�s~U84My\ 84N1f>ڿkkegu$~w^S/l$z4sqS+[۝dnO͟klwf]rH/c,"5eDQ?Ƙ,#W'ÝWs..{fuW%*8YGZ{;Y1D}^h>%U2_+-2�יREN }Zw7VcknT շbaOhPiݵ^)\#OS; k;}C%5Hnit˂#^zģxm( p^''x:G_q_-4ǹ(QŨ~+8Iy]['ӿ~/}' _؛Hw=sqyN֬V}$ u*WQDë<AeW[TGH,+֝U㯷p5zc1Ƚ\$3I;F2*z9G5Ĺe,w ⹸uVddy TtE4^UU$x'1PNFܫ2k=Yz5[6;Oz%~9KaUxǾK~ZhSub\ɲx;'u3ףslp1I⿾G]‚:?U簏;-8㮓eͫCf}%N=:֏A2Lvfՙ׆<g͹qONQtINy$<U<g3\Gu5 e RgkQZ%o$Ag [ݡrkWÝ@ ~5oRLB=HQgu*ofݞaN~>,$ ]#?cGhwf*UsCn%9o6~/nzxŸUux͵4 .pdך:qš+^x'$Q<EzaghuHws2c0*#1{9a}u*^W\`QW|X2~/^kQ/ b"(D}M̺hYէ;sesE>#ݚxD׿x<fU(g}OKL`~?hB6^t'o $nM*ײoD]m-vy^cg2F D~:>n#_sr]hר ?0KZbc7&]Qӧk^x^_>?uE�tJJG=Ilߏǯsz=(_gtc5uw2Q,γ9t5G^/xN-zUt߬r=ut$lj~׀gX۴cʽC8n+KB^*cg1z97,%B6Nq5X4·]\r>ׂ(^k3X<UuRYJlsr9j%k}V ki_Q[7ͻ[*!3۰G^ϮȵY (?UIL& +n}|bk oTu$ls)_q3Ϟn' sz_13:mP_{Ȉ]׈nu?9nW1 FM|/B9΂#k궺*kѡ:x\b߾KZyݟ=\?GX cٺ.ڬzLTߨޫ_4Vٍ&թnS4 }S5):nw_-VFp ־]?ڛ"+!@�)�9ա+V*FN>Z~ů@WuL;Ddx{_m9m?pwwwQLmwY4CP=Sk絖XNK460Ky(|i}=Ę-^_wq_ڦXKo]kW>8nbcl #UUT+"':W;xq-v#./wjq7Ma絺:(F1nu,o/y:{{~~~,�3Uwy⺿뮮иNԏEӨm:!ȇ8ߩFQ6G=R6я]`-Fٲ~swYL/ךS^gQQs}ga{]W=Zi]~[eWY5rYNiKw:}k-_9{m(QI}uh|3n،kY2iu_U\ϟD8OAjhvaxtZKɕ=}*1 @�cZCAk®ۡl?> ~Ϊ>]}}~o*!<YC|қ@)źvI4'TGYm΀cڣ]#WspjX׊#2 %~WDx>t9p=<9m}\Y:KF;\bO&>s<rlUe/TÚzU|ך1n?`9^YhpM:ͶTd @@rLzx^0ug+<8_ߑX04DA:^q__ד|+Sc4Sn=k,ۿ~u؝WYtO o.g8P갼kky kSy1d͚MT>._cuۣoyOx*k6;mq/=WzkG \UXGs]]s.Fuykʖ_Y(+gi]]}jֺh1ZmگqNxtC\Dkgy_3WgU @@:q2n~=V0v׷\K=Br[[ kkbbk({Vk{w1yJt={(,ik sEOY:ehvZjcCvGyu.U\ =cѦhל1E咡m\w>F_){?Uם k=gLggşq9T*ڠ|ì~g'mY6>'zo9Ӯ\Yk$ @ P}ZG}CvY5[w=`\A2AY3Y8v&<EY&y-1ȣ]\g;Ԟ  jue(W5Du9\_hsj6{Qr[}Wd zguFBu=].^7*yoQj]v[oN͏<1{3X )U SXL^>Rv6�CZ}_l\vkEX[s2` ʢx=.#TA>d\?F7 @@>lZ<ϽsN{,a76u =GG;U&?ZZ׏,^{"q�rݭ<Ԯ<o!ZF) ڬOzkY䯃.8~}E}~xs>.Uc xӨsʌ~qFnxVV^e2hvK6Lϲhn^=b]v}J3)$=?oG/p v}(nwqĈD5&..kK.~*<@dM,KYouY  ,H0]]u]붮_UL-Kݙ@:yǷ]Ni`1^qbع3sPmv˗ju|ӋѮb?ES~|wWנO$Jc&;9rU$~E#>T:iD.܏eKo&, ,{ kgfyվ]TuH4?$7Y}&g%Qu~ZDwWw϶FlŜμVj=kYջ]<+cŴM,zݡ^#DЛ<"@�/X'u*W^y{Wuz*v{P'N>qH*Sx|oSz=.]=cfN;V{EUݣ=zMe7y^ұ}$XM$~]e'^<_Zk58jfo=z5wZ³}|r$o|.J=Xv RWi&Uk *t#ubGvsyџw"ƈ1yo5~\߇|Zsk}.)ױ˲Uޮvv{k_fykvtS:hɖJ�#2 W~tzh9]r뤖kqTLwJ2ڵ9\mW:l>ףU[MQ+*s7S{sds_ V)~[=b1!m!;'ց:0>9\N,0uS'sזO LKj*b>qzX2Z9N&'W5}mZ\?R2"PogM8Dxe}͏nxZ`h}]3.*{;$[f!L_Bdv~�h؇uꪃ>ձuv٪.[ţWᭂDn~1@ޮ1JDmTգ*ߗ]̫;RZ_+Ph7]Wk4ݗ}WFaĨ=7¯כ;_{۽D|<Ըq}>H,㕗|w}uȤdD޷C:I׀hq_&5^۸U3jc^1:]�Yk7ƍ Di=o{yWUhwF8%?B @$8X7uNY?NѺ]NuU/ѺUx>y5h?ng3u<cE²{Ձ9u1:q"}w*W=5dU\^_V 8ϧY \5ϲ&V0/ꡮx9/^C\1۫OF쌟Vu9gꔃkӴ_gqTe(h=]m3Ә+;Uïvm'Q`Oz|{hy1-./֒r>Q7uG?_~�M|Uu@A4sjӿu=UTS^'p[WՕQqj ̗?Ew 2C}d&⺮ۚwGϊrkSx|Js~ߞg@pwz*ϳo&V5f\wX[JW>An_xQr!\3-,42NWzViEg>'ws Kjq\ ڞ9k>s:ךCnߣ]zOG\z:>VXF=mB#Nǚkrq]u?w_#@�mO_}<hG}*u~m6΂uv(|k7|V}ujLC_e#Jwf5wV٪>ujFM5X+K֟U(c 49͌z>m s<*ߪ<y~i<*^:$6Y(ˤ7vjgbsEP!߮٬սC t:wg]ٸGy<?F3ժ @@}&i><n H!&@� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[&�� IDAT @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!!m @� HE&@� @`kF[& @�}>{  @�" іI� @@ī^d @�Hle @� ' � @�!m6e%@� @`x �X> @�x}X @� H�,� @� H>o, @�$^?�O� @$^7� @��'@� @@� @p @� yE @� @`k  @�" @� 0\@5` @�|^@yc @�. | @�>/  @� x �X> @�x}X @� H�,� @� H>o, @�$^?�O� @$^7� @��'@� @@� @p @� yE @� @`k  @�" @� 0\@5` @�|^@yc @�. | @�>/  @� x �X> @�x}X @� H�,� @� H>o, @�$^?�O� @$^7� @��'@� @@� @p @� yE @� @`k  @�" @� 0\@5` @�|^@yc @�. | @�>/  @� x �X> @�x}X @� H�,� @� ?%2r}����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/collect.png��������������������������������������������������0000644�0001750�0001750�00000001600�14517772113�017202� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb*@:< X?{g/'l0{FY�?=1|{;ec��_3Ȯ85۸3|c7� X/o?~0E}.\ f2AYӟ } �@@eϟ.ؿego=gʨbxpa/Ët6nX��tFF6+7185^|YŰxj3Clv-O� $Vn 7AAA' a`bdb`a FcߔJHW@}Ev>1m2 >euÄ՗xU?L, < <"͑A^ów~� Q!>fW`, P�5?>̓k @'X0X312b`H/?| c4�b'VQ'1i]o?1233f%ÿ @3J00��A�Ѵ f%3;��!��.��.�������gM.9 7ϟί l, X10dA矿 r3<θ'�O!h)MVENXB֏ϊ@;~z?C�n�6�4H; ~  �Y4l2����IENDB`��������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/mpitrace.png�������������������������������������������������0000644�0001750�0001750�00000001200�14517772113�017355� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb̮hw?0vN)핌1@ .dDV@,?~`f6g0K9q O<ckf� ^V e$Ï_4s1h@|#$84d�@�.,!`Ͱ}�ɿ|T@@a֭궶^E>>~� @~> 3AGenn[/,--xxxj�'0 ~/,?8HP,&8?ɩ X~PZT@4O|{{{�E1bB - TL#�o6F�π3OL ?LaزePb:_X^` LQ\F�9a&HOJ9EtJ#�4�E?\zY^ E1@�a�[ ��3$Cev����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/heaptrace.png������������������������������������������������0000644�0001750�0001750�00000001016�14517772113�017512� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?%� (�D�D�Ă.091Hr#4;Jd�� Dd|cƿyG@p/t2Ͱ"2ÓK/ f�3~A-$ 4'0J*pv$v0\ w| wS gWcu$|8˰c*10wO0|vû7 g.= @�1}ƐV|1[^1( *� @L1Z(0~v /_}d�Qh��;0;  8߿ �Ę,{c=l2=Q%& 㒽@@ZĿ�Hif 2@�Ql�@�iwN����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/circleBlue.gif�����������������������������������������������0000644�0001750�0001750�00000000131�14517772113�017605� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89a � ��w!Created with The GIMP�! ��,���� � ��kྞL:~wQX1�;���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/warning.png��������������������������������������������������0000644�0001750�0001750�00000001133�14517772113�017223� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?###6s* F? sDN{Дj�6O<)W)iNel2g`DXM@�a5`}/C"?_ `� >H]-@�1aANńa 4GW @,kc(PVt/>~ A|8HY=@�aC?4# 2h8~uh$ ~fhPR0Pdc` ab y:�0@G_QdL#ԁԃ܀_xTA 70D]� }<%&J ȸ{c=>it9z>�b UP"MHȁ= ν *ڊ( 9OŚ\@ܘ)-P@"x d@�տv|,Q����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/performanceAnalyzerSplash.gif��������������������������������0000644�0001750�0001750�00000067407�14517772113�022741� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89a&���� A. Q j `   '0=\"$!"$0&_ %6$#k"'M!%+d'+=*+7+-*"(%-,1C'.#4j'*14@-4U4531004[,1.5d04z25p38K*215*38?V:?Q3?p7=9?{>BN9Bi;Bd9?;6:@EEG;@BFY7Gx@G_8@DJmCH=EFMeDMuBHBQAGNPcMQ]PSSLUoNSOQOSR[yGTPVP\W\u^\`X]pVaj^_l\a^YXaa|RbZcWdW\Zf]kgjgk~llwjjfpwbolonoqdswwjzh}lto|y}}~y}~{~r~rtȄx{{ŎØ͕ڎ֢ʊťޖ妪Ү峱۟̷֤仼ʩݬ٭٭cm! ��,����&��c 8*\VA[gHbE]3j̸֮ CEɓ%}Ų˖|IfaÂYϟ@ J貟G.[t3NI*UgЬBʵ׮ҤAjhӪ]{ڵhʝ{M[]˷߼ܴqLpao!V̸c"37˕/k̙ΠC6wӨSFW9^Gmr]w.wȓ+_n`YJNᬈ-jhkwW]$ˣ4L3e,fs&΢Lb5SNuՁXm\-4Θ%Ҭea\ҥ\xׇ `%Fb<7)&d(4nڍ8vmrG)GPuL6CEIDUx㑧z)ޗ0GMs}PG!`SpRET XWxvVdQXV5VxpֆyaأX≈ V*"eV㧠~&9ވΩ;V= jnF$qWk-NBĝvg%wiy%JeMշ<imSK=evڙX5ʖ[qm]ʅW FZj)bdyYgj0i7"\Vlj!G݊krtEb$ǎ,]z{3};8mY VTzUҀV[jXԑ;>bAi�,v k ˦vĬN[\tdv#OYry,7{1EsMc$sΐzۭ9tV`:QSnb0=2v:ll۽%GkEnl'^~WkYly+,K; :SNOo)nE 2-:!;խK*5mjSQpW#ޙ m $X̂ ޚ@ zG8pY+޳`'63 ɩgWi_C\Pw^_ Pje@tjl]#Hn,h[a0J`>8m#yғpi|.4 M+FS.~:)/WPy_b hEv4Jl F1x7F"z#H;n{+|d8Kpx )+^\觴GB]CԼ.:H\ѿ(r5Ҷ*ڰ2b|s$rI%B=*J$/0,h&dBg<V5 8sssY"j%�k(◿^+Ԝ* Mvcuƺn<x <� GPą6CIAVE@h" im$rj3iJ_;PvV9a*ȋrSy*VJ^f1|"G'ߤD,]~D[b* L|բT>eUEգ-a]XKDQ�' ƴt(#/oTF3.AE,DVTzc/TIJlT÷ȡo!CO YJ]uF[+Rdi@[zIlSW?q k(:is7%k9Abs|0쮚('vs\yJ&ͣk_zSa mUJɴt3i>pa|in67 ^΃!_SX..,Y SC,bh}SZh ҂+/&"$(Ex=Lmmk[Nu*3"tq+` 7SfRȬ7"#ajJP&0'7Y ˼R@SFK4nu~m5aLgCi=V YX4)A Hx&`FƹEY9.GO+Ku /Lg"vQϪ9Ⴄ ?8~u/%j[öY [J)Ɗ `Zf<kFY^B",jOX#H,MoO3M@P3sܛr.mU .7|mm޸uo} p!J?kRpŠU!] 82:{NYc&՝<.i:3 ,CZ1T.:rփ*eVVuc4פ4d۱m3S?lխ؇PLH]Vva.&^D)xsr36)<$PO fSȻ ՁL}O}V8cEФY݌C! _uDs34[ Bs1"Ys__kD;C#UD6xVllNg+dmwEzG,݁mqac'rv}tv4- B>fbbss{!}G5xI9o]"ހx/UGE[xeS$WAd?5XHUXFmuTzaw]F-d](wnHwC/ "M12U4vx�o&"|{IUF7JwͧWXD}U}Kϵu,uGi&&B>hjgnj)b2noia(:Ge5|x"gnIg;Aht60{elJS4+׌vuZu'PB O%vF&%-HHZ&o%:6 H_t?Vc7SNN$FByF&BuGzTCr<a2S&g&Vubs j7ss^EsRksăI8ȋhh7Nhɨlo3sO yyntqqT=ݓ 5LcY5tjhvn Mr^'94H(x2h(%g.0ȗ|[U`:dՈ> 9eD[uX!z>uCif#frMSxMzk9v|FEtErytI00<il{di ɐIɅdaeQeByᖕz*HlvZrKc?)xM+gDhNSX(yLoKԛyȅ2%>PȑDn+~.87&kg6{%%RS@3%l;;9A怺CKY}Hy^~'b#X35~)vaHB ҝs6wjE/=c6_":lA46l/iD<giqhYyUr=JvXUHn9E59/9DgR4I tHNw|ׄS'0i*=]H\iaߦPe> +X)瘊 BtvWV-ygR%mRVJY@yd9N= OD<w}f)z3Pm3>⳪? 㨧fqo1(1}FtYꏩ}Z\cOYyպZǁ v88213t~z ^B*^. m]UwsLhR:%qً ƨ*z"+ yb8ayYCuvω뗧nw Ҡ={ g3YE0aS (JE htO̱qQ 1grH-V) 0[{ ۹ P!z~k:@c{[zJ�Y7: <nX _󘞨Y2 {LvjkC^!ฮp{؛ڻ А$(tJEzX9IqXh˶TXg $YC"85c )XǼC{۸ p ccQ$_;/Rx)mXFϪRƿ\Yn m/4}&L.C\ PR<QRk׾8h|ul@i\9OD tXm2Z6&&(H励� T\Ȇ|Ȇ 諨A(:Jׯ HË`%K\!7rT؟r>f|>vS1Ջȸ˺\ȜK ¹ xhUudBX%KavzpjWYG,9K1Ȼ<\SȾ \GW V6;fLAɅ`Rכ̩<L}UBw˘ ]vQƛL�2N|\}̹ $X̔܏[l̈fǣAl\2jm\=qJ~fvĒB=D �W|dkW2쀚\< u;jDn\iT[= -vުٷ? A]r=tݽΆ'CuUhsM7+7|9ʵ1}T}sTi7 ?uٜٜ ʼnףD~}ɘ`l,hVɭى'eӹם==׊H8h LdK fy]m4`PU hŝي, p!*@ĖYFSȡ݉}zęiz9MvDŽNM- å;#ÓW ˶ sܷq"Pum(;]?-:>ԭ|b\Җzh[k\- U8G`D ?^̒xS#Ư-p-ӌۺo:U8嵀b>^= ɍ(OU7,*KjJiAʓ.d3"兞nѹGwJ%ZLO݈ɛ &O=On޺ 3٫^d߱;&评$~L羾Oo~kz *p nޜ&N>NF2#k@*=o.߮FQ.bM=ݭU^; NE @ eʧ U͈J7 LFPramm7-+$zm?F_ LM_GnյINy آnNs[;vY>L~>Q?` ex}@ +?;FX5oKu.MU~k?W#y`LQþ҉ʌuxTuh_gP C  ?yN2y4\n]wz"H%=qp+eۥePF뾾>TPB�aK. k] >|KD|xF8 RHÆ,R-W\SL5męSN=}tAP(A¨M>뙹sU^խXϭVlve׵;[Vڲܽs\oẽW^},… FLXbƍ!DJUƏ9IdɓTj֭]^P'L_R[VӺyεu_'wkWsխ~'8`zvޱ.ɐ &PʙZά|/Y:Ij0@ن@tb~  9 [n9w..:D.E<Σ,ޓo"$@BbA!$D"-* ې.-CS11Ytńb2G:|adO?D$4gJD,԰9.2;1l<O!87hN;wQ=U+V[_+IKnu'*E+-H3:-)ŴEOCU,TD}5S=8kVs#JKWLd-r@{ֵ$D IеQ `L91'S\ 'v݅W^zx_[[y&J)âc0Y鼼eghU Tl#m J(qs\B1ti9P88xifs& ۴mК 5'vɖZ"b{(]nZ'ՎIѯJP9cONV~96= 3sFQΡ37V> ?_[9\R=oM eDx&Sɕ v){WW~(Q_W⊫ѱNV :#wMϟLPf8϶ˀ^utϊ.}ӱ)L6ARLL5bb964g6,x` h(_Խa,kK˦!/0ێd9,[k,U >MhD Z&G2�K_ M8aESb( *X8):q öqӡ d>rZb%4g4:3m2 ^ %5'cr](T^X_(&_[i m&D'C9JR_t [h!,|j*%HZ""HGM_\E4@fM궷}BxDLz9NJdX灲\Fp\;{CM)v T(LKz=gl.~c AD`Sl"?Tq~ݜ,Kc`'Ӹ& :N^1<VE! 6BtO%՞:z"҂NJʔnkLp,z_ңR|͜9ĤY114!lVb$0k+Q- [bh((*D}lŦ2aP:[X +z%pCҜ&[)5f@|?38_Us k#<1vHJ(u_,KZ)b݅ %fU|.PZN{|! e o=졾tTB7W3+͟_PdrP^p& fq7$HB*R+E(/07,|','4ۘ/L9Sk(Vɉt:ώira:T(4i"ή"XpScY%nM<ĽQu/_@2 e=./<j%h1r2+DѨ%@XQf2Ϥ H1L@L6`jD"ɱ.rL>-MhMkY4%Cֿar+%i?tP3HGV&HZKvM[q~ɸy(yIg}h4)P~~Ito`!aPeD4[�&1xx*n16v}vDnI;:Ԡ2l N[51L;޳Azrw<&߆2l"2Sv`;f؂ߩQyy;A9ָnN=3I9WmraxI ׽j8]0Jlb=f\4>1ӆh|MzƓ7L3{Q(|r&@ Eg^&Ә-ʞdEц\gK=S+%:m` A$65`S7kX ͋.Ԥ|�JKp['S^-K䲤c?ʷ)Tϣ"Ӊ=3v3NJ5 ,0, ̼V qBc+#;c4s<m$㚲̈;A98p.t# )9q'<'%9)#|>[ (K!꽤j)7< B|@"(>0$6oW;A /GL$5"šC"| @< bXI9DVl:H;0R0JcI<Ŭ> Ěu3N*aDN°q5KF]y+_ ^sP ;44:5 >W4IEoq4mt7Z � )<N C #Wͺ}9$I3EƦp\I$3ǚA4!:8t^\k ? ;|| sM GJt~T9ɛF8ɕ{ȚnhJ9Ä,GcZYY�640<NFsNǙr3)A0HH1G";; ˠtFck>kJˁ8rGŋJt#-CT33C TE껉?|ʼLK 4?­;6D5tJŌtHSAʸJ:{Hd9z(@ ͔, A 3L1N׌?$2H%clCD@7q^1Bܹ$sHQ@F)#ζ#4ACBB Sp쭥>̱\ Q{3$ۛTzO:Bûe<tN1=<ўlP@{PhYJCdk񠫃X](slNx5Wە QHqe4#0-UQpBJL4L$MҌ?69DɃk^S S=/+5}>cPg щ1 KMMP\8ۺh?S .AmYOKRJTN/JDJ,4ԡ@HTRcbQ!A�U!_`abS@Upd#&sYLZR�A^FZ3QKQIW�FMo bب4$LWmE 1IJkk lVL7d $ o%ؗ M#e:W4WF T݌5J[Hـ HzN{/֠ٙ ʢreJMj)>؉MҠWG:sNn3=ݍ}}4]C?̑JEXDŽWA_WtKAֳ܏e[ <$Ir ͙)vlO+LQ3JzzQ-"@4O5]k\XY"EAū\kR4C(MǬ@99-)|zD7U]Y}^2eۦM5̗=$ZU\ P>C b= Uݙ2|ǘS{XuJ)I]%U!H\ 0| S&>];$Ň'[_7")=f^R2� "E>WPC%X9P0ܠb�b!\!"݆uj{xOcĢ2(?LA0<MḰ;f]A>c;8ΉS$cL`KU\2uPąfqA„ ddA[JXQ[5H6VXu3vnFYVb\VeR.A$]ƇjfP݌ZfogLY8�?fŻV(\ŋHpz.1edtFLk^gE1[Df{F.qn E_t{؜' lw=TyVh16Q&66iV⎶##.W ]e{hXbA<vqiQPF(;2 @~꩖j~v)`j2&k;F 愳F.jV頶V@JȈ䛦hv&iq0vi^)p P ` xȖɖl~nl>l&��mx� mv>%>..BkNZ徐>L鉶f5nGn^Q%HHj20 p( !8&o(.�(mp� 7pضK8mf& s~hh6Xߤn#@X�6G'xH�X�O-@nK>([_CfnSɊ%�p�V3G4� Ѐ 8n 8o�V؀>"?`hߓ\uruhvep896Nn;p+�0P�8' HTW�:q;؁+82/�0^?�\P0+$x�x�7C7D f#Gn(5*QPvMn7 %Q0u Xz_�'&5Lxxc07oP'W0xτ? x�@מBvIeL∶kFfCCYgsinO8_!s�wq{G6�oYg2ȄL@x臭70F` 1Fgʗkpwq_W\``@QB) �).C8ȗ1|18pYs 4oqx@6Wxx7H@'HՑ7`WU^ywᚸdoY,eNy2@|8� 048QHTY__LCH> H㇄ 2a‰:0`I6qȐ"G,i$~^rC@0rcBV'РB-j(ҤJ)RQ*Vҳu+X݊Y[jmR-ܸowE.޼w{__bj0ĆCY*Ʀ fLI3 ,Yq3СyY̌aB@ $ a@�Kyc‡-$YǍv,Rl:׉M;xUÒ//vlڵr׿e׮]|o/}?RpI#b *& 4�KIii!rV#D�Y+ĩ"}G p!H(�#K"UwWW\yh{rzշ|7ؖebS��@�iyi rx!y9IF�] B&"G-*(  ܰ'A�Fa z.F^ݑT%WLEYVqM_^W֧} ) cS�"[l!p#bp*0۬-i@_=M QG+s/sK-To%LX|0 cQ!�-;1'IR찂�+'z2CB$fULEf֔U^Yi]j/)(Bd4 D@!F| &$p,!b(᚝֘QpFu׭&Q p#+?p+8?qLOQ-PӅ2JuF-{gu4夓P]szнؙt(QC~LRg #i,!5@6ԧo't۽|aAqđ<O8l`JאǽHb ̵! 9(@ |�� '鄥 rt`QHj<IyhXlU4\/  c5AWC`b{(Dq1P"#ؽ)&{Hڶ@b摍l�, z"蠈= V< '`5ȡp%Q��`M냁2MnFG~eQU\3-zp V4R*d Lx{W'0~`ĝ(MYr C0G\^h_X "<=A!zP0+ eCP%( =B 2 0 ׁV�W``67`B8)JQ5.m)` S POr"FJօvSժ^Y;XE-jɝ~fE8*R@!?xb3h6U,IEXX[6qnbl8UWU<bA-"iF3 l0Vul9 1,'@A ZB h0ղMAjc+ԦP$I`(kYD8qg,\x.tAP}vJݹ^y�0+ējNYN<'\eZI;YrgOЦ*4G5J(L�?l3h d` e6 Sk2V(W> neԫ?/a0= *v}8ԡy}pP6l<F^%3Nv&=PTCx(+qn,Me&Ҭ Gd@g(8S <A RXSK�Z)B֙*,5OT.UdU@)�@ 26 �(pg@?pF04AIhV@A#0DÞm8ˆ1)WcB(ŨIX-n{<!޵7Ὅq;ɪ06}66aL'ޫ7am5Z O=VwTV &WtOTax+[PWe52�@V� .AD%1D&# -Ml~xe$S4xD] w׻kBkcqc&w q~;ݽ ?��`md/&왆e`B3 à3.bugt C)u}_nW(*Y  c 0bwOzW,z]nA-QYE+O::clpI2"<>Ɔ, u�>:Ƽh)wa +-wd{W͸JϤ\WUF�%�@�`At� �l  #B2mA2 b%C*t4`#hBevMuy=*¾_6_#$hE<6<C)\BuO~Xh^w΢WȑHY}EF~aB@=, <t�X@Ց෤Mf`hhr�Y6\)me(6 0"+`!4&(a-ș 4 #Ђ \a"4 "UX!Z]8^VՖܮ0�h #c2�/UT"bn�"">c/"8٢ AC:d |"}419$Z*i{-ɪJJ8UNjc. ͥ8 �% $# z�<B,M*\BA#<@A$V6A�̞a0Y%D� &`\G~$O,Z$$L]Udi �@�,P(0BT)|Xy[۷U@@ &j@$h۶_9l~fVfݰ,@ e4A4AY�#p'@�LA\x2` ^4=5Ґ$ޙ$ݨOp ,bdr =AtݨlHl"� Y6hYZ̀h$ba,uFEc5V!nfi \eQvAY:dPI@X l'lLO `w&̡JS_fy/a���� @}r!&M|<@ @D�!Ȃ$t h›n�W <hV*Ȁ@D7%)w&`^g>LZS5aɤ`d@O�B �D hȂ(H (!շ )CYZAD&lA*i 02"؍9*)^) &p*Xk@h*pj* X")4*\䌥-E锶ќ%��@1 k3`d $ 4B @Xhl,6$ եBZ},ȁt *ƹZX۾M=| 8dP X�#l(섐繌3LÞE>0iʹ~`Zl0nV:&� @T|��Bic- 4#,`+Z썄@@d%&WY`bHn؇&.p_ރ*@A6$I @4iBx]�c7Ww*,N^Ъ{!`LL,@)Xmӷy:8b kA�ACH@X\K,@A TbAb \e1<!xK* DBpg44@bT H* ?C9(I@a�\;)m+EA™g2l�� }[-p,g9.!߃@*\Q&o2� pPAІA�F* M3<6V2?0C=B S2H@#b6ޭWQc|dZ,�0g0�N&%(#8AP0C�,hz<5A CA�`@%@@ PYZA(@yK2ٲg/ T�+ԃ0(M312יp@` I!|dHV"l|٭6E2)-]^. *ƢVsgB4@0 `y@$N.*[·FO �Zb4o`|4h`B̀,ϲIO#L< ?dOTeWv g�/2+s9LЙX�6( o�%;�hR--T5֐ZuqkL@Xlۻ4 $N%$�8+@ZA `$DLF ,'06'BNdC8C'8_AAR88?I'Q {�(H$?4� @&, c2rg.+))*><uʯR87g5VќJwP,N�kba(mBjC,*[vF$C=9(x:ͮ@ȁ0L,,@T3ead 5W fg:&X@ !$$3+@ҙPb`v̠n7lTy˽qzjO@�P�$IF@D"Ws�@DA[* 3? C9 K(WAiԻ#fF{/L:0�+÷�P?x�PA:R댞+14yE]x31~!#yq+y0)#7 L{{ HH@$ #L96˪C9B At<oi$-�Ճ2+@#T`~<^bKyޮ4zs5R, .9o�@s$.|u.Nt7h詇�ൌI<?(3Ps=y{Ƅ O�80g'V**$nvSx<K ;~9C<)B��%P�|Lo~CA 0Nl;@$(̖&3I� F_(%VKz1BdI'Rɋ4D0@�L`HCvÅ3hJ&C.ANUIV"6 *gѦUm[oѓ;n]zӋwo_7pFK-ƻv<yr/˻zAf_?=ztϦ+z5aǎ=^e-L!94�0iq%yay0>It`p26$�9?IۀG"T)KIr :^` +@4�$v؀�|X- V0"@a!%1$"3dkE[9w p뮿 0 [(KΘdHԨRjyQ-ղdH�`Ahᢉfk$?\89vCFPJE=))@""I2O7>X0c $(` U;J(B CP #(�> jÈn";,ijƼxG20!S,1ưUR[2k(IK 4+\4WMW6Sh!܄="�PvG_lIsMHňF%L͸4;�ֳr1P (^%2!$2�FTRo  H !>U젂(`Fd1LPxC)G75"LBԭ6\ܑdqy|Zir"q$۶2o9{Rn(=͗)4[-H0�:� iqaG}Uߒ�%�" `8pAd!aV$rh@" D|TD9!`9es 4�y*x!C|6yr>dğz$"?nNvfڲ CL"Ӷm]ny-5w#0R3bdI~D@8 �(7mlc%| WBQ_O*�-5LP "�A�ԅ �FTPx0$@(c<x<Oa ;H� Mz@ Иm( gD@<Y)pH;V^?@!`|D �4hH/_G-8m%ԭ4r VA*˒}wxW['%@ b *_b( OQ_J&"l!9)Da4 D!!J~6x:ZXM�&#HbY4F@@ P@d-,A rQFA @� c  BX%!QPvxxy"BIr}4irV(c-֒4M\yeު4 8K rXp̀PGl@&-h:Pɯ)*AH,la$OID(2ψPhY 2X0lǹf$ ,2 ( j�D�F�IL'PdHm.%v6t'qN IhXJDD<{!'�Q\U]1zG&׵*v|dHVW)7ڍVZZ E�`> $rXw� @D G,qWgKrre O" n:!a?J�E 7,HX3 .A(ՠ LPF@Yɲ2KAHh�8I x#Qy~(փP ꛮn48r3O{ „0D"�^r t*"KJJLsn_8bpr!ݞ� ]z4'gaq D db A1\DC#r8[h�R  ( Ȱ�G�` $1\O`X|\\rʵm׻>w(;Ԣb=zԧ\ n-qb Kg`G?@D0@(#4Q ^ �i h�pMr؈ v[(JgqЀJ5xB-I9Ά6�` pPYx}9! < !0) w'pmK'lfwyʤvR{ +VBNt"% W@D"@A iibM,p-A'<�h-f1ԉ BGBQO! r\ NL,~P4 I zŀ {s#N/":xӅp`&5pQ+�nKJŽ-䫪O]LF :1��BF / X �` �jb;D�+ !, � w>."D0Pb@*`` O�FxZF% 8!,�@x@D` XEp "*[!OY܌~$Z�H[O�=c �MoA !B/܀ @,�4 �8l J""�P(�#(*|\#* c $@$ � >VkNZM p@P,6ph`-L1"XXa` `h$Q6PkF:ikOHo3ļ:�P5d\ o1]B )X",  A d`.!@1"+"f㈀(B#Y"`8,`�Cv%n & '-q''P- Ȁ C('1"(-p~bZPH @1�Q)% � 3܀!ߎ Aָ ! %$1>'OQcϹL `n!b%D8J/ �` 07pC 5L` 5!,(>�2,A-) Qo+8CЀo, o0 n`L", o a R>/T@Bz"" FQxBbw"fKRd!.(N05%tnB-B46鲂La!` BB@$N/%0�)6S-򺴦.Di+ΠSR OnT#Q;2Fmn  p*( ,Ͷ0eLEa#1b@fiRL#|J>e"* �1!E-40 5)ٖ` TK C5TCgC q4t(RJ�Q �`IbFgToY<)fR([s�CJI 1-EI-ݞ140q O $ "b�:1<� !A!or4 Z C!A #W&̕-fFM8w*UYxO~+PP,]:s5 W{5] v] @aaK3T@H b MIA#K"]d+pFTO5Gެ9__d_H/�Q,d-F!6./! 8/ ܉v|4~5ݠh QFWvu GkfqVVN1h4.l-@ j?|XT"n )@K5!6Tr-صFkzL+kVRHVs5$Koo1vW!D@ Pwb)$ uHv0 ]fZHto2IltuIeW;iwy6 10T� :}Zy7sYVv*Ǧ*Vΰftcg, PJpսKqWWh}~Mv X%b !y-8mj͜8Gtn-gng,|u&WVV-a(` d%K}xyWPAta{�1Ivg6@J;Srx[ܡU.~d]U8VQT�4V`jИ+K69y=15yae7zzU]VpP|uu r9yF Ψtt]g9xno, |vטOfcy114v4(񔔛ѸùdsɹTS?eD^+ yn_wYo9qɹX0mEYf72IH%Ic v+y33٣}kjlClYY9_6tUG9{_`IwZvkZ~@:őlo]6^SmZy؋kՖy`sy0z֗úzKyF~򤯲] 깕5lZ9b]l:EԶgF9Pe|X|3[ڳuۯ:6I[HNz/Ջ�7\Zu'6z۷ۜϚΑW;{n9`t9[57GLZ{cA_8ʌ5{7{%|A۾͐+][Hsg#ؽ|A'|1-] :Xտ̝ڡi{R`wz^|dƩdq-ܘ íU١k;K|^<;s˳ ||ǜHy׫ukg!!=\U6Q{= HW0у6K%#-ֿ3]sӫ7t;+[[{ ]Su ai=ҝ!q}k{׏y3lSx xȣ+e7 1ۯݺ}-ܵ] [G=ս\HQWޗ/>㗁=>]寰zzZs̑ n|JVʘz/ߝA?"Kl7/[l`Y>ugY+c]]]݁"˿0W{e+'\Ϧ>N-^샞l=>ܾߞיsz{ea:n񆌩 ʯ=%C~G3F{I<KOU=͑a?ֱio?u?{ ~{^O:Q{_:mX�X`Âx0… :|pٲ%:̙F/vR#4g\:2ʕ,[| 3̙4kڼ3Ν7s=[;B=(ҥLjTzRZj՞VzZzjرd˗o,ڵlۇ|r7]_|;W0A;N(Ɖ3vlY#3fCn -4<K>:լwv]ҡ)u;QTbU`j\lXj˦m ܺ} &<?p"ʓ=z9HС6:Z7)e[RD[ ^5pW !WV̙XF]pUvYwwہwFbccQ6dU|Y}>GBIdFZl%Qfm Nɛ Y8[rHWQWu]W"wޡ8̉b1i7rdQ!q_}Xhh.OJ$=YTS^nR5pYe)!qeyyaZgyd)"yaWb'gYAvɫdB]D:GhK+> mBL7H-E^ZUZj*ܪ*o&"t؋G}Yh*48l_-IKq4dQ*X%\Մ%g̙Zaŗng p}b<*09,MQ:V_}$<qz#;՛&^.쪪*~WzmP߅w�8pe{- }'K-X_ykjε]{-R6Of檝.}ᘦr/[^ݝϾTBQf7x SXyJ֮};6 ȥ/X6>ȺW2an]4;^X+.6Jxь7,XPC֏,DMr^5! ^Pκ=qo+ 6IY*tV}ks^&7Vf#bSv|E.J a,dOLҖ09.zT8}pr1Q'ߒ&4P7e3V4֡cSfVn|`5ğxR#>GiȂ UE b3,.jRH!9ь*e q\ [:n-wG5wCrF{ȱ9y$+ M ^d7df(Yr)C)WDtRWVtKKl$]1<!ٳtR#8f>3Ҥ5.jILV-mI'ρvs7HJlc|B љr.mKN<o8;T.⡼ϼ@!`QC?3(G2Sr͌E+k\\jFkɎnr`):B*ґdgcJ)r┃h.x,sSG֧飉;~ǨGERD(:p"ԨA+^]gzIkkdZՊVzsl8&>qs]e)rpl2T϶vgP?Flll+$a$HЦAΤDYi~ڸhyJ`hTZӞ jZR5߶R[Ѯi+..,q>S�s\4 tGJprjf7UnuEy ØE.^lݐ|\_ Wd|[EF�0}-+7O;2&l]$<+_0c:4%B`Lݦ1Ul[ jl,y],<Ӭ񍯙cb�'!D]-XRQs `ʔ&4e{Mo;? 6D0Xðhc&fg]Ty\;s(LyFzjbƮ�4i]acb|=6hEk{ |I/ɛJy-No'lOOQ9Jv$"iޚ19oj `87.g\(t)m4N=hW@[&0<nhl|2fhgJߦ|d[)G92em7R</Q!5,WfťMx$LQ9W+y];5qozo#}p o:-JvCѫb!Ku;"%{4:%f{Ոws/{q}?x>Vs`ڷoyHb!)qk 4OG DT2<-=A^LN'֕L&E&pp(kYwgqglw||Wxǁgg}'#}jm%8ygh%~%ntJjtiT%%C$K.wO$up\4C<DCLLt8 T>b?2A gAV|+v&Xxqww!HqxsFR-JnsRi)mJZ<eQ&;S6sho1'[fFD8B 8{ 8gYn7qcX|Ɩ||z|mxng}pH''ythVwZn*1_wn1dBzjBhOD(uA5TCXHTu0˓c,ԉ{'l8lxy׊׆聹h3}mey=GB)R7tDi'S44Gj`BuExe~o// [ǍN@T="3b_g/1Ǝv׎|jȆ82W}hxRBdnyd6F!oseXaبe<4Xp{gфQtkbH|-ghf͗}GX}f"'yM$GB~6D!D7U3BK9H\pMHߨ0Ru@ݥ[|&ʧ|4<)&}gXdFcn_ G'CI'?QDpM(^i@ETvV{Zȅ9G^x25Y}89sIsxًiuޔ60pUDu2z%kS 7VY6X9u T˃]|I,sɟ}'(#8ʼnAm$BNu:$STSlcXݹG~eȄyHĞkT՚ ȖX;َ؊qxFs@VRMy#zCfEKdR3y"'/df8ݘcikUplZU']k wi.i1w٧' JIz-1F$҉I?(;1eթo♂4H(a#qrSk MXvJuڛ~ ;x6}D_%iiEz Hj֭~"d:@ԍaH4Zmyx@ځ)xUȠ=ל$ZN[YoXAHoŅ/ńrʕs Ef!bR$Zp9sjg.ףǧ{7>i mڜ _ KLְHfzoå;^:+HñЕDH`I sl'-+eyq }Ǘ4Wړ:ˋgZ_.F:5~W2^qZGKoǭ"1Yڈš'kUpAj'v0o ؁&yշA+Fk>i {3t$g7 A'ص]i:Y:ӹkQ爎G(|Y۾9} Z_)W 6ԡKe,y+ZIYP~2pGO隔bbxww*€'}XJhvO> 3S1)*ZjSK! ٥>)"+EL L#A 9jly>A*; e̓g ~ck9l.DɈndJ2 e?S A\+5TT_׍di,m[TLȶqyzK}9xl(*%b6 9LG:%EE/D"a,<|$+ O,QV画򪟕3k'\͐txD[ٻIWnn extz f+Px0JiibvUg+|"|bL=ye;M=BnRcT*Cv܃S 6z;Y,uⱉ# f$<ƀ^W]~`my+dk0|N2)~ sT"v҃.⭌eH#cKti|tYۣ?#ܗJƁ\XeCRI7ng3S~ ,<+-ϺŔ#:&ۮk.fgw]]4}Є*;Ɇ@[yQMN .;迕iS]"!sc&' Kj8E0Omx7ީmx +ZzDRm}>|锖23@HҬb'- lr,m<k<Q޽<,&cz-|ʧ&|!{{<N2>)9+O`ۙzwը@6g&mM'Y햃xl{0 «Иm\~&͊*G)*6.>2M9^ΩKd@}օdkg ^=o$\-$^ɷ? /%[es̔آ iK<ev({CS #mݜ螬§ڈЅjK8׳Y)N%2Z~ZZԊ:RwϡYۘvŃ~ASlQo7||ɧ<;fDƔ:(t"mG>y4<[_Ӱު 9l $l̫ ,v]sBZ(?nT`[Ӛ13<jK~zK/[K8 LcpS7mujbߟpk؇ͥmJ|*~F ǿ9Hܢ¡97vn�xUnJ.wL'ͣx-KR FYS4,ܠ.G|b23<I{ Жժ]&A״PaC%N75n荛7 E 72ɒ'͙ ʖ0_Τ\M/ٓOA9t纞.eSQ{]wWڵVaŎ KYԮe[qⳇ]y×_ۗaĉ/f^0ȑ#VyXa4ogСA/+FZ2ԩU/s:3رevr[oWM\q!+Nņ;q(ū2yie޽ϦBU:>Vn废�2-ْkA/ 3 BłL2 +L4C3<[MXMEi7aMhQQGj r"3"h;@ȻJP" $f*<=.(:GY>4O?6+w,NzS-᢫.@懲z0 SCFр��;���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/jar.png������������������������������������������������������0000644�0001750�0001750�00000001366�14517772113�016342� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb? l2~`�b9$j}cƏv6$�0-xB -,u! w0}~Al�b)zS: 9  |1 #XY ?~a'÷ưw.� _fvb3;73' ;C?`ôu ja�@&9�0ո5j*ŕ'Hh'L,5T<( h& ~*:f/?0|4  ja�  +wanV ï8��Br_@/~0\Vw@,�]m[g~3g`gm.%/%G&Q � Y,,, /leЗ` L O-˃0�%~Jk30saݚ o2h3pYQ  ^~ te𝕅'>o  `TO�`~o<gI _?mxL@L\@JE7@`�= ,)%6����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/goup.png�����������������������������������������������������0000644�0001750�0001750�00000000716�14517772113�016536� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR������ ���G\���bKGD������ pHYs�� �� ~���tIME I/O��[IDAT(mJQ'gh!JEAb[K7 V0f#&` +IVȂ1AfIg3Ψ߾ϴw9�TMB&q[ ݼ i #Dݼ. <Ib`|>˜^UL+p3{svAPKaM3t/nbϓ9FW[~kci-CjDA��;%ubG,L`%u ^sݧ^s2i4~I,QL[9pY\Hh~j4t-V]1r!qf3ު}ky����IENDB`��������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/exclusive.png������������������������������������������������0000644�0001750�0001750�00000000764�14517772113�017576� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���Kpl_���tEXtSoftware�Adobe ImageReadyqe<��IDATxD=HBQ}DER jASS -).QC[KMEPT$El- KKPR=b=ϽN~bzh< LX<Rly&3*{p=C;S7D\ K05!(:yǂp Y(:9A4 >SV>sбKRbIY1P!oMh^@;%^ũ6zt6 slV=zRZ=OIEf͈LvpRmph0batМv:f +L1, tdt ؚ@dyTY }S$ te;՘V+(Y'�磭-$����IENDB`������������gprofng-gui-2.1/org/gprofng/mpmt/icons/smallBlank.png�����������������������������������������������0000644�0001750�0001750�00000000177�14517772113�017645� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������Sk���bKGD������ pHYs�� �� ����tIME*Q��� IDATc`����΅N����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/profile.png��������������������������������������������������0000644�0001750�0001750�00000001615�14517772113�017223� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?:)R@ \@ 7S&lGV @ej�<9%L9E1 )׮2ji3z; ݙT3i7@z�n@rZ Km�! ÖG|~3;qx?zΚv `H*LUv@{;Yi 1Y2ԁԃqJۼT$ ^FiT k1<w .G&/?ï?X1co ?~e&Ïs u }�2?^@6VfEXKVg30Lf/$ $@A�b?bx5.ĭ2 Aدn2jiWT칋 ? &F �O3cSfVN8m 2Ꮖϐ ҆`q:z>�bo_}p"oYϓ jQA@A�>_}>&fvvfܘi:z>�pʕgx^Ͽ~3<tĿ�RR@D²rr&f7 Ƀԁԃ ,<~п&6pݏAWW /c|2@x㧏g<}H@�d&`r P'0'Oy {�bĖhP8@-Z��qu����IENDB`�������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/undo.png�����������������������������������������������������0000644�0001750�0001750�00000001404�14517772113�016524� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������sO/���tEXtSoftware�Adobe ImageReadyqe<��IDATx|RmHSQ~vuMLΉKiN # "h?2$$m~ؔo!d FIEeRY~PL͹{9 Q9=Gu�mD"qCИҜR/$+HvstX."Qz<J+c1.Z_ C[HɽL cm0PzOߵ./9hSEf䡮<n';eNC0ޭn$_UņQUUC{077C1l^\KW: YϪ9X4(پ!Pin!OKugj ˊYK2[AI467"=CRWt΁]V"!-cNv&+-bJ"q�80f4H<яY@Sv vg7j3ŴYVoOyhX]]FbpHԋ4 ԟCq^q>Na#*CWσD a޾.)DjX|4("Ì́/!nlWֻVY\Q=&r=$\o".\Ҏj8} ttmO�GG4����IENDB`������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/errorNew.png�������������������������������������������������0000644�0001750�0001750�00000005741�14517772113�017372� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a��� pHYs�� �� ��� OiCCPPhotoshop ICC profile��xڝSgTS=BKKoR RB&*! J!QEEȠQ, !{kּ> H3Q5 B.@ $p�d!s#�~<<+"�x �M0B\t8K�@zB�@F&S��`cb�P-�`'�{�[!� eD�h;�VE�X0�fK9�-�0IWfH�� � �0Q)�{�`##x��FW<+*��x<$9E[-qWW.(I+6aa@.y24��x6_-"bbϫp@��t~,/;m%h^ uf@�Wp~<<EJB[aW}g_Wl~<$2]GLϒ bG "IbX*QqD2"B)%d,>5�j>{-]cK'Xt��o(hw?G%�fIq��^D$.Tʳ?��D*A, `6B$BB dr`)B(Ͱ*`/@4Qhp.U=pa( Aa!ڈbX#!H$ ɈQ"K5H1RT UH=r9\F;�2G1Q= C7F dt1r=6Ыhڏ>C03l0.B8, c˱" VcϱwE 6wB aAHXLXNH $4 7 Q'"K&b21XH,#/{C7$C2'ITFnR#,4H#dk9, +ȅ3![ b@qS(RjJ4e2AURݨT5ZBRQ4u9̓IKhhitݕNWGw Ljg(gwLӋT071oUX**| J&*/Tު UUT^S}FU3S ԖUPSSg;goT?~YYLOCQ_ cx,!k u5&|v*=9C3J3WRf?qtN (~))4L1e\kXHQG6EYAJ'\'GgSSݧ M=:.kDwn^Loy}/TmG X $ <5qo</QC]@Caaᄑ<FFi\$mmƣ&&!&KMMRM);L;L֙͢5=12כ߷`ZxZ,eIZYnZ9YXUZ]F%ֻNNgðɶۮm}agbgŮ}}= Z~sr:V:ޚΜ?}/gX3)iSGggs󈋉K.>.ȽJtq]zۯ6iܟ4)Y3sCQ? 0k߬~OCOg#/c/Wװwa>>r><72Y_7ȷOo_C#dz�%gA[z|!?:eAAA!h쐭!ΑiP~aa~ 'W?pX15wCsDDDޛg1O9-J5*>.j<74?.fYXXIlK9.*6nl {/]py.,:@LN8A*%w% yg"/6шC\*NH*Mz쑼5y$3,幄'L Lݛ:v m2=:1qB!Mggfvˬen/kY- BTZ(*geWf͉9+̳ې7ᒶKW-X潬j9<qy +V<*mOW~&zMk^ʂk U }]OX/Yߵa>(xoʿܔĹdff-[n ڴ VE/(ۻC<e;?TTTT6ݵan{4[>ɾUUMfeI?m]Nmq#׹=TR+Gw- 6 U#pDy  :v{vg/jBFS[b[O>zG4<YyJTiӓgό}~.`ۢ{cjotE;;\tWW:_mt<Oǻ\kz{f7y՞9=ݽzo~r'˻w'O_@AC݇?[jwGCˆ 8>99?rCd&ˮ/~јѡ򗓿m|x31^VwwO| (hSЧc3-��� cHRM��z%��������u0��`��:��o_F�� IDATxڤJAEJ#XheXK*H:AlK#X!M`)("M6$f=޻Ht X;gʣ I8FҁnfRZFie5yf �MrTudKj3Z +# 1oaZOE#(\`W# Y?35z�; ~k?5Du`:{af}�o͏Q`q[,͇z�0|$|!����IENDB`�������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/callee.png���������������������������������������������������0000644�0001750�0001750�00000001075�14517772113�017010� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?%� X`ܚL 5 On[5Ǐjg�  2?h$mM^�)*2߿OhfA [~p=$@, ŋ&1TwLf*H &0V3a̙X�@,_>}X]?ÃGO|o_>,R vJJʙ9s  %̐UR˰n^?Hk`<oyV �x?,L/J랦@hi >}xp�ɀ? hOwJc3߿O Nl DOO3۷oG D�"h@\ȁg9n�0=D#B@h0P ܀_?)(. R ad `:@~�Ą,$t����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/green100.png�������������������������������������������������0000644�0001750�0001750�00000000264�14517772113�017103� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���d��� ���~l)��� pHYs�� �� ����tIME� xo���tEXtComment�Created with The GIMPd%n���*IDATH1���0d_|-²R K,Yd)%hTt8����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/redo.png�����������������������������������������������������0000644�0001750�0001750�00000001365�14517772113�016516� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������sO/���tEXtSoftware�Adobe ImageReadyqe<��IDATxڄS[HTQ]wMehz'I)_akLJ  >L+>$0-+!ԁJ)Gs9չ6s9k8g}YcSEaG)(z߶SͣF&&dRVlOX+ .Z}:/,Q^Y/\j_ZdTQ  IhQ2w]SsWm7fY#t[leLapx>ucrrJq\ :MfSs I ς ,FF|3j@"2z a2%LI1<XI̺ȭ*݃i5SZ*#nkՀ+(yy.(i]\u-UǸ~i+7P Dph7k <ʊH:lT޺,V&.9畹55#?$)ח.aԀcY&ʸ3&tA6 '` MakuL|�1 ҳgEE`CUqc q=m^D%Hߝh@Gw/PHQfUW4r &)J#BQg= �7+Cv����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_up_focused.png�����������������������������������������0000644�0001750�0001750�00000000247�14517772113�021107� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������Sk���bKGD������ pHYs�� �� ����tIME!1I6���4IDATmA �@zD I \6. -ZS����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/inclusive.png������������������������������������������������0000644�0001750�0001750�00000000533�14517772113�017562� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���w&���tEXtSoftware�Adobe ImageReadyqe<���IDATxtoJ@dB�%7(xy{# ^6 MwӅ N~;}VTO%�2(j{ڔ,sΟ ˳9\2smL<!O?YkovqKDx+҆7z߀mjHG:J %n~ͼCWt:LMܘ�pꭟn ʂġNW�N5ۖ����IENDB`���������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/bubble_icon_16.png�������������������������������������������0000644�0001750�0001750�00000001147�14517772113�020334� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���tEXtSoftware�Adobe ImageReadyqe<�� IDATxڔSka+(~qQ2VDA1 搡:Y̿lB'R};uĨ"SEDQP޽`!zsaBl[*:JojkD"'|>?f6d2\P|Z, T*16b4͞tvC$ V|<v�)[,4!0t:/=O1 v`(F d2/uxZc%?A?F,yP.qz=$%mx,>Ql>:vE^d`"P7jRcZ]o@AA:EfQIHX "8ti4T*hD FJ0+ d2P. Z& z`�@+`W(iكFt۽]g:M&ӷ^' 45ݼbc/y&w�Mihك����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/time.png�����������������������������������������������������0000644�0001750�0001750�00000000716�14517772113�016522� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ��� ���r|���bKGD������ pHYs�� �� ����tIMEc��[IDAT(ύKBq?#B!pJ7 4D Z"?AAjquBy)$kN}{Lpv =0aBD@0z(]) @"r{!1pv=�R7˲15 -"nL&ST*WZkeg2tN|. �Q*0 B��FeTUɤڇ%Z|p8u]RDbױmH$i�j�>;lui"YZh~-\xVJ}}`"TZ����IENDB`��������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/warnexperiment.png�������������������������������������������0000644�0001750�0001750�00000001435�14517772113�020633� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?:H/k20]Y��2�7u{Ox΂ qt�Ąn#|~45uԴ@|8HY=@�auU7qbA HB]-@�0` f h,{8B�j@xZI20mbbɐZ$\ d  FXM)R5zzaa c'X{'f=;mY=H &ٝ1麺 ?c/Ów?ߝdx̾uqkM�@Xw]83ho~�/.,aJcmǾ?~ x�-E/+3 \f{pYK >1 3242? �߿ Z)6bp6`td1`p2`sS�$@, 9d;LJc beefϰOl,,� q3nܸy3`{8 ЀW` b~d� x~`5y~{Ͽ3+fxaz)Gb5 x4}&c ,!$|KEl W�@Ae a��FnT ����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/stop.png�����������������������������������������������������0000644�0001750�0001750�00000001256�14517772113�016551� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������sO/���tEXtSoftware�Adobe ImageReadyqe<��PIDATx|RAkQD1- !b (ʂm (x9 6AzɛB ʦPk5RDP۸6$,&|}_{۶)?111xfKHnjŏkWYBX U7c >zEoAI)I.l� _7}-&hח�a^XI2 oW8'$qwW6R<Ycծ =Z88{]q\Q#CR)[jN{{QY. L>c\2Z4뙓!1B] N`J<E v{vȲvEf8t�vm-;?OkKKd[}*|%vp<tzr$k鍧]1@@ Tҋmf cE^92 S;2$ ~3Y9}f,[805�/QyNǃ"FDxc„=k%v/EH /b>&x .j;:p0�Ws>p8����IENDB`��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/circleRed.gif������������������������������������������������0000644�0001750�0001750�00000000131�14517772113�017430� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GIF89a � ��焄!Created with The GIMP�! ��,���� � ��kྞL:~wQX1�;���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/up.png�������������������������������������������������������0000644�0001750�0001750�00000001011�14517772113�016175� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?.&O$H-⸐IoVbS@L4 aEPC6 cS@ Y@A|8Z�bDLaM+B1.'ðČ�B1`QXsX6_ooaMXaUؐ�< EH*1N·A y:z>�`V� ?۸vMf& +sH3, . ?b`W-kZpD09:z>�b-(_SgM~x=\�1=:�΋;9��ZyRM4@�@gH6� `@A�u~\d@�b@�:)����IENDB`�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/expandcollaps.png��������������������������������������������0000644�0001750�0001750�00000001676�14517772113�020427� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��PIDATxb? , R@ \@ 7¨3`�3`IDDAI<a6.._߾1|x̚ ?b}>�6`aD=<PWO0||E�?3\8)~FC�anN@b?ORR)jZ ?3ׯ ~3\1l4� u<I  !,+ 1Š a`ˁԁ#� X0?~ >iÕ>pya0p0DZ];@�?~D0j;;Nq2#{AD4&wbw��bo! a \& ?Lg`f`dǰ~nn{2zfӋ_Wy 猿p- &2 dXf/?$X$V�@Ls]ZwɳNZ <eEL RR ̬ l ٵ ܼ`9T?=S3NIpI>zZ[49ʠ'ΐVfÅ3,SX>� X@<fdd, P9vK_Ngqs c`ebz{;+'d% T|v:۷%�Ĉ)a V /w122dPWWg`cc{͛ Νg8sµK r�H=a7t5N.[ (o=~e �D@)@jO 5��\v":ͽs����IENDB`������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/apply_filter.png���������������������������������������������0000644�0001750�0001750�00000001433�14517772113�020253� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR���������a���gAMA��7���tEXtSoftware�Adobe ImageReadyqe<��IDATxb?%�  j0yI{rބ& �bÌ:(;/8 O<c8}A�ƱٕgjqZ7>0\tACSa `q>$�b+玄7t~_1ܼqA[[aҼ ,<�b):Nƕֵ10220\|AEEg27/>{u%H߿� @>:'u6]pE0=uz0˵0 ~ ` |gd00maxÛOvY`XH÷.bxw 2a`bbb:\ؑn?_?,*Ţ d ؁Ȱ\K^q\co  b 0 �?p>+ O|gH ??~>e@,آϟ ,`~p&k4g1Ȱ*2�bf߿l%=|˲6~fj%h@�m=B?ƭ;X f^-rg�%C5Z�bĖMlqpqǂ߿~}<eec?f(� � rAs*Ȼϐ5�@�W[_����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/icons/small_up.png�������������������������������������������������0000644�0001750�0001750�00000000251�14517772113�017372� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������PNG  ��� IHDR��� ������Sk���bKGD������ pHYs�� �� ����tIME5^G���6IDAT}Q � BmWr})+"a8!$aIYa5Z${�Yzs"SU����IENDB`�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/���������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�017171� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcDataMaster.java���������������������������0000644�0001750�0001750�00000002616�14744453367�023575� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import java.util.ArrayList; public abstract class CoordCalcDataMaster implements CoordCalcDataReader { public abstract void setCanvasPixels(int visiblePixels); public abstract void edt_revalidate(); // must be called from event dispatch thread public abstract boolean isValid(); // must be called from event dispatch thread public abstract boolean isInitialized(); public abstract void setAbsRowMinHeights(ArrayList<Integer> mins); public abstract void setAbsRowMinHeights(int rowCount, int minPixels); public abstract void setExpandToFill(boolean expands); public abstract void setRowRange(int startrow, int endrow); public abstract void setVisibleRange(double start, double end); } ������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcTimeImpl.java�����������������������������0000644�0001750�0001750�00000014523�14744453367�023270� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; /** Coordinate Calculator for Timeline Time axis */ public class CoordCalcTimeImpl extends CoordCalcTimeMaster { // adjustable settings private int canvasPixels = 0; private long start_time = 0; private long end_time = 0; // computed private long start_time_align = 0; // used to align start @ data fetch private long time_per_bin = 1; private boolean is_initialized = false; // edt_revalidate() has been called at least once private boolean needs_compute = true; // preferences private final int min_pixels_per_bin = 1; private final int x_margins; // space between TL and ruler public CoordCalcTimeImpl(int canvas_margin) { x_margins = canvas_margin; } // --- canvas geometry /** Sets current canvas width */ public void setCanvasPixels(int visiblePixels) { if (canvasPixels == visiblePixels) { return; } canvasPixels = visiblePixels; needs_compute = true; } /** Gets current canvas width */ public int getCanvasPixels() { return canvasPixels; } // --- time geometry settings public void edt_revalidate() { setTimeBinAlignment(); is_initialized = true; } private void setTimeBinAlignment() { // for a given zoom, determine time alignment of bins so that it is // consistent regardless of panning. long trange = getTimeDuration(); // nanoseconds int maxBinCount = getAvailPixels() / min_pixels_per_bin; long estBinSize; if (maxBinCount <= 0) { estBinSize = 0; } else { estBinSize = (trange + (maxBinCount - 1)) / maxBinCount; } time_per_bin = estBinSize; if (time_per_bin < 1) { time_per_bin = 1; } // compute alignment long absStartTime = 0; // Should it be: getAbsoluteTimeStart() ? long startdelta = start_time - absStartTime; long mod = startdelta % time_per_bin; start_time_align = mod; needs_compute = false; } /** Get the minimum number of pixels allowed for a bin */ private int getMinPixelsPerBin() { return min_pixels_per_bin; } /** margins allow states along edges to be visible and accessible */ public int getMargin() { return x_margins; } public boolean isInitialized() { return is_initialized; } public boolean isValid() { return !needs_compute; } // --- time range public void setTimeRange(long start, long end) { if (start_time == start && end_time == end) { return; } start_time = start; end_time = end; needs_compute = true; } public long getTimeStart() { return start_time; } public long getTimeEnd() { return end_time; } public long getTimeDuration() { long duration = end_time - start_time + 1; return duration; } // ---------- computed values ---------- public int getAvailPixels() { // in pixels int availWidth = getCanvasPixels() - getMargin() * 2; return availWidth; } /** get avail # of bins */ public int getNumBins() { long tmp = getTimeDuration() + time_per_bin - 1; tmp /= time_per_bin; return (int) tmp; } /** get avail # of bins */ public long getTimePerBin() { return time_per_bin; } public long getTimeStartAligned() { long tstart = getTimeStart() - start_time_align; return tstart; } public long getTimeStartAligned(long time) { long absStartTime = 0; // Should it be: getAbsoluteTimeStart() ? // compute alignment if (time < absStartTime) { // punt on handling negative time return absStartTime; } long startdelta = time - absStartTime; long mod = startdelta % time_per_bin; long returnTime = time - mod; return returnTime; } public long getTimeEndAligned() { long tstart = getTimeStartAligned(); int nbins = getNumBins(); long tduration = nbins * time_per_bin; // fills the last bin long tend = tstart + tduration - 1; // != options.getFilterTimeEnd() return tend; } // return may be MPVIEW_CHART_DATA_NAN if click was not on a state public long getTimeAtCoord(int xx) { int x = xx - getMargin(); long totalTime = getTimeDuration(); int availWidth = getAvailPixels(); if (availWidth <= 0) { availWidth = 1; } long time = x * totalTime / availWidth; if (time < 0) { return 0; } if (time >= getTimeDuration()) { return getTimeDuration(); } time += start_time; return time; } // always returns a valid value public long getTimeNearCoord(int xx) { int x = xx - getMargin(); long totalTime = getTimeDuration(); int availWidth = getAvailPixels(); if (availWidth <= 0) { return getTimeStart(); } long time = x * totalTime / availWidth; time += start_time; if (time < getTimeStart()) { time = getTimeStart(); } if (time > getTimeEnd()) { time = getTimeEnd(); } return time; } public int getLowCoordForBin(int bin) { int totalBins = getNumBins(); if (totalBins <= 0) { return 0; } if (bin < 0) { int ii = 0; // breakpoint } int availWidth = getAvailPixels(); int x = bin * availWidth / totalBins; int xx = x + getMargin(); return xx; } public int getCoordAtTime(long time) { long offsetTime = time - start_time; long duration = getTimeDuration(); if (duration <= 0) { return 0; } int availWidth = getAvailPixels(); int x = (int) (offsetTime * availWidth / duration); int xx = x + getMargin(); return xx; } public int getBinAtTime(long time) { long offsetTime = time - start_time; long duration = getTimeDuration(); if (duration <= 0) { return 0; } int totalBins = getNumBins(); int bin = (int) (offsetTime * totalBins / duration); return bin; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/VerticalRowRuler.java������������������������������0000644�0001750�0001750�00000001701�14744453367�023243� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import java.awt.Graphics; import javax.swing.JComponent; public abstract class VerticalRowRuler extends JComponent { public abstract void setRange(long start_p, long end_p); public abstract void lockRulerThickness(Graphics g, boolean lock); } ���������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcDataReader.java���������������������������0000644�0001750�0001750�00000003551�14744453367�023543� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; public interface CoordCalcDataReader { // pixels public int getMargin(); public int getCanvasPixels(); public int getAvailPixels(); // pixels available for data public int getTotalPixels(); // virtual # of pixels if everything drawn public int getMinPixelsForAllRows(); public int getMinPixelsRequired(int row_lo, int row_hi); // YXXX unused // rows public int getRowStart(); public int getRowEnd(); public int getRowCount(); public int getAbsRowEnd(); // last valid row; zero if getRowCount()=0 public int getAbsRowCount(); // percent visible (used with smooth scrolling) public double getVisibleStart(); public double getVisibleEnd(); public double getVisiblePercent(); // conversions public int getLowCoordForRow(int yrow); public int getCenterCoordForRow(int yrow); public int getHighCoordForRow(int yrow); public double getCenterPercentForRow(int yrow); public double getPercentNearCoord(int canvasY); public double getRowPercentOfTotal(int yrow); public int getRowAtCoord(int canvasY); public int getRowNearCoord(int canvasY); public int getRowNearPercent(double percent); // always returns a valid row } �������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelinePanel.java���������������������������������0000644�0001750�0001750�00000273550�15044710303�022507� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.timeline2.TimelineDraw; import org.gprofng.mpmt.timeline2.TimelineSelectionEvent; import org.gprofng.mpmt.util.gui.AnLongScrollBar; import org.gprofng.mpmt.util.ruler.RangeRuler; import org.gprofng.mpmt.util.ruler.valuetypes.ValuesNanoseconds; import org.gprofng.mpmt.util.zoomruler.OverlayMouseHandler; import org.gprofng.mpmt.util.zoomruler.ZoomRulerEvent; import org.gprofng.mpmt.util.zoomruler.ZoomRulerListener; import org.gprofng.mpmt.util.zoomruler.ZoomRulerOverlay; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.util.ArrayList; import java.util.List; import java.util.Vector; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.Timer; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** * This class provides a JComponent to display a timeline. The timeline shows several processes or * threads of execution simultaneously. Each will be represented by a horizontal bar with the color * of the bar indicating the state at each moment in time. The raw data is provided by a * TimelineProvider object with display options specified by a TimlineOptions objects. * * <p>The timeline provides panning and zooming capabilities. In addition to the state information, * optional message lines can be displayed to show communication between processes. * * <p>To minimize refetches of data from DBE, this class may draw a subset of the data that has been * fetched from DBE and stored in the TimelineProcessStates array. * * <p>With the current implementation, the time interval displayed is exactly what has been fetched * from dbe. In the process direction, however, zoom is allowed to show a subset of the data. */ public class TimelinePanel extends JPanel { // image data private TimelineDrawer tldrawer; private CoordCalcTimeMaster timeAxisCalculator; private CoordCalcDataMaster dataAxisCalculator; // listeners private Vector<ChangeListener> change_listeners; private boolean forceDataReload; // options private final boolean enable_vertical_zoom; private final boolean enable_zoom_overlays; private final boolean enable_vertical_row_snap; private final boolean enable_time_caliper; // zoom and pan history private class ZoomHistoryEvent { public final long timeStart; public final long timeEnd; public final double ypctStart; // used by MPI timeline public final double ypctEnd; // used by MPI timeline public final long timeFocus; public final double timeFocusScreenPercent; public final double ypctFocus; public final double ypctFocusScreenPercent; public final int vZoomLevel; // used by regular timeline public ZoomHistoryEvent( long timeStart, long timeEnd, double ypctStart, double ypctEnd, long timeFocus, double timeFocusScreenPercent, double ypctFocus, double ypctFocusScreenPercent, int vZoomLevel) { this.timeStart = timeStart; this.timeEnd = timeEnd; this.ypctStart = ypctStart; this.ypctEnd = ypctEnd; this.timeFocus = timeFocus; this.timeFocusScreenPercent = timeFocusScreenPercent; this.ypctFocus = ypctFocus; this.ypctFocusScreenPercent = ypctFocusScreenPercent; this.vZoomLevel = vZoomLevel; } public boolean equals(ZoomHistoryEvent e) { if (e.timeStart != this.timeStart || e.timeEnd != this.timeEnd || e.vZoomLevel != this.vZoomLevel) { return false; } double epsilon = 0.0001; if (Math.abs(e.ypctStart - this.ypctStart) > epsilon) { return false; } if (Math.abs(e.ypctEnd - this.ypctEnd) > epsilon) { return false; } return true; } public String toString() { ZoomHistoryEvent e = this; String s = String.format( "[t=(%.1f, %.1f), v=(%.0f, %.0f) z=%d]", e.timeStart / 10000000f, e.timeEnd / 10000000f, e.ypctStart * 100, e.ypctEnd * 100, e.vZoomLevel); return s; } } private List<ZoomHistoryEvent> zoomHistory = new ArrayList<>(); private int zoomHistoryIdx = 0; // position of next add, can't undo from here private long visible_time_start = 0; // first time visible on screen private long visible_time_end = 0; // last time visible on screen private double visible_ypct_start = 0; // y axis visible start (% of total) private double visible_ypct_end = 0; // y axis visible end (% of total) private boolean zoom_ypct_at_max; // true when at max vertical zoom out private ZoomHistoryEvent referenceEvent; // zoom center private long zoom_time_center; // should be renamed to time_focus private double zoom_time_center_screen_percent; // should be renamed to time_focus_screen_percent private double ypct_focus; // y axis zoom center (% of total) private double ypct_focus_screen_percent; // screen center of time zoom // calipers private TimelineCaliper timeCaliper; /* scrolling state */ private boolean set_vscroll = false; private boolean set_hscroll = false; private boolean hscroll_adjusting = false; private boolean yscroll_adjusting = false; ZoomHistoryEvent scroll_adjusting_snapshot; /* variables for rubberband zoom rectangle */ private static int RUBBERBAND_WIDTH = 2; private boolean rubberbandIs2D = false; /* mouse settings */ private final int MOUSE_PRESS_DRAG_DELAY = 400; // ms before enabled private final int AUTO_PAN_REPEAT_TIME = 100; // ms between updates private final int AUTO_PAN_REGION_PIXELS = 4; // margin where activated private final double AUTO_PAN_RELOCATION_PERCENT = 0.25; // new location percent of screen private final int MOUSE_DRAG_MIN_PIXELS = 2; // pixels before enabled private final int CALIPER_CLICK_PIXEL_TOLERANCE = TimelineDraw.CLICK_PIXEL_TOLERANCE + 0; // yuck, crosses interface public static enum MouseDragMode { MOUSE_RUBBERBANDING_MODE, // zoom MOUSE_GRABBING_MODE, // pan MOUSE_SELECTION_MODE // set/expand selection }; private static enum MouseSubmode { MM_UNKNOWN, MM_HOVER_CALIPER, MM_HOVER_SELECTION, MM_HOVER_GRAB, MM_HOVER_RUBBERBAND, MM_DRAG_CALIPER, // drag-to-adjust caliper MM_DRAG_SELECTION, // drag-to-adjust selection region MM_DRAG_GRAB, // drag-to-pan MM_DRAG_RUBBERBAND, // drag to zoom MM_OVERLAY // nop, pass to overlay }; private MouseDragMode mouse_drag_mode = MouseDragMode.MOUSE_GRABBING_MODE; private boolean global_mouse_drag_mode_changed = true; private final int SMALL_PAN_STEP_FRACTION = 40; // 1/40th of screen step private final int LARGE_PAN_STEP_FRACTION = 5; // 1/5th of screen step private static final boolean MOUSE_WHEEL_ZOOMS = false; // true=>hzoom, false=>vscroll // components private JPanel southPanel; private AnLongScrollBar horScroll; private JScrollBar verScroll; private static final int VERSCROLL_TO_PERCENT = 100000; private static final double PERCENT_TOLERANCE = 0.000001; // YXXX need to restructure private static final double HUNDRED_PERCENT_ROUNDUP = 1.0 - PERCENT_TOLERANCE; private static final double ROW_SNAP_TOLERANCE = 0.01; private JPanel southEastSpacer; private JPanel southWestSpacer; private TimelineCanvas timelineCanvas; private TimelineCursor handcursors; private RangeRuler globalRuler; private RangeRuler localRuler; private VerticalRowRuler verticalRuler; private final MouseDragMode mainPanelDefaultMouseMode; private final MouseDragMode hRulerDefaultMouseMode; private final MouseDragMode vRulerDefaultMouseMode; // zoom overlays private ZoomRulerOverlay timeOverlay = null; private ZoomRulerOverlay processOverlay = null; private OverlayMouseHandler defaultOverlayMouseHandler = new OverlayMouseHandler() { @Override public boolean inOverlay(int x, int y) { return false; } @Override public void deactivate() {} @Override public void activate() {} @Override public Cursor getCursor() { return null; } }; private OverlayMouseHandler overlayMouseHandler = defaultOverlayMouseHandler; /** Creates a new instance of TimelinePanel. Call this from AWT thread only */ public TimelinePanel( final TimelineDrawer tldrawer, final MouseDragMode mainPanelMode, final MouseDragMode hRulerMode, final MouseDragMode vRulerMode) { super(); this.tldrawer = tldrawer; mainPanelDefaultMouseMode = mainPanelMode; hRulerDefaultMouseMode = hRulerMode; vRulerDefaultMouseMode = vRulerMode; this.enable_vertical_zoom = tldrawer.getEnableZoomVertical(); this.enable_zoom_overlays = tldrawer.getEnableZoomOverlays(); this.enable_vertical_row_snap = !tldrawer.getEnableUnalignedRows(); this.enable_time_caliper = tldrawer.getEnableTimeCaliper(); // sync with calculators initAxisCalculators(); change_listeners = new Vector<>(); handcursors = new TimelineCursor(); timeCaliper = new TimelineCaliper(0, 0); initializeComponents(); // zoomHistoryAdd(); } private void initAxisCalculators() { this.timeAxisCalculator = tldrawer.getTimeAxisMaster(); long zoom_time_start_prev = tldrawer.getAbsoluteTimeStart(); long zoom_time_end_prev = tldrawer.getAbsoluteTimeEnd(); zoom_time_center = (zoom_time_start_prev + zoom_time_end_prev + 1) / 2; zoom_time_center_screen_percent = 0.5; // zoom focus at middle timeAxisCalculator.setTimeRange(zoom_time_start_prev, zoom_time_end_prev); timeAxisCalculator.edt_revalidate(); this.dataAxisCalculator = tldrawer.getDataAxisMaster(); double zoom_ypct_start_prev = 0.0; /* display from 0% */ double zoom_ypct_end_prev = 1.0; /* display to 100% */ ypct_focus = 0.0; /* center at 0% */ ypct_focus_screen_percent = 0.0; // focus at top zoom_ypct_at_max = true; dataAxisCalculator.setVisibleRange( // order matters, do this last zoom_ypct_start_prev, zoom_ypct_end_prev); dataAxisCalculator.edt_revalidate(); } public void edt_resetAll() { // edt only initAxisCalculators(); // Depends on TL2DataSnapshot being reset first zoomHistoryReset(); } public void edt_resetExperiments() { // edt only int ii = 0; } public void edt_resetTLRanges() { zoomYToPercent(1.0); zoomTimeToDuration(tldrawer.getAbsoluteTimeDuration()); ZoomHistoryEvent latest = zoomHistoryCreateEvent(); if (referenceEvent != null && !referenceEvent.equals(latest)) { zoomHistoryReset(); } referenceEvent = latest; } // ----- stuff used by right-hand-tab filter selector public long getFilterTimeStart() { return timeAxisCalculator.getTimeStart(); } public long getFilterTimeEnd() { return timeAxisCalculator.getTimeEnd(); } /** Returns the center time at the current pan offset */ public int getFilterProcStart() { int p; if (zoom_ypct_at_max) { p = 0; } else { p = dataAxisCalculator.getRowStart(); } return p; } public int getFilterProcEnd() { int p; if (zoom_ypct_at_max) { p = tldrawer.getAbsoluteRowEnd(); } else { p = dataAxisCalculator.getRowEnd(); } return p; } /** Force a data refresh and a display update (used by unfilter) */ public void edt_refetchAndRepaint() { // AWT thread only forceDataReload = true; // AWT thread only repaint(); } public void edt_revalidateAll(boolean _forceDataReload) { // AWT thread only if (_forceDataReload) { forceDataReload = true; } // zoomHistoryAdd(); updateY(true); updateX(true); } // ---- listeners for context menu /** Adds a MouseListener to the timeline display */ public void addMouseListener(MouseListener l) { timelineCanvas.addMouseListener(l); verticalRuler.addMouseListener(l); globalRuler.addMouseListener(l); localRuler.addMouseListener(l); } /** Adds a MouseMotionListener to the timeline display */ public void addMouseMotionListener(MouseMotionListener l) { timelineCanvas.addMouseMotionListener(l); } // ----- Zoom to endpoints /** sets zoom endpoints and center.. e.g. rubberband */ private void zoomTimeToRange(long t1, long t2, boolean isPan) { long newstart = t1; long newend = t2; // swap if needed if (newstart > newend) { long tmp = newstart; newstart = newend; newend = tmp; } long delta = newend - newstart; long absEnd = tldrawer.getAbsoluteTimeEnd(); long absStart = tldrawer.getAbsoluteTimeStart(); if (newend > absEnd) { newend = absEnd; if (isPan) { newstart = newend - delta; } } if (newstart < absStart) { newstart = absStart; if (isPan) { newend = newstart + delta; } if (newend > absEnd) { newend = absEnd; } } zoom_time_center = (newstart + newend + 1) / 2; zoom_time_center_screen_percent = 0.5; timeAxisCalculator.setTimeRange(newstart, newend); updateX(false); } /** sets zoom endpoints and center. e.g. rubberband */ private void zoomProcessToRange(int start_p, int end_p, boolean isPan) { int newstart = start_p; int newend = end_p; // swap if needed if (newstart > newend) { // swap if needed int tmp = newstart; newstart = newend; newend = tmp; } int delta = newend - newstart; if (!isPan) { // for zooms, update zoom_proc_at_max int range = delta + 1; zoom_ypct_at_max = (range >= tldrawer.getAbsoluteRowCount()); } if (newend > tldrawer.getAbsoluteRowEnd()) { newend = tldrawer.getAbsoluteRowEnd(); if (isPan) { newstart = newend - delta; } } if (newstart < 0) { newstart = 0; if (isPan) { newend = newstart + delta; } if (newend > tldrawer.getAbsoluteRowEnd()) { newend = tldrawer.getAbsoluteRowEnd(); } } ypct_focus = (newstart + newend + 1) / 2; ypct_focus_screen_percent = 0.5; dataAxisCalculator.setRowRange(newstart, newend); updateY(false); } /** sets zoom endpoints and center. e.g. rubberband */ private void zoomYToRange(double start_pct, double end_pct, boolean isPan) { double newstart = start_pct; double newend = end_pct; // swap if needed if (newstart > newend) { double tmp = newstart; newstart = newend; newend = tmp; } double delta = newend - newstart; if (!isPan) { // for zooms, update zoom_proc_at_max zoom_ypct_at_max = (delta >= HUNDRED_PERCENT_ROUNDUP); } if (enable_vertical_row_snap) { int start_p, end_p; if (isPan) { int num_p = dataAxisCalculator.getRowCount(); double slop = 1.0 / (dataAxisCalculator.getAbsRowEnd() + 1) * ROW_SNAP_TOLERANCE; double start_pct_rounded = newstart + slop; start_p = dataAxisCalculator.getRowNearPercent(start_pct_rounded); end_p = start_p + num_p - 1; } else { start_p = dataAxisCalculator.getRowNearPercent(newstart); end_p = dataAxisCalculator.getRowNearPercent(newend); } zoomProcessToRange(start_p, end_p, isPan); return; } // contrain the zoom level if (!isPan) { double min_percent = 1.0 / (dataAxisCalculator.getAbsRowEnd() + 1); if (delta < min_percent) { delta = min_percent; double center = (newstart + newend) / 2; newstart = center - delta / 2; newend = center + delta / 2; } } if (newend > HUNDRED_PERCENT_ROUNDUP) { newend = 1.0; if (isPan) { newstart = newend - delta; } } if (newstart < 0.0) { newstart = 0.0; if (isPan) { newend = newstart + delta; } if (newend > HUNDRED_PERCENT_ROUNDUP) { newend = 1.0; } } ypct_focus = (newstart + newend) / 2; ypct_focus_screen_percent = 0.5; dataAxisCalculator.setVisibleRange(newstart, newend); updateY(false); } // --- zoom to a fixed scale using existing zoom center /** zoom to a fixed scale using existing zoom center, e.g. zoom slider */ private void zoomTimeToDuration(long duration) { if (duration < 1) { duration = 1; } else if (duration > tldrawer.getAbsoluteTimeDuration()) { duration = tldrawer.getAbsoluteTimeDuration(); } long newstart = zoom_time_center - (long) (zoom_time_center_screen_percent * duration); if (newstart < tldrawer.getAbsoluteTimeStart()) newstart = tldrawer.getAbsoluteTimeStart(); long newend = newstart + (duration - 1); if (newend > tldrawer.getAbsoluteTimeEnd()) { newend = tldrawer.getAbsoluteTimeEnd(); newstart = newend - (duration - 1); } timeAxisCalculator.setTimeRange(newstart, newend); updateX(false); } /** zoom to a fixed scale using existing zoom center, e.g. zoom slider */ private void zoomProcessToCount(int procCount) { zoom_ypct_at_max = (procCount >= tldrawer.getAbsoluteRowCount()); if (procCount < 1) { procCount = 1; } else if (procCount > tldrawer.getAbsoluteRowCount()) { procCount = tldrawer.getAbsoluteRowCount(); } int zoom_proc_center = dataAxisCalculator.getRowNearPercent(ypct_focus); int newstart = zoom_proc_center - procCount / 2; // YXXX probably should be something like below, but needs testing // - (long)(ypct_focus_screen_percent * procCount); if (newstart < 0) newstart = 0; int newend = newstart + (procCount - 1); if (newend > tldrawer.getAbsoluteRowEnd()) { newend = tldrawer.getAbsoluteRowEnd(); newstart = newend - (procCount - 1); } dataAxisCalculator.setRowRange(newstart, newend); updateY(false); } /** zoom to a fixed scale using existing zoom center, e.g. zoom slider */ private void zoomYToPercent(double percent) { zoom_ypct_at_max = (percent >= HUNDRED_PERCENT_ROUNDUP); if (enable_vertical_row_snap) { int procCount = (int) (dataAxisCalculator.getAbsRowCount() * (percent + PERCENT_TOLERANCE)); if (procCount < 1) { procCount = 1; } zoomProcessToCount(procCount); return; } // contrain the zoom level double min_percent = 1.0 / (dataAxisCalculator.getAbsRowEnd() + 1); if (percent < min_percent) { percent = min_percent; } else if (percent >= HUNDRED_PERCENT_ROUNDUP) { percent = 1.0; } double newstart = ypct_focus - ypct_focus_screen_percent * percent; if (newstart < 0.0) { newstart = 0.0; } double newend = newstart + percent; if (newend >= HUNDRED_PERCENT_ROUNDUP) { newend = 1.0; newstart = newend - percent; } dataAxisCalculator.setVisibleRange(newstart, newend); updateY(false); } // --- zoom by step /** Zoom in by a factor of 2 */ public void zoomTimeIn() { zoomHistoryAdd(); long duration = timeAxisCalculator.getTimeDuration() / 2; zoomTimeToDuration(duration); } /** Zoom out by a factor of 2 */ public void zoomTimeOut() { zoomHistoryAdd(); long duration = timeAxisCalculator.getTimeDuration() * 2; zoomTimeToDuration(duration); } /** Zoom in by a factor of 2 */ public void zoomProcessIn() { zoomHistoryAdd(); double range = dataAxisCalculator.getVisiblePercent() / 2; zoomYToPercent(range); } /** Zoom out by a factor of 2 */ public void zoomProcessOut() { zoomHistoryAdd(); double range = dataAxisCalculator.getVisiblePercent() * 2; zoomYToPercent(range); } // -----Compute Zoom levels used by Zoom slider widgets public int getZoomTimeLevelMax() { return getZoomLevel(tldrawer.getAbsoluteTimeDuration(), 0); } public int getZoomProcessLevelMax() { return getZoomLevel(tldrawer.getAbsoluteRowCount(), 0); } public int getZoomTimeLevel() { long absolute = tldrawer.getAbsoluteTimeDuration(); long current = timeAxisCalculator.getTimeDuration(); int level = getZoomLevel(absolute, current); return level; } public int getZoomProcessLevel() { long totalnp = tldrawer.getAbsoluteRowCount(); long current; if (zoom_ypct_at_max) { current = totalnp; } else { current = (long) (totalnp * dataAxisCalculator.getVisiblePercent()); } int level = getZoomLevel(totalnp, current); return level; } /** Compute the nearest level for a segment within max */ private int getZoomLevel(long max, long segment) { int i = 0; long lt = max; while (lt > segment) { lt >>= 1; i++; } return i; } private long getZoomMultiplier(int lev) { long mult = 1L << lev; return mult; } // --- zoom to level public void zoomTimeToLevel(int lev) { zoomHistoryAdd(); long multiplier = getZoomMultiplier(lev); long abs_count = tldrawer.getAbsoluteTimeDuration(); long desired_count = abs_count / multiplier; zoomTimeToDuration(desired_count); } public void zoomProcessToLevel(int lev) { zoomHistoryAdd(); long multiplier = getZoomMultiplier(lev); double percent = 1.0 / multiplier; zoomYToPercent(percent); } // --- reset and revert zoom /** Reset zoom to show entire time and process range */ public void resetZoom() { zoomHistoryAdd(); zoomTimeToDuration(tldrawer.getAbsoluteTimeDuration()); zoomYToPercent(1.0); // YXXX does double paint } public void zoomCenterSelection() { if (tldrawer.selectionActive()) { zoomHistoryAdd(); tldrawer.zoomCenterSelection(); ypct_focus = tldrawer.getSelectionYCenter(); ypct_focus_screen_percent = 0.5; zoom_time_center = tldrawer.getSelectionTimeCenter(); zoom_time_center_screen_percent = 0.5; zoomTimeToDuration(timeAxisCalculator.getTimeDuration()); zoomYToPercent(dataAxisCalculator.getVisiblePercent()); } } private double calcTimeScreenPercent(long tstamp) { final double deltat = tstamp - timeAxisCalculator.getTimeStart(); final long duration = timeAxisCalculator.getTimeDuration(); if (duration < 1) { return 0; // weird } double screenPercent = deltat / duration; if (screenPercent > 1.0) { screenPercent = 1.0; // weird } else if (screenPercent < 0.0) { screenPercent = 0.0; // weird } return screenPercent; } private double calcYpctScreenPercent(double ypct) { final double deltat = ypct - dataAxisCalculator.getVisibleStart(); final double visible = dataAxisCalculator.getVisiblePercent(); if (visible == 0) { return 0; // weird } double screenPercent = deltat / visible; if (screenPercent > 1.0) { screenPercent = 1.0; // weird } else if (screenPercent < 0.0) { screenPercent = 0.0; // weird } return screenPercent; } // --- zoomHistory internal and external functions private static boolean dumpHistory = false; private void zoomHistoryReset() { zoomHistory.clear(); zoomHistoryIdx = 0; zoomHistoryNotifyListeners(); } public boolean zoomHistoryAtMax() { validate_zoomHistoryIdx(); if (zoomHistoryIdx >= zoomHistory.size() - 1) { return true; } return false; } public boolean zoomHistoryAtMin() { validate_zoomHistoryIdx(); if (zoomHistoryIdx == 0) { return true; } return false; } public void zoomHistoryAdd() { ZoomHistoryEvent e = zoomHistoryCreateEvent(); zoomHistoryAdd(e); } private void zoomHistoryAdd(ZoomHistoryEvent e) { validate_zoomHistoryIdx(); for (int ii = zoomHistory.size() - 1; ii >= zoomHistoryIdx; ii--) { zoomHistory.remove(ii); } int prev_frame = zoomHistoryIdx - 1; if (prev_frame >= 0 && prev_frame < zoomHistory.size()) { ZoomHistoryEvent old_e = zoomHistory.get(prev_frame); if (e.equals(old_e)) { if (dumpHistory) System.out.printf( "HistoryAdd@%d: skipping - exact match: %s\n", zoomHistoryIdx, e.toString()); // debug zoomHistoryNotifyListeners(); return; } } zoomHistory.add(e); zoomHistoryIdx = zoomHistory.size(); if (dumpHistory) System.out.printf("HistoryAdd@%d: %s\n", zoomHistoryIdx, e.toString()); // debug // // if(debugHistory)System.out.printf("HistoryAdd@%d:\n%s",zoomHistoryIdx,zoomHistoryDump().toString()); // debug zoomHistoryNotifyListeners(); } public void undoZoom() { if (zoomHistoryAtMin()) { return; } // remember where we came from: ZoomHistoryEvent e = zoomHistoryCreateEvent(); if (zoomHistoryIdx > zoomHistory.size() - 1) { zoomHistory.add(e); } else { zoomHistory.set(zoomHistoryIdx, e); } if (dumpHistory) System.out.printf( "HistoryUndo@%d: updated %d: %s\n", zoomHistoryIdx - 1, zoomHistoryIdx, e.toString()); // debug // restore zoom e = zoomHistory.get(--zoomHistoryIdx); // // if(debugHistory)System.out.printf("HistoryUndo@%d:\n%s",zoomHistoryIdx,zoomHistoryDump().toString()); // debug zoomHistoryDoZoom(e); zoomHistoryNotifyListeners(); } public void redoZoom() { if (zoomHistoryAtMax()) { return; } // remember where we came from: ZoomHistoryEvent e = zoomHistoryCreateEvent(); zoomHistory.set(zoomHistoryIdx, e); if (dumpHistory) System.out.printf( "HistoryRedo@%d: updated %d: %s\n", zoomHistoryIdx, zoomHistoryIdx, e.toString()); // debug // restore zoom e = zoomHistory.get(++zoomHistoryIdx); // // if(debugHistory)System.out.printf("HistoryRedo@%d:\n%s",zoomHistoryIdx,zoomHistoryDump().toString()); // debug zoomHistoryDoZoom(e); zoomHistoryNotifyListeners(); } private void validate_zoomHistoryIdx() { if (zoomHistoryIdx > zoomHistory.size()) { if (dumpHistory) System.out.printf( "HistoryValidate fail: idx=%d size=@%d\n", zoomHistoryIdx, zoomHistory.size()); // debug zoomHistoryIdx = zoomHistory.size(); // weird } else if (zoomHistoryIdx < 0) { if (dumpHistory) System.out.printf( "HistoryValidate fail: idx=%d size=@%d\n", zoomHistoryIdx, zoomHistory.size()); // debug zoomHistoryIdx = 0; // weird } } private ZoomHistoryEvent zoomHistoryCreateEvent() { ZoomHistoryEvent e = new ZoomHistoryEvent( timeAxisCalculator.getTimeStart(), timeAxisCalculator.getTimeEnd(), dataAxisCalculator.getVisibleStart(), dataAxisCalculator.getVisibleEnd(), zoom_time_center, zoom_time_center_screen_percent, ypct_focus, ypct_focus_screen_percent, AnWindow.getInstance().getSettings().getTimelineSetting().getTLStackDepth()); return e; } private StringBuffer zoomHistoryDump() { StringBuffer sb = new StringBuffer(); for (int ii = 0; ii < zoomHistory.size(); ii++) { if (ii == zoomHistoryIdx) { sb.append(" *"); } else { sb.append(" "); } sb.append(String.format("%2d: %s\n", ii, zoomHistory.get(ii).toString())); } return sb; } private void zoomHistoryNotifyListeners() { TimelineSelectionHistoryEvent e = new TimelineSelectionHistoryEvent(zoomHistoryAtMin(), zoomHistoryAtMax()); tldrawer.notifyZoomHistoryChange(e); } private void zoomHistoryDoZoom(ZoomHistoryEvent e) { zoom_time_center = e.timeFocus; zoom_time_center_screen_percent = e.timeFocusScreenPercent; ypct_focus = e.ypctFocus; ypct_focus_screen_percent = e.ypctFocusScreenPercent; AnWindow.getInstance() .getSettings() .getTimelineSetting() .setTLStackDepth(TimelinePanel.this, e.vZoomLevel); // delayed :( zoomTimeToRange(e.timeStart, e.timeEnd, false); zoomYToRange(e.ypctStart, e.ypctEnd, false); zoom_time_center = e.timeFocus; zoom_time_center_screen_percent = e.timeFocusScreenPercent; ypct_focus = e.ypctFocus; ypct_focus_screen_percent = e.ypctFocusScreenPercent; // YXXX does double paint } // --- mouse and rubberbanding modes /** * Set Mouse Mode to MOUSE_GRABBING_MODE or MOUSE_RUBBERBANDING_MODE The modes differ in how to * process mouse drags. MOUSE_GRABBING_MODE - a drag pans MOUSE_RUBBERBANDING_MODE - a drag draws * a rectangle for zooming Both modes select objects with a single click and zoom and center on a * double click. */ public void setMouseMode(MouseDragMode mode) { if (mouse_drag_mode != mode) { mouse_drag_mode = mode; global_mouse_drag_mode_changed = true; } } /** Return mouse mode */ public MouseDragMode getMouseMode() { return mouse_drag_mode; } /** Set type of rubberbanding to use */ public void setRubberbandIs2D(boolean is2d) { rubberbandIs2D = is2d; } /** Add a listener for changes to the range of the display */ public void addChangeListener(ChangeListener listener) { change_listeners.add(listener); } /** Notify change listeners of a zoom or pan */ private void notifyListeners() { ChangeEvent event = new ChangeEvent(this); for (ChangeListener listener : change_listeners) { listener.stateChanged(event); } } private int limitCoord(int initialCoord, int max) { int coord = initialCoord; if (coord < 0) { coord = 0; } else if (coord >= max) { coord = max - 1; } return coord; } /** * Main routine to layout the timeline with the following components. timelineCanvas - central * drawing area to display the timeline globalRuler - ruler showing the global range on the bottom * of the timeline. localRuler - ruler that shows the width of the current display. verticalRuler * - ruler with the process labels. horScroll - time Scrollbar on the bottom of the timeline. * verScroll - process scrollbar on the right side of the display. */ private void initializeComponents() { this.setLayout(new BorderLayout()); southPanel = new JPanel(); southPanel.setLayout(new BorderLayout()); this.add(southPanel, BorderLayout.SOUTH); /* south: graph's horizontal scrollbar */ horScroll = new AnLongScrollBar(JScrollBar.HORIZONTAL); horScroll.addLongAdjustmentListener( new AnLongScrollBar.LongAdjustmentListener() { public void adjustmentValueChanged(AnLongScrollBar.LongAdjustmentEvent adjustmentEvent) { if (set_hscroll) { /* ignore events while adjusting geometry */ return; } { if (scroll_adjusting_snapshot == null) { scroll_adjusting_snapshot = zoomHistoryCreateEvent(); } hscroll_adjusting = true; long newstart = adjustmentEvent.getValue(); panTimeTo(newstart); hscroll_adjusting = false; if (!adjustmentEvent.getValueIsAdjusting()) { zoomHistoryAdd(scroll_adjusting_snapshot); scroll_adjusting_snapshot = null; } } } }); southPanel.add(BorderLayout.CENTER, horScroll); /* east: scroll bar for processes */ verScroll = new JScrollBar(JScrollBar.VERTICAL); verScroll.addAdjustmentListener( new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { if (set_vscroll) { /* ignore events while adjusting geometry */ return; } { if (scroll_adjusting_snapshot == null) { scroll_adjusting_snapshot = zoomHistoryCreateEvent(); } yscroll_adjusting = true; double newstart; if (enable_vertical_row_snap) { int proc = verScroll.getValue(); int yy = dataAxisCalculator.getLowCoordForRow(proc); newstart = dataAxisCalculator.getPercentNearCoord(yy); } else { newstart = verScroll.getValue(); newstart /= VERSCROLL_TO_PERCENT; } panProcTo(newstart); yscroll_adjusting = false; if (!adjustmentEvent.getValueIsAdjusting()) { zoomHistoryAdd(scroll_adjusting_snapshot); scroll_adjusting_snapshot = null; } } } }); this.add(verScroll, BorderLayout.EAST); /* north: time ruler */ ValuesNanoseconds vtype = new ValuesNanoseconds(timeAxisCalculator.getTimeStart(), timeAxisCalculator.getTimeEnd()); globalRuler = new RangeRuler(vtype, RangeRuler.HORIZONTAL_ORIENTATION); globalRuler.setTitlePlacement(localRuler.PLACEMENT_WITH_LABELS); globalRuler.setTitle(AnLocale.getString("Time")); globalRuler.setTickPlacement(RangeRuler.TICKS_ON_THE_BOTTOM); globalRuler.setUseTickCenterForUnitSteps(true); TimelineMouseAdapter globalRulerMouseAdapter = new TimelineMouseAdapter( globalRuler, MousePanelType.MP_X_RULER, hRulerDefaultMouseMode, MouseDragMode.MOUSE_RUBBERBANDING_MODE); globalRuler.addMouseWheelListener(globalRulerMouseAdapter); globalRuler.addMouseMotionListener(globalRulerMouseAdapter); globalRuler.addMouseListener(globalRulerMouseAdapter); this.add(globalRuler, BorderLayout.NORTH); /* south panel's relative scale ruler */ vtype = new ValuesNanoseconds(0, timeAxisCalculator.getTimeDuration()); localRuler = new RangeRuler(vtype, RangeRuler.HORIZONTAL_ORIENTATION); localRuler.setTitlePlacement(localRuler.PLACEMENT_WITH_LABELS); localRuler.setTitle(AnLocale.getString("Relative")); localRuler.setTickPlacement(RangeRuler.TICKS_ON_THE_TOP); localRuler.setUseTickCenterForUnitSteps(false); TimelineMouseAdapter localRulerMouseAdapter = new TimelineMouseAdapter( localRuler, MousePanelType.MP_X_RULER, hRulerDefaultMouseMode, MouseDragMode.MOUSE_RUBBERBANDING_MODE); localRuler.addMouseWheelListener(localRulerMouseAdapter); localRuler.addMouseMotionListener(localRulerMouseAdapter); localRuler.addMouseListener(localRulerMouseAdapter); southPanel.add(BorderLayout.NORTH, localRuler); /* south: spacer to east of scrollbar */ southEastSpacer = new JPanel(); southPanel.add(BorderLayout.EAST, southEastSpacer); /* south: spacer to west of scrollbar */ southWestSpacer = new JPanel(); southPanel.add(BorderLayout.WEST, southWestSpacer); /* The canvas is where the timeline is drawn */ timelineCanvas = new TimelineCanvas(); { // YXXX is this the right place vs. AnWindow or TL2Disp/MPITLDisp? AccessibleContext ac = timelineCanvas.getAccessibleContext(); if (ac != null) { String accessibleName = AnLocale.getString("Timeline"); // YXXX what should text be? String accessibleDescription = AnLocale.getString("Timeline shows experiment activity vs. time"); ac.setAccessibleName(accessibleName); ac.setAccessibleDescription(accessibleName); } } TimelineMouseAdapter timelineMouseAdapter = new TimelineMouseAdapter(timelineCanvas, MousePanelType.MP_MAIN_PANEL, mainPanelDefaultMouseMode, MouseDragMode.MOUSE_RUBBERBANDING_MODE); timelineCanvas.addMouseWheelListener(timelineMouseAdapter); timelineCanvas.addMouseMotionListener(timelineMouseAdapter); timelineCanvas.addMouseListener(timelineMouseAdapter); // zoom sliders. Dimensions are used for timelineCanvas if (enable_zoom_overlays) { initZoomOverlays(timelineCanvas); int overlaySz = timeOverlay.getWidth(); timelineCanvas.setPreferredSize(new Dimension(overlaySz, overlaySz)); timelineCanvas.setMinimumSize(new Dimension(overlaySz, overlaySz)); } this.add(timelineCanvas, BorderLayout.CENTER); /* west: vertical ruler for processes */ verticalRuler = tldrawer.getVerticalRuler(); TimelineMouseAdapter vRulerMouseAdapter = new TimelineMouseAdapter( verticalRuler, MousePanelType.MP_Y_RULER, vRulerDefaultMouseMode, null); verticalRuler.addMouseWheelListener(vRulerMouseAdapter); verticalRuler.addMouseMotionListener(vRulerMouseAdapter); verticalRuler.addMouseListener(vRulerMouseAdapter); this.add(verticalRuler, BorderLayout.WEST); tldrawer.addSelectionListener( new TimelineSelectionListener() { public void valueChanged(TimelineSelectionGenericEvent ge) { if (ge instanceof TimelineSelectionEvent) { // update caliper TimelineSelectionEvent rowTimeEvent = (ge instanceof TimelineSelectionEvent) ? (TimelineSelectionEvent) ge : null; boolean shift = false; boolean updateCaliper = true; if (rowTimeEvent != null) { if (rowTimeEvent.shiftKey) { shift = true; } if (!rowTimeEvent.requestCaliperUpdate) { updateCaliper = false; } if (rowTimeEvent.moveAxis == rowTimeEvent.moveAxis.LEFT_RIGHT) { long eventTimeStart = tldrawer.getSelectionTimeStart(); long eventTimeEnd = tldrawer.getSelectionTimeEnd(); panLeftRightToMakeVisible(eventTimeStart, eventTimeEnd); } else if (rowTimeEvent.moveAxis == rowTimeEvent.moveAxis.UP_DOWN) { double yCenter = tldrawer.getSelectionYCenter(); panUpDownToMakeVisible(yCenter); } else { // direct or restored selection (not cursor move) if (tldrawer.selectionActive()) { double yCenter = tldrawer.getSelectionYCenter(); panUpDownToMakeVisible(yCenter); } else { int ii = 1; // weird } } } if (updateCaliper) { long timeLow = tldrawer.getSelectionTimeStart(); long timeHigh = tldrawer.getSelectionTimeEnd(); caliperUtilSetAndNotify(timeLow, timeHigh, shift); } } else { int ii = 1; // for breakpoint } } }); this.revalidate(); // needed after adding components } private void panUpDownToMakeVisible(double yCenter) { ZoomHistoryEvent e = zoomHistoryCreateEvent(); final double recenterPercentOfScreen = AUTO_PAN_RELOCATION_PERCENT; // Y axis ypct_focus = yCenter; final double visibleStart = dataAxisCalculator.getVisibleStart(); final double visibleEnd = dataAxisCalculator.getVisibleEnd(); final double vizPercent = dataAxisCalculator.getVisiblePercent(); if (ypct_focus <= visibleStart) { zoomHistoryAdd(e); ypct_focus_screen_percent = recenterPercentOfScreen; double newStart = ypct_focus - vizPercent * recenterPercentOfScreen; panProcTo(newStart); } else if (ypct_focus >= visibleEnd) { zoomHistoryAdd(e); ypct_focus_screen_percent = 1 - recenterPercentOfScreen; double newStart = ypct_focus - vizPercent * (1 - recenterPercentOfScreen); panProcTo(newStart); } else { ypct_focus_screen_percent = calcYpctScreenPercent(ypct_focus); } } private void panLeftRightToMakeVisible(long eventTimeStart, long eventTimeEnd) { ZoomHistoryEvent e = zoomHistoryCreateEvent(); double recenterPercentOfScreen = AUTO_PAN_RELOCATION_PERCENT; // Time axis zoom_time_center = (eventTimeStart + eventTimeEnd) / 2; final long visibleTimeStart = timeAxisCalculator.getTimeStart(); final long visibleTimeEnd = timeAxisCalculator.getTimeEnd(); final long visibleDuration = timeAxisCalculator.getTimeDuration(); if (visibleDuration < 5) { // with very few ns of time, percentage doesn't work, pick middle. recenterPercentOfScreen = 0.51; } if (eventTimeEnd < visibleTimeStart) { zoomHistoryAdd(e); zoom_time_center_screen_percent = recenterPercentOfScreen; zoomTimeToDuration(visibleDuration); } else if (eventTimeStart > visibleTimeEnd) { zoomHistoryAdd(e); zoom_time_center_screen_percent = 1 - recenterPercentOfScreen; zoomTimeToDuration(visibleDuration); } else { zoom_time_center_screen_percent = calcTimeScreenPercent(zoom_time_center); } } // === Mouse handlers private static enum MousePanelType { MP_MAIN_PANEL, MP_X_RULER, MP_Y_RULER }; private class TimelineMouseAdapter extends MouseAdapter { /* mouse dragging */ private ZoomHistoryEvent history_start_drag; private int x_start_drag = 0; private int y_start_drag = 0; private int caliperStepX = 0; private int caliperX = 0; private int recent_mouse_button = -1; private long x_start_drag_timeOffset; private double y_start_drag_percentOffset; private Timer mousePressedTimer = null; private Timer autoScrollTimer; private final MousePanelType parentPanelType; private final JComponent parentPanel; private MouseSubmode mouseSubmode = MouseSubmode.MM_UNKNOWN; private final MouseDragMode altDragAction; private final MouseDragMode dragAction; // if null, use global mouse_mode private final boolean x_is_live, y_is_live; public TimelineMouseAdapter( JComponent _parentPanel, MousePanelType _mmode, MouseDragMode _dragAction, MouseDragMode _altDragAction) { parentPanel = _parentPanel; parentPanelType = _mmode; dragAction = _dragAction; altDragAction = _altDragAction; x_is_live = (parentPanelType == MousePanelType.MP_MAIN_PANEL || parentPanelType == MousePanelType.MP_X_RULER); y_is_live = (parentPanelType == MousePanelType.MP_MAIN_PANEL || parentPanelType == MousePanelType.MP_Y_RULER); autoScrollTimer = new Timer( AUTO_PAN_REPEAT_TIME, new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // user timer to scroll if (x_is_live) { long curStart = timeAxisCalculator.getTimeStart(); long binTime = timeAxisCalculator.getTimePerBin(); long newTime = curStart + binTime * caliperStepX / 3; panTimeTo(newTime); switch (getMouseSubmode()) { case MM_DRAG_CALIPER: case MM_DRAG_SELECTION: { long time = timeAxisCalculator.getTimeNearCoord(caliperX); timeCaliper.setActiveCaliperTime(time); caliperUtilNotify(timeCaliper); break; } default: int ii = 1; // weird break; } } } }); autoScrollTimer.setRepeats(true); } private boolean killMousePressedTimer() { if (mousePressedTimer != null) { mousePressedTimer.stop(); mousePressedTimer = null; return true; } return false; } private void checkAutoScrollTimer(MouseEvent e) { int scrollzonePixels = AUTO_PAN_REGION_PIXELS; int rightScrollzonePixels = timeAxisCalculator.getAvailPixels() - scrollzonePixels; caliperStepX = 0; final int ix = translateX(e); if (ix > rightScrollzonePixels) { caliperStepX = ix - rightScrollzonePixels; } else if (scrollzonePixels > ix) { caliperStepX = -(scrollzonePixels - ix); } if (caliperStepX != 0) { // auto-pan needed caliperX = ix; if (!autoScrollTimer.isRunning()) { autoScrollTimer.start(); } } else { // turn off auto-pan autoScrollTimer.stop(); } } // === track ctrl-key events to change mouse state // couldn't figure out which JComponent's getInputMap() is needed: // private boolean ctrlKeyDown = false; // private void initCtrlKeyListener(){ // String ks_string; // KeyStroke ks_def; // ks_string = "_CONTROLPRESSED"; // ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, // InputEvent.CTRL_DOWN_MASK, false); // parentPanel.getInputMap(JComponent.WHEN_FOCUSED).put(ks_def, ks_string); // parentPanel.getActionMap().put(ks_string, new AbstractAction() { // @Override // public void actionPerformed(ActionEvent ev) { // ctrlKeyDown = true; // // parentPanel.setCursor(handcursors.getCursor(TimelineCursor.OPEN_HAND_CURSOR)); // } // }); // // ks_string = "_CONTROLRELEASED"; // ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, // InputEvent.CTRL_DOWN_MASK, true); // parentPanel.getInputMap(JComponent.WHEN_FOCUSED).put(ks_def, ks_string); // parentPanel.getActionMap().put(ks_string, new AbstractAction() { // @Override // public void actionPerformed(ActionEvent ev) { // ctrlKeyDown = false; // // parentPanel.setCursor(handcursors.getCursor(TimelineCursor.CLOSED_HAND_CURSOR)); // } // }); // } // === translate coordinates from rulers to pmain panel private int translateX(MouseEvent e) { // translate to main panel coordinates if (!x_is_live) { return Integer.MIN_VALUE; } // YXXX ugly switch on global object final int x_offset; if (e.getComponent() == globalRuler) { x_offset = globalRuler.getPaddingLow() - timeAxisCalculator.getMargin(); } else if (e.getComponent() == localRuler) { x_offset = localRuler.getPaddingLow() - timeAxisCalculator.getMargin(); } else if (e.getComponent() == verticalRuler) { x_offset = 0; } else { x_offset = 0; } final int ix = e.getX() - x_offset; return ix; } private int translateY(MouseEvent e) { // translate to main panel coordinates if (!y_is_live) { return Integer.MIN_VALUE; } return e.getY(); } private boolean coord_is_live(int ix) { if (ix == Integer.MIN_VALUE) { return false; } return true; } // === timeline mouse modes, Submodes private MouseSubmode getMouseSubmode() { return mouseSubmode; } private void setMouseSubmode(final MouseSubmode newMode) { // sets mouseSubmode and panel's cursor if (mouseSubmode == newMode && !global_mouse_drag_mode_changed) { return; } global_mouse_drag_mode_changed = false; mouseSubmode = newMode; parentPanel.setCursor(getSubmodeCursor(newMode)); } private Cursor getSubmodeCursor(MouseSubmode submode) { switch (submode) { case MM_OVERLAY: return overlayMouseHandler.getCursor(); case MM_DRAG_RUBBERBAND: case MM_HOVER_RUBBERBAND: return handcursors.getCursor(Cursor.TEXT_CURSOR); case MM_DRAG_GRAB: return handcursors.getCursor(TimelineCursor.CLOSED_HAND_CURSOR); case MM_HOVER_GRAB: return handcursors.getCursor(Cursor.DEFAULT_CURSOR); case MM_DRAG_SELECTION: case MM_HOVER_SELECTION: return handcursors.getCursor(Cursor.CROSSHAIR_CURSOR); case MM_DRAG_CALIPER: case MM_HOVER_CALIPER: return handcursors.getCursor(Cursor.E_RESIZE_CURSOR); } return handcursors.getCursor(Cursor.DEFAULT_CURSOR); // weird, should not happen } private MouseSubmode convertHoverToDrag(MouseSubmode hoverMode) { switch (hoverMode) { case MM_HOVER_RUBBERBAND: return MouseSubmode.MM_DRAG_RUBBERBAND; case MM_HOVER_GRAB: return MouseSubmode.MM_DRAG_GRAB; case MM_HOVER_SELECTION: return MouseSubmode.MM_DRAG_SELECTION; case MM_HOVER_CALIPER: return MouseSubmode.MM_DRAG_CALIPER; } return hoverMode; // weird, should not happen } private void setMouseDragMode() { MouseSubmode newMode = convertHoverToDrag(getMouseSubmode()); setMouseSubmode(newMode); } // === other listener actions public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { // e.getScrollAmount() // unit increments per notch // e.getUnitsToScroll() // unit increments // scrollPane.getVerticalScrollBar().getUnitIncrement(1) // Vertical unit increment pixels } else { // scroll type == MouseWheelEvent.WHEEL_BLOCK_SCROLL // scrollPane.getVerticalScrollBar().getBlockIncrement(1) // Vertical block increment pixels } if (MOUSE_WHEEL_ZOOMS) { // zoom X Double zoomFactor = notches * 1.5; final int ix = translateX(e); long mouseTime = coord_is_live(ix) ? timeAxisCalculator.getTimeAtCoord(ix) : zoom_time_center; long duration; if (zoomFactor < 0) { // zoom in Double dd = timeAxisCalculator.getTimeDuration() / (-zoomFactor); duration = dd.longValue(); } else { // zoom out Double dd = timeAxisCalculator.getTimeDuration() * (zoomFactor); duration = dd.longValue(); if (duration < 2) { duration = 2; // deal with rounding at maximum zoom } } zoomTimeToDuration(duration); // sets the duration recalc_time_focus(mouseTime); zoomTimeToDuration(duration); // pans to updated center } else { // vertical scrolling final int visiblePixels = dataAxisCalculator.getAvailPixels(); if (visiblePixels <= 0) { return; } final int pixelsPerNotch = 50; final double percentPerPixel = dataAxisCalculator.getVisiblePercent() / visiblePixels; Double panPercent = (notches * pixelsPerNotch) * percentPerPixel; panProcBy(panPercent); } } public void mouseDragged(MouseEvent e) { if (recent_mouse_button != e.BUTTON1) { return; } final MouseSubmode submode = getMouseSubmode(); switch (submode) { case MM_OVERLAY: break; case MM_DRAG_RUBBERBAND: processRubberband(e, false); break; case MM_DRAG_GRAB: if (x_is_live) { final int ix = translateX(e); int deltaX = ix - x_start_drag; long deltatime = timeAxisCalculator.getTimeDuration() * deltaX / timeAxisCalculator.getAvailPixels(); long start = x_start_drag_timeOffset - deltatime; panTimeTo(start); } if (y_is_live) { final int iy = translateY(e); int deltaY = iy - y_start_drag; double deltaPercent = dataAxisCalculator.getVisiblePercent() * deltaY / dataAxisCalculator.getAvailPixels(); double startYPercent = y_start_drag_percentOffset - deltaPercent; panProcTo(startYPercent); } break; case MM_DRAG_SELECTION: case MM_DRAG_CALIPER: if (x_is_live) { checkAutoScrollTimer(e); final int ix = translateX(e); long time = timeAxisCalculator.getTimeNearCoord(ix); timeCaliper.setActiveCaliperTime(time); caliperUtilNotify(timeCaliper); } else { int ii = 1; // weird, not supported yet } break; case MM_HOVER_RUBBERBAND: case MM_HOVER_GRAB: case MM_HOVER_SELECTION: case MM_HOVER_CALIPER: final int xDist = x_is_live ? Math.abs(x_start_drag - translateX(e)) : 0; final int yDist = y_is_live ? Math.abs(y_start_drag - translateY(e)) : 0; if (mousePressedTimer != null && (xDist < MOUSE_DRAG_MIN_PIXELS && yDist < MOUSE_DRAG_MIN_PIXELS)) { // for the initial period, don't pan/rubberband for small movements int foo = 1; // for breakpoint } else { // either timer expired or cursor moved significantly killMousePressedTimer(); setMouseDragMode(); } break; default: int xx = 1; // weird break; } } private void mouseDraggedEnd(MouseEvent e) { // called by mouseReleased(). Cleans up any state used by mouseDragged() switch (getMouseSubmode()) { case MM_DRAG_RUBBERBAND: processRubberband(e, true); break; default: // Java appears to provide same X/Y to mouseDragged() // and mouseReleased(), no need to do anything else here break; } } public void mouseMoved(MouseEvent e) { selectHoverState(e, false); } private void selectHoverState(final MouseEvent e, final boolean checkAltMode) { /* Set the cursor and mouse MM_HOVER_* state */ if (parentPanelType == MousePanelType.MP_MAIN_PANEL && overlayMouseHandler.inOverlay(e.getX(), e.getY())) { // for now, only support zoom overlay in main panel setMouseSubmode(MouseSubmode.MM_OVERLAY); overlayMouseHandler.activate(); return; } overlayMouseHandler.deactivate(); if (enable_time_caliper) { // check if over a caliper int idx = caliperUtilSelectNearX(translateX(e)); if (idx != -1) { // we're hovering over a caliper if (idx == 0) { // selected caliper arm is the anchor timeCaliper.swapAnchor(); // make the other the anchor } timeCaliper.setActiveIdx(1); setMouseSubmode(MouseSubmode.MM_HOVER_CALIPER); return; } } final MouseDragMode defaultDragAction; if (checkAltMode && e.isControlDown() && altDragAction != null) { // toggle to alternate mode defaultDragAction = altDragAction; } else { defaultDragAction = dragAction != null ? dragAction : mouse_drag_mode; } final MouseSubmode newMode; switch (defaultDragAction) { default: case MOUSE_GRABBING_MODE: newMode = MouseSubmode.MM_HOVER_GRAB; break; case MOUSE_SELECTION_MODE: newMode = MouseSubmode.MM_HOVER_SELECTION; break; case MOUSE_RUBBERBANDING_MODE: newMode = MouseSubmode.MM_HOVER_RUBBERBAND; break; } setMouseSubmode(newMode); } public void mouseClicked(MouseEvent e) { if (getMouseSubmode() == MouseSubmode.MM_OVERLAY) { return; } if (e.getButton() == e.BUTTON1) { if (e.getClickCount() == 2) { doubleClickZoomIn(e); } } } private void doubleClickZoomIn(final MouseEvent e) { zoomHistoryAdd(); if (x_is_live) { // reset zoom X center final int x = translateX(e); zoom_time_center = timeAxisCalculator.getTimeNearCoord(x); zoom_time_center_screen_percent = calcTimeScreenPercent(zoom_time_center); // zoom X long duration = timeAxisCalculator.getTimeDuration() / 4; zoomTimeToDuration(duration); } if (y_is_live) { final int y = translateY(e); // reset zoom Y center //YXXX mouse up already sets the center?? ypct_focus = dataAxisCalculator.getPercentNearCoord(y); ypct_focus_screen_percent = calcYpctScreenPercent(ypct_focus); // zoom Y if (parentPanelType == MousePanelType.MP_MAIN_PANEL || enable_vertical_zoom) { double vis_percent = dataAxisCalculator.getVisiblePercent(); int yproc = dataAxisCalculator.getRowNearPercent(ypct_focus); double three_rows_pct = dataAxisCalculator.getRowPercentOfTotal(yproc) * 3; if (vis_percent > three_rows_pct) { vis_percent /= 2; if (vis_percent < three_rows_pct) { vis_percent = three_rows_pct; } zoomYToPercent(vis_percent); } } else if (parentPanelType == MousePanelType.MP_Y_RULER) { int xx = 1; // no action implemented yet } } } public void mousePressed(final MouseEvent e) { selectHoverState(e, e.isControlDown()); if (getMouseSubmode() == MouseSubmode.MM_OVERLAY) { return; } int button = e.getButton(); recent_mouse_button = button; if (button != e.BUTTON1) { return; } /* This is where a mouse drag starts (though it's also called for * a click), there is not a call for MouseDragged with the initial * coordinates */ { mousePressedTimer = new Timer( MOUSE_PRESS_DRAG_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { setMouseDragMode(/*e*/ ); mousePressedTimer = null; } }); mousePressedTimer.setRepeats(false); mousePressedTimer.start(); } x_start_drag = translateX(e); y_start_drag = translateY(e); x_start_drag_timeOffset = timeAxisCalculator.getTimeStart(); y_start_drag_percentOffset = dataAxisCalculator.getVisibleStart(); history_start_drag = zoomHistoryCreateEvent(); if (getMouseSubmode() == MouseSubmode.MM_HOVER_SELECTION && !e.isShiftDown()) { // always resets the selection, give feedback right away long time = timeAxisCalculator.getTimeNearCoord(x_start_drag); timeCaliper.setActiveIdx(1); timeCaliper.setTime(0, time); timeCaliper.setTime(1, time); caliperUtilNotify(timeCaliper); } } private void processRubberband(final MouseEvent e, final boolean isDragEnd) { final int xx = translateX(e); final int yy = translateY(e); boolean yzoom = true, xzoom = true; if (!coord_is_live(xx)) { xzoom = false; } else if (!coord_is_live(yy) || !enable_vertical_zoom) { yzoom = false; } else if (!rubberbandIs2D) { // determine the primary direction of drag int dx = Math.abs(xx - x_start_drag); int dy = Math.abs(yy - y_start_drag); if (dx < dy) { xzoom = false; } else { yzoom = false; } } final int x1, y1, x2, y2; if (xzoom) { // x1 = timeAxisCalculator.getCoordAtTime(x_start_drag_time); x1 = x_start_drag; x2 = limitCoord(xx, timelineCanvas.getWidth()); } else { x1 = 0; x2 = timelineCanvas.getWidth() - 1; } if (yzoom) { y1 = y_start_drag; y2 = limitCoord(yy, timelineCanvas.getHeight()); } else { y1 = 0; y2 = timelineCanvas.getHeight() - 1; } if (!isDragEnd) { setRubberband(x1, y1, x2, y2); repaint(); } else { clearRubberband(); repaint(); { if (yzoom) { double p1 = dataAxisCalculator.getPercentNearCoord(y1); double p2 = dataAxisCalculator.getPercentNearCoord(y2); zoomYToRange(p1, p2, false); } if (xzoom) { long t1 = timeAxisCalculator.getTimeNearCoord(x1); long t2 = timeAxisCalculator.getTimeNearCoord(x2); zoomTimeToRange(t1, t2, false); } } } } /* The drag is complete */ public void mouseReleased(MouseEvent e) { if (getMouseSubmode() == MouseSubmode.MM_OVERLAY) { selectHoverState(e, false); autoScrollTimer.stop(); killMousePressedTimer(); return; } recent_mouse_button = -1; int button = e.getButton(); if (button != e.BUTTON1) { return; } autoScrollTimer.stop(); boolean preTimeout = killMousePressedTimer(); final int xx = x_start_drag; // may be MIN_VALUE final int yy = y_start_drag; // may be MIN_VALUE final boolean isClick = preTimeout; if (isClick) { // we consider this to be a click final TimelineCaliper selected; if (coord_is_live(yy) || getMouseSubmode() == MouseSubmode.MM_HOVER_GRAB) { // vRuler or main panel // check for event hit: selected = tldrawer.selectNearXY(xx, yy, e.isControlDown(), e.isShiftDown()); } else { // hRuler // don't modify event selection: selected = null; } // update calipers if (selected != null) { // x-axis click hit an event, update caliper to match: caliperUtilSetAndNotify(selected.getLowTime(), selected.getHighTime(), e.isShiftDown()); } else { // x-axis click did not update event selection if (coord_is_live(xx)) { // hRuler or main panel, put caliper at click location: long time = timeAxisCalculator.getTimeNearCoord(xx); caliperUtilSetAndNotify(time, time, e.isShiftDown()); } } } else { // end of drag action mouseDraggedEnd(e); } if (coord_is_live(yy)) { // y-axis click, update zoom center double clickYPercent = dataAxisCalculator.getPercentNearCoord(yy); recalc_ypct_focus(clickYPercent, !isClick); } ZoomHistoryEvent updated = zoomHistoryCreateEvent(); if (!updated.equals(history_start_drag)) { zoomHistoryAdd(history_start_drag); } history_start_drag = null; selectHoverState(e, false); } } private boolean isTimeVisible(long time) { final long start = timeAxisCalculator.getTimeStart(); final long end = timeAxisCalculator.getTimeEnd(); // if( end-start<=1 && time==start ){ // // special rule when only two ticks visible on screen // return true; // } // return start<time && time<end; return start <= time && time <= end; } private boolean isYpctVisible(double ypct) { final double start = dataAxisCalculator.getVisibleStart(); final double end = dataAxisCalculator.getVisibleEnd(); return start < ypct && ypct < end; } private void recalc_time_focus(long mouseTime) { // This method updates zoom_time_center and zoom_time_center_screen_percent // There are many options for what zoom should use as the focal point... long new_zoom_center = -1; // final int maxSnapToCaliperPixels = 20; // // if a caliper line is near mouse, use it // if (new_zoom_center == -1) { // if (timeCaliper != null){ // long candidateTime = -1; // int bestDist = Integer.MAX_VALUE; // for (int ii = 0; ii < 2; ii++) { // long ctime = timeCaliper.getTime(ii); // if ( isVisible(ctime) ) { // // caliper is on screen // int caliperX = timeAxisCalculator.getCoordAtTime(ctime); // int dist = Math.abs(caliperX - mouseX); // if( maxSnapToCaliperPixels > dist && // bestDist> dist){ // bestDist = dist; // candidateTime = ctime; // } // } // } // if(candidateTime != -1){ // new_zoom_center = candidateTime; // } // } // } // // // // try active caliper // if (new_zoom_center == -1) { // if (timeCaliper != null) { // final long caliperTime = timeCaliper.getActiveCaliperTime(); // if ( caliperTime!=-1 && // isVisible(caliperTime) ) { // new_zoom_center = caliperTime; // } // } // } // // // if a single caliper line is visible, use it // if (new_zoom_center == -1) { // if (timeCaliper != null){ // int num_visible = 0; // long candidateTime = -1; // for (int ii = 0; ii < 2; ii++) { // long ctime = timeCaliper.getTime(ii); // if ( isVisible(ctime) ) { // candidateTime = ctime; // num_visible++; // } // } // if (num_visible == 1) { // new_zoom_center = candidateTime; // } // } // } // if any caliper line is visible, pick the closest one if (new_zoom_center == -1) { if (timeCaliper != null) { long candidateTime = Long.MAX_VALUE; int num_visible = 0; long minDist = Long.MAX_VALUE; for (int ii = 0; ii < 2; ii++) { long ctime = timeCaliper.getTime(ii); if (isTimeVisible(ctime)) { num_visible++; long dist = Math.abs(mouseTime - ctime); if (minDist > dist) { minDist = dist; candidateTime = ctime; } } } // if( num_visible == 2){ { // consider midpoint as well long ctime = (timeCaliper.getTime(0) + timeCaliper.getTime(1)) / 2; long dist = Math.abs(mouseTime - ctime); if (isTimeVisible(ctime)) { if (minDist > dist) { minDist = dist; candidateTime = ctime; } } } if (candidateTime != Long.MAX_VALUE) { new_zoom_center = candidateTime; } } } // // try selection center // if (new_zoom_center == -1) { // long selectionTime = tldrawer.getSelectionTimeCenter(); // if (tldrawer.selectionActive() && isVisible(selectionTime)) { // // if selection is visible, use it as the selection center // new_zoom_center = selectionTime; // } // } // use the mouse location if (new_zoom_center == -1) { new_zoom_center = mouseTime; } boolean needPercentCalc = false; if (zoom_time_center != new_zoom_center) { zoom_time_center = new_zoom_center; needPercentCalc = true; } if (timeAxisCalculator.getTimeStart() == tldrawer.getAbsoluteTimeStart() || timeAxisCalculator.getTimeEnd() == tldrawer.getAbsoluteTimeEnd()) { // maxxed out at one edge needPercentCalc = true; } if (timeAxisCalculator.getTimeDuration() < 10) { // using percentage when there are only a few ns doesn't work. Pick middle zoom_time_center_screen_percent = 0.49; } else if (needPercentCalc) { double newPercent = calcTimeScreenPercent(zoom_time_center); zoom_time_center_screen_percent = newPercent; } } private boolean double_equals(double a, double b) { final double sigma = 0.0001; return Math.abs(a - b) < sigma; } private void recalc_ypct_focus(double clickYPercent, boolean isDrag) { // try selection center double new_zoom_center = -1; final double visEnd = dataAxisCalculator.getVisibleEnd(); final double visStart = dataAxisCalculator.getVisibleStart(); final double midScreen = (visEnd + visStart) / 2; if (isDrag) { double sel = tldrawer.getSelectionYCenter(); if (tldrawer.selectionActive() && isYpctVisible(sel)) { // if selection is visible, use it as the selection center new_zoom_center = sel; } else { new_zoom_center = midScreen; } } // use the mouse location if (new_zoom_center < 0) { if (isYpctVisible(clickYPercent)) { new_zoom_center = clickYPercent; } else { new_zoom_center = midScreen; } } boolean needPercentCalc = false; if (!double_equals(ypct_focus, new_zoom_center)) { ypct_focus = new_zoom_center; needPercentCalc = true; } else if (double_equals(visStart, 0) || double_equals(visEnd, 1)) { // maxxed out at one edge needPercentCalc = true; } if (needPercentCalc) { double newPercent = calcYpctScreenPercent(ypct_focus); ypct_focus_screen_percent = newPercent; } } public TimelineCaliper getCaliperClone() { if (timeCaliper == null) { return null; } return timeCaliper.clone(); } public void zoomToCaliper() { if (timeCaliper == null || timeCaliper.isSingleEvent()) { return; } zoomHistoryAdd(); zoomTimeToRange(timeCaliper.getLowTime(), timeCaliper.getHighTime(), true); } private void caliperUtilNotify(TimelineCaliper caliper) { timeCaliper = caliper; recalc_time_focus(zoom_time_center); tldrawer.notifyCaliperChange(getCaliperClone()); updateLocalRuler(); if (hRulerDefaultMouseMode == TimelinePanel.MouseDragMode.MOUSE_SELECTION_MODE) { updateHRulerCalipers(); } } private void caliperUtilSetTimeAndNotify(long anchor, long caliper) { TimelineCaliper newCaliper = new TimelineCaliper(anchor, caliper); caliperUtilNotify(newCaliper); } private int caliperUtilSelectNearX(int ix) { // returns index of caliper or -1 if (timeCaliper == null) { return -1; } if (ix == Integer.MIN_VALUE) { return -1; } int closestDist = CALIPER_CLICK_PIXEL_TOLERANCE; TimelineCaliper closestCaliper = null; int closestTimeIdx = -1; { // originally designed to loop through multiple calipers TimelineCaliper caliper = timeCaliper; for (int timeIdx = 0; timeIdx < caliper.getSize(); timeIdx++) { long time = caliper.getTime(timeIdx); if (caliper.getHighTime() == time // is right side && !(caliper.isSingleEvent() && timeIdx == 0)) { // is not left side time += 1; // +1 because all events are shown fattened by 1 ns } int x = timeAxisCalculator.getCoordAtTime(time); final int xDist = Math.abs(x - ix); if (closestDist > xDist) { closestDist = xDist; closestCaliper = caliper; closestTimeIdx = timeIdx; } } } if (closestCaliper == null) { return -1; // nothing found within caliper_max_grab_distance } return closestTimeIdx; } private void caliperUtilSetAndNotify(long timeLow, long timeHigh, boolean shift) { final long anchorTime, caliper; if (timeCaliper != null && shift) { anchorTime = timeCaliper.getTime(0); if (timeLow >= anchorTime) { caliper = timeHigh; } else if (timeHigh <= anchorTime) { caliper = timeLow; } else { // new event straddles anchor, ambigous if (Math.abs(anchorTime - timeHigh) > Math.abs(anchorTime - timeLow)) { caliper = timeHigh; } else { caliper = timeLow; } } } else { anchorTime = timeLow; caliper = timeHigh; } caliperUtilSetTimeAndNotify(anchorTime, caliper); } // requires timelineCanvas private void initZoomOverlays(JComponent parentCanvas) { timeOverlay = new ZoomRulerOverlay( parentCanvas, 2, 2, ZoomRulerOverlay.HORIZONTAL_ORIENTATION, ZoomRulerOverlay.RULER_LD_DEFAULT, false, true, false, false); timeOverlay.setNumberOfLevels(getZoomTimeLevelMax()); timeOverlay.addZoomRulerListener( new ZoomRulerListener() { public void zoomChanged(ZoomRulerEvent event) { if (event.isUndo()) { undoZoom(); } else if (event.isRedo()) { redoZoom(); } else if (event.isLevelChange()) { int lev = event.getZoomLevel(); zoomTimeToLevel(lev); } else if (event.isLevelPlus()) { zoomTimeIn(); } else if (event.isLevelMinus()) { zoomTimeOut(); } else if (event.isReset()) { resetZoom(); } else if (event.isPan()) { if (event.getDirection() == ZoomRulerEvent.PAN_UP) panUp(); else if (event.getDirection() == ZoomRulerEvent.PAN_RIGHT) panRight(); else if (event.getDirection() == ZoomRulerEvent.PAN_DOWN) panDown(); else // PAN_LEFT panLeft(); } } }); if (enable_vertical_zoom) { processOverlay = new ZoomRulerOverlay( parentCanvas, 2, timeOverlay.getHeight() + 1, ZoomRulerOverlay.VERTICAL_ORIENTATION, ZoomRulerOverlay.RULER_LD_DEFAULT, false, false, false, false); processOverlay.setNumberOfLevels(getZoomProcessLevelMax()); processOverlay.addZoomRulerListener( new ZoomRulerListener() { public void zoomChanged(ZoomRulerEvent event) { if (event.isLevelChange()) { int lev = event.getZoomLevel(); zoomProcessToLevel(lev); } else if (event.isLevelPlus()) { zoomProcessIn(); } else if (event.isLevelMinus()) { zoomProcessOut(); } } }); } this.overlayMouseHandler = new OverlayMouseHandler() { private boolean active = false; public boolean inOverlay(int x, int y) { return timeOverlay.withinBounds(x, y) || (enable_vertical_zoom && processOverlay.withinBounds(x, y)); } public void activate() { if (active) { return; } active = true; timeOverlay.activateMouseHandling(); if (enable_vertical_zoom) { processOverlay.activateMouseHandling(); } } public void deactivate() { if (!active) { return; } active = false; timeOverlay.deactivateMouseHandling(); if (enable_vertical_zoom) { processOverlay.deactivateMouseHandling(); } } public Cursor getCursor() { return overlaycursor; } }; } // --- X & Y update private void updateX(boolean force) { updateXCalc(); if (force || timeAxisCalculator.getTimeStart() != visible_time_start || timeAxisCalculator.getTimeEnd() != visible_time_end) { updateXWidgetsRanges(); repaint(); return; } return; } private void updateY(boolean force) { updateYCalc(); if (force || dataAxisCalculator.getVisibleStart() != visible_ypct_start || dataAxisCalculator.getVisibleEnd() != visible_ypct_end) { updateYWidgetsRanges(); repaint(); return; } return; } // Update X widgets. X-axis TimelineOptions must already be set. // Should not modify TimelineOptions private void updateXWidgetsRanges() { long start_ts = timeAxisCalculator.getTimeStart(); long duration = timeAxisCalculator.getTimeDuration(); updateXRulers(); // horizontal scroll bar if (!hscroll_adjusting) { set_hscroll = true; horScroll.setValues( start_ts, duration, tldrawer.getAbsoluteTimeStart(), tldrawer.getAbsoluteTimeEnd() + 1); set_hscroll = false; } int zlvl = getZoomTimeLevel(); if (timeOverlay != null) { timeOverlay.setZoomLevel(zlvl); } } private void updateXRulers() { long start_ts = timeAxisCalculator.getTimeStart(); long end_ts = timeAxisCalculator.getTimeEnd(); globalRuler.setRange(start_ts, end_ts); updateLocalRuler(); } private void updateLocalRuler() { long start_ts = timeAxisCalculator.getTimeStart(); long duration = timeAxisCalculator.getTimeDuration(); final long centerTime; TimelineCaliper caliper = timeCaliper; if (caliper != null) { centerTime = caliper.getLowTime(); } else if (tldrawer.selectionActive()) { centerTime = tldrawer.getSelectionTimeStart(); } else { centerTime = zoom_time_center; } long relStart = start_ts - centerTime; long relEnd = relStart + duration - 1; localRuler.setRange(relStart, relEnd); } private void updateHRulerCalipers() { List<Long> valueList = new ArrayList<>(); List<RangeRuler.TabStopTypes> typeList = new ArrayList<>(); TimelineCaliper caliper = timeCaliper; if (caliper != null) { valueList.add(caliper.getLowTime()); valueList.add(caliper.getHighTime()); typeList.add(RangeRuler.TabStopTypes.TABSTOP_LEFT); typeList.add(RangeRuler.TabStopTypes.TABSTOP_RIGHT); } globalRuler.setTabStops(valueList, typeList, timeAxisCalculator); localRuler.setTabStops(valueList, typeList, timeAxisCalculator); } // Update Y widgets. Y-axis TimelineOptions must already be set. // Should not modify TimelineOptions private void updateYWidgetsRanges() { // process ruler int start_p = dataAxisCalculator.getRowStart(); int end_p = dataAxisCalculator.getRowEnd(); verticalRuler.setRange(start_p, end_p); // process scrollbar. Scrollbar range is based ranks. if (!yscroll_adjusting) { set_vscroll = true; int scroll_lo; int scroll_hi; int scroll_abs_start; int scroll_abs_end; if (enable_vertical_row_snap) { scroll_lo = start_p; scroll_hi = end_p; scroll_abs_start = 0; scroll_abs_end = tldrawer.getAbsoluteRowEnd(); } else { double start_pct = dataAxisCalculator.getVisibleStart(); double end_pct = dataAxisCalculator.getVisibleEnd(); scroll_lo = (int) (start_pct * VERSCROLL_TO_PERCENT); scroll_hi = (int) (end_pct * VERSCROLL_TO_PERCENT); scroll_abs_start = 0; scroll_abs_end = VERSCROLL_TO_PERCENT; } int scroll_visible = scroll_hi - scroll_lo + 1; verScroll.setValues(scroll_lo, scroll_visible, scroll_abs_start, scroll_abs_end + 1); int scrollBlockStep = scroll_visible / 2; if (scrollBlockStep <= 0) scrollBlockStep = 1; verScroll.setBlockIncrement(scrollBlockStep); int scrollUnitStep = scrollBlockStep / SMALL_PAN_STEP_FRACTION; if (scrollUnitStep <= 0) scrollUnitStep = 1; verScroll.setUnitIncrement(scrollUnitStep); set_vscroll = false; } if (enable_vertical_zoom && processOverlay != null) { int plvl = getZoomProcessLevel(); processOverlay.setZoomLevel(plvl); } } // --- "state" selection via cursor // --- pan commands // internal private void panTimeTo(long start) { long duration = timeAxisCalculator.getTimeDuration(); zoomTimeToRange(start, start + duration - 1, true); } public void panProcTo(double start) { // YXXX public, hack for TL2 remap center double proc_cnt = dataAxisCalculator.getVisiblePercent(); zoomYToRange(start, start + proc_cnt, true); } private void panTimeBy(long step) { panTimeTo(timeAxisCalculator.getTimeStart() + step); } private void panProcBy(double step) { zoomHistoryAdd(); panProcTo(dataAxisCalculator.getVisibleStart() + step); } // external public void pageUp() { zoomHistoryAdd(); panProcBy(-dataAxisCalculator.getVisiblePercent()); } public void pageDown() { zoomHistoryAdd(); panProcBy(dataAxisCalculator.getVisiblePercent()); } public void panUp() { zoomHistoryAdd(); panProcBy(-dataAxisCalculator.getVisiblePercent() / LARGE_PAN_STEP_FRACTION); } public void panDown() { zoomHistoryAdd(); panProcBy(dataAxisCalculator.getVisiblePercent() / LARGE_PAN_STEP_FRACTION); } public void stepUp() { zoomHistoryAdd(); panProcBy(-dataAxisCalculator.getVisiblePercent() / SMALL_PAN_STEP_FRACTION); } public void stepDown() { zoomHistoryAdd(); panProcBy(dataAxisCalculator.getVisiblePercent() / SMALL_PAN_STEP_FRACTION); } public void pageLeft() { zoomHistoryAdd(); panTimeBy(-timeAxisCalculator.getTimeDuration()); } public void pageRight() { zoomHistoryAdd(); panTimeBy(timeAxisCalculator.getTimeDuration()); } public void panLeft() { zoomHistoryAdd(); panTimeBy(-(timeAxisCalculator.getTimeDuration() / LARGE_PAN_STEP_FRACTION + 1)); } public void panRight() { zoomHistoryAdd(); panTimeBy((timeAxisCalculator.getTimeDuration() / LARGE_PAN_STEP_FRACTION + 1)); } public void stepLeft() { zoomHistoryAdd(); panTimeBy(-(timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1)); } public void stepRight() { zoomHistoryAdd(); panTimeBy((timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1)); } private int findTimeMarkerIndex = 0; public void findTimeMarker() { if (timeCaliper == null) { return; } zoomHistoryAdd(); long newTime = timeCaliper.getTime(findTimeMarkerIndex); findTimeMarkerIndex = (findTimeMarkerIndex + 1) & 1; // zoom_time_center = newTime; // zoom_time_center_screen_percent = 0.5; // zoomTimeToDuration(timeAxisCalculator.getTimeDuration()); panLeftRightToMakeVisible(newTime, newTime); } public void setTimeMarker() { long anchor = (timeAxisCalculator.getTimeStart() + timeAxisCalculator.getTimeEnd()) / 2; caliperUtilSetTimeAndNotify(anchor, anchor); } private long limitTime(long inTime) { if (inTime < tldrawer.getAbsoluteTimeStart()) { inTime = tldrawer.getAbsoluteTimeStart(); } else if (inTime > tldrawer.getAbsoluteTimeEnd()) { inTime = tldrawer.getAbsoluteTimeEnd(); } return inTime; } private void moveTimeMarker(long delta) { if (timeCaliper == null) { return; } long newTime = limitTime(timeCaliper.getTime(1) + delta); caliperUtilSetTimeAndNotify(newTime, newTime); panLeftRightToMakeVisible(newTime, newTime); } private void moveTimeSelectionMarker(long delta) { if (timeCaliper == null) { return; } long tmp; do { tmp = timeCaliper.getTime(1); if (isTimeVisible(tmp) || // is maxxed out (tmp == tldrawer.getAbsoluteTimeStart() && tmp == timeAxisCalculator.getTimeStart()) || (tmp == tldrawer.getAbsoluteTimeEnd() && tmp == timeAxisCalculator.getTimeEnd())) { break; } tmp = timeCaliper.getTime(0); if (isTimeVisible(tmp)) { timeCaliper.swapAnchor(); // make the other the anchor break; } tmp = timeCaliper.getTime(1); } while (false); long anchor = timeCaliper.getTime(0); long newTime = limitTime(tmp + delta); caliperUtilSetTimeAndNotify(anchor, newTime); panLeftRightToMakeVisible(newTime, newTime); } public void moveTimeMarkerLeft() { long step = timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1; moveTimeMarker(-step); } public void moveTimeMarkerRight() { long step = timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1; moveTimeMarker(+step); } public void moveTimeRangeToLeft() { long step = timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1; moveTimeSelectionMarker(-step); } public void moveTimeRangeToRight() { long step = timeAxisCalculator.getTimeDuration() / SMALL_PAN_STEP_FRACTION + 1; moveTimeSelectionMarker(+step); } // --- image update utilites /* Bar heights are calculated on image initialization, process zoom, and * component resizes */ private void updateYCalc() { int canvasHeight = timelineCanvas.getHeight(); if (dataAxisCalculator.getCanvasPixels() != canvasHeight) { // must update setCanvasPixels() before calling doCompute() dataAxisCalculator.setCanvasPixels(canvasHeight); if (zoom_ypct_at_max) { // attempt to resize to full height dataAxisCalculator.setVisibleRange(0.0, 1.0); } } int avail = dataAxisCalculator.getAvailPixels(); int min_pixels = dataAxisCalculator.getMinPixelsForAllRows(); double desired_pct = dataAxisCalculator.getVisiblePercent(); int desired_min = (int) (min_pixels * desired_pct); boolean percentAdjustNeeded = false; if (!enable_vertical_zoom) { // vertical size is set externally percentAdjustNeeded = true; } else { // has local control of vertical zoom if (avail < desired_min) { // not enough canvas real estate for all procs double percentAvail = (double) avail / min_pixels; if (enable_vertical_row_snap) { int visibleProcs = (int) (tldrawer.getAbsoluteRowCount() * (percentAvail + PERCENT_TOLERANCE)); if (visibleProcs < 1) { visibleProcs = 1; } int absStartProc = 0; int absEndProc = tldrawer.getAbsoluteRowEnd(); int zoom_proc_center = dataAxisCalculator.getRowNearPercent(ypct_focus); int newStartProc = zoom_proc_center - visibleProcs / 2; if (newStartProc < absStartProc) { newStartProc = absStartProc; } int newEndProc = newStartProc + (visibleProcs - 1); if (newEndProc > absEndProc) { newEndProc = absEndProc; newStartProc = newEndProc - (visibleProcs - 1); } dataAxisCalculator.setRowRange(newStartProc, newEndProc); dataAxisCalculator.edt_revalidate(); return; } else { percentAdjustNeeded = true; } } } if (percentAdjustNeeded && min_pixels > 0) { double percentAvail = (double) avail / min_pixels; double newStartPct = ypct_focus - ypct_focus_screen_percent * percentAvail; if (newStartPct < 0.0) { newStartPct = 0.0; } double newEndPct = newStartPct + percentAvail; if (newEndPct > 1.0) { newEndPct = 1.0; newStartPct = newEndPct - percentAvail; } dataAxisCalculator.setVisibleRange(newStartPct, newEndPct); } dataAxisCalculator.edt_revalidate(); } private void updateXCalc() { int canvasWidth = timelineCanvas.getWidth(); timeAxisCalculator.setCanvasPixels(canvasWidth + 1); // +1: scrollbar acts like border timeAxisCalculator.edt_revalidate(); // set alignment } // rubberband private int rb_x1, rb_x2, rb_y1, rb_y2; private boolean rb_enable = false; private void setRubberband(int x1, int y1, int x2, int y2) { int tmp; if (x2 < x1) { tmp = x1; x1 = x2; x2 = tmp; } if (y2 < y1) { tmp = y1; y1 = y2; y2 = tmp; } rb_x1 = x1; rb_x2 = x2; rb_y1 = y1; rb_y2 = y2; rb_enable = true; } private void clearRubberband() { rb_enable = false; } private void drawRubberband(final Graphics g) { if (!rb_enable) { return; } g.setXORMode(Color.YELLOW); int w = rb_x2 - rb_x1; int h = rb_y2 - rb_y1; for (int ii = 0; ii < RUBBERBAND_WIDTH; ii++) { g.drawRect(rb_x1 + ii, rb_y1 + ii, w - 2 * ii, h - 2 * ii); } } /* This is the component where the timeline process bars and message lines * are rendered */ private class TimelineCanvas extends javax.swing.JComponent implements Accessible { private boolean firstPaint = true; public TimelineCanvas() { super(); initialize(); } private void initialize() { this.addComponentListener( new ComponentListener() { public void componentResized(ComponentEvent componentEvent) { if (dataAxisCalculator.getCanvasPixels() != timelineCanvas.getHeight()) { updateY(true); // visible proc range may change verticalRuler.repaint(); } if (timeAxisCalculator.getCanvasPixels() != timelineCanvas.getWidth() + 1) { // +1: see setCanvasPixels() updateX(false); globalRuler.repaint(); localRuler.repaint(); } repaint(); // may be redundant, tbd } public void componentMoved(ComponentEvent componentEvent) {} public void componentShown(ComponentEvent componentEvent) {} public void componentHidden(ComponentEvent componentEvent) {} }); } @Override public void setCursor(Cursor cursor) { if (super.getCursor() != cursor) { super.setCursor(cursor); // YXXX see if this is fast enough... } } // Notify timeline PaintListeners @Override public void paintComponent(Graphics g) { myPaint(g); if (timeOverlay != null) { timeOverlay.paintRuler(g); } if (enable_vertical_zoom && processOverlay != null) { processOverlay.paintRuler(g); } drawRubberband(g); } /* Get new data from the image provide and request that the state and * message drawers redraw the timeline image */ private void myPaint(Graphics g) { // javax.swing.JOptionPane.showMessageDialog(null, "Updating"); boolean notify = false; if (dataAxisCalculator.getCanvasPixels() != this.getHeight()) { return; // let componentResized handle it } if (timeAxisCalculator.getCanvasPixels() != this.getWidth() + 1) { // +1: see setCanvasPixels() return; // let componentResized handle it } if (dataAxisCalculator.isInitialized() && timeAxisCalculator.isInitialized()) { if (tldrawer.edt_fetchData(forceDataReload)) { // fetch started // notify = true; forceDataReload = false; } else { int ii = 0; // for breakpoint } } else { int ii = 0; // for breakpoint } if (visible_ypct_start != dataAxisCalculator.getVisibleStart() || visible_ypct_end != dataAxisCalculator.getVisibleEnd() || visible_time_start != timeAxisCalculator.getTimeStart() || visible_time_end != timeAxisCalculator.getTimeEnd()) { // data range change visible_ypct_start = dataAxisCalculator.getVisibleStart(); visible_ypct_end = dataAxisCalculator.getVisibleEnd(); visible_time_start = timeAxisCalculator.getTimeStart(); visible_time_end = timeAxisCalculator.getTimeEnd(); if (dataAxisCalculator.getAbsRowCount() != 0) { // YXXX should probably look at Time data too? // legit new data notify = true; } } if (firstPaint) { // YXXX some of the following may not be kosher from paintComponent()? // adjust rulers for margins int vRulerWidth = verticalRuler.getWidth(); // not known until 1st update int xMargin = timeAxisCalculator.getMargin(); // currently, static int xPaddingLo = xMargin + vRulerWidth; int vScrollWidth = verScroll.getWidth(); int xPaddingHi = xMargin + vScrollWidth; globalRuler.setPadding(xPaddingLo, xPaddingHi); localRuler.setPadding(xPaddingLo, xPaddingHi); globalRuler.lockRulerThickness(g, true); localRuler.lockRulerThickness(g, true); verticalRuler.lockRulerThickness(g, true); // repaint rulers. Why? Initially, rulers may know their range, // but not geometry, so they wouldn't have painted at the // resize event. globalRuler.repaint(); verticalRuler.repaint(); southWestSpacer.setPreferredSize(new Dimension(vRulerWidth, 0)); southEastSpacer.setPreferredSize(new Dimension(vScrollWidth, 0)); southPanel.revalidate(); firstPaint = false; } if (tldrawer.drawData(g)) { // notify = true; } if (notify) { // YXXX some of the listeners may not be kosher from paintComponent()? notifyListeners(); } } /////////////////////////// // Accessibility support // /////////////////////////// /** * Gets the AccessibleContext associated with this JPanel. For MPITimelineCanvas, the * AccessibleContext takes the form of an AccessibleMPITimelineCanvas. A new AccessibleJPanel * instance is created if necessary. * * @return an AccessibleJPanel that serves as the AccessibleContext of this JPanel */ public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleMPITimelineCanvas(); } return accessibleContext; } /** * This class implements accessibility support for the <code>MPITimelineCanvas</code> class. It * provides an implementation of the Java Accessibility API appropriate to panel user-interface * elements. */ protected class AccessibleMPITimelineCanvas extends AccessibleJComponent { /** * Get the role of this object. * * @return an instance of AccessibleRole describing the role of the object */ public AccessibleRole getAccessibleRole() { return AccessibleRole.PANEL; } } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcDataImpl.java�����������������������������0000644�0001750�0001750�00000033763�14744453367�023252� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import java.util.ArrayList; /** * Coordinate calculator for timeline rows * * <p>Coordinate systems used: * * <p>"ucoord": coordinate system to represent unscaled user rows. Zero corresponds to upper edge of * first row. "vcoord": coordinate system to represent user rows scaled to fit screen. Zero * corresponds to upper edge of first row. "canvas": coordinate system of canvas. Scrollbar and * margins are added to vcoord; */ public class CoordCalcDataImpl extends CoordCalcDataMaster { // ------- user settings ------ // --- total range of rows to be displayed private int abs_row_end = 0; // absolute end row (at full zoom out) private int abs_row_count = 0; // number of rows (at full zoom out) // --- canvas size private int canvasPixels = 0; // --- unscaled row layout (ucoord) private ArrayList<Integer> ucoord_row_tops; // row upper edge (unscaled) private ArrayList<Integer> ucoord_row_bottoms; // row lower edge (unscaled) // --- zoom range (value [0.0-1.0] corresponds to [0-ucoord_total_pixels]) private double visible_start_pct = 0.0; // visible start (% of total) private double visible_end_pct = 0.0; // visible end (% of total) private int visible_start_row; // visible start (row) private int visible_end_row; // visible start (row) // ------- computed values ------ // --- state private boolean is_initialized = false; // edt_revalidate() has been called at least once private boolean needs_compute = false; private boolean needs_vcoord_table; private int vcoord_visible_top; // vcoord offset to start of visible data private double vcoord2ucoordRatio = 1.0; // YXXX look for div/zero private boolean use_rows_for_range; // rows or percent to set range? // --- unscaled row layout (ucoord) private int ucoord_total_pixels = 1; // total size of all rows (unscaled) // --- scaled row layout (vcoord) private ArrayList<Integer> vcoord_row_tops; // row upper edge (scaled) private ArrayList<Integer> vcoord_row_bottoms; // row lower edge (scaled) private int vcoord_total_pixels = 1; // total size of all rows (scaled) // preferences private boolean expandRowsToFill = true; // expand (only at full zoom out) private final int canvasY_header = 0; // optional vertical offset private final int canvasY_margin; // space between TL and ruler public static final double HUNDRED_PERCENT_ROUNDUP = 0.999; public CoordCalcDataImpl(int canvas_margin) { canvasY_margin = canvas_margin; } // --- canvas geometry /** Sets current canvas height */ @Override public void setCanvasPixels(int visiblePixels) { if (canvasPixels != visiblePixels) { canvasPixels = visiblePixels; needs_compute = true; } } /** Gets current canvas height */ public int getCanvasPixels() { return canvasPixels; } // --- row geometry settings @Override public void edt_revalidate() { // setAbsRowMinHeight*() must be called first if (needs_compute) { calculateRowSizes(); needs_compute = false; } is_initialized = true; } /** sets variables used to calculate row height */ private void calculateRowSizes() { if (ucoord_row_tops == null) { setVcoordHeights(1.0); vcoord_visible_top = 0; needs_compute = false; return; } // calculate new scale double vdelta = getAvailPixels(); double udelta; if (use_rows_for_range) { int uy_top = ucoord_row_tops.get(visible_start_row); int uy_bottom = ucoord_row_bottoms.get(visible_end_row); udelta = uy_bottom - uy_top; } else { udelta = ucoord_total_pixels * getVisiblePercent(); } double ideal_scale = vdelta / udelta; // adjust scale if required double actual_scale; if (!expandRowsToFill && ideal_scale > 1.0) { actual_scale = 1.0; } else { if (ideal_scale < HUNDRED_PERCENT_ROUNDUP) { boolean toBigToFit = true; } actual_scale = ideal_scale; } // update the vcoord tables setVcoordHeights(actual_scale); // update vcoord_visible_top { int vy_top; if (use_rows_for_range) { vy_top = vcoord_row_tops.get(visible_start_row); } else { vy_top = (int) (vcoord_total_pixels * visible_start_pct); } vcoord_visible_top = vy_top; } needs_compute = false; } /** margins allow states along edges to be visible and accessible */ public int getMargin() { return canvasY_margin; } public boolean isInitialized() { return is_initialized; } public boolean isValid() { return !needs_compute; } // --- row range private void setAbsRowCount(int rowCount) { int end = rowCount > 0 ? rowCount - 1 : 0; if (abs_row_count != rowCount || abs_row_end != end) { abs_row_count = rowCount; abs_row_end = end; needs_vcoord_table = true; needs_compute = true; } } public int getAbsRowEnd() { return abs_row_end; } public int getAbsRowCount() { return abs_row_count; } public void setAbsRowMinHeights(ArrayList<Integer> mins) { // YXXX just set mins setAbsRowCount(mins.size()); int absRowCount = getAbsRowCount(); int total_used = 0; if (absRowCount == 0) { ucoord_row_tops = ucoord_row_bottoms = null; } else { ucoord_row_tops = new ArrayList(absRowCount); ucoord_row_bottoms = new ArrayList(absRowCount); for (int ii = 0; ii < absRowCount; ii++) { ucoord_row_tops.add(total_used); int rowHeight = mins.get(ii); total_used += rowHeight; ucoord_row_bottoms.add(total_used); } } setUcoordHeights(total_used); } public void setAbsRowMinHeights(int rowCount, int minPixels) { setAbsRowCount(rowCount); int absRowCount = getAbsRowCount(); int total_used = 0; if (absRowCount == 0) { ucoord_row_tops = ucoord_row_bottoms = null; } else { ucoord_row_tops = new ArrayList(absRowCount); ucoord_row_bottoms = new ArrayList(absRowCount); for (int ii = 0; ii < absRowCount; ii++) { ucoord_row_tops.add(total_used); total_used += minPixels; ucoord_row_bottoms.add(total_used); } } setUcoordHeights(total_used); } public void setExpandToFill(boolean expands) { expandRowsToFill = expands; } public void setRowRange(int startrow, int endrow) { if (use_rows_for_range != true || visible_start_row != startrow || visible_end_row != endrow) { use_rows_for_range = true; visible_start_row = startrow; visible_end_row = endrow; if (ucoord_row_tops == null) { visible_start_pct = 0; visible_end_pct = 0; } else { visible_start_pct = (double) ucoord_row_tops.get(startrow) / ucoord_total_pixels; visible_end_pct = (double) ucoord_row_bottoms.get(endrow) / ucoord_total_pixels; } needs_compute = true; } } public int getRowStart() { return visible_start_row; } public int getRowEnd() { return visible_end_row; } public int getRowCount() { return visible_end_row - visible_start_row + 1; } public void setVisibleRange(double start, double end) { if (use_rows_for_range != false || visible_start_pct != start || visible_end_pct != end) { use_rows_for_range = false; visible_start_pct = start; visible_end_pct = end; visible_start_row = getRowNearPercent(visible_start_pct); visible_end_row = getRowNearPercent(visible_end_pct); needs_compute = true; } } public double getVisibleStart() { return visible_start_pct; } public double getVisibleEnd() { return visible_end_pct; } public double getVisiblePercent() { return visible_end_pct - visible_start_pct; } /* --- initialize coordinate tables --- */ private void setUcoordHeights(int total_used) { // set unscaled row layout ucoord_total_pixels = total_used; if (ucoord_total_pixels < 1) { ucoord_total_pixels = 1; } needs_vcoord_table = true; visible_start_row = getRowNearPercent(visible_start_pct); visible_end_row = getRowNearPercent(visible_end_pct); needs_compute = true; } private void setVcoordHeights(double new_vcoord2ucoordRatio) { if (!needs_vcoord_table && vcoord2ucoordRatio == new_vcoord2ucoordRatio) { return; } vcoord2ucoordRatio = new_vcoord2ucoordRatio; if (ucoord_row_tops == null) { vcoord_row_tops = vcoord_row_bottoms = null; needs_vcoord_table = false; vcoord_total_pixels = 1; return; } // populate vcoord_row_* ArrayLists int absRowCount = getAbsRowCount(); vcoord_row_tops = new ArrayList(absRowCount); vcoord_row_bottoms = new ArrayList(absRowCount); int ii; int vcoord; // loop (below) ensures that top of each row is the same value // as bottom of previous row. This prevents gaps caused by rounding. int ucoord = 0; vcoord_row_tops.add(0); for (ii = 1; ii < absRowCount; ii++) { ucoord = ucoord_row_tops.get(ii); vcoord = ucoord2vcoord(ucoord, new_vcoord2ucoordRatio); vcoord_row_bottoms.add(vcoord); vcoord_row_tops.add(vcoord); } ucoord = ucoord_row_bottoms.get(absRowCount - 1); vcoord = ucoord2vcoord(ucoord, new_vcoord2ucoordRatio); vcoord_row_bottoms.add(vcoord); vcoord_total_pixels = vcoord; if (vcoord_total_pixels < 1) { vcoord_total_pixels = 1; } needs_vcoord_table = false; } private int ucoord2vcoord(int ucoord, double ratio) { double vcoord = ucoord * ratio; if (vcoord > Integer.MAX_VALUE) { vcoord = Integer.MAX_VALUE; /* overflow! */ } return (int) vcoord; } // ---------- computed values ---------- private int vcoord2canvas(int vy) { int canvasY = vy - vcoord_visible_top + (canvasY_margin + canvasY_header); return canvasY; } private int canvas2vcoord(int canvasY) { int vy = canvasY + vcoord_visible_top - (canvasY_margin + canvasY_header); return vy; } public int getAvailPixels() { int availHeight = canvasPixels - canvasY_margin * 2; if (availHeight < 1) { availHeight = 1; } return availHeight; } public int getTotalPixels() { // YXXX unused return vcoord_total_pixels; } public int getMinPixelsForAllRows() { return ucoord_total_pixels; } public int getMinPixelsRequired(int row_lo, int row_hi) { // YXXX unused if (vcoord_row_tops == null) { return 0; } int top = ucoord_row_tops.get(row_lo); int bottom = ucoord_row_tops.get(row_hi); return bottom - top; } /** Get top coordinate for the ith row */ public int getLowCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vy = vcoord_row_tops.get(yrow); int y = vcoord2canvas(vy); return y; } /** Get center coordinate for the ith row */ public int getCenterCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vyt = vcoord_row_tops.get(yrow); int vyb = vcoord_row_bottoms.get(yrow); int vy = (vyt + vyb) / 2; int y = vcoord2canvas(vy); return y; } /** Get bottom coordinate for the ith row */ public int getHighCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vy = vcoord_row_bottoms.get(yrow); int y = vcoord2canvas(vy); return y; } // will return -1 if yy is between states public int getRowAtCoord(int canvasY) { // YXXX this might no longer be needed int idx = internalCoord2Row(canvasY); if (idx >= getAbsRowCount()) { return -1; } return idx; } // always returns a valid row num public int getRowNearCoord(int canvasY) { int idx = internalCoord2Row(canvasY); int nrows = getAbsRowCount(); if (idx < 0) { return 0; } else if (idx >= nrows) { return nrows - 1; } return idx; } // always returns a valid row num private int internalCoord2Row(int canvasY) { if (vcoord_row_tops == null) { return -1; } int vy = canvas2vcoord(canvasY); if (vy < 0) { return -1; } int nrows = getAbsRowCount(); for (int ii = 0; ii < nrows; ii++) { if (vy >= vcoord_row_tops.get(ii) && vy < vcoord_row_bottoms.get(ii)) { return ii; } } return nrows; } public double getPercentNearCoord(int canvasY) { if (vcoord_row_tops == null) { return 0; } int vy = canvas2vcoord(canvasY); double percent = (double) vy / vcoord_total_pixels; return percent; } /* --- important: the following use only ucoord values --- */ public double getCenterPercentForRow(int yrow) { if (ucoord_row_tops == null) { return 0; } int uy = (ucoord_row_tops.get(yrow) + ucoord_row_bottoms.get(yrow)) / 2; double percent = (double) uy / ucoord_total_pixels; return percent; } public double getRowPercentOfTotal(int yrow) { if (ucoord_row_tops == null) { return 0; } int uy = ucoord_row_bottoms.get(yrow) - ucoord_row_tops.get(yrow); double percent = (double) uy / ucoord_total_pixels; return percent; } public int getRowNearPercent(double percent) { if (ucoord_row_tops == null) { return 0; } int uy = (int) (ucoord_total_pixels * percent); if (uy <= 0) { return 0; } int nrows = getAbsRowCount(); for (int ii = 0; ii < nrows - 1; ii++) { if (uy >= ucoord_row_tops.get(ii) && uy < ucoord_row_bottoms.get(ii)) { return ii; } } return nrows - 1; } } �������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineCursor.java��������������������������������0000644�0001750�0001750�00000014170�15044710303�022714� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; import java.awt.image.MemoryImageSource; import java.util.HashMap; import java.util.Map; /** * This class provides the cursors displayed in the timeline. * * @author Owner */ public class TimelineCursor extends Component { private final Map<Integer, Cursor> savedCursors; private final Image openHandImage; public static final int CLOSED_HAND_CURSOR = -1; public static final int OPEN_HAND_CURSOR = -2; /** Creates a new instance of HandCursor */ public TimelineCursor() { Image img; Cursor cursor; savedCursors = new HashMap<>(); img = createOpenHandImage(24, 24); openHandImage = img; img = createOpenHandImage(32, 32); cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(5, 5), "openhand"); savedCursors.put(OPEN_HAND_CURSOR, cursor); img = createClosedHandImage(32, 32); cursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(5, 5), "closedhand"); savedCursors.put(CLOSED_HAND_CURSOR, cursor); } /** Get the open hand "Grabber" cursor */ public Image getOpenHandImage() { return openHandImage; } private Image createOpenHandImage(final int curWidth, final int curHeight) { int curCol; Image img; int x, y; int pix[] = new int[curWidth * curHeight]; for (y = 0; y <= curHeight; y++) { for (x = 0; x <= curWidth; x++) { pix[y + x] = 0; // all points transparent } } // black pixels curCol = Color.black.getRGB(); int n = 0; while (open_black[n] != 0) { pix[open_black[n++] + open_black[n++] * curWidth] = curCol; } // white pixels curCol = Color.white.getRGB(); n = 0; while (open_white[n] != 0) { pix[open_white[n++] + open_white[n++] * curWidth] = curCol; } // white pixel runs n = 0; y = 9; while (open_whiteruns[n] != 0) { for (x = open_whiteruns[n++]; x < open_whiteruns[n]; x++) { pix[x + y * curWidth] = curCol; } n++; y++; } img = createImage(new MemoryImageSource(curWidth, curHeight, pix, 0, curWidth)); return img; } // hand cursor data private final int closed_black[] = { 6, 5, 7, 5, 9, 5, 10, 5, 12, 5, 13, 5, 5, 6, 8, 6, 11, 6, 14, 6, 15, 6, 5, 7, 14, 7, 16, 7, 6, 8, 16, 8, 5, 9, 6, 9, 16, 9, 4, 10, 16, 10, 4, 11, 16, 11, 4, 12, 15, 12, 5, 13, 15, 13, 6, 14, 14, 14, 7, 15, 14, 15, 7, 16, 14, 16, 0 }; private final int closed_white[] = { 6, 4, 7, 4, 9, 4, 10, 4, 12, 4, 13, 4, 5, 5, 8, 5, 11, 5, 14, 5, 15, 5, 4, 6, 6, 6, 7, 6, 9, 6, 10, 6, 12, 6, 13, 6, 16, 6, 4, 7, 15, 7, 17, 7, 5, 8, 17, 8, 4, 9, 17, 9, 3, 10, 5, 10, 15, 10, 17, 10, 3, 11, 17, 11, 3, 12, 16, 12, 4, 13, 16, 13, 5, 14, 15, 14, 6, 15, 15, 15, 6, 16, 15, 16, 7, 17, 14, 17, 0 }; private final int closed_whiteruns[] = { 6, 13, 7, 15, 7, 15, 5, 15, 5, 15, 5, 14, 6, 14, 7, 13, 8, 13, 8, 13, 0 }; private final int open_black[] = { 10, 3, 11, 3, 6, 4, 7, 4, 9, 4, 12, 4, 13, 4, 14, 4, 5, 5, 8, 5, 9, 5, 12, 5, 15, 5, 5, 6, 8, 6, 9, 6, 12, 6, 15, 6, 17, 6, 6, 7, 9, 7, 12, 7, 15, 7, 16, 7, 18, 7, 6, 8, 9, 8, 12, 8, 15, 8, 18, 8, 4, 9, 5, 9, 7, 9, 15, 9, 18, 9, 3, 10, 6, 10, 7, 10, 18, 10, 3, 11, 7, 11, 17, 11, 4, 12, 17, 12, 5, 13, 17, 13, 5, 14, 16, 14, 6, 15, 16, 15, 7, 16, 15, 16, 8, 17, 15, 17, 8, 18, 15, 18, 0 }; private final int open_white[] = { 10, 2, 11, 2, 6, 3, 7, 3, 9, 3, 12, 3, 13, 3, 5, 4, 8, 4, 10, 4, 11, 4, 15, 4, 4, 5, 6, 5, 7, 5, 10, 5, 11, 5, 13, 5, 14, 5, 16, 5, 17, 5, 4, 6, 6, 6, 7, 6, 10, 6, 11, 6, 13, 6, 14, 6, 16, 6, 18, 6, 5, 7, 7, 7, 8, 7, 10, 7, 11, 7, 13, 7, 14, 7, 17, 7, 19, 7, 4, 8, 5, 8, 7, 8, 8, 8, 10, 8, 11, 8, 13, 8, 14, 8, 16, 8, 17, 7, 19, 8, 3, 9, 6, 9, 16, 9, 17, 9, 19, 9, 2, 10, 4, 10, 5, 10, 19, 10, 2, 11, 18, 11, 3, 12, 18, 12, 4, 13, 18, 13, 4, 14, 17, 14, 5, 15, 17, 15, 6, 16, 16, 16, 7, 17, 18, 17, 7, 18, 16, 18, 8, 19, 15, 19, 0 }; private final int open_whiteruns[] = { 9, 14, 8, 17, 4, 16, 5, 16, 6, 16, 6, 15, 7, 15, 8, 14, 9, 14, 9, 14, 0 }; private Image createClosedHandImage(final int curWidth, final int curHeight) { int curCol; Image img; int x, y; int pix[] = new int[curWidth * curHeight]; for (y = 0; y <= curHeight; y++) { for (x = 0; x <= curWidth; x++) { pix[y + x] = 0; // all points transparent } } // black pixels curCol = Color.black.getRGB(); int n = 0; while (closed_black[n] != 0) { pix[closed_black[n++] + closed_black[n++] * curWidth] = curCol; } // white pixels curCol = Color.white.getRGB(); n = 0; while (closed_white[n] != 0) { pix[closed_white[n++] + closed_white[n++] * curWidth] = curCol; } // white pixel runs n = 0; y = 7; while (closed_whiteruns[n] != 0) { for (x = closed_whiteruns[n++]; x < closed_whiteruns[n]; x++) { pix[x + y * curWidth] = curCol; } n++; y++; } img = createImage(new MemoryImageSource(curWidth, curHeight, pix, 0, curWidth)); return img; } public Cursor getCursor(int id) { Cursor cursor = savedCursors.get(id); if (cursor == null) { try { cursor = new Cursor(id); } catch (IllegalArgumentException e) { cursor = new Cursor(Cursor.DEFAULT_CURSOR); } savedCursors.put(id, cursor); } return cursor; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineCaliper.java�������������������������������0000644�0001750�0001750�00000004413�14744453367�023041� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; public class TimelineCaliper { private final long time[]; // length[2], one for each caliper. [0] is anchor. private int activeIdx; // which of two calipers is dynamically changing, or -1 for none public TimelineCaliper(long time0, long time1) { this.time = new long[2]; this.time[0] = time0; this.time[1] = time1; this.activeIdx = -1; } public TimelineCaliper clone() { TimelineCaliper clone = new TimelineCaliper(time[0], time[1]); clone.activeIdx = this.activeIdx; return clone; } public int getSize() { return time.length; } public long getTime(int idx) { return time[idx]; // throws if out of bounds } public void setTime(int idx, long newTime) { time[idx] = newTime; // throws if out of bounds } public boolean isSingleEvent() { return time[0] == time[1]; } public long getLowTime() { return (time[0] < time[1]) ? time[0] : time[1]; } public long getHighTime() { return (time[0] < time[1]) ? time[1] : time[0]; } public int getActiveIdx() { return activeIdx; } public long getActiveCaliperTime() { if (activeIdx == -1) { return -1; } return time[activeIdx]; } public void setActiveIdx(int idx) { if (idx >= 0 && idx < time.length) { activeIdx = idx; } else { activeIdx = -1; } } public boolean setActiveCaliperTime(long newTime) { if (activeIdx == -1) { return false; } time[activeIdx] = newTime; return true; } public void swapAnchor() { long tmp = time[0]; time[0] = time[1]; time[1] = tmp; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineSelectionCaliperEvent.java�����������������0000644�0001750�0001750�00000001746�14744453367�025717� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; /** Holds information about timeline caliper state */ public class TimelineSelectionCaliperEvent extends TimelineSelectionGenericEvent { public final TimelineCaliper caliper; public TimelineSelectionCaliperEvent(TimelineCaliper caliper) { this.caliper = caliper.clone(); } } ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineSelectionListener.java���������������������0000644�0001750�0001750�00000002136�14744453367�025115� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; /** * TimelineSelectionListeners are notified when the selected objects in the timeline change. This * allows for the display around the timeline component to update. */ public interface TimelineSelectionListener { /** * Called by the Timeline for each TimelineSelection Listener when there is a change in selected * objects. */ public void valueChanged(TimelineSelectionGenericEvent e); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcTimeReader.java���������������������������0000644�0001750�0001750�00000002722�14744453367�023567� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; public interface CoordCalcTimeReader { // pixels public int getMargin(); public int getCanvasPixels(); public int getAvailPixels(); // pixels available for data // time public long getTimeStart(); public long getTimeEnd(); public long getTimeDuration(); // bin-related public int getNumBins(); public long getTimePerBin(); public long getTimeStartAligned(); public long getTimeStartAligned(long time); // return is >= 0 public long getTimeEndAligned(); // conversions public int getCoordAtTime(long time); public int getLowCoordForBin(int bin); public long getTimeAtCoord(int xx); // returns -1 if coord out of range public long getTimeNearCoord(int xx); // always returns a valid time public int getBinAtTime(long time); } ����������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineSelectionGenericEvent.java�����������������0000644�0001750�0001750�00000001666�14744453367�025715� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; /** * A TimelineSelectionEvent object contains pointers to the objects selected in the timeline by a * single gesture. It is assumed that one state may be selected and multiple messages. */ public class TimelineSelectionGenericEvent {} ��������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/CoordCalcTimeMaster.java���������������������������0000644�0001750�0001750�00000002142�14744453367�023614� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; public abstract class CoordCalcTimeMaster implements CoordCalcTimeReader { public abstract void setCanvasPixels(int visiblePixels); public abstract void edt_revalidate(); // must be called from event dispatch thread public abstract boolean isValid(); // must be called from event dispatch thread public abstract boolean isInitialized(); public abstract void setTimeRange(long start, long end); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineSelectionHistoryEvent.java�����������������0000644�0001750�0001750�00000001761�14744453367�025776� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; /** * @author ylmaruya */ public class TimelineSelectionHistoryEvent extends TimelineSelectionGenericEvent { public final boolean atMin; public final boolean atMax; public TimelineSelectionHistoryEvent(boolean atMin, boolean atMax) { this.atMin = atMin; this.atMax = atMax; } } ���������������gprofng-gui-2.1/org/gprofng/mpmt/timeline_common/TimelineDrawer.java��������������������������������0000644�0001750�0001750�00000005240�14744453367�022705� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline_common; import java.awt.Graphics; public interface TimelineDrawer { // consts public static final long TIME_INVALID = -1; // used by IPC public void setParent(TimelinePanel parent); // YXXX yuck, use interface // ------ get components public CoordCalcTimeMaster getTimeAxisMaster(); public CoordCalcDataMaster getDataAxisMaster(); public VerticalRowRuler getVerticalRuler(); // ------ get options public boolean getEnableZoomVertical(); public boolean getEnableZoomOverlays(); public boolean getEnableUnalignedRows(); public boolean getEnableTimeCaliper(); // ------ get X & Y max dimensions public long getAbsoluteTimeStart(); public long getAbsoluteTimeEnd(); public long getAbsoluteTimeDuration(); public int getAbsoluteRowCount(); public int getAbsoluteRowEnd(); // last valid row, or 0 if no rows. // ------ zoom public void zoomCenterSelection(); // ------ selection (cursor) public boolean selectionActive(); public long getSelectionTimeCenter(); public long getSelectionTimeStart(); public long getSelectionTimeEnd(); public double getSelectionYCenter(); public boolean getSelectionNavigationEnabled(); public void selectFirst(); public void selectLeft(); public void selectRight(); public void selectUp(); public void selectDown(); public void selectLeft(boolean ctrl, boolean shift); public void selectRight(boolean ctrl, boolean shift); public void selectUp(boolean ctrl, boolean shift); public void selectDown(boolean ctrl, boolean shift); public TimelineCaliper selectNearXY( int x, int y, boolean ctrl, boolean shift); // return TimelineCaliper only on precise hit public void notifyCaliperChange(TimelineCaliper caliper); public void notifyZoomHistoryChange(TimelineSelectionHistoryEvent e); public void addSelectionListener(TimelineSelectionListener listener); // --- fetch of data public boolean edt_fetchData(boolean forceRefetch); public boolean drawData(Graphics g); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/StatisticsView.java������������������������������������������������0000644�0001750�0001750�00000024502�15044710303�017557� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnTextIcon; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.text.DecimalFormat; import java.util.ArrayList; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.border.EtchedBorder; public final class StatisticsView extends AnDisplay implements ExportSupport, AnChangeListener { private boolean experimentAdded = false; private static final DecimalFormat statis_fmt = new DecimalFormat("0.###"); private static final Object syncFormat = new Object(); private AnTree tree; // Constructor public StatisticsView() { super(AnWindow.getInstance(), AnDisplay.DSP_Statistics, AnVariable.HELP_TabsStatistics); setAccessibility(AnLocale.getString("Statistics")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("StatisticsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: experimentAdded = true; if (selected) { computeOnAWorkerThread(); } break; case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case FILTER_CHANGING: case FILTER_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void requestFocus() { if (tree != null) { tree.requestFocus(); } } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); tree = new AnTree(AnLocale.getString("Experiments"), 1); tree.getAccessibleContext().setAccessibleName(AnLocale.getString("Experiments")); tree.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Experiments")); add(new AnJScrollPane(tree), BorderLayout.CENTER); } // Append added experiment private void addExperiment() { AnTextIcon[] exp_list; int last; exp_list = window.getExperimentList(); if (exp_list == null) { return; } // Add the extra node "<Sum across selected experiments>" if needed & // Get the last index last = tree.addExtra(AnLocale.getString("<Sum across selected experiments>")); // Add experiment into tree tree.addNodes(exp_list, last); } // Compute & update Statistics display @Override public void doCompute() { Object[] ov_data, st_data; String errstr; int size; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (experimentAdded) { addExperiment(); experimentAdded = false; } if (!computed) { // need re-compute // Get data ov_data = getStatisOverviewList(); errstr = window.getMsg(AnUtility.ERROR_MSG); if ((ov_data != null) && (errstr == null)) { st_data = getStatisList(); errstr = window.getMsg(AnUtility.ERROR_MSG); if ((st_data != null) && (errstr == null)) { size = ov_data.length; for (int i = 1; i < size; i++) { tree.setContent(i - 1, getContent(ov_data, st_data, i)); } } } showError(errstr); } tree.setSelectionRow(0); computed = true; } @Override public java.util.List<ExportSupport.ExportFormat> getSupportedExportFormats() { java.util.List<ExportSupport.ExportFormat> formats = new ArrayList<>(); // formats.add(ExportSupport.ExportFormat.TEXT); // formats.add(ExportSupport.ExportFormat.HTML); // formats.add(ExportSupport.ExportFormat.CSV); formats.add(ExportSupport.ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return true; } // Set container for one experiment element private JPanel getContent(Object[] ov_data, Object[] st_data, int index) { JPanel panel, inter_panel; AnList ov_list, st_list; inter_panel = new JPanel(); inter_panel.setLayout(new BoxLayout(inter_panel, BoxLayout.X_AXIS)); // Overview panel ov_list = processOVData(ov_data, index); ov_list.getAccessibleContext().setAccessibleName(AnLocale.getString("Overview")); ov_list.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Overview")); ov_list.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); inter_panel.add(ov_list); inter_panel.add(Box.createHorizontalStrut(4)); // Statistics panel st_list = processSTData(st_data, index); st_list.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); inter_panel.add(st_list); st_list.getAccessibleContext().setAccessibleName(AnLocale.getString("Statistics")); st_list.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Statistics")); panel = new JPanel(new BorderLayout(2, 2)); panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); panel.add( AnUtility.getHeader(AnLocale.getString("Execution statistics for entire program:")), BorderLayout.NORTH); panel.add(inter_panel, BorderLayout.CENTER); return panel; } // Process Overview data private static AnList processOVData(Object[] data, int index) { AnList ov_list; String[] label; double[] value; int size, columns; int i; double total; AnDouble dvalue; String dstr; // Compute overview data ov_list = new AnList(false); label = (String[]) data[0]; value = (double[]) data[index]; size = label.length; // Get total total = 0.0; for (i = 5; i < size; i++) { total += value[i]; } columns = (new AnDouble(total)).toString().length() + AnDouble.quote_space.length(); // Write Overview header for (i = 0; i < 5; i++) { dvalue = new AnDouble(value[i]); dstr = (dvalue.doubleValue() < 0.0) ? AnLocale.getString("N/A") : dvalue.toString(); if (label[i].equals(AnLocale.getString("Total LWP Time (sec.)"))) { total = dvalue.doubleValue(); } ov_list.add( AnUtility.getItem(label[i] + ":"), AnUtility.getNumber(dstr + AnDouble.quote_space, columns)); } // Write Overview values ov_list.add((JComponent) null, (JComponent) null); ov_list.add(AnUtility.getItem(AnLocale.getString("Process Times (sec.):")), null); for (i = 5; i < size; i++) { double percent = total == 0.0 ? total : (value[i] / total) * 100; ov_list.add( AnUtility.getItem(label[i] + ":"), AnUtility.getNumber((new AnDouble(value[i])).toPercentQuote(percent), columns)); } return ov_list; } // Process Statistics data private static AnList processSTData(Object[] data, int index) { AnList st_list; String[] label; String[] value_str; double[] value; int size, len, columns; int i; // Write statistics data st_list = new AnList(false); label = (String[]) data[0]; value = (double[]) data[index]; size = label.length; value_str = new String[size]; columns = 0; for (i = 0; i < size; i++) { synchronized (syncFormat) { // begin critical section: format is not thread safe value_str[i] = statis_fmt.format(value[i]); } // end of critical section len = value_str[i].length(); if (columns < len) { columns = len; } } for (i = 0; i < size; i++) { st_list.add(AnUtility.getItem(label[i] + ":"), AnUtility.getNumber(value_str[i], columns)); } return st_list; } // Native methods from liber_dbe.so private Object[] getStatisOverviewList() { synchronized (IPC.lock) { window.IPC().send("getStatisOverviewList"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } private Object[] getStatisList() { synchronized (IPC.lock) { window.IPC().send("getStatisList"); window.IPC().send(0); return (Object[]) window.IPC().recvObject(); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnShellCommand.java������������������������������������������������0000644�0001750�0001750�00000013115�14744453367�017441� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; /** * Class ShellCommand executes an external program and supports input/output functions * * <p>Main functions: run a program write to stdin read from stdout read from stderr return exit * status */ class AnShellCommand { private BufferedReader processOutput; private BufferedReader processError; private PrintStream processInput; private Runtime rt; protected boolean interrupted; protected Process thisProcess; protected String shArgs; protected String errors; protected String output; protected String remoteConnection; // NM protected static ByteArrayOutputStream lastOutput; /** Creates a new instance of ShellCommand */ public AnShellCommand() { processOutput = null; processError = null; thisProcess = null; rt = Runtime.getRuntime(); interrupted = false; shArgs = null; errors = ""; output = ""; } /** * Set the remote connection * * @param args - connection */ public void setRemoteConnection(String args) { if (null == args) { remoteConnection = null; return; } remoteConnection = new String(args); } /** * Set the arguments * * @param args - arguments */ public void setShellArgs(String args) { shArgs = new String(args); } /** Interrupt and destroy the process */ public void interrupt() { interrupted = true; thisProcess.destroy(); thisProcess = null; } /** Return exit status */ public int exitValue() { if (interrupted) { return (-1); } try { thisProcess.waitFor(); } catch (Exception e) { return (-2); } return (thisProcess.exitValue()); } /** Check if the process is running */ public boolean isRunning() { try { int ev = thisProcess.exitValue(); } catch (IllegalThreadStateException ie) { return (true); } catch (Exception ie) { return (false); } return (false); } /** * Read from a stream * * @param reader - a stream */ private String readStream(BufferedReader reader) throws Exception { String ret = null; try { if (!reader.ready()) { int ev = thisProcess.exitValue(); ret = reader.readLine(); if (ret != null) { ret += "\n"; } return (ret); } ret = reader.readLine(); if (ret != null) { ret += "\n"; } } catch (IllegalThreadStateException ie) { return (""); } return (ret); } /** * Read from standard output stream * * @param shouldWait - a flag (if true, wait while read is done) */ public String readOutput(boolean shouldWait) throws Exception { String ret; if (shouldWait) { ret = processOutput.readLine(); } else { ret = readStream(processOutput); } if (ret != null) { output += ret; } return (ret); } /** * Read from standard error stream * * @param shouldWait - a flag (if true, wait while read is done) */ public String readError(boolean shouldWait) throws Exception { String ret; if (shouldWait) { ret = processError.readLine(); } else { ret = readStream(processError); } return (ret); } /** * Write to standard input stream * * @param str - a message */ public void writeInput(String str) throws Exception { processInput.print(str); processInput.flush(); } /** * Run a program * * @param dirname - working directory * @param cmnd - command line */ public void run(String dirname, String cmnd) throws Exception { if (null != dirname) { cmnd = "cd " + dirname + " && " + cmnd; } run(cmnd); } /** * Run a program * * @param cmnd - command line */ public void run(String cmnd) throws Exception { String[] ss = new String[3]; ss[0] = "sh"; // NM ss[0] = "/bin/sh"; if (shArgs == null) { ss[1] = new String("-ec"); } else { ss[1] = new String(shArgs); } // ss[2] = new String(cmnd + " 2>&1"); if (null != remoteConnection) { cmnd = remoteConnection + " ' " + cmnd + " '"; } ss[2] = new String(cmnd); interrupted = false; try { // System.err.println("DEBUG: rt.exec(): sh -ce "+cmnd); // DEBUG (perf test) thisProcess = rt.exec(ss); InputStream os = thisProcess.getInputStream(); InputStream os_err = thisProcess.getErrorStream(); OutputStream is = thisProcess.getOutputStream(); processOutput = new BufferedReader(new InputStreamReader(os)); processError = new BufferedReader(new InputStreamReader(os_err)); processInput = new PrintStream(is, true); } catch (Exception ee) { String msg = "Command \"" + cmnd + "\" failed:\n" + ee.toString(); throw new Exception(msg); } return; } } /* End of class AnShellCommand */ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CannotFindFilePanel.java�������������������������������������������0000644�0001750�0001750�00000007142�14744453367�020422� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; public class CannotFindFilePanel extends javax.swing.JPanel { private final String path; private final String msg; private final long obj_id; public CannotFindFilePanel(final String msg, final String path, long obj_id) { this.path = path; this.msg = msg; this.obj_id = obj_id; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); textLabel.setText(msg); resolveButton.setText(AnLocale.getString("Resolve")); resolveButton.setMnemonic(AnLocale.getString('R', "resolve_button")); resolveButton.setToolTipText(AnLocale.getString(("Resolve missing source file"))); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; textLabel = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); resolveButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); textLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; add(textLabel, gridBagConstraints); pathTextField.setEditable(false); pathTextField.setBorder(null); pathTextField.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(pathTextField, gridBagConstraints); resolveButton.setText("jButton1"); resolveButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resolveButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(resolveButton, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void resolveButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_resolveButtonActionPerformed ResolveFilePathDialog resolveFilePathDialog = new ResolveFilePathDialog(AnWindow.getInstance().getFrame(), path, obj_id); resolveFilePathDialog.setVisible(true); } // GEN-LAST:event_resolveButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField pathTextField; private javax.swing.JButton resolveButton; private javax.swing.JLabel textLabel; // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015301� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterParser.java�������������������������������������������0000644�0001750�0001750�00000010300�15044710303�020450� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import java.util.ArrayList; import java.util.List; import java.util.Stack; import java.util.StringTokenizer; /** * @author thp */ public class FilterParser { public enum Type { INT, DASH, COMMA }; private String filter = null; private String filterId = null; public FilterParser(String filter, String filterId) { this.filter = filter; this.filterId = filterId; } public String go() { Stack<Elem> stack = new Stack<Elem>(); Elem save = null; List<Elem> commas = new ArrayList<>(); if (filter == null) { return null; } if (filter.equals("all")) { return ""; } StringTokenizer tokenizer = new StringTokenizer(filter, "-,", true); while (tokenizer.hasMoreTokens()) { String tok = tokenizer.nextToken().trim(); // System.out.println("tok=" + tok); Elem elem; if (tok.equals("-")) { elem = new Elem(Type.DASH); } else if (tok.equals(",")) { elem = new Elem(Type.COMMA); } else { try { int val = new Integer(tok).intValue(); elem = new Elem(val); } catch (NumberFormatException e) { return null; } } if (elem.getType() == Type.INT) { if (save != null) { stack.push(elem); stack.push(save); save = null; } else { stack.push(elem); } } else if (elem.getType() == Type.DASH) { if (save != null || stack.peek() == null) { return null; // Error } save = elem; } else if (elem.getType() == Type.COMMA) { if (save != null || stack.peek() == null) { return null; // Error } commas.add(elem); // save = elem; } } for (Elem com : commas) { stack.push(com); } return generateFilter(stack); } private String generateFilter(Stack<Elem> stack) { if (stack.empty()) { return ""; } Elem elem = stack.pop(); if (elem.getType() == Type.INT) { return "(" + filterId + "==" + elem.getVal() + ")"; } else if (elem.getType() == Type.DASH) { Elem elem1 = stack.pop(); Elem elem2 = stack.pop(); return "(" + filterId + ">=" + elem2.getVal() + " && " + filterId + "<=" + elem1.getVal() + ")"; } else if (elem.getType() == Type.COMMA) { String filter1 = generateFilter(stack); String filter2 = generateFilter(stack); return "(" + filter2 + " || " + filter1 + ")"; } else { assert false; } return null; // Error } class Elem { private Type type; private int val; public Elem(int val) { this.type = Type.INT; this.val = val; } public Elem(Type type) { this.type = type; this.val = 0; } /** * @return the type */ public Type getType() { return type; } /** * @return the val */ public int getVal() { return val; } } /** * @param args the command line arguments */ public static void main(String[] args) { String in; String out; test("34-38", "Samples"); test("12,23", "Samples"); test("1,2,3", "Samples"); test("1,2-3", "Samples"); test("34-38, 12, 23", "Samples"); } private static void test(String filter, String filterId) { String res = new FilterParser(filter, filterId).go(); System.out.println(filter + "========>" + res); System.out.println(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterNavigationPanel.java����������������������������������0000644�0001750�0001750�00000004466�14744453367�022337� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnWindow; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.JPanel; public class FilterNavigationPanel extends JPanel { /** Creates new form FilterNavigationPanel */ public FilterNavigationPanel(AnWindow anWindow) { initComponents(); setBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); setMinimumSize(new Dimension(0, 70)); FilterStatusPanel filterStatusPanel = new FilterStatusPanel(anWindow); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(filterStatusPanel, gridBagConstraints); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.BorderLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/CustomPanel.java��������������������������������������������0000644�0001750�0001750�00000015103�14744453367�020332� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; /** * @author thp */ public class CustomPanel extends JPanel { private CustomFilterDialog customFilterDialog; private CustomEditPanel customEditPanel = null; private boolean changed = false; /** Creates new form ExperimentsPanel */ public CustomPanel(Filters filter, CustomFilterDialog customFilterDialog) { this.customFilterDialog = customFilterDialog; initComponents(); String commentText = AnLocale.getString( "The Filter Specification text box initially displays filter expressions that are" + " generated when you select predefined filters in views such as the Functions" + " view. You can customize the Filter Specification by editing the filter text" + " directly."); String commentText21 = AnLocale.getString("To filter using your customizations, click OK."); commentTextArea.setText(commentText); commentTextArea.setOpaque(false); commentTextArea.setBackground(AnEnvironment.INVISIBLE_BACKGROUND); commentTextArea2.setText(commentText21); commentTextArea2.setOpaque(false); commentTextArea2.setBackground(AnEnvironment.INVISIBLE_BACKGROUND); customEditPanel = new CustomEditPanel(filter); customEditPanel.getTextPane().getDocument().addDocumentListener(new TextDocumentListner()); editPanel.add(customEditPanel, BorderLayout.CENTER); getAccessibleContext() .setAccessibleName( AnLocale.getString("Custom filter settings", "ACCESSIBILITY_Custom_Panel")); getAccessibleContext() .setAccessibleDescription( AnLocale.getString("Custom filter settings", "ACCESSIBILITY_Custom_Panel")); commentTextArea .getAccessibleContext() .setAccessibleName(AnLocale.getString("Guidance", "ACCESSIBILITY_GUIDANCE")); commentTextArea .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Guidance", "ACCESSIBILITY_GUIDANCE")); commentTextArea2 .getAccessibleContext() .setAccessibleName(AnLocale.getString("Guidance", "ACCESSIBILITY_GUIDANCE")); commentTextArea2 .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Guidance", "ACCESSIBILITY_GUIDANCE")); } class TextDocumentListner implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) {} @Override public void insertUpdate(DocumentEvent e) { changed = true; customFilterDialog.updateButtonStates(); } @Override public void removeUpdate(DocumentEvent e) { changed = true; customFilterDialog.updateButtonStates(); } } public boolean hasChanges() { return changed; } public boolean hasBeenChanged() { return customEditPanel.getTextPane().getText().length() > 0; } public void resetToFactorySetting() { customEditPanel.resetToFactorySetting(); } public void addText(String text) { customEditPanel.addText(text); } public void apply() { customEditPanel.apply(); changed = false; } public void undoToLastApply() { customEditPanel.undoToLastApply(); changed = false; } public void setFilter(String filter) { customEditPanel.setFilter(filter); changed = false; customFilterDialog.updateButtonStates(); } public String getFilter() { String filter = customEditPanel.getTextPane().getText(); return filter; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; commentTextArea = new javax.swing.JTextArea(); editPanel = new javax.swing.JPanel(); commentTextArea2 = new javax.swing.JTextArea(); setLayout(new java.awt.GridBagLayout()); commentTextArea.setEditable(false); commentTextArea.setLineWrap(true); commentTextArea.setWrapStyleWord(true); commentTextArea.setBorder(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; add(commentTextArea, gridBagConstraints); editPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(editPanel, gridBagConstraints); commentTextArea2.setEditable(false); commentTextArea2.setLineWrap(true); commentTextArea2.setWrapStyleWord(true); commentTextArea2.setBorder(null); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(commentTextArea2, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextArea commentTextArea; private javax.swing.JTextArea commentTextArea2; private javax.swing.JPanel editPanel; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterStatusPanel.form��������������������������������������0000644�0001750�0001750�00000005243�14744453367�021537� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="filterLabel"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/Filters.java������������������������������������������������0000644�0001750�0001750�00000030525�15044710303�017471� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.ipc.IPCCancelledException; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Stack; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; public final class Filters { private static Filters instance = null; private Frame frame; private AnWindow window; private CustomFilterDialog customFilterDialog; // States private Stack<FilterClause> clausesStack = new Stack<FilterClause>(); private Stack<FilterClause> clausesUndoStack = new Stack<FilterClause>(); private Stack<FilterClause> clausesRedoStack = new Stack<FilterClause>(); // Listeners private List<ChangeListener> changeListeners = new ArrayList<>(); // Constructor public Filters(final AnWindow window, final Frame frame) { this.window = window; this.frame = frame; instance = this; } public static Filters getInstance() { return instance; } public CustomFilterDialog getCustomFilterDialog() { if (customFilterDialog == null) { customFilterDialog = new CustomFilterDialog(frame, window); } return customFilterDialog; } public void showCustomFilterDialog() { getCustomFilterDialog().setFilter(getStandardFilters(true)); getCustomFilterDialog().setVisible(true); } private void invalidFilterDialog(String filter) { String filterTxt = filter; if (filter.length() > 200) { filterTxt = filter.subSequence(0, 199) + "..."; } String errmsg = AnLocale.getString("Invalid filter:") + "\n" + filterTxt; AnUtility.showMessage(frame, errmsg, JOptionPane.ERROR_MESSAGE); } protected String trim(String filter) { filter = filter.replaceAll("//.*\n", " "); filter = filter.replaceAll("\n", " "); filter = filter.replaceAll(" +", " "); filter = filter.trim(); return filter; } /** Reset All filters from context menus */ public void resetAllFiltersAction() { // System.out.println("Filters:resetAllFiltersAction"); if (!isFactorySetting()) { clausesStack.removeAllElements(); clausesUndoStack.removeAllElements(); clausesRedoStack.removeAllElements(); apply(false); } } /** * Returns whether the current state of filters are the default (factory setting) * * @return true if filter state is default (factory setting) */ private boolean isFactorySetting() { boolean val; val = clausesStack.isEmpty() && clausesUndoStack.isEmpty() && clausesRedoStack.isEmpty(); return val; } public List<FilterClause> getFilters() { List<FilterClause> list1 = new ArrayList<>(); Iterator<FilterClause> iterator = clausesStack.iterator(); while (iterator.hasNext()) { FilterClause clause = iterator.next(); if (clause.isEnabled()) { if (clause.isStandardFilter()) { list1.add(clause); } else if (clause.isCustomFilter()) { list1 = new ArrayList<>(); // reset list list1.add(clause); } else if (clause.isNoFiltersFilter()) { list1 = new ArrayList<>(); // reset list } else { assert true; } } } List<FilterClause> list2 = new ArrayList<>(); for (int n = list1.size() - 1; n >= 0; n--) { list2.add(list1.get(n)); } return list2; } public boolean anyFilters() { return !getFilters().isEmpty(); } public void removeClause(FilterClause clause) { // int i = clausesUndoStack.search(clause); // if (i > 0) { // clausesUndoStack.remove(clausesUndoStack.size() - i); // } clause.setEnabled(false); clausesUndoStack.push(clause); apply(false); } /** Undoes the last filter operation back to last applied */ public void undoLastFilteraction() { if (clausesUndoStack.size() > 0) { FilterClause clause = clausesUndoStack.pop(); clause.setEnabled(!clause.isEnabled()); clausesRedoStack.push(clause); } apply(false); } /** * Returns whether there are any filters to undo * * @return true if there are more filters to undo */ public boolean canUndoLastFilter() { return clausesUndoStack.size() > 0; } /** Undoes the last filter operation back to last applied */ public void redoLastFilteraction() { if (clausesRedoStack.size() > 0) { FilterClause clause = clausesRedoStack.pop(); clause.setEnabled(!clause.isEnabled()); clausesUndoStack.push(clause); } apply(false); } /** * Returns whether there are any filters to redo * * @return true if there are more filters to redo */ public boolean canRedoLastFilter() { // return redoFilters.size() > 0; return clausesRedoStack.size() > 0; } public boolean canRemoveAllFilters() { return !getFilters().isEmpty(); } private String getStandardFilters(boolean insertNL) { StringBuilder sb = new StringBuilder(); List<FilterClause> enabledFilters = new ArrayList<>(); for (FilterClause clause : clausesStack) { if (clause.isEnabled()) { if (clause.isStandardFilter()) { enabledFilters.add(clause); } else if (clause.isCustomFilter()) { enabledFilters = new ArrayList<>(); // reset list enabledFilters.add(clause); } else if (clause.isNoFiltersFilter()) { enabledFilters = new ArrayList<>(); // reset list } else { assert true; } } } int n = 0; for (FilterClause fcl : enabledFilters) { if (fcl.isEnabled()) { sb.append(fcl.getClause()); if (!fcl.isCustomFilter() && insertNL) { sb.append(" // "); sb.append(fcl.getShortNameWithSerialNumber()); sb.append("\n"); } if (n < (enabledFilters.size() - 1)) { if (!fcl.isCustomFilter() && insertNL) { sb.append("&&\n"); } else { sb.append(" && "); } } } n++; } return sb.toString(); } protected void apply(final boolean showTooltip) { if (SwingUtilities.isEventDispatchThread()) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { setFilter(showTooltip); } }, "Filter Worker Thread"); } else { setFilter(showTooltip); } } /** Construct a complete filter based on settings in all three panels and apply */ private void setFilter(boolean showTooltip) { AnUtility.checkIfOnAWTThread(false); String filterString = trim(getStandardFilters(false)); if (filterString.length() == 0) { filterString = "1"; } boolean valid = validateFilterExpression(filterString); // IPC if (!valid) { invalidFilterDialog(filterString); return; } // Apply the filter setFilter(filterString.toString().replace("\n", " "), showTooltip); return; } /** * Set filter * * @param filtertext * @param showTooltip */ private void setFilter(final String filtertext, final boolean showTooltip) { AnUtility.checkIfOnAWTThread(false); if (System.getenv("SP_ANALYZER_DUMP_FILTER") != null) { System.err.println("setFilterStr: w_id=" + 0 + " filtertext='" + filtertext + "'"); } synchronized (AnVariable.mainFlowLock) { IPCContext.newCurrentContext( AnLocale.getString("Setting filter..."), IPCContext.Scope.SESSION, false, AnWindow.getInstance()); Object progressBarHandle = AnWindow.getInstance() .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Setting Filter")); String msg = null; try { msg = setFilterStr(0, filtertext); // IPC } catch (IPCCancelledException ex) { System.out.println("\nfilter cancelled..."); } final String message = msg; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (message != null) { // Filter setting failed String errmsg = AnLocale.getString("Error: ") + message; AnUtility.showMessage(frame, errmsg, JOptionPane.ERROR_MESSAGE); } else { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(showTooltip, AnChangeEvent.Type.FILTER_CHANGING)); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(showTooltip, AnChangeEvent.Type.FILTER_CHANGED)); } } }); AnWindow.getInstance().getSystemProgressPanel().progressBarStop(progressBarHandle); IPCContext.newCurrentContext(null, IPCContext.Scope.SESSION, false, AnWindow.getInstance()); } } /** * Setting clause * * @param clause the filter clause */ public void addClause( String shortName, String longName, String clauseText, FilterClause.Kind kind) { if (clauseText == null) { return; } // System.out.println("FilterSelector:setClause: " + clause); FilterClause cl = new FilterClause(shortName, longName, clauseText, kind); addClause(cl, true); } public void addClause(FilterClause cl, boolean showTooltip) { clausesStack.push(cl); clausesUndoStack.push(cl); clausesRedoStack.removeAllElements(); apply(showTooltip); } public JMenu removeFilterMenuItem() { JMenu removeMenu = new JMenu(AnLocale.getString("Remove Filter")); List<FilterClause> filters = getFilters(); for (FilterClause filterClause : filters) { JMenuItem mi = new JMenuItem(); mi.setText(filterClause.getShortNameWithSerialNumber()); removeMenu.add(mi); final FilterClause fc = filterClause; mi.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeClause(fc); } }); } return removeMenu; } private String setFilterStr(final int win_id, final String filter) { synchronized (IPC.lock) { window.IPC().send("setFilterStr"); window.IPC().send(win_id); window.IPC().send(filter); String s = window.IPC().recvString(); lastFilterStr = null; lastFilterStr = getFilterStr(win_id); // Optimization return s; } } private static String lastFilterStr = null; // Optimization. Important for context menu. public String getFilterStr(final int win_id) { if (null != lastFilterStr) { return lastFilterStr; // Optimization } synchronized (IPC.lock) { window.IPC().send("getFilterStr"); window.IPC().send(win_id); lastFilterStr = window.IPC().recvString(); // Optimization return lastFilterStr; } } public boolean validateFilterExpression(final String str_expr) { synchronized (IPC.lock) { window.IPC().send("validateFilterExpression"); window.IPC().send(str_expr); int val = window.IPC().recvInt(); return val != 0; } } public Object[] getFilterKeywords() { synchronized (IPC.lock) { window.IPC().send("getFilterKeywords"); window.IPC().send(0); Object[] obj = (Object[]) window.IPC().recvObject(); return obj; } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterTextField.java����������������������������������������0000644�0001750�0001750�00000014114�14744453367�021137� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.ActionTextField; import org.gprofng.mpmt.util.gui.ToolTipPopup; import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; /** * @author tpreisle */ public class FilterTextField extends ActionTextField { private Color background; private FilterClause clause; private Filters filter; private ToolTipPopup tooltipPopup = null; public FilterTextField(Filters filter, Color background, FilterClause clause) { this.filter = filter; this.background = background; this.clause = clause; setForeground(AnEnvironment.FILTER_FOREGROUND_COLOR); setBackground(background); setFont(getFont().deriveFont(Font.BOLD)); setBorder(null); setEditable(false); setActionToolTipText(AnLocale.getString("Remove this filter")); String clauseTT = clause.getClause(); if (clauseTT.length() > 100) { clauseTT = clauseTT.substring(0, 100) + "..."; } setToolTipText( "<html><b>" + (clause.getLongName() != null ? clause.getLongName() : "???") + "</b>" + ": " + clauseTT + "</html>"); } @Override public void paint(Graphics g) { if (focused) { setBackground(AnEnvironment.FILTER_BACKGROUND_SELECTED_COLOR); } else { setBackground(background); } super.paint(g); } // @Override @Override public void mouseClicked(MouseEvent me) { if (me.getButton() == MouseEvent.BUTTON3) { showContextMenu(FilterTextField.this, me.getPoint().x + 5, me.getPoint().y + 5); } } // @Override @Override public void mouseExited(MouseEvent me) { super.mouseExited(me); hideTooltipPopup(); } // @Override @Override public void mouseReleased(MouseEvent me) { super.mouseReleased(me); if (!me.isConsumed()) { showTooltipPopup(); } } private void showTooltipPopup() { if (tooltipPopup != null) { return; } JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); Font font = getFont().deriveFont(Font.PLAIN); int gridy = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; JLabel label1 = new JLabel(); label1.setFont(label1.getFont().deriveFont(Font.BOLD)); String viewName = clause.getViewName(); if (viewName != null) { label1.setText(viewName + ": " + clause.getLongName()); } else { label1.setText(clause.getLongName()); } label1.setForeground(AnEnvironment.FILTER_FOREGROUND_COLOR); gridBagConstraints.gridy = gridy++; gridBagConstraints.insets = new Insets(0, 0, 0, 0); panel.add(label1, gridBagConstraints); JLabel label2 = new JLabel(); label2.setFont(font); label2.setText(AnLocale.getString("Expression: ") + clause.getClause(110)); label2.setForeground(AnEnvironment.TOOLTIP_POPUP_FOREGROUND_COLOR); gridBagConstraints.gridy = gridy++; gridBagConstraints.insets = new Insets(4, 0, 0, 0); panel.add(label2, gridBagConstraints); tooltipPopup = new ToolTipPopup(this, panel, ToolTipPopup.Location.EAST, false); tooltipPopup.show(); } private void hideTooltipPopup() { if (tooltipPopup != null) { tooltipPopup.hide(); tooltipPopup = null; } } protected void showTooltipPopupAdded() { JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); int gridx = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; JLabel label0 = new JLabel(); label0.setText(AnLocale.getString("New filter added:")); label0.setForeground(AnEnvironment.TOOLTIP_POPUP_FOREGROUND_COLOR); label0.setFont(label0.getFont().deriveFont(Font.BOLD)); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 0, 0, 0); panel.add(label0, gridBagConstraints); JLabel label1 = new JLabel(); label1.setFont(label1.getFont().deriveFont(Font.BOLD)); label1.setText(clause.getShortName()); label1.setForeground(AnEnvironment.FILTER_FOREGROUND_COLOR); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 4, 0, 0); panel.add(label1, gridBagConstraints); ToolTipPopup toolTipPopup = new ToolTipPopup(this, panel, ToolTipPopup.Location.EAST, true); toolTipPopup.show(0, 3000); } protected void removeButtonActionPerformed(java.awt.event.ActionEvent evt) { filter.removeClause(clause); hideTooltipPopup(); } private void showContextMenu(Component component, int x, int y) { JPopupMenu popup = new JPopupMenu(); JMenuItem removeItem = new JMenuItem(AnLocale.getString("Remove this filter")); popup.add(removeItem); removeItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeButtonActionPerformed(null); } }); popup.show(component, x, y); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/CustomPanel.form��������������������������������������������0000644�0001750�0001750�00000011036�14744453367�020355� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,48,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JTextArea" name="commentTextArea"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="lineWrap" type="boolean" value="true"/> <Property name="wrapStyleWord" type="boolean" value="true"/> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="editPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> <Component class="javax.swing.JTextArea" name="commentTextArea2"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="lineWrap" type="boolean" value="true"/> <Property name="wrapStyleWord" type="boolean" value="true"/> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="25" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/UndoFilterAction.java���������������������������������������0000644�0001750�0001750�00000002366�14744453367�021320� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JMenuItem; /** * @author tpreisle */ public class UndoFilterAction extends AbstractAction { public JMenuItem jmi = null; public UndoFilterAction() { super(AnLocale.getString("Undo Filter Action") /*, AnUtility.back_filt_icon*/); } @Override public void actionPerformed(ActionEvent ev) { AnWindow anWindow = AnWindow.getInstance(); anWindow.getFilters().undoLastFilteraction(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterNavigationPanel.form����������������������������������0000644�0001750�0001750�00000003746�14744453367�022361� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Form> ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/CustomFilterAction.java�������������������������������������0000644�0001750�0001750�00000002471�14744453367�021662� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JMenuItem; /** * @author tpreisle */ public class CustomFilterAction extends AbstractAction { public JMenuItem jmi = null; public CustomFilterAction() { super(AnLocale.getString("Add Filter: Advanced Custom Filter...")); } public CustomFilterAction(String name) { super(AnLocale.getString(name)); } public void actionPerformed(ActionEvent ev) { AnWindow anWindow = AnWindow.getInstance(); anWindow.getFilters().showCustomFilterDialog(); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterClause.java�������������������������������������������0000644�0001750�0001750�00000005570�14744453367�020471� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; /** * @author tpreisle */ public class FilterClause { public enum Kind { STANDARD, CUSTOM, NO_FILTERS }; private static int serialNumberCounter = 1; private String shortName; private String longName; private String clause; private boolean enabled; private Kind kind; private int serialNumber = 0; public FilterClause(String shortName, String longName, String clause, FilterClause.Kind kind) { this.shortName = shortName; this.longName = longName; this.clause = clause; this.enabled = true; this.kind = kind; if (kind != Kind.NO_FILTERS) { this.serialNumber = serialNumberCounter++; } } public static FilterClause getNoFiltersClause() { return new FilterClause(null, null, "1", Kind.NO_FILTERS); } /** * @return the kind */ public Kind getKind() { return kind; } /** * @return the displayName */ public String getShortName() { return shortName; } /** * @return the displayName */ public String getShortNameWithSerialNumber() { return serialNumber + ": " + shortName; } public String getViewName() { String viewName = null; if (getShortName() != null) { int i = getShortName().indexOf(':'); if (i > 0) { viewName = getShortName().substring(0, i); } } return viewName; } /** * @return the clause */ public String getClause() { return clause; } public String getClause(int maxCharacters) { String shortClause = getClause(); if (clause.length() > maxCharacters) { shortClause = shortClause.substring(0, maxCharacters) + "..."; } return shortClause; } /** * @return the enabled */ public boolean isEnabled() { return enabled; } public boolean isStandardFilter() { return getKind() == Kind.STANDARD; } public boolean isCustomFilter() { return getKind() == Kind.CUSTOM; } public boolean isNoFiltersFilter() { return getKind() == Kind.NO_FILTERS; } /** * @param enabled the enabled to set */ public void setEnabled(boolean enabled) { this.enabled = enabled; } /** * @return the longName */ public String getLongName() { return longName; } } ����������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/CustomFilterDialog.java�������������������������������������0000644�0001750�0001750�00000010742�14744453367�021644� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dialog; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * @author tpreisle */ public class CustomFilterDialog extends AnDialog { private Frame frame; private AnWindow window; private JPanel mainPanel; private CustomPanel customPanel; private static int customFilterNumber = 1; public CustomFilterDialog(Frame frame, AnWindow window) { super( window, frame, AnLocale.getString("Advanced Custom Filter"), false, null, null, AnVariable.HELP_Filter); this.window = window; setModalityType(Dialog.ModalityType.APPLICATION_MODAL); customPanel = new CustomPanel(window.getFilters(), this); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Custom Filter")); mainPanel.getAccessibleContext().setAccessibleName(AnLocale.getString("Custom Filter")); mainPanel.add(customPanel, BorderLayout.CENTER); mainPanel.setPreferredSize(new Dimension(700, 500)); setAccessory(mainPanel); updateButtonStates(); close.setText(AnLocale.getString("Cancel")); // close.setMnemonic(AnLocale.getString('C', "MNEM_DIALOG_CANCEL")); apply.setVisible(false); } public void setFilter(String filters) { customPanel.setFilter(filters); } public String getFilter() { return customPanel.getFilter(); } @Override public void setVisible(boolean val) { super.setVisible(val); updateButtonStates(); } @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("Cancel", "FILTER_DATA_CANCEL"))) { setVisible(false); } else if (cmd.equals(AnLocale.getString("OK", "FILTER_DATA_OK"))) { createCustomFilterFromDialog(); } } @Override protected boolean vetoClose() { return true; } protected final void updateButtonStates() { boolean hasChanges = customPanel.hasChanges(); ok.setEnabled(hasChanges); } private void createCustomFilterFromDialog() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { String customFilter = getFilter(); if (customFilter.length() > 0) { if (!window .getFilters() .validateFilterExpression(window.getFilters().trim(customFilter))) { // IPC invalidFilterDialog(customFilter); return; } } window .getFilters() .addClause( AnLocale.getString("Custom Filter " + customFilterNumber), AnLocale.getString("Custom Filter " + customFilterNumber), customFilter, FilterClause.Kind.CUSTOM); customFilterNumber++; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { setVisible(false); } }); } }, "Filter Worker Thread"); } private void invalidFilterDialog(String filter) { String filterTxt = filter; if (filter.length() > 200) { filterTxt = filter.subSequence(0, 199) + "..."; } String errmsg = AnLocale.getString("Invalid filter:") + "\n" + filterTxt; AnUtility.showMessage(frame, errmsg, JOptionPane.ERROR_MESSAGE); } } ������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/KeywordsPanel.java������������������������������������������0000644�0001750�0001750�00000010342�14744453367�020667� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import java.util.Formatter; import javax.swing.border.LineBorder; /** * @author thp */ public class KeywordsPanel extends javax.swing.JPanel { public KeywordsPanel(Filters filter) { initComponents(); scrollPane.setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR, 1)); String text = computeKeywords(filter); textArea.setText(text); textArea.setCaretPosition(0); textArea.setBackground(AnEnvironment.DEFAULT_TEXT_PANE_RO_BACKGROUND); textArea.setBorder(null); textArea.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Keywords")); textArea.getAccessibleContext().setAccessibleName(AnLocale.getString("Keywords")); } private String computeKeywords(Filters filter) { String empty = ""; Object[] obj = filter.getFilterKeywords(); if (obj == null) { return empty; // weird } String[] kwCategory = (String[]) (obj[0]); String[] kwCategoryI18N = (String[]) (obj[1]); String[] kwDataType = (String[]) (obj[2]); String[] kwKeyword = (String[]) (obj[3]); String[] kwFormula = (String[]) (obj[4]); String[] kwDescrip = (String[]) (obj[5]); Object[] kwEnumDescs = (Object[]) (obj[6]); String sectionFormat = "------ %s ------\n"; String categoryFormat = "%s\n"; String keywordFormat = " %-20s %s\n"; String previousCategory = empty; StringBuilder stringBuffer = new StringBuilder(); for (int i = 0; i < kwKeyword.length; i++) { if (kwKeyword[i] == null) { stringBuffer.append(new Formatter().format(sectionFormat, kwCategoryI18N[i])); continue; } String cat = kwCategoryI18N[i]; if (previousCategory.compareTo(cat) != 0) { stringBuffer.append(new Formatter().format(categoryFormat, cat)); } previousCategory = cat; String[] enumDescs = (String[]) kwEnumDescs[i]; String keyword = kwKeyword[i]; if (kwDescrip[i] != null) { stringBuffer.append(new Formatter().format(keywordFormat, keyword, kwDescrip[i])); keyword = empty; } if (kwFormula[i] != null) { stringBuffer.append(new Formatter().format(keywordFormat, keyword, kwFormula[i])); keyword = empty; } int numEnums = enumDescs != null ? enumDescs.length : 0; for (int jj = 0; jj < numEnums; jj++) { stringBuffer.append(new Formatter().format(keywordFormat, keyword, enumDescs[jj])); keyword = empty; } } return stringBuffer.toString(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { scrollPane = new javax.swing.JScrollPane(); textArea = new javax.swing.JTextArea(); setLayout(new java.awt.BorderLayout()); textArea.setColumns(20); textArea.setEditable(false); textArea.setFont(new java.awt.Font("Monospaced", 0, 12)); textArea.setRows(10); textArea.setWrapStyleWord(true); scrollPane.setViewportView(textArea); add(scrollPane, java.awt.BorderLayout.CENTER); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane scrollPane; private javax.swing.JTextArea textArea; // End of variables declaration//GEN-END:variables } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/KeywordsPanel.form������������������������������������������0000644�0001750�0001750�00000006340�14744453367�020714� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <SubComponents> <Container class="javax.swing.JScrollPane" name="scrollPane"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <BorderConstraints direction="Center"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTextArea" name="textArea"> <Properties> <Property name="columns" type="int" value="20"/> <Property name="editable" type="boolean" value="false"/> <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> <Font name="Monospaced" size="12" style="0"/> </Property> <Property name="rows" type="int" value="10"/> <Property name="wrapStyleWord" type="boolean" value="true"/> </Properties> </Component> </SubComponents> </Container> </SubComponents> </Form> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/RedoFilterAction.java���������������������������������������0000644�0001750�0001750�00000002365�14744453367�021303� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JMenuItem; /** * @author tpreisle */ public class RedoFilterAction extends AbstractAction { public JMenuItem jmi = null; public RedoFilterAction() { super(AnLocale.getString("Redo Filter Action") /*, AnUtility.fwd_filt_icon*/); } @Override public void actionPerformed(ActionEvent ev) { AnWindow anWindow = AnWindow.getInstance(); anWindow.getFilters().redoLastFilteraction(); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/FilterStatusPanel.java��������������������������������������0000644�0001750�0001750�00000041347�15044710303�021476� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnIconButton; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.statuspanel.StatusLabelValueHandle; import org.gprofng.mpmt.util.gui.AnGradientPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class FilterStatusPanel extends JPanel implements AnChangeListener { private JButton undoButton; private JButton resetButton; private JButton redoButton; private JButton manageButton; private JTextArea infoArea; private final AnWindow anWindow; private List<FilterTextField> filterTextFields = new ArrayList<>(); private JPanel listPanel; private JScrollPane scrollPane; private int gridy = 0; /** Creates new form FilterStatusPanel */ public FilterStatusPanel(final AnWindow anWindow) { this.anWindow = anWindow; initComponents(); filterLabel.setFont(filterLabel.getFont().deriveFont(Font.BOLD)); filterLabel.setForeground(AnEnvironment.FILTER_HEADER_COLOR); // setBackground(AnEnvironment.NAVIGATION_PANEL_BACKGROUND_2_COLOR); setOpaque(false); // setOpaque(true); // setBackground(Color.yellow); updateLabel(0); GridBagConstraints gridBagConstraints; // Button panel undoButton = new AnIconButton(AnUtility.undo_icon); undoButton.setToolTipText(AnLocale.getString("Undo filter action")); undoButton.addActionListener(new UndoFilterAction()); resetButton = new AnIconButton(AnUtility.restore_icon); resetButton.setToolTipText(AnLocale.getString("Remove all filters")); resetButton.addActionListener(new RemoveAllFilterAction()); redoButton = new AnIconButton(AnUtility.redo_icon); redoButton.setToolTipText(AnLocale.getString("Redo filter action")); redoButton.addActionListener(new RedoFilterAction()); manageButton = new AnIconButton(AnUtility.compareHamburgerIcon); manageButton.setToolTipText(AnLocale.getString("Add or remove filters")); manageButton.addActionListener( new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { anWindow.getViews().getCurrentViewDisplay().showFilterPopup(manageButton); } }); JPanel buttonPanel = new AnGradientPanel( AnEnvironment.FILTER_TOOLBAR_BACKGROUND1_COLOR, AnEnvironment.FILTER_TOOLBAR_BACKGROUND2_COLOR); buttonPanel.setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); buttonPanel.setLayout(new GridBagLayout()); buttonPanel.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.FILTER_STATUS_BORDER_COLOR)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(3, 3, 2, 0); buttonPanel.add(undoButton, gridBagConstraints); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(3, 3, 2, 0); buttonPanel.add(redoButton, gridBagConstraints); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(3, 3, 2, 0); buttonPanel.add(resetButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(3, 0, 2, 3); buttonPanel.add(manageButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; // add(buttonPanel, gridBagConstraints); // Scroll pane scrollPane = new JScrollPane(); scrollPane.setBorder( BorderFactory.createMatteBorder(0, 1, 1, 1, AnEnvironment.FILTER_STATUS_BORDER_COLOR)); scrollPane.setHorizontalScrollBarPolicy( javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; // add(scrollPane, gridBagConstraints); // Buttons and filters panel JPanel buttonAndFiltersPanel = new JPanel(new GridBagLayout()); buttonAndFiltersPanel.setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); // buttonAndFiltersPanel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, // AnEnvironment.NAVIGATION_SPLIT_PANE_DIVIDER_COLOR)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(3, 5, 0, 4); buttonAndFiltersPanel.add(buttonPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 5, 5, 4); buttonAndFiltersPanel.add(scrollPane, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(buttonAndFiltersPanel, gridBagConstraints); // List panel listPanel = new JPanel(); listPanel.setLayout(new java.awt.GridBagLayout()); listPanel.setBackground(AnEnvironment.FILTER_BACKGROUND1_COLOR); // Info text area String infoText = AnLocale.getString( "To add a filter, select a row from a view (such as Functions) and then click on the" + " toolbar Filters icon."); infoArea = new JTextArea(); AnUtility.setAccessibleContext( infoArea.getAccessibleContext(), AnLocale.getString("Info Area")); infoArea.setEditable(false); infoArea.setWrapStyleWord(true); infoArea.setLineWrap(true); infoArea.setBackground(AnEnvironment.FILTER_BACKGROUND1_COLOR); infoArea.setForeground(AnEnvironment.FILTER_INFO_TEXT_COLOR); infoArea.setMargin(new Insets(2, 2, 2, 2)); infoArea.setText(infoText); infoArea.setToolTipText(infoText); infoArea.setFont(getFont().deriveFont((float) (getFont().getSize() - 1))); AnEventManager.getInstance().addListener(this); updateStatus(false); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_FOCUSED) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getActionMap() .put( KeyboardShortcuts.helpActionShortcut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { Analyzer.getInstance().showHelp(null); } }); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("FilterStatusPanel stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: undoButton.setEnabled(false); resetButton.setEnabled(false); redoButton.setEnabled(false); manageButton.setEnabled(false); removeAllFilterTextFields(); listPanel.validate(); listPanel.repaint(); break; case EXPERIMENTS_LOADED_FAILED: case EXPERIMENTS_LOADED: manageButton.setEnabled(true); // Nothing break; case FILTER_CHANGED: Boolean showTooltip = (Boolean) e.getSource(); updateStatus(showTooltip); break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SETTING_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } private void debug() { System.out.println(this.getClass().getSimpleName()); } private void removeAllFilterTextFields() { listPanel.removeAll(); filterTextFields = new ArrayList<>(); gridy = 0; } private FilterTextField addFilterTextField(FilterClause clause) { Color background; if (gridy % 2 == 0) { background = AnEnvironment.FILTER_BACKGROUND1_COLOR; } else { background = AnEnvironment.FILTER_BACKGROUND2_COLOR; } FilterTextField filterTextField = new FilterTextField(anWindow.getFilters(), background, clause); filterTextField.setText(clause.getShortNameWithSerialNumber()); // filterTextField.setToolTipText((clause.getLongName() != null ? clause.getLongName() : // "???") + ": " + clause.getClause()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy++; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 2, 0, 0); listPanel.add(filterTextField, gridBagConstraints); filterTextFields.add(filterTextField); return filterTextField; } private void addFiller() { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 100; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; listPanel.add(new JLabel(), gridBagConstraints); } private void updateLabel(int noFilters) { StringBuilder text = new StringBuilder(); text.append(AnLocale.getString("Filters")); if (noFilters == 1) { text.append(": " + noFilters + " "); text.append(AnLocale.getString("active filter")); } else if (noFilters > 1) { text.append(": " + noFilters + " "); text.append(AnLocale.getString("active filters")); } filterLabel.setText(text.toString()); AnUtility.setAccessibleContext(filterLabel.getAccessibleContext(), filterLabel.getText()); filterLabel.setDisplayedMnemonic(AnLocale.getString('i', "FilterPanelActiveFiltersMN")); filterLabel.setLabelFor(manageButton); } private void updateStatus(final boolean showTooltip) { // The IPC call below should be done on a worker thread // if (!anWindow.getAnalyzer().IPC_started) { // return; // } AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { final List<FilterClause> list = anWindow.getFilters().getFilters(); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { undoButton.setEnabled(anWindow.getFilters().canUndoLastFilter()); redoButton.setEnabled(anWindow.getFilters().canRedoLastFilter()); if (list.isEmpty()) { resetButton.setEnabled(false); anWindow .getFilterStatusHandle() .update(AnLocale.getString("off"), StatusLabelValueHandle.Mode.DEFAULT); } else { resetButton.setEnabled(true); anWindow .getFilterStatusHandle() .update(AnLocale.getString("on"), StatusLabelValueHandle.Mode.SET); } removeAllFilterTextFields(); if (list.isEmpty()) { scrollPane.setVerticalScrollBarPolicy( javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); scrollPane.setViewportView(infoArea); } else { scrollPane.setVerticalScrollBarPolicy( javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(listPanel); for (FilterClause clause : list) { addFilterTextField(clause); } addFiller(); } updateLabel(list.size()); validate(); repaint(); if (showTooltip && filterTextFields.size() > 0) { filterTextFields.get(0).showTooltipPopupAdded(); } } }); } }, "Filter_thread"); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; filterLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); filterLabel.setText("NOI18N"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(3, 6, 0, 0); add(filterLabel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel filterLabel; // End of variables declaration//GEN-END:variables } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/RemoveAllFilterAction.java����������������������������������0000644�0001750�0001750�00000002433�14744453367�022274� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JMenuItem; /** * @author tpreisle */ public class RemoveAllFilterAction extends AbstractAction { public JMenuItem jmi = null; public RemoveAllFilterAction() { super(AnLocale.getString("Remove All Filters") /*, AnUtility.restore_icon*/); } @Override public void actionPerformed(ActionEvent ev) { AnWindow anWindow = AnWindow.getInstance(); anWindow.getFilters().addClause(FilterClause.getNoFiltersClause(), false); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/filter/CustomEditPanel.java����������������������������������������0000644�0001750�0001750�00000024676�14744453367�021157� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.filter; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnIconButton; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.KeyStroke; import javax.swing.border.LineBorder; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.text.BadLocationException; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; import javax.swing.undo.UndoableEdit; public class CustomEditPanel extends JPanel { private static final String help_id = AnVariable.HELP_Filter; MyUndoManager manager = null; JTextPane pane = null; Action undoAction = null; Action redoAction = null; Action clearAction = null; public CustomEditPanel(Filters filter) { pane = new JTextPane(); pane.setEditable(true); // Editable pane.setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR, 1)); pane.setForeground(AnEnvironment.FILTER_FOREGROUND_COLOR); setLayout(new BorderLayout()); add(new AnJScrollPane(pane), BorderLayout.CENTER); // Create the undo manager and actions manager = new MyUndoManager(); pane.getDocument().addUndoableEditListener(manager); undoAction = new UndoAction(manager); redoAction = new RedoAction(manager); clearAction = new ClearAction(manager); // Add the actions to buttons JButton undoButton = new AnIconButton(AnUtility.undo_icon); undoButton.setToolTipText(AnLocale.getString("Undo")); JButton redoButton = new AnIconButton(AnUtility.redo_icon); redoButton.setToolTipText(AnLocale.getString("Redo")); undoButton.addActionListener(undoAction); redoButton.addActionListener(redoAction); JPanel panel = new JPanel(); panel.setLayout(new java.awt.GridBagLayout()); GridBagConstraints gridBagConstraints; JLabel keywordsLabel = new JLabel(); AnUtility.setTextAndAccessibleContext(keywordsLabel, AnLocale.getString("Keywords:")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(8, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.WEST; panel.add(keywordsLabel, gridBagConstraints); AnUtility.checkIPCOnWrongThread(false); KeywordsPanel keywordsPanel = new KeywordsPanel(filter); AnUtility.checkIPCOnWrongThread(true); keywordsPanel.setPreferredSize(new Dimension(100, 180)); keywordsLabel.setLabelFor(keywordsPanel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; panel.add(keywordsPanel, gridBagConstraints); add(panel, BorderLayout.SOUTH); panel = new JPanel(); panel.setLayout(new java.awt.GridBagLayout()); JLabel filterSpecLabel; gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(8, 0, 0, 0); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; filterSpecLabel = new JLabel(); AnUtility.setTextAndAccessibleContext( filterSpecLabel, AnLocale.getString("Filter Specification:")); AnUtility.setTextAndAccessibleContext(keywordsLabel, AnLocale.getString("Keywords:")); panel.add(filterSpecLabel, gridBagConstraints); filterSpecLabel.setDisplayedMnemonic( AnLocale.getString('F', "MNEMONIC_FILTER_SPECIFICATION_BUTTON")); filterSpecLabel.setLabelFor(pane); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 4, 2, 0); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 1.0; panel.add(undoButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 4, 2, 0); gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; panel.add(redoButton, gridBagConstraints); add(panel, BorderLayout.NORTH); // Assign the actions to keys pane.registerKeyboardAction( undoAction, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK), JComponent.WHEN_FOCUSED); pane.registerKeyboardAction( redoAction, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK), JComponent.WHEN_FOCUSED); getAccessibleContext() .setAccessibleName( AnLocale.getString("Custom filter settings", "ACCESSIBILITY_Custom_Panel")); getAccessibleContext() .setAccessibleDescription( AnLocale.getString("Custom filter settings", "ACCESSIBILITY_Custom_Panel")); undoButton .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Undo button", "ACCESSIBILITY_Undo_button")); redoButton .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Redo button", "ACCESSIBILITY_Redo_button")); } // class AnIconButton extends JButton implements MouseListener, FocusListener { // // public AnIconButton(Icon icon) { // super(icon); // setBorder(javax.swing.BorderFactory.createLineBorder(Color.LIGHT_GRAY)); // setOpaque(false); // setContentAreaFilled(false); // setBorderPainted(false); // // addMouseListener(this); // addFocusListener(this); // } // // public Insets getInsets() { // return new Insets(3,3,3,3); // } // // public void mouseExited(MouseEvent e) { // setBorderPainted(false); // validate(); // repaint(); // } // // public void mouseClicked(MouseEvent e) { // } // // public void mouseEntered(MouseEvent e) { // setBorderPainted(true); // validate(); // repaint(); // } // // public void mousePressed(MouseEvent e) { // } // // public void mouseReleased(MouseEvent e) { // } // // public void focusGained(FocusEvent e) { // setBorderPainted(true); // validate(); // repaint(); // } // // public void focusLost(FocusEvent e) { // setBorderPainted(false); // validate(); // repaint(); // } // } class MyUndoManager extends UndoManager { boolean applied = true; UndoableEdit applyEdit = null; public MyUndoManager() { getTextPane() .getDocument() .addUndoableEditListener( new UndoableEditListener() { public void undoableEditHappened(UndoableEditEvent evt) { UndoableEdit anEdit = evt.getEdit(); if (applied) { applyEdit = anEdit; applied = false; } } }); } public void undoToLastApply() { if (applyEdit != null) { applied = true; undoTo(applyEdit); } applyEdit = null; } public void apply() { applied = true; applyEdit = null; } } public JTextPane getTextPane() { return pane; } public void resetToFactorySetting() { clearAction.actionPerformed(null); } public void setFilter(String filter) { pane.setText(filter); } public void addText(String text) { int pos = pane.getDocument().getLength(); try { pane.getDocument().insertString(pos, text, null); } catch (BadLocationException ble) { } } public void apply() { manager.apply(); } public void undoToLastApply() { manager.undoToLastApply(); } // The Undo action public class UndoAction extends AbstractAction { private UndoManager manager; public UndoAction(UndoManager manager) { this.manager = manager; } public void actionPerformed(ActionEvent evt) { try { manager.undo(); } catch (CannotUndoException e) { Toolkit.getDefaultToolkit().beep(); } } } // The Redo action public class RedoAction extends AbstractAction { private UndoManager manager; public RedoAction(UndoManager manager) { this.manager = manager; } public void actionPerformed(ActionEvent evt) { try { manager.redo(); } catch (CannotRedoException e) { Toolkit.getDefaultToolkit().beep(); } } } // The Clear action public class ClearAction extends AbstractAction { private UndoManager manager; public ClearAction(UndoManager manager) { this.manager = manager; } public void actionPerformed(ActionEvent evt) { try { int pos = pane.getDocument().getLength(); pane.getDocument().remove(0, pos); // pane.getDocument().insertString(pos, "dsadsada", null); } catch (BadLocationException be) { } } } } ������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnLong.java��������������������������������������������������������0000644�0001750�0001750�00000005262�15044710303�015752� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.AnObject.format_group_integer; public final class AnLong extends AnObject implements Comparable<AnLong> { private final long value; private final Long obj; public AnLong(long value) { this.value = value; obj = this.value; } // Analyzer Long printing format @Override public String toString() { if (sign) { return String.format("%+d", value); } return obj.toString(); } // Analyzer formatted printing format @Override public String toFormString() { if (value == 0) { if (!showZero) { return quote_space; } } if (sign) { return format_group_sinteger.format(value); } return format_group_integer.format(value); } // Percent printing @Override public String toPercent(double total) { if (value == 0) { if (!showZero) { return quote_space; } return zero_percent; } return format_percent.format(value * total); } // Time printing @Override public String toTime(double clock) { if (value == 0) { return get_zero_decimal(); } AnDouble d = new AnDouble(value * clock); d.showSign(sign); d.showZero(showZero); return d.toString(); } // Time formatted printing format @Override public String toFormTime(double clock) { if (value == 0) { return get_zero_decimal(); } AnDouble d = new AnDouble(value * clock); d.showSign(sign); d.showZero(showZero); return d.toFormString(); } // To Long public Long toLong() { return obj; } // To double @Override public double doubleValue() { return value; } // As Long.compareTo @Override public int compareTo(AnLong o) { return obj.compareTo(o.toLong()); } // Convert long[] to AnLong[] public static AnLong[] toArray(long[] list) { int length = list.length; AnLong[] new_list = new AnLong[length]; for (int i = 0; i < length; i++) { new_list[i] = new AnLong(list[i]); } return new_list; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/NoMetricsSelectedPanel.java����������������������������������������0000644�0001750�0001750�00000007177�14744453367�021163� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import javax.swing.JPopupMenu; public class NoMetricsSelectedPanel extends javax.swing.JPanel { private int dtype; public NoMetricsSelectedPanel(int dtype) { this.dtype = dtype; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); textLabel.setText(AnLocale.getString("No metrics selected for this view.")); resolveButton.setText(AnLocale.getString("Select Metrics")); resolveButton.setMnemonic(AnLocale.getString('S', "select_metrics_button")); resolveButton.setToolTipText(AnLocale.getString(("Select metrics"))); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; textLabel = new javax.swing.JLabel(); pathTextField = new javax.swing.JTextField(); resolveButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); textLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; add(textLabel, gridBagConstraints); pathTextField.setEditable(false); pathTextField.setBorder(null); pathTextField.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(pathTextField, gridBagConstraints); resolveButton.setText("jButton1"); resolveButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resolveButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(resolveButton, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void resolveButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_resolveButtonActionPerformed JPopupMenu popup = new JPopupMenu(); AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricsPopupSelector(popup, dtype, true); popup.show(resolveButton, resolveButton.getWidth(), 0 /*resolveButton.getHeight()*/); } // GEN-LAST:event_resolveButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField pathTextField; private javax.swing.JButton resolveButton; private javax.swing.JLabel textLabel; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CallTreeView.java��������������������������������������������������0000644�0001750�0001750�00000374632�15044710303�017134� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.util.gui.AnUtility.getImageIconBar; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.filter.FilterClause; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.ViewModeSetting; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Vector; import java.util.concurrent.atomic.AtomicBoolean; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.JViewport; import javax.swing.KeyStroke; import javax.swing.event.PopupMenuEvent; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; public final class CallTreeView extends AnDisplay implements ExportSupport, AnChangeListener { private boolean updated = false; protected boolean convertHWCtoTime = false; // Temporary fix for patch (CR 6985920) protected double clock_frequency = 1.0; // Temporary fix for patch (CR 6985920) protected long sel_func, sel_src; protected int name_col, sort_col, metric_col; private AnTable caller; private Object[][] caller_data, func_data, callee_data; private JTree calltree; // Call tree private final Object CallTreeLock = new Object(); // global lock to synchronize call tree modifications private JScrollPane tree_jsp; // Call tree scrollable pane private JScrollPane errorPane = null; private JLabel tree_label; // Call tree label private CT_TreeNode tnTotal = null; // Call tree node <Total> private boolean show_inclusive = true; private boolean show_exclusive = false; private boolean show_percentage = true; private boolean show_colorbars = true; private boolean show_tooltips = true; private boolean stop_expanding = false; private boolean stop_expanding_enabled = false; private final AtomicBoolean skip_build_subtree = new AtomicBoolean(false); // Optimization flag private boolean skip_update_summary = false; // Optimization flag private boolean sortByName = false; private int previous_metric_col = -1; // used in "Sort by Name" case private DefaultMutableTreeNode rootnode; // Call tree root node private long[] ids_callers = null; private long[] ids_callees = null; private CT_CallStack ct_callstack; private MetricLabel[] caller_label; private AnMetric[] available_metrics = new AnMetric[0]; private String metricName; // To show metric name in the Title private String metricCommandName; // To get colors for icons final String mlistStr = "MET_CALL_AGR"; final String typeStrFunction = "FUNCTION"; final String subtypeStr = "0"; final String stab_callers = "CALLERS"; final String stab_callees = "CALLEES"; final String stab_self = "SELF"; private AnMenuListener menuListener; // Menu actions final String STR_ACTION_SHOWSOURCE = AnLocale.getString("Show Source"); final String STR_ACTION_SHOWDISASM = AnLocale.getString("Show Disassembly"); final String STR_ACTION_EXPANDNODE = AnLocale.getString("Expand Node"); final String STR_ACTION_EXPANDBRANCH = AnLocale.getString("Expand Branch"); final String STR_ACTION_EXPANDHOTTEST = AnLocale.getString("Expand Hottest Branch"); final String STR_ACTION_EXPANDHOT = AnLocale.getString("Expand Hot Branches"); final String STR_ACTION_EXPANDTREE = AnLocale.getString("Expand All Branches"); final String STR_ACTION_STOPEXPANDING = AnLocale.getString("Stop Expanding"); final String STR_ACTION_COLLAPSEBRANCH = AnLocale.getString("Collapse Branch"); final String STR_ACTION_COLLAPSENODE = AnLocale.getString("Collapse Node"); final String STR_ACTION_COLLAPSETREE = AnLocale.getString("Collapse All Branches"); final String STR_ACTION_SETROOT = AnLocale.getString("Set Root"); final String STR_ACTION_RESET = AnLocale.getString("Reset Root"); final String STR_ACTION_SETMETRIC = AnLocale.getString("Set Metric"); final String STR_ACTION_REFRESH = AnLocale.getString("Refresh Tree"); final String STR_ACTION_COPY_ALL = AnLocale.getString("Copy All"); final String STR_ACTION_SETTINGS = AnLocale.getString("Call Tree Settings"); private static final String STR_SORT_BY_METRIC = AnLocale.getString("Sort By Metric"); private static final String STR_SORT_BY_NAME = AnLocale.getString("Sort By Name"); private static final String ADD_FILTER = AnLocale.getString("Add Filter: "); static final String FILTER_NAME_ACTION_NAME = "filterNameinStack"; static final String FILTER_NAME_LONG_NAME = AnLocale.getString("Include only stacks containing name"); static final String FILTER_NAME_SHORT_NAME = AnLocale.getString("Name in Stack"); static final String FILTER_SELECTED_BRANCH_ACTION_NAME = "filterSelectedBranch"; static final String FILTER_SELECTED_BRANCH_LONG_NAME = AnLocale.getString("Include only stacks containing the selected branch"); static final String FILTER_SELECTED_BRANCH_SHORT_NAME = AnLocale.getString("Selected Branch"); static final String FILTER_NOT_SELECTED_BRANCH_ACTION_NAME = "filterNotSelectedBranch"; static final String FILTER_NOT_SELECTED_BRANCH_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected branch"); static final String FILTER_NOT_SELECTED_BRANCH_SHORT_NAME = AnLocale.getString("Not Selected Branch"); static final String FILTER_SELECTED_FUNCTION_ACTION_NAME = "filterSelectedfunction"; static final String FILTER_SELECTED_FUNCTION_LONG_NAME = AnLocale.getString("Include only stacks containing the selected function"); static final String FILTER_SELECTED_FUNCTION_SHORT_NAME = AnLocale.getString("Selected Function"); static final String FILTER_SELECTED_LEAF_ACTION_NAME = "filterSelectedLeaf"; static final String FILTER_SELECTED_LEAF_LONG_NAME = AnLocale.getString("Include only stacks with the selected function as leaf"); static final String FILTER_SELECTED_LEAF_SHORT_NAME = AnLocale.getString("Selected Leaf"); final String STR_ACTION_UNDO_FILTER = AnLocale.getString("Undo Filter Action"); final String STR_ACTION_REDO_FILTER = AnLocale.getString("Redo Filter Action"); final String STR_ACTION_REMOVE_ALL_FILTERS = AnLocale.getString("Remove All Filters"); final String STR_ACTION_CUSTOM_FILTER = ADD_FILTER + AnLocale.getString("Advanced Custom Filter..."); final String STR_ACTION_SHOWNEXT = AnLocale.getString("Show Next Reference To Function"); final String STR_ACTION_SHOWALL = AnLocale.getString("Show All References To Function"); final String STR_ACTION_HIDE_INCLUSIVE = AnLocale.getString("Hide Inclusive Metric"); final String STR_ACTION_SHOW_INCLUSIVE = AnLocale.getString("Show Inclusive Metric"); final String STR_ACTION_SHOW_EXCLUSIVE = AnLocale.getString("Show Exclusive Metric"); final String STR_ACTION_HIDE_PERCENTAGE = AnLocale.getString("Hide Percentage"); final String STR_ACTION_SHOW_PERCENTAGE = AnLocale.getString("Show Percentage"); final String STR_ACTION_HIDE_COLORBARS = AnLocale.getString("Hide Color Bars"); final String STR_ACTION_SHOW_COLORBARS = AnLocale.getString("Show Color Bars"); final String STR_ACTION_HIDE_TOOLTIPS = AnLocale.getString("Hide Tool tips"); final String STR_ACTION_SHOW_TOOLTIPS = AnLocale.getString("Show Tool tips"); private String STR_TREE_TITLE_FUNCTIONS; private String STR_TREE_TITLE_COMPLETE_VIEW; private String STR_TREE_TITLE_PARTIAL; private String STR_TREE_TITLE_FILTER; private String acName; private String acDesc; private String lastFilter = null; // Constructor public CallTreeView() { super(AnWindow.getInstance(), AnDisplay.DSP_CallTree, AnVariable.HELP_TabsCallTree); // System.err.println("XXX In CallTreeDisp() type: " + type + " subtype: " + subtype); STR_TREE_TITLE_FUNCTIONS = AnLocale.getString("Call Tree: FUNCTIONS."); STR_TREE_TITLE_COMPLETE_VIEW = AnLocale.getString("Complete view."); STR_TREE_TITLE_PARTIAL = AnLocale.getString("Partial view."); STR_TREE_TITLE_FILTER = AnLocale.getString("Filtered view."); // Accessibility acName = AnLocale.getString("Call Tree"); acDesc = AnLocale.getString("Functions Call Tree"); if (null != calltree) { calltree.getAccessibleContext().setAccessibleName(acName); calltree.getAccessibleContext().setAccessibleDescription(acDesc); } if (null != tree_jsp) { tree_jsp.getAccessibleContext().setAccessibleName(acName); tree_jsp.getAccessibleContext().setAccessibleDescription(acDesc); } if (null != tree_label) { String text = STR_TREE_TITLE_FUNCTIONS; tree_label.getAccessibleContext().setAccessibleName(text); tree_label.getAccessibleContext().setAccessibleDescription(text); } name_col = -1; sort_col = -1; setAccessibility(AnLocale.getString("Call Tree")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("CallTreeView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.CALL_TREE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void requestFocus() { if (calltree != null) { calltree.requestFocus(); } } @Override public JPopupMenu getFilterPopup() { return initPopup(true); } /** Initialize GUI components */ @Override protected void initComponents() { // System.err.println("XXX In CallTreeDisp.initComponents()"); setLayout(new BorderLayout()); // This is just a minimal initialization // The remaining part is in reset(). } /** Reset GUI components */ public @Override void reset() { // System.err.println("XXX In CallTreeDisp.reset()"); // Remove Call Tree if (null != tree_jsp) { // Remove selection listener CallTreeSelectionListener[] cts_listeners = calltree.getListeners(CallTreeSelectionListener.class); for (CallTreeSelectionListener listener : cts_listeners) { calltree.removeTreeSelectionListener(listener); } // Remove expansion listener CallTreeExpansionListener[] cte_listeners = calltree.getListeners(CallTreeExpansionListener.class); for (CallTreeExpansionListener listener : cte_listeners) { calltree.removeTreeExpansionListener(listener); } // CT_CollapseTree(); tnTotal = null; remove(tree_jsp); } // Init Call Tree initCallTree(); // Add Call Tree tree_jsp = new AnJScrollPane(calltree); tree_jsp.add(tree_label); add(tree_jsp, BorderLayout.CENTER); // Popup menu menuListener = new AnMenuListener(this, calltree); calltree.addMouseListener(menuListener); // this.addMouseListener(menuListener); // Do we need it? KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; calltree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); calltree .getActionMap() .put( ks, new AbstractAction() { public void actionPerformed(ActionEvent ev) { JPopupMenu popup = initPopup(false); if (popup != null) { JTree src = (JTree) ev.getSource(); Rectangle cellRect, visRect; visRect = src.getVisibleRect(); cellRect = visRect; int selrow = src.getMaxSelectionRow(); if (selrow >= 0) { cellRect = src.getRowBounds(selrow); } // if current view doesn't include selected row, scroll if (!visRect.contains(cellRect)) { // calculate middle based on selected row // being below or above current visible rows if (visRect.y < cellRect.y) { cellRect.y += visRect.height / 2; } else { cellRect.y -= visRect.height / 2; } src.scrollRectToVisible(cellRect); } popup.show(src, cellRect.x, cellRect.y + cellRect.height); } } }); } // Init Call Tree private void initCallTree() { String text = STR_TREE_TITLE_FUNCTIONS; rootnode = new DefaultMutableTreeNode(STR_TREE_TITLE_FUNCTIONS, true); calltree = new CT_Tree(rootnode); tree_label = new JLabel(text); tree_label.setDisplayedMnemonic(AnLocale.getString('A', "MNEM_CALLTREEFUNCTIONS")); tree_label.setLabelFor(calltree); tree_label.setVisible(false); // Add a selection listener, to listen for selected nodes calltree.addTreeSelectionListener(new CallTreeSelectionListener()); // Add an expansion listener, to listen for expanded nodes calltree.addTreeExpansionListener(new CallTreeExpansionListener()); // Allow only a single node to be selected (default) calltree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); if (show_tooltips) { // Show tooltips javax.swing.ToolTipManager.sharedInstance().registerComponent(calltree); } } // Clear display public @Override void clear() { // System.err.println("XXX In CallTreeDisp.clear()"); } /** Copy all lines to the system clipboard */ protected void copyAll() { String text = exportAsText(null, ExportFormat.TEXT, null); AnUtility.copyToClipboard(text); } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = CT_PrintTree(); return text; } // Get new selected func index & compare to the old one // Note: must be called from doCompute private final long getFuncObj() { final long func_obj; if (sel_func <= 0) { // not initialized yet // need Total/Maximum from func-list data window .getFunctionsView() .computeIfNeeded(); // on worker thread and synchronized (AnVariable.mainFlowLock) } func_obj = window.getSelectedObject().getSelObjV2(typeStrFunction); // API V2 if (sel_func != func_obj) { updated = false; } return func_obj; } private static int ThreadID = 0; // Semaphore private final Object shortLock = new Object(); // For short critical sections /** Compute & update call tree */ @Override public void doCompute() { synchronized (shortLock) { if (inCompute) { return; } inCompute = true; } // Only one thread at a time doCompute_internal(); synchronized (shortLock) { inCompute = false; } } // Compute & update call tree private void doCompute_internal() { long ID_to_expand; AnUtility.checkIfOnAWTThread(false); if (!selected) { return; // Not selected - nothing to do. } if (window .getSettings() .getCompareModeSetting() .comparingExperiments()) { // XXXX show error when compare is on, needs simplified, but the // situation is different for different views reset(); JLabel error_label = new JLabel(); error_label.setHorizontalAlignment(JLabel.CENTER); error_label.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); error_label .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Error message")); JViewport error_view = new JViewport(); error_view.setView(error_label); String msg = AnLocale.getString("Not available when comparing experiments"); error_label.setText(msg); if (errorPane == null) { errorPane = new AnJScrollPane(); add(errorPane, BorderLayout.CENTER); } errorPane.setViewportView(error_view); errorPane.setVisible(true); if (tree_jsp != null) { tree_jsp.setVisible(false); } return; } if (errorPane != null) { errorPane.setVisible(false); } if (tree_jsp != null) { tree_jsp.setVisible(true); } long starttime = System.currentTimeMillis(); long t = starttime; sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // TEMPORARY // long my_sel_func = sel_func; // System.out.println("CallTree step 1 time: " + (System.currentTimeMillis() - t) + " ms"); // // DEBUG t = System.currentTimeMillis(); int progress = 1; int version = 1; if (!computed) { // need re-compute reset(); // window.setBusyCursor(true); // Repeat after reset() DefaultMutableTreeNode dn; if (ct_callstack == null) { ct_callstack = new CT_CallStack(); } else { ct_callstack.reset(); sel_func = my_sel_func; // reset() sets sel_func to <Total> } ID_to_expand = sel_func; sort_col = window.getSettings().getMetricsSetting().getSortColumnByDType(DSP_CallTree); int buildlevel = 2; // min tree depth int maxlevel = 5; // tree depth int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Initializing call tree")); dn = CT_BuildTree(calltree, buildlevel, threshold, ID_to_expand); // System.out.println("CallTree step 1a time: " + (System.currentTimeMillis() - t) + " ms // buildlevel = " + buildlevel); // DEBUG t = System.currentTimeMillis(); long curtime = System.currentTimeMillis() - starttime; /* if (0 == version) { // old version if (curtime < 2000) { // Minimal building took less than 2 seconds - try to build more if (curtime > 0) { int dynmaxlevel = (int) (2000 / curtime); if (dynmaxlevel < maxlevel) { maxlevel = dynmaxlevel; } } if (maxlevel > 1) { buildlevel = maxlevel; progress = 20; threshold = current_threshold; // % window.setProgress(progress, "Initializing call tree"); dn = CT_BuildTree(calltree, buildlevel, threshold, ID_to_expand); System.out.println("CallTree step 2a time: " + (System.currentTimeMillis() - t) + " ms buildlevel = " + buildlevel); // DEBUG t = System.currentTimeMillis(); } } } // end of old version */ progress = 80; window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Expanding call tree")); if (0 == version) { // old version // Expand Call Tree int expandlevel = 1; // min tree depth CT_TreeNode n = CT_ExpandTree(calltree, tnTotal, expandlevel, threshold, ID_to_expand); curtime = System.currentTimeMillis() - starttime; if (curtime < 5000) { // Total time is less than 5 seconds - try to expand more long expt = System.currentTimeMillis() - t; expandlevel = 30; // 20; // default tree depth if (expt > 0) { int dynmaxlevel = (int) (2000 / expt); if (dynmaxlevel < expandlevel) { expandlevel = dynmaxlevel; } } if (expandlevel > 1) { n = CT_ExpandTree(calltree, tnTotal, expandlevel, threshold, ID_to_expand); } } System.out.println( "CallTree step 3a time: " + (System.currentTimeMillis() - t) + " ms expandlevel = " + expandlevel); // DEBUG t = System.currentTimeMillis(); if (null == n) { if (null != dn) { progress = 90; window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Expanding call tree")); expandlevel = dn.getDepth(); // adjusted tree depth CT_ExpandTree(calltree, dn, expandlevel, threshold, ID_to_expand); System.out.println( "CallTree step 4a time: " + (System.currentTimeMillis() - t) + " ms"); // DEBUG t = System.currentTimeMillis(); final int row = findFirst(ID_to_expand); AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { long t = System.currentTimeMillis(); calltree.setSelectionRow(row); showSelectedRow(row); System.out.println( "CallTree step 5a time: " + (System.currentTimeMillis() - t) + " ms"); // DEBUG t = System.currentTimeMillis(); } }); } } } // end of old version CT_TreeNode n = null; if (ID_to_expand > 0) { // Selected object final long[] cstack = CT_FindCallStackForID(ID_to_expand); // IPC if ((cstack != null) && (cstack.length > 0)) { long id = cstack[cstack.length - 1]; n = CT_ExpandBranch( calltree, tnTotal, cstack.length + 1 /*level*/, 0 /*no threshold*/, id, cstack); } } if (null == n) { // fall back to the old code int level = 100; // some big value CT_DynamicExpandCallTree( /*JTree tree,*/ dn, level, threshold, ID_to_expand, starttime, progress); } CT_UpdateTitle(); // TEMPORARY progress = 100; window.getSystemProgressPanel().setProgress(100, AnLocale.getString("Expanding call tree")); } else if (!updated) { // need update int minlevel = 1; // min tree depth int maxlevel = 5; // tree depth int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % ID_to_expand = sel_func; sort_col = window.getSettings().getMetricsSetting().getSortColumnByDType(DSP_CallTree); DefaultMutableTreeNode dn = CT_RebuildTree(minlevel, threshold, ID_to_expand); // System.out.println("CallTree step 1b time: " + (System.currentTimeMillis() - t) + " ms // minlevel = " + minlevel); // DEBUG t = System.currentTimeMillis(); long curtime = System.currentTimeMillis() - starttime; if (0 == version) { // old version if (t < 2000) { // Minimal building took less than 2 seconds - try to build more if (curtime > 0) { int dynmaxlevel = (int) (2000 / curtime); if (dynmaxlevel < maxlevel) { maxlevel = dynmaxlevel; } } if (maxlevel > 0) { // progress = 20; threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % // window.setProgress(progress, "Initializing call tree"); dn = CT_RebuildTree(maxlevel, threshold, ID_to_expand); System.out.println( "CallTree step 2b time: " + (System.currentTimeMillis() - t) + " ms maxlevel = " + maxlevel); // DEBUG t = System.currentTimeMillis(); } } CT_TreeNode n = CT_ExpandTree(calltree, dn, maxlevel, threshold, ID_to_expand); System.out.println( "CallTree step 3b time: " + (System.currentTimeMillis() - t) + " ms"); // DEBUG t = System.currentTimeMillis(); final int row = findFirst(ID_to_expand); System.out.println( "CallTree step 4b time: " + (System.currentTimeMillis() - t) + " ms"); // DEBUG t = System.currentTimeMillis(); AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { long t = System.currentTimeMillis(); calltree.setSelectionRow(row); showSelectedRow(row); System.out.println( "CallTree step 5b time: " + (System.currentTimeMillis() - t) + " ms"); // DEBUG t = System.currentTimeMillis(); } }); } // end of old version CT_TreeNode n = null; if (ID_to_expand > 0) { // Selected object final long[] cstack = CT_FindCallStackForID(ID_to_expand); if ((cstack != null) && (cstack.length > 0)) { long id = cstack[cstack.length - 1]; n = CT_ExpandBranch( calltree, tnTotal, cstack.length + 1 /*level*/, 0 /*no threshold*/, id, cstack); } } if (null == n) { // fall back to the old code int level = 100; // some big value CT_DynamicExpandCallTree( /*JTree tree,*/ dn, level, threshold, ID_to_expand, starttime, progress); } CT_UpdateTitle(); // TEMPORARY } available_metrics = window.getSettings().getMetricsSetting().getMetricListByMType(MetricsSetting.MET_CALL_AGR); window.getSystemProgressPanel().setProgress(0, ""); // Update selection? // ... computed = true; updated = true; // System.out.println("CallTree doCompute time: " + (System.currentTimeMillis() - starttime) + " // ms"); // DEBUG } /* * Experimental code to localize performance and responsiveness issues */ private int CT_DynamicExpandCallTree( /*JTree tree,*/ DefaultMutableTreeNode dn, int level, int threshold, long ID_to_expand, long starttime, int progress) { // Expand Call Tree int expandlevel = 1; // min tree depth CT_TreeNode n = CT_ExpandTree(calltree, tnTotal, expandlevel, threshold, ID_to_expand); long t = System.currentTimeMillis(); long curtime = System.currentTimeMillis() - starttime; if (curtime < 5000) { // Total time is less than 5 seconds - try to expand more long expt = System.currentTimeMillis() - t; expandlevel = level; // 20; // default tree depth if (expt > 0) { int dynmaxlevel = (int) (2000 / expt); if (dynmaxlevel < expandlevel) { expandlevel = dynmaxlevel; } } if (expandlevel > 1) { n = CT_ExpandTree(calltree, tnTotal, expandlevel, threshold, ID_to_expand); } } // System.out.println("CallTree step 3a time: " + (System.currentTimeMillis() - t) + " ms // expandlevel = " + expandlevel); // DEBUG t = System.currentTimeMillis(); if (null == n) { if (null != dn) { progress = 90; window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Expanding call tree")); expandlevel = dn.getDepth(); // adjusted tree depth CT_ExpandTree(calltree, dn, expandlevel, threshold, ID_to_expand); // System.out.println("CallTree step 4a time: " + (System.currentTimeMillis() - t) + " ms"); // // DEBUG t = System.currentTimeMillis(); final int row = findFirst(ID_to_expand); AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { long t = System.currentTimeMillis(); calltree.setSelectionRow(row); showSelectedRow(row); // System.out.println("CallTree step 5a time: " + (System.currentTimeMillis() - t) + // " ms"); // DEBUG t = System.currentTimeMillis(); } }); } } return progress; } @Override protected boolean supportsFindText() { return true; } /** * Find a tree node that contains the specified string * * @param str * @param forward Direction: true - forward, false - backward * @return row */ @Override public int find(final String str, final boolean forward, boolean caseSensitive) { final boolean do_selection = true; int sel_row = -1; long id = -1; boolean wrap_around = true; return (find(str, forward, id, sel_row, wrap_around, do_selection, caseSensitive)); } /** * Find a tree node that contains the specified ID * * @param id * @param sel_row * @param forward * @param wrap_around * @return row */ private int find_not_used( long id, int sel_row, final boolean forward, final boolean wrap_around, boolean caseSensitive) { final boolean do_selection = true; final String str = null; return (find(str, forward, id, sel_row, wrap_around, do_selection, caseSensitive)); } /** * Find a tree node that contains the specified ID * * @param id * @param sel_row * @return row */ private int find(long id, int sel_row, final boolean do_selection, boolean caseSensitive) { final boolean forward = true; final boolean wrap_around = true; final String str = null; // Expand all branches that contain this id CT_ExpandAllCallStacksForID(id); // Update selected row sel_row = calltree.getMaxSelectionRow(); return (find(str, forward, id, sel_row, wrap_around, do_selection, caseSensitive)); } /** * Find a tree node that contains the specified string or specified ID * * @param str * @param forward * @param sel_row * @param id * @param wrap_around * @return row */ private int find( String str, final boolean forward, long id, int sel_row, final boolean wrap_around, final boolean do_selection, boolean caseSensitive) { final JTree t = calltree; int found_row = -1; int last_found_row = -1; int row = 0; int selected_row = t.getMaxSelectionRow(); if (sel_row >= 0) { selected_row = sel_row; } CT_TreeNode total = tnTotal; if (total == null) { return found_row; } if (!caseSensitive && null != str) { str = str.toLowerCase(); } CT_TreeNode ctn = total; CT_TreeNode found_node = ctn; Enumeration num = ctn.depthFirstEnumeration(); // ctn.breadthFirstEnumeration(); while (num.hasMoreElements()) { ctn = (CT_TreeNode) num.nextElement(); TreePath path = new TreePath(ctn.getPath()); row = t.getRowForPath(path); if ((row == selected_row) || (row < 0) /* not expanded */) { continue; } if (!wrap_around) { // Skip these checks for "Wrap around" if (row < selected_row) { if (forward) { continue; } } else { if (!forward) { continue; } } } boolean found = false; if (null != str) { // Compare strings String text = ctn.getUserObject().toString(); if (!caseSensitive) { text = text.toLowerCase(); } if (text.contains(str)) { found = true; } } else { // Compare IDs if (ctn.ID == id) { found_node = ctn; found = true; } } if (found) { if (wrap_around) { if (found_row < 0) { // nothing found yet found_row = row; } } if (!forward) { if ((row > last_found_row) || (last_found_row == -1)) { if (row < selected_row) { // for "Wrap around" last_found_row = row; // System.out.println("Found prev: "+ctn.getUserObject().toString()+" ID="+ctn.ID); } } if (wrap_around) { if (found_row < row) { found_row = row; } } } else { // forward if ((row < last_found_row) || (last_found_row == -1)) { if (row > selected_row) { // for "Wrap around" last_found_row = row; } } if (wrap_around) { if (found_row > row) { found_row = row; } } } } } if (last_found_row >= 0) { found_row = last_found_row; } if (do_selection) { // select the row if (found_row >= 0) { final int select_row = found_row; AnUtility.dispatchOnSwingThread( new Runnable() { // @Override public void run() { t.setSelectionRow(select_row); showSelectedRow(select_row); } }); // Set Selected Object and update Summary final long ID = found_node.ID; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { ct_callstack.setSelectedObject(ID); window.getSelectionManager().updateSelection(); } }, "call tree selection"); } } return found_row; } /** * Find the first tree node that contains the specified ID * * @param id * @param do_selection * @return row */ private int findFirst(long id) { final JTree t = calltree; int found_row = -1; int row = 0; CT_TreeNode total = tnTotal; if (total == null) { return found_row; } CT_TreeNode ctn = total; Enumeration num = ctn.depthFirstEnumeration(); while (num.hasMoreElements()) { ctn = (CT_TreeNode) num.nextElement(); TreePath path = new TreePath(ctn.getPath()); row = t.getRowForPath(path); if ((row < 0) /* not expanded */) { continue; } if (ctn.ID == id) { found_row = row; break; } } return found_row; } /** Show selected row via scrolling up or down Note: use AWT Thread to call this method */ public void showSelectedRow(int row) { final Rectangle cellRect, visRect; if (row < 0) { return; } cellRect = calltree.getRowBounds(row); visRect = calltree.getVisibleRect(); // if (cellRect == null) { // return; // } // if (visRect == null) { // return; // } if (visRect.x + visRect.width > cellRect.x) { // Visible area is wide enough to show the object cellRect.x = visRect.x; } // if current view doesn't include selected row, scroll if (!visRect.contains(cellRect)) { // calculate middle based on selected row // being below or above current visible rows if (visRect.y < cellRect.y) { cellRect.y += visRect.height / 2; } else { cellRect.y -= visRect.height / 2; } calltree.scrollRectToVisible(cellRect); } // Set row selection if (calltree.getMaxSelectionRow() != row) { calltree.setSelectionRow(row); } } /** * Sorting is not allowed in the Call Tree * * @param index */ public void sort(final int index) { // No sorting } Object[][] MaximumValues = null; // Process the raw data from mixed Primary/Object to pure Object array. // Creates and updates MaximumValues. protected Object[][] localProcessData(final Object[] raw_data) { int i; AnAddress aa = new AnAddress(0); AnDouble ad = new AnDouble(0.0); AnInteger ai = new AnInteger(0); AnLong al = new AnLong(0); AnString as = new AnString(""); final int nc = raw_data.length - 1; final Object[][] data = new Object[nc][]; MaximumValues = new Object[2][nc]; for (i = 0; i < nc; i++) { if (raw_data[i] instanceof double[]) { data[i] = AnDouble.toArray((double[]) raw_data[i]); MaximumValues[1][i] = ad; } else if (raw_data[i] instanceof int[]) { data[i] = AnInteger.toArray((int[]) raw_data[i]); MaximumValues[1][i] = ai; } else if (raw_data[i] instanceof long[]) { if ((((long[]) raw_data[i]).length == 0) || !AnAddress.isAddress(((long[]) raw_data[i])[0])) { data[i] = AnLong.toArray((long[]) raw_data[i]); MaximumValues[1][i] = al; } else { data[i] = AnAddress.toArray((long[]) raw_data[i]); MaximumValues[1][i] = aa; } } else { data[i] = (Object[]) raw_data[i]; MaximumValues[1][i] = as; } updateTotalMax(data[i], i); } for (i = 0; i < nc; i++) { // make sure there are no null elements in MaximumValues[1] if (MaximumValues[1][i] == null) { MaximumValues[1][i] = ad; } } return data; } /* * Updates MaximumValues (Total and Max values) * Note: Total is not used, so only Maximum is updated. */ void updateTotalMax(Object[] table_column, int index) { for (int i = 0; i < table_column.length; i++) { if (MaximumValues[1][index] == null) { MaximumValues[1][index] = table_column[i]; continue; } int j = MaximumValues[1][index].toString().length(); int k = table_column[i].toString().length(); if (j < k) { MaximumValues[1][index] = table_column[i]; } } } /* * Returns MaximumValues (Total and Max values), calculated by processData() */ Object[] getTotalMax() { return MaximumValues; } // Create the filter clause based on the selected objects public String createFilterClause(String action) { long ID = -1; long[] cstack = null; String clause = null; // int selected = calltree.getLeadSelectionRow(); TreePath tp = calltree.getSelectionPath(); DefaultMutableTreeNode dn; if ((tp != null) && (tp.getPathCount() > 1)) { dn = (DefaultMutableTreeNode) tp.getLastPathComponent(); if (dn instanceof CT_TreeNode) { ID = ((CT_TreeNode) dn).ID; cstack = ((CT_TreeNode) dn).stack; } } if (ID >= 0) { clause = "(" + ID + ")"; String stack = "USTACK"; if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.MACHINE) { stack = "MSTACK"; } if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.EXPERT) { stack = "XSTACK"; } if (action.equals(STR_ACTION_REMOVE_ALL_FILTERS)) { clause = "1"; } if (action.equals(FILTER_NAME_ACTION_NAME)) { clause = window.getObjNameV2(ID); clause = "(FNAME(\".*" + clause + ".*\") SOME IN " + stack + ")"; } if (action.equals(FILTER_SELECTED_FUNCTION_ACTION_NAME)) { clause = "(" + clause + " IN " + stack + ")"; } if (action.equals(FILTER_SELECTED_LEAF_ACTION_NAME)) { // clause = "(LEAF IN " + clause + ")"; clause = "((" + stack + "+0) IN " + clause + ")"; } if (action.equals(FILTER_SELECTED_BRANCH_ACTION_NAME)) { if ((cstack != null) && (cstack.length > 0)) { clause = "("; for (int i = 0; ; ) { clause = clause + cstack[i]; if (++i < cstack.length) { clause = clause + ","; } else { clause = clause + ")"; break; } } clause = "(" + clause + " ORDERED IN " + stack + ")"; } } if (action.equals(FILTER_NOT_SELECTED_BRANCH_ACTION_NAME)) { if ((cstack != null) && (cstack.length > 0)) { clause = "("; for (int i = 0; ; ) { clause = clause + cstack[i]; if (++i < cstack.length) { clause = clause + ","; } else { clause = clause + ")"; break; } } clause = "(!(" + clause + " ORDERED IN " + stack + "))"; } } } return clause; } // CallTree tree private class CT_Tree extends JTree { private CT_TreeRenderer renderer; public CT_Tree() { super(); init(); } public CT_Tree(TreeNode root) { super(root); init(); } private void init() { AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Call Tree")); if (AnEnvironment.isLFNimbus()) { setBackground(AnEnvironment.NIMBUS_TREE_BACKGROUND); } ((DefaultTreeCellRenderer) getCellRenderer()).setLeafIcon(null); ((DefaultTreeCellRenderer) getCellRenderer()).setClosedIcon(null); ((DefaultTreeCellRenderer) getCellRenderer()).setOpenIcon(null); renderer = new CT_TreeRenderer(); setCellRenderer(renderer); } // Call Tree cell renderer private final class CT_TreeRenderer extends DefaultTreeCellRenderer { public Component getTreeCellRendererComponent( final JTree tree, Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { final Object object; Icon icon = null; setLeafIcon(null); setClosedIcon(null); setOpenIcon(null); if (value instanceof DefaultMutableTreeNode) { object = value; // NM ((DefaultMutableTreeNode) value).getUserObject(); if (object instanceof CT_TreeNode) { final CT_TreeNode item = (CT_TreeNode) object; value = item.getText(); if (show_colorbars) { icon = item.getIcon(); } if (show_tooltips) { setToolTipText(metricName + value); } } else if (object instanceof JComponent) { // FINDBUGS: reports this is always false. Is there a JComponent that is a // DefaultMutableTreeNode? return (Component) object; } } super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (icon != null) { setIcon(icon); } return this; } } } // CallTree icons private static ImageIcon p_icon[] = new ImageIcon[101]; private static void cleanMetricIcons() { for (int i = 0; i < p_icon.length; i++) { p_icon[i] = null; } } // CallTree node private class CT_TreeNode extends DefaultMutableTreeNode { private String sname; private long ID; private long[] stack; private double inclusive = 0.0; private AnObject incValue; private double exclusive; private int callees; private int inc_percent = 0; private String text = null; private javax.swing.Icon icon = null; public CT_TreeNode(String name, boolean b) { super(name, b); this.sname = name; callees = -1; } // To String public String toString() { return getText(); } // Get text public String getText() { if (null == text) { text = generateTextAndIcon(); } return text; } // Get icon public Icon getIcon() { if (null == icon) { int n = inc_percent; if (n < 1) { return null; } if (n > 100) { n = 100; } if (null == p_icon[n]) { String metric = metricCommandName; int height = 10; // 10 should be replaced with Font height p_icon[n] = getImageIconBar(metric, n, height); } icon = p_icon[n]; } return icon; } /** * Set Inclusive Value * * @param value */ public void setInclusiveValue(AnObject value) { this.incValue = value; if (null != incValue) { inclusive = incValue.doubleValue(); } } // Set Exclusive Value public void setExclusiveValue(double value) { exclusive = value; } // Set Name public void setName(String name) { sname = name; } public String generateTextAndIcon() { double adjustment = 0.0005; double inclusive_value = inclusive; if (inclusive_value > 0.0) { inclusive_value = inclusive_value + adjustment; } // Code to generate visible node name String m = ""; if (convertHWCtoTime) { inclusive_value = inclusive_value * clock_frequency; // "clock_frequency" is 1/frequency } if (show_inclusive) { m = " " + incValue.toString(); } if (show_percentage) { int percentage = 0; if (tnTotal != null) { double total_incValue = tnTotal.incValue.doubleValue(); if (total_incValue > 0.) { if (total_incValue != inclusive) { double d = inclusive * 100 / total_incValue; percentage = (int) (d + 0.49); } else { percentage = 100; } m += " (" + percentage + "%) "; } } inc_percent = percentage; // To pick appropriate icon } String s = " " + m + " " + sname; // + " (ID=" + ID + ")"; return s; } } /* * Add a node to the Call Tree */ private void CT_AddTreeNode(final DefaultMutableTreeNode parent, final CT_TreeNode tn) { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { parent.add(tn); // PERFORMANCE: 30% real time, call from CT_BuildSubTree } }); } /* * Add nodes to the Call Tree */ private void CT_AddTreeNodes(final CT_TreeNode parent, final CT_TreeNode[] tns) { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { if (parent.callees < 0) { parent.callees = 0; } parent.callees += tns.length; for (int i = 0; i < tns.length; i++) { parent.add(tns[i]); // PERFORMANCE: ?% real time, call from CT_BuildSubTree } } }); } /* * Remove a node from the Call Tree */ private void CT_RemoveTreeNode_notused(final DefaultMutableTreeNode parent, final int nodeIndex) { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { parent.remove(nodeIndex); } }); } /** Collapse all tree nodes */ public void CT_CollapseTree() { final JTree t = calltree; AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { int row = t.getMaxSelectionRow(); if (row < 1) { row = 1; // Do not collapse root node } for (; row >= 1; row--) { t.collapseRow(row); } } }); } /** Collapse selected node */ public void CT_CollapseNode() { final JTree t = calltree; AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { int row = t.getMaxSelectionRow(); if (row < 1) { row = 1; // Do not collapse root node } t.collapseRow(row); } }); } /** Build the Call Tree */ public DefaultMutableTreeNode CT_BuildTree( JTree tree, int maxlevel, int threshold, long ID_to_expand) { Object[] raw_data; CT_TreeNode tn; DefaultMutableTreeNode anode; DefaultMutableTreeNode node_to_expand = null; Vector<CT_TreeNode> nextNodes; Vector<CT_TreeNode> prevNodes; String nodeName; double minValue = 0.0; AnObject[] incMetrics = null; // long t = System.currentTimeMillis(); // DEBUG anode = rootnode; if (anode.getChildCount() > 0) { // Collapse all tree nodes CT_CollapseTree(/*calltree*/ ); // Reset selection calltree.clearSelection(); } // Step 1: add <Total> // get call stack with one element: <Total> ct_callstack = new CT_CallStack(); raw_data = getCalleeList(null); ct_callstack.append(0); // get callers of <Total> - this is necessary to initialize data long[] cstack = ct_callstack.getIDs(); raw_data = getCallerList(cstack); // to initialize name_col, metric_col and sort_col CT_UpdateTitle(); cstack = ct_callstack.getIDs(); String[] names = ct_callstack.getNames(); nodeName = names[0]; raw_data = getFuncItemData(cstack); // getFuncItemData() creates func_data if (func_data[metric_col] instanceof AnObject[]) { incMetrics = (AnObject[]) func_data[metric_col]; show_inclusive = true; show_percentage = true; if (incMetrics instanceof AnAddress[]) { show_percentage = false; } // If sort metric is IPC or CPI - don't show percentage if (null != metricName) { String mn1 = "Instructions Per Cycle"; String mn2 = AnLocale.getString("Attributed ") + mn1; if (metricName.equals(mn1) || metricName.equals(mn2)) { show_percentage = false; } if (false != show_percentage) { mn1 = "Cycles Per Instruction"; mn2 = AnLocale.getString("Attributed ") + mn1; if (metricName.equals(mn1) || metricName.equals(mn2)) { show_percentage = false; } } } } else { // Names only. Don't show metric value and percentage show_inclusive = false; show_percentage = false; } // build the node as CT_TreeNode. We need a synchronization here if (tnTotal == null) { tnTotal = new CT_TreeNode(nodeName, true); } tnTotal.ID = cstack[0]; tnTotal.stack = cstack; if ((incMetrics != null) && (incMetrics.length > 0) && (incMetrics[0] != null)) { tnTotal.setInclusiveValue(incMetrics[0]); } // System.out.println("DEBUG: CallTreeDisp.CT_BuildTree: tnTotal.ID=" + tnTotal.ID); // Remove all children // tnTotal.removeAllChildren(); if (tnTotal.getParent() == null) { CT_AddTreeNode(rootnode, tnTotal); // Should be here only once! } if (node_to_expand == null) { if (tnTotal.ID == ID_to_expand) { node_to_expand = tnTotal; } } prevNodes = new Vector<CT_TreeNode>(1); prevNodes.add(tnTotal); int nrows = prevNodes.size(); int progress = 1; window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Initializing call tree")); // Step 2: add callees to tnTotal node nextNodes = new Vector<CT_TreeNode>(0); // Next level nodes int level = 1; for (int row = 0; /* row < nrows */ ; ) { // We don't know yet how many rows this tree will have CT_TreeNode dn = prevNodes.elementAt(row); CT_TreeNode[] tns = getChildrenOfTreeNode(dn, false); if (++progress > 98) { progress = 98; } else { window .getSystemProgressPanel() .setProgress(progress, AnLocale.getString("Initializing call tree")); } // add children for (int i = 0; i < tns.length; i++) { tn = tns[i]; // Add this node to the Call Tree // NM ((DefaultMutableTreeNode) prevNodes.elementAt(row)).add(tn); // NM Use AWT-thread to add nodes final DefaultMutableTreeNode parent; final CT_TreeNode child = tn; parent = ((DefaultMutableTreeNode) prevNodes.elementAt(row)); CT_AddTreeNode(parent, child); if ((minValue > 0.0) && (tn.inclusive < minValue)) { // TEMPORARY // Do not expand this node - // its value is less than threshold // try to add its children addChildren(tn); } else { // Save for the next level nextNodes.add(tn); } if (ID_to_expand > 0) { if (node_to_expand == null) { // Not found yet if (tn.ID == ID_to_expand) { node_to_expand = tn; } } } } if (++row == nrows) { // this level is done, go one level deeper // System.out.println("DEBUG: CallTreeDisp.CT_BuildTree: level=" + level + " is done."); if (++level > maxlevel) { // We are done, the tree is built deep enough // NM Add fake child to each "leaf" node for future for (int i = 0; i < nextNodes.size(); i++) { tn = nextNodes.elementAt(i); // try to add its children addChildren(tn); } break; } nrows = nextNodes.size(); if (nrows == 0) { // We are done, the tree is built break; } prevNodes = nextNodes; nextNodes = new Vector<CT_TreeNode>(0); // Next level nodes row = 0; } cstack = prevNodes.elementAt(row).stack; ct_callstack.setIDs(cstack); } // Finally add all nodes to the tree // Probably we have to use EventDispatchThread there // ((DefaultMutableTreeNode)tree.getModel().getRoot()).add(tnTotal); window.getSystemProgressPanel().setProgress(99, AnLocale.getString("Initializing call tree")); return node_to_expand; } private void CT_ExpandAllCallStacksForID(long id) { // Expand all branches that contain this id final Vector<long[]> cstacks = CT_FindAllCallStacksForID(id); // IPC if (cstacks != null) { int len = cstacks.size(); for (int i = 0; i < len; i++) { long[] cstack = cstacks.elementAt(i); if ((cstack != null) && (cstack.length > 0)) { CT_ExpandBranch( calltree, tnTotal, cstack.length + 1 /*level*/, 0 /*no threshold*/, -1 /*no select*/, cstack); } } } } /** * Find Call Stack For ID * * @param id * @return stack */ private long[] CT_FindCallStackForID(long id) { if (id <= 0) { return null; } long[] stack = new long[1]; stack[0] = id; long[] cstack = CT_FindCallStackForStackFragment(stack); return cstack; } /** * Find Call Stack For Stack Fragment * * @return stack */ private long[] CT_FindCallStackForStackFragment(long[] stack) { if (null == stack || stack.length <= 0) { return null; } CT_TreeNode total = tnTotal; if (null == total) { return null; } long totalID = total.ID; // build call stack up to <Total> CT_CallStack callstack = new CT_CallStack(); long[] cstack = stack; // new long[1]; callstack.setIDs(cstack); Object[] raw_data = getCallerList(cstack); // IPC, updates ids_callers while ((ids_callers != null) && (ids_callers.length > 0)) { callstack.prepend(0); cstack = callstack.getIDs(); if (cstack[0] == totalID) { break; } raw_data = getCallerList(cstack); // IPC, updates ids_callers } return cstack; } /** * Find All Call Stacks For ID * * @param id * @return Vector */ private Vector<long[]> CT_FindAllCallStacksForID(long id) { // Get all callers long[] stack = new long[1]; stack[0] = id; CT_TreeNode total = tnTotal; if (null == total) { return null; } long totalID = total.ID; Vector<long[]> v = new Vector<long[]>(); CT_FindAllCallStacksForStackFragment(stack, totalID, v); return v; } /** * Find All Call Stacks For StackFragment. Recursive. Updates Vector. * * @param stack * @param total * @param Vector */ private void CT_FindAllCallStacksForStackFragment(long[] stack, long total, Vector<long[]> v) { CT_CallStack callstack = new CT_CallStack(); callstack.setIDs(stack); getCallerList(stack); // IPC. Updates ids_callers if ((ids_callers == null) || (0 >= ids_callers.length)) { return; } long[] callers = new long[ids_callers.length]; // need a copy for (int i = 0; i < ids_callers.length; i++) { callers[i] = ids_callers[i]; } // Get all call stacks for (int i = 0; i < callers.length; i++) { long[] cstack = new long[stack.length + 1]; // a copy + caller cstack[0] = callers[i]; for (int j = 0; j < stack.length; j++) { cstack[j + 1] = stack[j]; } if (total == callers[i]) { v.add(cstack); // Add call stack continue; } CT_FindAllCallStacksForStackFragment(cstack, total, v); } return; } /* * Rebuild the Call Tree */ public DefaultMutableTreeNode CT_RebuildTree(int maxlevel, int threshold, long ID_to_expand) { Object[] raw_data; CT_TreeNode tn; DefaultMutableTreeNode anode; DefaultMutableTreeNode node_to_expand = null; Vector<CT_TreeNode> nextNodes; Vector<CT_TreeNode> prevNodes; // double minValue = 0.0; AnObject[] incMetrics = null; // long t = System.currentTimeMillis(); // DEBUG // Initialize name_col, metric_col and sort_col if (ct_callstack == null) { ct_callstack = new CT_CallStack(); } else { ct_callstack.reset(); } long[] cstack = ct_callstack.getIDs(); raw_data = getCallerList(cstack); if ((rootnode == null) || (tnTotal == null)) { return node_to_expand; // The tree is not initialized yet } CT_UpdateTitle(); anode = rootnode; if (anode.getChildCount() > 0) { // Collapse all tree nodes // CT_CollapseTree(); // Reset selection // calltree.clearSelection(); } // Step 1: update <Total> cstack = new long[1]; cstack[0] = tnTotal.ID; /* raw_data = */ getFuncItemData(cstack); // getFuncItemData() creates func_data if (func_data[metric_col] instanceof AnObject[]) { incMetrics = (AnObject[]) func_data[metric_col]; show_inclusive = true; show_percentage = true; if (incMetrics instanceof AnAddress[]) { show_percentage = false; } // If sort metric is IPC or CPI - don't show percentage if (null != metricName) { String mn1 = "Instructions Per Cycle"; String mn2 = AnLocale.getString("Attributed ") + mn1; if (metricName.equals(mn1) || metricName.equals(mn2)) { show_percentage = false; } if (false != show_percentage) { mn1 = "Cycles Per Instruction"; mn2 = AnLocale.getString("Attributed ") + mn1; if (metricName.equals(mn1) || metricName.equals(mn2)) { show_percentage = false; } } } } else { // Names only. Don't show metric value and percentage show_inclusive = false; show_percentage = false; } // tnTotal.ID = cstack[0]; // tnTotal.stack = cstack; if ((incMetrics != null) && (incMetrics.length > 0) && (incMetrics[0] != null)) { tnTotal.setInclusiveValue(incMetrics[0]); } // Step 2: update tnTotal children prevNodes = new Vector<CT_TreeNode>(1); prevNodes.add(tnTotal); int nrows = prevNodes.size(); nextNodes = new Vector<CT_TreeNode>(0); // Next level nodes int level = 1; for (int row = 0; /* row < nrows */ ; ) { { // new version CT_TreeNode pn = prevNodes.elementAt(row); CT_TreeNode[] tns = getChildrenOfTreeNode(pn, false); // update children CT_TreeNode child = null; int k = pn.getChildCount(); for (int i = 0; i < k; i++) { boolean found = false; child = (CT_TreeNode) pn.getChildAt(i); for (int j = 0; j < tns.length; j++) { tn = tns[j]; if (child.ID == tn.ID) { child.setInclusiveValue(tn.incValue); child.inclusive = tn.inclusive; child.exclusive = tn.exclusive; child.sname = tn.sname; child.stack = tn.stack; found = true; break; } } nextNodes.add(child); if (!found) { // Child is filtered out. Ideally we shall remove it. child.inclusive = 0.0; // TEMPORARY child.exclusive = 0.0; // TEMPORARY continue; } if (ID_to_expand > 0) { if (node_to_expand == null) { if (child.ID == ID_to_expand) { node_to_expand = child; } } } } } // end of new version if (++row == nrows) { // this level is done, go one level deeper // System.out.println("DEBUG: CallTreeDisp.CT_RebuildTree: level=" + level + " is done."); if (++level > maxlevel) { break; } nrows = nextNodes.size(); if (nrows == 0) { // We are done, the tree is rebuilt break; } prevNodes = nextNodes; nextNodes = new Vector<CT_TreeNode>(0); // Next level nodes row = 0; } cstack = prevNodes.elementAt(row).stack; ct_callstack.setIDs(cstack); } // t = System.currentTimeMillis() - t; // System.out.println("DEBUG: CallTreeDisp.CT_BuildTree(maxlevel=" + maxlevel + "): time=" + t + // " mls."); return node_to_expand; } /* * Build a subtree of the Call Tree */ public void CT_BuildSubTree(DefaultMutableTreeNode start_node, int maxlevel) { long[] cstack; CT_TreeNode tn; CT_TreeNode[] tns; Vector<CT_TreeNode> nextNodes; Vector<CT_TreeNode> prevNodes; if (!(start_node instanceof CT_TreeNode)) { // root node return; } CT_TreeNode sn = (CT_TreeNode) start_node; // long t = System.currentTimeMillis(); // DEBUG // Step 1: add start_node prevNodes = new Vector<CT_TreeNode>(); prevNodes.add(sn); int nrows = prevNodes.size(); cstack = sn.stack; ct_callstack.setIDs(cstack); // Step 2: add callees to start_node node nextNodes = new Vector<CT_TreeNode>(); // Next level nodes int level = 1; boolean already_has_children; for (int row = 0; /* row < nrows */ ; ) { CT_TreeNode dn = prevNodes.elementAt(row); // addChildren(dn); // To make sure this node is initialized int len = dn.getChildCount(); already_has_children = false; if (len == 0) { // try to get children tns = getChildrenOfTreeNode(dn, false); len = tns.length; } else { already_has_children = true; tns = new CT_TreeNode[len]; for (int i = 0; i < len; i++) { tns[i] = (CT_TreeNode) dn.getChildAt(i); } } // add children if ((!already_has_children) && (len > 0)) { CT_AddTreeNodes(dn, tns); // PERFORMANCE: ?% Total Thread Time } for (int i = 0; i < len; i++) { tn = tns[i]; // Add this node to the Call Tree // ((DefaultMutableTreeNode)prevNodes.elementAt(row)).add(tn); // if (!already_has_children) { // //NM dn.add(tn); // //NM Use AWT-thread to add nodes // final DefaultMutableTreeNode parent = dn; // final CT_TreeNode child = tn; // CT_AddTreeNode(parent, child); // PERFORMANCE: 60% Total Thread Time // } // Save for the next level nextNodes.add(tn); } if (++row == nrows) { // this level is done, go one level deeper // System.out.println("DEBUG: CallTreeDisp.CT_BuildTree: level=" + level + " is done."); if (++level > maxlevel) { // We are done, the tree is built deep enough break; } nrows = nextNodes.size(); if (nrows == 0) { // We are done, the tree is built break; } prevNodes = nextNodes; nextNodes = new Vector<CT_TreeNode>(); // Next level nodes row = 0; } cstack = prevNodes.elementAt(row).stack; ct_callstack.setIDs(cstack); } // t = System.currentTimeMillis() - t; // System.out.println("DEBUG: CallTreeDisp.CT_BuildSubTree(maxlevel=" + maxlevel + "): time=" + // t + " mls."); } /* * Get Children */ private CT_TreeNode[] getChildrenOfTreeNode(CT_TreeNode dn, boolean addFakeChild) { CT_TreeNode[] children = new CT_TreeNode[0]; long[] cstack = dn.stack; long ID = -1; AnObject[] incMetrics = null; Object[] raw_data = getCalleeList(cstack); // IPC if ((callee_data != null) && (callee_data.length > 0)) { if (callee_data[metric_col] instanceof AnObject[]) { incMetrics = (AnObject[]) callee_data[metric_col]; } int len = callee_data[0].length; children = new CT_TreeNode[len]; for (int i = 0; i < len; i++) { // Get my ID if (raw_data[raw_data.length - 1] instanceof long[]) { ID = ((long[]) raw_data[raw_data.length - 1])[i]; } // Create my stack long[] my_stack = new long[cstack.length + 1]; my_stack[cstack.length] = ID; for (int k = 0; k < cstack.length; k++) { my_stack[k] = cstack[k]; } // build the node as CT_TreeNode String nodeName = (String) callee_data[name_col][i]; CT_TreeNode tn = new CT_TreeNode(nodeName, true); tn.ID = ID; tn.stack = my_stack; if (incMetrics != null && incMetrics.length > i) { tn.setInclusiveValue(incMetrics[i]); } tn.exclusive = 0.0; // TEMPORARY // Add this node to the Call Tree children[i] = tn; } dn.callees = callee_data.length; } else { dn.callees = 0; } return children; } /* * Expand the Call Tree */ public CT_TreeNode CT_ExpandTree( JTree tree, DefaultMutableTreeNode dn, int level, int threshold, long id) { if (dn == null) { dn = tnTotal; } long[] cstack = null; return (CT_ExpandBranch( tree, dn, level, threshold, id, cstack)); // PERFORMANCE: 60% real time, call from CT_ExpandAllBranches } /** * Expand the selected branch of the Call Tree * * @param tree * @param anode - node to expand * @param level * @param threshold * @param id * @return node with specified id */ public CT_TreeNode CT_ExpandBranch( JTree tree, DefaultMutableTreeNode anode, int level, int threshold, final long id, final long[] cstack) { CT_TreeNode select_node = null; if (anode == null) { return select_node; // Branch is not specified } if (anode instanceof CT_TreeNode) { if (id >= 0) { if (((CT_TreeNode) anode).ID == id) { select_node = (CT_TreeNode) anode; } } } int csindex = 0; int K = 1000; // will be increased in the loop if necessary CT_TreeNode total = tnTotal; if (total == null) { return null; // nothing to expand } double minValue = (total.inclusive / 100.0) * threshold; // TEMPORARY // int progress = 0; // window.setProgress(progress, "Expanding branch"); for (int i = 1; ; ) { CT_BuildSubTree(anode, 2); // NM Need 2 levels deep if (anode.getChildCount() == 0) { // try to add its children addChildren(anode); // NM Not needed anymore? } // if (++progress > 98) { // progress = 98; // } // window.setProgress(progress, "Expanding branch"); if (anode.getChildCount() > 0) { if (cstack != null) { // Find next node csindex++; if (csindex >= cstack.length) { break; // we are done } try { CT_TreeNode tn = (CT_TreeNode) anode.getChildAt(0); int len = anode.getChildCount(); for (int k = 1; k < len; k++) { if (tn.ID == cstack[csindex]) { break; // found } tn = (CT_TreeNode) anode.getChildAt(k); } if (tn.ID == cstack[csindex]) { anode = tn; // Found next node } else { return null; // Should never be here } } catch (Exception e) { // Not a CT_TreeNode in the tree return null; // Should never be here } } else { // Follow top node anode = (DefaultMutableTreeNode) anode.getChildAt(0); } if (level > 0) { if (i >= level) { CT_BuildSubTree(anode, 2); if (anode.getChildCount() == 0) { // try to add its children addChildren(anode); } break; } } if (++i >= K) { // System.out.println("DEBUG: CallTreeDisp.expandBranch(level=" + K + ")"); K += K; } if (anode instanceof CT_TreeNode) { if (id >= 0) { if (((CT_TreeNode) anode).ID == id) { if (null == select_node) { select_node = (CT_TreeNode) anode; } } } double d = ((CT_TreeNode) anode).inclusive; if (d < minValue) { CT_BuildSubTree(anode, 2); if (anode.getChildCount() == 0) { // try to add its children addChildren(anode); } break; } } if (!selected) { // TEMPORARY code to interrupt break; } if (stop_expanding) { // Stop expanding break; } continue; } break; } TreeNode[] pathnodes = anode.getPath(); if (null != select_node) { pathnodes = select_node.getPath(); } TreePath anodepath = new TreePath(pathnodes); if (tree == null) { // old code calltree.expandPath(anodepath); calltree.setSelectionPath(anodepath); } else { // use AWT final JTree t = calltree; final TreePath ap = anodepath; final boolean preserve_select; if (null == select_node) { preserve_select = true; } else { preserve_select = false; } // Use SwingUtilities to update tree AnUtility.dispatchOnSwingThread( new Runnable() { // @Override public void run() { // PERFORMANCE: 60% real time, call from CT_ExpandTree (Expand All Branches) try { skip_build_subtree.set(true); // NM TEMPORARY Protection against infinite loop try { TreePath sp = t.getSelectionPath(); t.expandPath(ap); t.setSelectionPath(ap); // Scroll if necessary if (null != cstack) { // Not a good check, need a special flag for this int select_row = t.getRowForPath(ap); showSelectedRow(select_row); } // Restore selection if necessary if (preserve_select && null != sp) { t.setSelectionPath(sp); } } finally { skip_build_subtree.set(false); // NM TEMPORARY Remove protection } } catch (Exception exc) { System.err.println("CallTreeDisp.CT_ExpandBranch() exception: " + exc); exc.printStackTrace(); } } }); } // window.setProgress(100, "Expanding branch"); return select_node; } /** * Expands All Branches * * @param tree * @param anode * @param level * @param threshold * @param id * @return node to select */ public CT_TreeNode CT_ExpandAllBranches( JTree tree, DefaultMutableTreeNode anode, int level, int threshold, long id) { CT_TreeNode select_node = null; CT_TreeNode found_node = null; CT_TreeNode top_level_node; TreePath select_path = null; if (anode == null) { anode = tnTotal; if (anode == null) { return null; } } // int progress = 0; // window.setProgress(progress, "Expanding all branches"); if (id >= 0) { top_level_node = (CT_TreeNode) anode; if (top_level_node.ID == id) { select_node = top_level_node; } } else { // Remember selected path select_path = calltree.getLeadSelectionPath(); } CT_TreeNode total = tnTotal; if (total == null) { return null; // nothing to expand } double minValue = (total.inclusive / 100.0) * threshold; // TEMPORARY int max = calltree.getRowCount(); skip_update_summary = true; // Optimization // Experiment: first, expand hottest branch long[] cstack = null; CT_ExpandBranch(calltree, tnTotal, level, threshold, id, cstack); for (int i = 1; i < max; i++) { if (stop_expanding) { // Stop expanding break; } TreePath tp = calltree.getPathForRow(i); if (!(tp.getLastPathComponent() instanceof CT_TreeNode)) { continue; } CT_TreeNode node = (CT_TreeNode) tp.getLastPathComponent(); double d = node.inclusive; if ((id >= 0) && (select_node == null)) { if (node.ID == id) { select_node = node; } } if (d < minValue) { continue; } if (node.callees < 0) { // try to add its children addChildren(node); } if (node.getChildCount() == 0) { max = calltree.getRowCount(); continue; } int exp_threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int exp_level = 1; // 1 level long exp_id = -1; if (null == found_node) { exp_id = id; } found_node = CT_ExpandTree(calltree, node, exp_level, exp_threshold, exp_id); // need CT_ExpandNode() max = calltree.getRowCount(); } // End of loop - the tree is expanded skip_update_summary = false; // Restore selected object if (null == select_node) { if (null != select_path) { calltree.setLeadSelectionPath(select_path); int row = calltree.getLeadSelectionRow(); if ((tree.getLastSelectedPathComponent() instanceof CT_TreeNode)) { // Set Selected Object and update Summary CT_TreeNode ctn = (CT_TreeNode) tree.getLastSelectedPathComponent(); final long ID = ctn.ID; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { ct_callstack.setSelectedObject(ID); window.getSelectionManager().updateSelection(); } }, "call tree selection"); } // calltree.setSelectionRow(row); showSelectedRow(row); } } // window.setProgress(100, "Expanding all branches"); return select_node; } /* * Switch to the Source view */ private void CT_ShowSource() { window.setSelectedView(AnDisplay.DSP_Source); } /* * Switch to the Disassembly view */ private void CT_ShowDisasm() { window.setSelectedView(AnDisplay.DSP_Disassembly); } /** Performs default action for double click */ private void performDefaultAction() { CT_ShowSource(); } // ==================================================== // // Listeneres and event handlers // // ==================================================== // /** * Inner class which listens for expansion events on the tree. When one is received, it will get * the path of the selected node and add sub directory nodes, if any, to it. */ class CallTreeExpansionListener implements TreeExpansionListener { /** Called whenever an item in the tree has been expanded. */ public void treeExpanded(TreeExpansionEvent event) { valueChanged(event); } /** Called whenever an item in the tree has been collapsed. */ public void treeCollapsed(TreeExpansionEvent event) { // valueChanged(event); } public void valueChanged(final TreeExpansionEvent tee) { // NM TEMPORARY Protection against infinite loop: // check that we are expanding a freshly built tree if (skip_build_subtree.get()) { return; } // NM TEMPORARY Cannot use a worker thread - desynchronization with AWT thread: // final boolean use_thread = true; // AnUtility.dispatchOnAWorkerThread(new Runnable() { // @Override // public void run() { // valueChanged(tee, use_thread); // } // }, "CallTree_thread"); // } // // private void valueChanged(TreeExpansionEvent tee, boolean use_thread) { // get the selected tree path TreePath path = tee.getPath(); // check that a path is in fact selected if (path == null) { return; } // get the last node DefaultMutableTreeNode curNode = (DefaultMutableTreeNode) path.getLastPathComponent(); // add children to the selected node if (curNode.getChildCount() == 0) { addChildren(curNode); } for (int i = 0; i < curNode.getChildCount(); i++) { addChildren((DefaultMutableTreeNode) curNode.getChildAt(i)); } } } /** * Inner class which listens for selection events on the tree. When one is received, it will get * the path of the selected node and add sub directory nodes, if any, to it. */ class CallTreeSelectionListener implements TreeSelectionListener { @Override public void valueChanged(final TreeSelectionEvent tse) { // NM TEMPORARY Protection against infinite loop: // check that we are expanding a freshly built tree if (skip_build_subtree.get()) { return; } // NM TEMPORARY Cannot use a worker thread - desynchronization with AWT thread: // final boolean use_thread = true; // AnUtility.dispatchOnAWorkerThread(new Runnable() { // @Override // public void run() { // valueChanged(tse, use_thread); // } // }, "CallTree_thread"); // } // // private void valueChanged(TreeSelectionEvent tse, boolean use_thread) { // get the selected tree path TreePath path = tse.getNewLeadSelectionPath(); // check that a path is in fact selected if (path == null) { return; } // get the selected node DefaultMutableTreeNode curNode = (DefaultMutableTreeNode) path.getLastPathComponent(); // get all the nodes in the selected tree path // Object nodes[] = path.getPath(); if (!(curNode instanceof CT_TreeNode)) { // root node return; } // add children to the selected node if (curNode.getChildCount() == 0) { addChildren(curNode); } if (!skip_update_summary) { // Update Summary final long ID = ((CT_TreeNode) curNode).ID; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { ct_callstack.setSelectedObject(ID); window.getSelectionManager().updateSelection(); } }, "call tree selection"); } } } /** * Adds the subnodes, if any, of the given path to the given node. * * @param node tree node to add sub directory nodes to */ protected void addChildren(DefaultMutableTreeNode node) { synchronized (CallTreeLock) { if (!(node instanceof CT_TreeNode)) { return; // Not our node } final CT_TreeNode dn = (CT_TreeNode) node; // add sub nodes to given node if (dn != null) { if (dn.callees < 0) { // Not initialized yet // try to get children final CT_TreeNode[] tns = getChildrenOfTreeNode(dn, true); // IPC dn.callees = tns.length; // update internal children counter if (tns.length > 0) { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { for (int i = 0; i < tns.length; i++) { dn.add(tns[i]); } } }); } } } } } // ==================================================== // // Wrappers for native methods from liber_dbe.so // // ==================================================== // // Get row Table Data private Object[] getTableData( final String mlistStr, final String modeStr, final String typeStr, final String subtypeStr, final long[] cstack) { // long t = System.currentTimeMillis(); AnUtility.checkIPCOnWrongThread(false); Object[] data = window.getTableDataV2(mlistStr, modeStr, typeStr, subtypeStr, cstack); AnUtility.checkIPCOnWrongThread(true); // t = System.currentTimeMillis() - t; // if (t > 100) { // System.out.println("DEBUG: CallTreeDisp.getTableData(" + modeStr + "): time=" + t + " mls."); // } return data; } /** * Get Callee List. Uses IPC call. * * @param cstack * @return list */ private Object[] getCalleeList(final long[] cstack) { Object[] raw_data_with_ids = getTableData(mlistStr, stab_callees, typeStrFunction, subtypeStr, cstack); ids_callees = (long[]) raw_data_with_ids[raw_data_with_ids.length - 1]; Object[] raw_data = new Object[raw_data_with_ids.length]; for (int i = 0; i < raw_data.length; i++) { raw_data[i] = raw_data_with_ids[i]; } raw_data[raw_data.length - 1] = null; callee_data = localProcessData(raw_data); name_col = window.getSettings().getMetricsSetting().getNameColumnIndexByDType(type); if (name_col < 0) { name_col = 0; } if ((callee_data.length > name_col) && (callee_data[name_col] instanceof String[])) { // Ok. } else { // Hack: find name column for (int i = 0; i < callee_data.length; i++) { if (callee_data[i] instanceof String[]) { name_col = i; } } } return raw_data_with_ids; } // Get function item data private Object[] getFuncItemData(final long[] cstack) { Object[] raw_data_with_ids = getTableData(mlistStr, stab_self, typeStrFunction, subtypeStr, cstack); Object[] raw_data = new Object[raw_data_with_ids.length]; for (int i = 0; i < raw_data.length; i++) { raw_data[i] = raw_data_with_ids[i]; } raw_data[raw_data.length - 1] = null; func_data = localProcessData(raw_data); return raw_data_with_ids; } // Get callers data list private Object[] getCallerList(final long[] cstack) { Object[] raw_data_with_ids = getTableData(mlistStr, stab_callers, typeStrFunction, subtypeStr, cstack); ids_callers = (long[]) raw_data_with_ids[raw_data_with_ids.length - 1]; Object[] raw_data = new Object[raw_data_with_ids.length]; for (int i = 0; i < raw_data.length; i++) { raw_data[i] = raw_data_with_ids[i]; } raw_data[raw_data.length - 1] = null; caller_data = localProcessData(raw_data); caller_label = window .getSettings() .getMetricsSetting() .getLabel(caller_data, getTotalMax(), DSP_CallTree, caller); name_col = window.getSettings().getMetricsSetting().getNameColumnIndexByDType(type); if (name_col < 0) { name_col = 0; } if ((caller_data.length > name_col) && (caller_data[name_col] instanceof String[])) { // Ok. } else { for (int i = 0; i < caller_data.length; i++) { if (caller_label[i].getAnMetric().isNameMetric()) { name_col = i; } } } if ((sort_col < 0) || (caller_data.length <= sort_col)) { sort_col = window.getSettings().getMetricsSetting().getSortColumnByDType(DSP_CallTree); if ((sort_col < 0) || (caller_data.length <= sort_col)) { sort_col = 0; // NM: Can we ever get there? Why? } } metric_col = sort_col; if (name_col == metric_col) { if (previous_metric_col >= 0 && (caller_data.length > previous_metric_col)) { metric_col = previous_metric_col; // Set previous metric } } else { previous_metric_col = metric_col; // Save metric column } // Check if cycles should be converted to time convertHWCtoTime = false; if (caller_label.length > metric_col) { if (caller_label[metric_col].getClock() != -1.0) { clock_frequency = caller_label[metric_col].getClock(); convertHWCtoTime = true; } } metricName = caller_label[metric_col].getAnMetric().getName(); if ((null == metricCommandName) || !metricCommandName.equals(caller_label[metric_col].getAnMetric().getComd())) { metricCommandName = caller_label[metric_col].getAnMetric().getComd(); cleanMetricIcons(); } return raw_data_with_ids; } // ==================================================== // // CallStack actions // // ==================================================== // private final class CT_CallStack { long[] ids = new long[0]; String[] names = new String[0]; long selectionTime = 0; // NM String lastFilter = null; long last_ID = -1; AnTable last_selected_table = null; int last_selected_row = -1; public void append(int index) { if ((ids_callees == null) || (index >= ids_callees.length)) { // System.err.println("ERROR: CT_CallStack.append(" + index + ")"); return; } long ID = ids_callees[index]; long[] new_cstack = new long[ids.length + 1]; for (int i = 0; i < ids.length; i++) { new_cstack[i] = ids[i]; } new_cstack[new_cstack.length - 1] = ID; ids = new_cstack; String[] new_ids_names = new String[names.length + 1]; for (int i = 0; i < names.length; i++) { new_ids_names[i] = names[i]; } new_ids_names[names.length] = (String) callee_data[name_col][index]; names = new_ids_names; // Save selection // saveSelection(ID, func_item, ids.length - 1); } public void prepend(int index) { if ((ids_callers == null) || (index >= ids_callers.length)) { // System.err.println("ERROR: CT_CallStack.prepend(" + index + ")"); return; } long ID = ids_callers[index]; // last_ID = ID; long[] new_cstack = new long[ids.length + 1]; new_cstack[0] = ID; for (int i = 1; i < new_cstack.length; i++) { new_cstack[i] = ids[i - 1]; } ids = new_cstack; String[] new_ids_names = new String[names.length + 1]; for (int i = 0; i < names.length; i++) { new_ids_names[i + 1] = names[i]; } new_ids_names[0] = (String) caller_data[name_col][index]; names = new_ids_names; // Save selection // saveSelection(ID, func_item, 0); } public void remove(int index) { if ((index == 0) && (ids.length > 1)) { // Remove top function long[] new_cstack = new long[ids.length - 1]; for (int i = 1; i < ids.length; i++) { new_cstack[i - 1] = ids[i]; } // NM long ID = ids[0]; ids = new_cstack; String[] new_names = new String[names.length - 1]; for (int i = 1; i < names.length; i++) { new_names[i - 1] = names[i]; } names = new_names; // Save selection // NM saveSelection(ID, caller, -1); } if ((index > 0) && (ids.length - 1 == index)) { // Remove bottom function long[] new_cstack = new long[ids.length - 1]; for (int i = 0; i < new_cstack.length; i++) { new_cstack[i] = ids[i]; } // NM long ID = ids[ids.length - 1]; ids = new_cstack; String[] new_names = new String[names.length - 1]; for (int i = 0; i < new_names.length; i++) { new_names[i] = names[i]; } names = new_names; // Save selection // NM saveSelection(ID, callee, -1); } } public void replace(long[] stack, int index) { long ID = stack[index]; long[] new_cstack = new long[1]; new_cstack[0] = ID; ids = new_cstack; // Get name String fname = window.getObjNameV2(ID); String[] new_names = new String[1]; new_names[0] = fname; names = new_names; // Save selection // NM saveSelection(ID, func_item, 0); } public void reset() { ids = new long[0]; names = new String[0]; } public long[] getIDs() { if ((ids == null) || (ids.length == 0)) { // Get ID long ID = window.getSelectedObject().getSelObjV2(typeStrFunction); long[] new_cstack = new long[1]; new_cstack[0] = ID; ids = new_cstack; // Get name String fname = window.getObjNameV2(ID); String[] new_names = new String[1]; new_names[0] = fname; names = new_names; // Get Filter // NM lastFilter = window.getFilterStr(); // Save selection // NM saveSelection(ID, func_item, 0); } return ids; } public void setIDs(long[] stack) { ids = stack; } public String[] getNames() { if ((names == null) || (names.length == 0)) { getIDs(); } return names; } public void setNames(String[] names) { this.names = names; } public void saveSelection(long ID, AnTable table, int index) { last_ID = ID; last_selected_table = table; last_selected_row = index; } /* * Set selected object and save selection time */ private void setSelectedObject(long ID) { window.getSelectedObject().setSelObjV2(ID); selectionTime = window.getSelectedObject().getSelObjectSelectionTime(); sel_func = ID; // Save selection // NM saveSelection(ID, func_item, 0); // last_ID = ID; // last_selected_table = null; // last_selected_row = -1; } /* * Quick and durty hack to check if reset is needed */ // public boolean needReset() { // String fs = window.getFilterStr(); // if (fs != null) { // if (!fs.equals(lastFilter)) { // // Filter changed // boolean res = true; //return true; // } // } // if (selectionTime != window.getSelectedObject().getSelObjectSelectionTime()) { // // Selected Object was changed in another tab // if ((ids == null) || (ids.length <= 1)) { // // Stack is only one function // return true; // } // } // return false; // } } // CT_CallStack private String getSelectedViewDisplayName() { String ret = "Timeline"; // fallback if (window != null) { ret = window.getSelectedView().getDisplayName(); } return ret; } private void setClause(String shortName, String longName, String clause) { window .getFilters() .addClause( getSelectedViewDisplayName() + ": " + shortName, longName, clause, FilterClause.Kind.STANDARD); } /** * Update tree in CalTree tab Possible actions: Set Root - set the selected function as root (not * implemented yet). Reset Root - set <Total> as root (not implemented yet). Set Filter: Name in * Stack - set the selected function name as filter. Set Filter: Call Path in Stack - set the call * path to the selected function as filter. Set Filter: Function in Stack - set the selected * function as filter. Set Filter: Function is Leaf - set the selected function as filter. Show * Next Reference - show next node related to the selected function (same ID). Show All References * - show all nodes related to the selected function (not implemented yet). Expand Branch - expand * selected branch (with respect to current threshold). Expand Hottest Branch - expand the hottest * branch (with respect to current threshold). Expand Hot Branches - expand all hot branches (top * node >= 10%) (not implemented yet). Expand All Branches - expand all branches (with respect to * current threshold). Show Inclusive Metric - show inclusive metric (default). Show Exclusive * Metric - show exclusive metric (not implemented yet). Show Percentage - show percentage (with * respect to Total inclusive) (default). * * <p>Note: this method is invoked on a "worker" thread */ private void CT_UpdateTree(String actionName, ActionEvent ev) { DefaultMutableTreeNode dn; Object progressBarHandle = window.getSystemProgressPanel().progressBarStart(AnLocale.getString("Call Tree Update")); Choices: { if (actionName.equals(FILTER_SELECTED_BRANCH_ACTION_NAME)) { String clause = createFilterClause(actionName); setClause(FILTER_SELECTED_BRANCH_SHORT_NAME, FILTER_SELECTED_BRANCH_LONG_NAME, clause); break Choices; } else if (actionName.equals(FILTER_NOT_SELECTED_BRANCH_ACTION_NAME)) { String clause = createFilterClause(actionName); setClause( FILTER_NOT_SELECTED_BRANCH_SHORT_NAME, FILTER_NOT_SELECTED_BRANCH_LONG_NAME, clause); break Choices; } else if (actionName.equals(FILTER_SELECTED_FUNCTION_ACTION_NAME)) { String clause = createFilterClause(actionName); setClause(FILTER_SELECTED_FUNCTION_SHORT_NAME, FILTER_SELECTED_FUNCTION_LONG_NAME, clause); break Choices; } else if (actionName.equals(FILTER_SELECTED_LEAF_ACTION_NAME)) { String clause = createFilterClause(actionName); setClause(FILTER_SELECTED_LEAF_SHORT_NAME, FILTER_SELECTED_LEAF_LONG_NAME, clause); break Choices; } // if (actionName.equals(FILTER_NAME_ACTION_NAME)) { // String[] clause = new String[4]; // clause[0] = createFilterClause(FILTER_NAME_ACTION_NAME); // clause[1] = createFilterClause(FILTER_SELECTED_BRANCH_ACTION_NAME); // clause[2] = createFilterClause(FILTER_SELECTED_FUNCTION_ACTION_NAME); // clause[3] = createFilterClause(FILTER_SELECTED_LEAF_ACTION_NAME); //// window.filter.showDialog(); //// window.filter.setSelectedTab(1); // Select advanced filter tab // //window.filter.setClause(clause); // Put strings in combo box // window.filter.setClause(CALL_TREE + FILTER_NAME_SHORT_NAME, CALL_TREE + // FILTER_NAME_LONG_NAME, clause[0], true); // Put the string in text field // } // This must be done on AWT thread (see actionPerformed) if (actionName.equals(STR_ACTION_CUSTOM_FILTER)) { window.getFilters().showCustomFilterDialog(); break Choices; } if (actionName.equals(STR_ACTION_REMOVE_ALL_FILTERS)) { window.getFilters().addClause(FilterClause.getNoFiltersClause(), false); break Choices; } if (actionName.equals(STR_ACTION_UNDO_FILTER)) { window.getFilters().undoLastFilteraction(); break Choices; } if (actionName.equals(STR_ACTION_REDO_FILTER)) { window.getFilters().redoLastFilteraction(); break Choices; } if (actionName.equals(STR_ACTION_RESET)) { break Choices; } if (actionName.equals(STR_ACTION_SHOWSOURCE)) { CT_ShowSource(); break Choices; } if (actionName.equals(STR_ACTION_SHOWDISASM)) { CT_ShowDisasm(); break Choices; } if (actionName.equals(STR_ACTION_EXPANDBRANCH)) { stop_expanding_enabled = true; stop_expanding = false; final DefaultMutableTreeNode fdn; fdn = (DefaultMutableTreeNode) calltree.getLastSelectedPathComponent(); int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int level = 0; // unlimited long id = -1; long[] cstack = null; CT_ExpandBranch(calltree, fdn, level, threshold, id, cstack); stop_expanding = false; stop_expanding_enabled = false; break Choices; } if (actionName.equals(STR_ACTION_EXPANDHOTTEST)) { stop_expanding_enabled = true; stop_expanding = false; int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int level = 0; // unlimited long id = -1; long[] cstack = null; CT_ExpandBranch(calltree, tnTotal, level, threshold, id, cstack); stop_expanding = false; stop_expanding_enabled = false; break Choices; } if (actionName.equals(STR_ACTION_EXPANDHOT)) { stop_expanding_enabled = true; stop_expanding = false; int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int level = 0; // unlimited long id = -1; CT_ExpandTree(calltree, tnTotal, level, threshold, id); stop_expanding = false; stop_expanding_enabled = false; break Choices; } if (actionName.equals(STR_ACTION_EXPANDTREE)) { stop_expanding_enabled = true; stop_expanding = false; int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int level = 0; // unlimited long id = -1; // long time = System.currentTimeMillis(); CT_ExpandAllBranches(calltree, tnTotal, level, threshold, id); // time = System.currentTimeMillis() - time; // System.out.println("CT_ExpandAllBranches: time = "+time); stop_expanding = false; stop_expanding_enabled = false; break Choices; } if (actionName.equals(STR_ACTION_COPY_ALL)) { // Copy all lines copyAll(); break Choices; } if (actionName.equals(STR_ACTION_SETTINGS)) { window.getSettings().showDialog(window.getSettings().settingsCalltreeIndex); break Choices; } if (actionName.equals(STR_SORT_BY_METRIC)) { if (null != metricName) { for (int i = 0; i < available_metrics.length; i++) { String mn1 = available_metrics[i].getUserName(); String mn2 = AnLocale.getString("Attributed ") + mn1; if (metricName.equals(mn1) || metricName.equals(mn2)) { window.getSettings().getMetricsSetting().setSortMetricByDType(this, i, type); computed = false; computeOnAWorkerThread(); sortByName = false; break; } } } break Choices; } if (actionName.equals(STR_SORT_BY_NAME)) { sortByName = true; window.getSettings().getMetricsSetting().setSortMetricByDType(this, name_col, type); computed = false; if (selected) { computeOnAWorkerThread(); } break Choices; } if (actionName.equals(STR_ACTION_EXPANDNODE)) { dn = (DefaultMutableTreeNode) calltree.getLastSelectedPathComponent(); int threshold = window.getSettings().getCallTreeSetting().getThreshold(); // % int level = 1; // 1 level long id = -1; CT_ExpandTree(calltree, dn, level, threshold, id); break Choices; } if (actionName.equals(STR_ACTION_SHOWNEXT)) { dn = (DefaultMutableTreeNode) calltree.getLastSelectedPathComponent(); if (null != dn) { if (dn instanceof CT_TreeNode) { CT_TreeNode n = (CT_TreeNode) dn; long id = n.ID; int row = calltree.getMaxSelectionRow(); boolean do_selection = true; find(id, row, do_selection, true); } } break Choices; } if (actionName.equals(STR_ACTION_SHOWALL)) { dn = (DefaultMutableTreeNode) calltree.getLastSelectedPathComponent(); if (null != dn) { if (dn instanceof CT_TreeNode) { CT_TreeNode n = (CT_TreeNode) dn; long id = n.ID; CT_ExpandAllCallStacksForID(id); } } break Choices; } if (actionName.equals(STR_ACTION_HIDE_COLORBARS)) { show_colorbars = false; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_SHOW_COLORBARS)) { show_colorbars = true; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_HIDE_TOOLTIPS)) { show_tooltips = false; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_SHOW_TOOLTIPS)) { show_tooltips = true; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_REFRESH)) { updated = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_SHOW_INCLUSIVE)) { show_inclusive = true; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_HIDE_INCLUSIVE)) { show_inclusive = false; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_SHOW_EXCLUSIVE)) { show_exclusive = true; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_SHOW_PERCENTAGE)) { show_percentage = true; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_HIDE_PERCENTAGE)) { show_percentage = false; computed = false; computeOnAWorkerThread(); break Choices; } if (actionName.equals(STR_ACTION_STOPEXPANDING)) { stop_expanding = true; break Choices; } if (actionName.equals(STR_ACTION_COLLAPSENODE)) { CT_CollapseNode(); break Choices; } if (actionName.equals(STR_ACTION_COLLAPSETREE)) { CT_CollapseTree(); break Choices; } // if (actionName.equals(STR_ACTION_COLLAPSEBRANCH)) { // dn = (DefaultMutableTreeNode) calltree.getLastSelectedPathComponent(); // CT_CollapseBranch(calltree, dn); // } // Set metric, perhaps? if (available_metrics.length > 1) { for (int i = 0; i < available_metrics.length; i++) { if (actionName.equals(available_metrics[i].getUserName())) { sortByName = false; window .getSettings() .getMetricsSetting() .setSortMetricByDType(this, i, DSP_CallTree); // Will fire change event.... break; } } break Choices; } } // End of Choices window.getSystemProgressPanel().progressBarStop(progressBarHandle); } /** Update title */ private synchronized void CT_UpdateTitle() { String titletext = STR_TREE_TITLE_FUNCTIONS; final String threeSpaces = " "; final String STR_PERCENT = "%"; final String STR_NO_FILTER = "1"; final String STR_METRIC = AnLocale.getString("Metric: "); final String STR_THRESHOLD = AnLocale.getString("Threshold: "); final String STR_SORT_BY_NAME = AnLocale.getString("Sort by: name."); final String STR_SORT_BY_METRIC = AnLocale.getString("Sort by: metric."); lastFilter = window.getFilterStr(); // IPC CALL! Perhaps there is a better place? if ((lastFilter != null) && (!lastFilter.equals(STR_NO_FILTER))) { titletext += threeSpaces + STR_TREE_TITLE_FILTER; } else { titletext += threeSpaces + STR_TREE_TITLE_COMPLETE_VIEW; } titletext += threeSpaces + STR_THRESHOLD + window.getSettings().getCallTreeSetting().getThreshold() + STR_PERCENT; int nc = AnWindow.getInstance().getSettings().getMetricsSetting().getNameColumnIndexByDType(type); int si = AnWindow.getInstance().getSettings().getMetricsSetting().getSortColumnByDType(type); if (nc == si) { sortByName = true; } if (sortByName) { titletext += threeSpaces + STR_SORT_BY_NAME; } else { titletext += threeSpaces + STR_SORT_BY_METRIC; } if (null != metricName) { String metrictext = threeSpaces + STR_METRIC + metricName; titletext += metrictext; } final String text = titletext; AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { rootnode.setUserObject(text); calltree.repaint(); } }); } /** Variable to check if the node is expanded */ static int print_row; /** Create text presentation of the tree and print it. Calls CT_PrintChildren(). */ private String CT_PrintTree() { // Prepare text presentation of the tree String text; text = rootnode.getUserObject().toString(); String prefix = "\n"; print_row = 1; text += CT_PrintChildren(tnTotal, prefix); text += prefix; // Print it // System.out.println(text); return text; } /* * Recursively print all children */ private String CT_PrintChildren(CT_TreeNode node, String prefix) { String buf = ""; String P0 = "+-"; String P2 = " |"; String P1 = " "; // Print prefix buf = prefix + P0; if (prefix.endsWith(P2)) { buf = prefix.substring(0, prefix.length() - 1) + P0; } // Print current node info buf += node.toString(); // TEMPORARY: check if print_row is correct TreePath tp = calltree.getPathForRow(print_row); if (null == tp) { // System.err.println("WARNING: empty tree"); return buf; } CT_TreeNode n = (CT_TreeNode) tp.getLastPathComponent(); String s1 = n.toString(); String s2 = node.toString(); if (!s1.equals(s2)) { System.err.println("ERROR: node does not match the row"); return buf; } // If node is not expanded - return if (!calltree.isExpanded(print_row)) { return buf; } // Get children int nc = node.getChildCount(); if (nc <= 0) { return buf; } // Print children String ch_prefix = prefix + P2; for (int i = 0; i < nc - 1; i++) { print_row++; buf += CT_PrintChildren((CT_TreeNode) node.getChildAt(i), ch_prefix); } ch_prefix = prefix + P1; print_row++; buf += CT_PrintChildren((CT_TreeNode) node.getChildAt(nc - 1), ch_prefix); return buf; } public JPopupMenu initPopup(boolean filterOnly) { AccessibleContext ac; JMenuItem mi; JPopupMenu popup = new JPopupMenu(); String txt; boolean row_selected = false; int row = calltree.getLeadSelectionRow(); if (row >= 0) { row_selected = true; } if (!filterOnly) { // Add "Show Source" action txt = STR_ACTION_SHOWSOURCE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); // Add "Show Disassembly" action txt = STR_ACTION_SHOWDISASM; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); // Add separator popup.addSeparator(); // Add "Expand Node" action txt = STR_ACTION_EXPANDNODE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); if (calltree.isExpanded(row)) { mi.setEnabled(false); } // popup.add(mi); // TEMPORARY // Add "Expand Branch" action txt = STR_ACTION_EXPANDBRANCH; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // Add "Expand Hottest Branch" action txt = STR_ACTION_EXPANDHOTTEST; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // Add "Expand All Branches" action txt = STR_ACTION_EXPANDTREE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); // mi.setEnabled(true); mi.setEnabled(true); popup.add(mi); // Add separator popup.addSeparator(); // Add "Stop Expanding" action txt = STR_ACTION_STOPEXPANDING; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(stop_expanding_enabled); popup.add(mi); // Add "Collapse Node" action txt = STR_ACTION_COLLAPSENODE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // popup.add(mi); // TEMPORARY // Add "Collapse All Branches" action txt = STR_ACTION_COLLAPSETREE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); popup.add(mi); // Add separator // popup.addSeparator(); // Add "Set Root" action txt = STR_ACTION_SETROOT; UpdateAction ua = new UpdateAction(txt); mi = new JMenuItem(ua); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (row <= 1) { mi.setEnabled(false); } else { mi.setEnabled(true); } mi.setEnabled(false); // TEMPORARY // popup.add(mi); // TEMPORARY // Add "Reset Root" action txt = STR_ACTION_RESET; UpdateAction rsa = new UpdateAction(txt); mi = new JMenuItem(rsa); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // if root node is <Total> // mi.setEnabled(false); mi.setEnabled(false); // TEMPORARY // popup.add(mi); // TEMPORARY // // Add separator // popup.addSeparator(); // // Add "Set Threshold 0%" action // txt = STR_SET_THRESHOLD_0; // UpdateAction st0 = new UpdateAction(txt); // mi = new JMenuItem(st0); // ac = mi.getAccessibleContext(); // ac.setAccessibleDescription(txt); // if (0 == window.getSettings().getCallTreeSetting().getThreshold()) { // mi.setEnabled(false); // } else { // mi.setEnabled(true); // } // popup.add(mi); // // Add "Set Threshold 1%" action // txt = STR_SET_THRESHOLD_1; // UpdateAction st1 = new UpdateAction(txt); // mi = new JMenuItem(st1); // ac = mi.getAccessibleContext(); // ac.setAccessibleDescription(txt); // if (0 == window.getSettings().getCallTreeSetting().getThreshold()) { // mi.setEnabled(true); // } else { // mi.setEnabled(false); // } // popup.add(mi); // Add separator popup.addSeparator(); } // Add "Set Filter: Call Path in Stack ..." action txt = ADD_FILTER + FILTER_SELECTED_BRANCH_LONG_NAME; mi = new JMenuItem(new UpdateAction(txt, FILTER_SELECTED_BRANCH_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Call Path not in Stack ..." action txt = ADD_FILTER + FILTER_NOT_SELECTED_BRANCH_LONG_NAME; mi = new JMenuItem(new UpdateAction(txt, FILTER_NOT_SELECTED_BRANCH_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Function in Stack ..." action txt = ADD_FILTER + FILTER_SELECTED_FUNCTION_LONG_NAME; mi = new JMenuItem(new UpdateAction(txt, FILTER_SELECTED_FUNCTION_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // Add "Set Filter: Function is Leaf ..." action txt = ADD_FILTER + FILTER_SELECTED_LEAF_LONG_NAME; mi = new JMenuItem(new UpdateAction(txt, FILTER_SELECTED_LEAF_ACTION_NAME)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); // // Add "Set Filter: Name in Stack ..." action // txt = ADD_FILTER + FILTER_NAME_LONG_NAME; // mi = new JMenuItem(new UpdateAction(txt, FILTER_NAME_ACTION_NAME)); // ac = mi.getAccessibleContext(); // ac.setAccessibleDescription(txt); // mi.setEnabled(row_selected); // popup.add(mi); // Add "Undo Last Filter ..." action // Add "Manage Filters..." action txt = STR_ACTION_CUSTOM_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); popup.add(mi); if (filterOnly) { popup.addSeparator(); } txt = STR_ACTION_UNDO_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(window.getFilters().canUndoLastFilter()); popup.add(mi); // Add "Redo Last Filter ..." action txt = STR_ACTION_REDO_FILTER; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(window.getFilters().canRedoLastFilter()); popup.add(mi); // Add "Restore Default Filter ..." action txt = STR_ACTION_REMOVE_ALL_FILTERS; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(window.getFilters().canRemoveAllFilters()); popup.add(mi); // Add "Remove Filter" action if (window.getFilters().anyFilters()) { popup.add(window.getFilters().removeFilterMenuItem()); } // if (filterOnly) { // popup.addSeparator(); // } if (!filterOnly) { // Add separator popup.addSeparator(); // Add "Show Next Reference To Function" action txt = STR_ACTION_SHOWNEXT; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); String hotkey = "CTRL_N"; KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK, false); calltree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, hotkey); UpdateAction act = new UpdateAction(txt); calltree.getActionMap().put(hotkey, act); mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); mi.setEnabled(true); popup.add(mi); // Add "Show All References To Function" action txt = STR_ACTION_SHOWALL; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); mi.setEnabled(true); popup.add(mi); // Add separator popup.addSeparator(); // Add "Hide/Show Color Bars" action if (show_colorbars) { txt = STR_ACTION_HIDE_COLORBARS; } else { txt = STR_ACTION_SHOW_COLORBARS; } mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); if (true == show_percentage) { mi.setEnabled(true); } else { mi.setEnabled(false); } popup.add(mi); // Add "Hide/Show Tool Tips" action if (show_tooltips) { txt = STR_ACTION_HIDE_TOOLTIPS; } else { txt = STR_ACTION_SHOW_TOOLTIPS; } mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); mi.setEnabled(true); popup.add(mi); // Add "Hide/Show Inclusive Metric" action if (show_inclusive) { txt = STR_ACTION_HIDE_INCLUSIVE; } else { txt = STR_ACTION_SHOW_INCLUSIVE; } mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // popup.add(mi); // not ready yet // Add "Show Exclusive Metric" action txt = STR_ACTION_SHOW_EXCLUSIVE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(false); // TEMPORARY // popup.add(mi); // not ready yet // Add "Hide/Show Percentage" action txt = STR_ACTION_SHOW_PERCENTAGE; if (show_percentage) { txt = STR_ACTION_HIDE_PERCENTAGE; } else { txt = STR_ACTION_SHOW_PERCENTAGE; } mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(row_selected); // popup.add(mi); // not ready yet // Add separator popup.addSeparator(); // Add "Sort By Metric" action txt = STR_SORT_BY_METRIC; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (sortByName) { mi.setEnabled(true); } else { mi.setEnabled(false); } popup.add(mi); // Add "Sort By Name" action txt = STR_SORT_BY_NAME; UpdateAction st1 = new UpdateAction(txt); mi = new JMenuItem(st1); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (sortByName) { mi.setEnabled(false); } else { mi.setEnabled(true); } popup.add(mi); // Add separator popup.addSeparator(); // Add "Set Metric" action txt = STR_ACTION_SETMETRIC; UpdateAction sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); if (available_metrics.length <= 1) { mi.setEnabled(false); popup.add(mi); } else { JMenu submenu1; submenu1 = new JMenu(txt); for (int i = 0; i < available_metrics.length; i++) { txt = available_metrics[i].getUserName(); sm = new UpdateAction(txt); mi = new JMenuItem(sm); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(STR_ACTION_SETMETRIC + ":" + txt); if (available_metrics[i].isNameMetric()) { mi.setEnabled(false); } else { mi.setEnabled(true); } submenu1.add(mi); } popup.add(submenu1); } // Add "Refresh Tree" action txt = STR_ACTION_REFRESH; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(true); // popup.add(mi); } // Add separator popup.addSeparator(); // Add menu item "Copy All" txt = STR_ACTION_COPY_ALL; UpdateAction cs = new UpdateAction(txt); mi = new JMenuItem(cs); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); // Add separator popup.addSeparator(); // Add "Settings" action txt = STR_ACTION_SETTINGS; UpdateAction st0 = new UpdateAction(txt); mi = new JMenuItem(st0); mi.setAccelerator(KeyboardShortcuts.settingsActionShortcut); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); popup.add(mi); return popup; } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); // formats.add(ExportFormat.HTML); // formats.add(ExportFormat.CSV); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } // ------- Private classes to implement popup menu items ------- // private class AnMenuListener extends MouseAdapter { private boolean debug; // NM private AnTable anTable; CallTreeView callTreeDisp; JTree tree; AnMenuListener(CallTreeView callTreeDisp, JTree tree) { this.callTreeDisp = callTreeDisp; this.tree = tree; debug = false; } // Experimental code, mostly "quick and dirty hack" public JPopupMenu initPopup(MouseEvent event) { // Experimental code // NM if (parent != null) { // NM try { // NM parent.changeSelection(anTable, table.rowAtPoint(event.getPoint())); // NM } catch (Exception exc) { // NM System.out.println("AnTable.init_popup() exception: " + exc); // NM exc.printStackTrace(); // NM } // NM } // NM setSelectedRowNow(table.rowAtPoint(event.getPoint())); return callTreeDisp.initPopup(false); } /** Check for double click to performs default action */ @Override public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { performDefaultAction(); } } public void mousePressed(MouseEvent e) { maybeShowPopup(e); } public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { if (!Analyzer.getInstance().normalSelection) { int row = tree.getClosestRowForLocation(e.getX(), e.getY()); if (row != -1 && !tree.isRowSelected(row)) { // if (tree.getRowCount() <= (row-1)) { // System.out.println("row="+row+" max="+tree.getRowCount()); // } tree.setSelectionRow(row); // fireAnEvent(new AnEvent(fl_table, AnEvent.EVT_SELECT, row, null)); } } JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } /* * Generic action for context menu items. * Action name is passed as String. */ class UpdateAction extends AbstractAction { String actionName = null; public UpdateAction(String name) { super(name); this.actionName = name; } public UpdateAction(String name, String actionName) { super(name); this.actionName = actionName; } @Override public void actionPerformed(ActionEvent ev) { // Use AWT thread to perform some actions // if (actionName.equals(STR_ACTION_MANAGEFILTERS)) { // window.filter.setSelectedTab(0); // window.filter.showDialog(); // return; // } if (actionName.equals(STR_ACTION_SHOW_EXCLUSIVE)) { show_exclusive = true; return; } if (actionName.equals(FILTER_SELECTED_BRANCH_ACTION_NAME) || actionName.equals(FILTER_NOT_SELECTED_BRANCH_ACTION_NAME) || actionName.equals(FILTER_SELECTED_FUNCTION_ACTION_NAME) || actionName.equals(FILTER_SELECTED_LEAF_ACTION_NAME) || actionName.equals(STR_ACTION_CUSTOM_FILTER) || actionName.equals(STR_ACTION_REMOVE_ALL_FILTERS) || actionName.equals(STR_ACTION_UNDO_FILTER) || actionName.equals(STR_ACTION_REDO_FILTER)) { // Do these actions on AWT CT_UpdateTree(actionName, ev); return; } // Use a "worker" thread to perform other actions final String an = actionName; final ActionEvent ae = ev; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { CT_UpdateTree(an, ae); } }, "CallTree_thread"); } } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getTimelineCallStackSubview()); list.add(window.getIoCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } } ������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ExperimentPickLists.java�������������������������������������������0000644�0001750�0001750�00000004702�14744453367�020564� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.picklist.PickListEvent; import org.gprofng.mpmt.picklist.PickListListener; import java.util.HashMap; import java.util.List; import java.util.Map; public class ExperimentPickLists implements PickListListener { private int MAX = 25; private Map<String, ExperimentPickList> picklistMap = new HashMap<String, ExperimentPickList>(); public ExperimentPickList getPicklist() { String host = Analyzer.getInstance().getHost(); ExperimentPickList instance = getPicklistMap().get(host); if (instance == null) { instance = new ExperimentPickList(MAX); getPicklistMap().put(host, instance); instance.addPicklistListener(this); } return instance; } public void add(String host, List<ExperimentPickListElement> list) { ExperimentPickList instance = new ExperimentPickList(MAX); if (list != null) { for (int i = list.size() - 1; i >= 0; i--) { instance.addElement(list.get(i)); } } getPicklistMap().put(host, instance); instance.addPicklistListener(this); } @Override public void contentsChanged(PickListEvent e) { fireContentsChanged(this); } private void fireContentsChanged(Object source) { AnChangeEvent anChangeevent = new AnChangeEvent(this, AnChangeEvent.Type.MOST_RECENT_EXPERIMENT_LIST_CHANGED); AnEventManager.getInstance().fireAnChangeEvent(anChangeevent); } /** * @return the picklistMap */ public Map<String, ExperimentPickList> getPicklistMap() { return picklistMap; } /** * @param picklistMap the picklistMap to set */ public void setPicklistMap(Map<String, ExperimentPickList> picklistMap) { this.picklistMap = picklistMap; } } ��������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnFile.java��������������������������������������������������������0000644�0001750�0001750�00000042057�14744453367�015761� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.ipc.IPCLogger; import java.io.File; import java.io.IOException; /** AnFile extends File, overwrites method exists() */ public class AnFile extends File { public static final char separatorChar = '/'; boolean attributesReady = false; boolean isDirectoryFlag = false; boolean executableFlag = false; boolean existsFlag = true; private String directory = null; private String fullpath = null; private static final String SLASH = "/"; private static final String DOT = "."; /** * Default constructor: expects full path * * @param pathname */ public AnFile(String pathname) { super(pathname); if (Analyzer.getInstance().remoteConnection == null) { File f = new File(pathname); existsFlag = f.exists(); if (existsFlag) { isDirectoryFlag = f.isDirectory(); executableFlag = f.canExecute(); } fullpath = f.getAbsolutePath(); directory = f.getParent(); attributesReady = true; return; } pathname = AnFileSystemView.slashifyPath(pathname); if (pathname.equals(SLASH)) { isDirectoryFlag = true; attributesReady = true; fullpath = SLASH; directory = SLASH; return; } if (pathname.startsWith(SLASH)) { fullpath = pathname; int next = pathname.lastIndexOf(SLASH); if (next > 0) { directory = pathname.substring(0, next + 1); // include last / } else { directory = SLASH; } } else { AnWindow aw = AnWindow.getInstance(); directory = aw.getCurrentRemoteDirectory(); if (directory == null) { directory = SLASH; } if (!directory.endsWith(SLASH)) { directory += SLASH; } fullpath = directory + pathname; } fullpath = AnFileSystemView.slashifyPath(fullpath); // Now let's check if everything is correct int error = 0; if (fullpath.equals(SLASH)) { // System.err.println("AnFile: error = 1; fullpath="+fullpath); IPCLogger.logTrace("\n" + "AnFile: error = 1; fullpath=" + fullpath); error = 1; // should not come here } if (null == directory) { // System.err.println("AnFile: error = 2; fullpath="+fullpath+" directory="+directory); IPCLogger.logTrace( "\n" + "AnFile: error = 2; fullpath=" + fullpath + " directory=" + directory); error = 2; // should not come here } if (directory.endsWith(SLASH)) { String fn = directory + getName(); if (!fullpath.equals(fn)) { // System.err.println("AnFile: error = 3; fullpath="+fullpath+" directory="+directory+" // fn="+fn); // Exception e = new Exception(); // e.printStackTrace(); IPCLogger.logTrace( "\n" + "AnFile: error = 3; fullpath=" + fullpath + " directory=" + directory + " fn=" + fn); error = 3; } } else { // System.err.println("AnFile: error = 4; fullpath="+fullpath+" directory="+directory); IPCLogger.logTrace( "\n" + "AnFile: error = 4; fullpath=" + fullpath + " directory=" + directory); error = 4; String fn = directory + SLASH + getName(); if (!fullpath.equals(fn)) { // System.err.println("AnFile: error = 5; fullpath="+fullpath+" directory="+directory); IPCLogger.logTrace( "\n" + "AnFile: error = 5; fullpath=" + fullpath + " directory=" + directory); error = 5; } } } /** * Constructor: expects full directory path and short file name * * @param dir * @param name */ public AnFile(String dir, String name) { this(dir + SLASH + name); } @Override public File[] listFiles() { File[] ret; if (Analyzer.getInstance().remoteConnection == null) { ret = super.listFiles(); } else { ret = AnFileSystemView.getFileSystemView() .getFiles(this, false); // FIXUP: how tp pass isFileHidingEnabled? } return ret; } /** * Checks if remote file is executable. * * @return */ @Override public boolean canExecute() { if (!attributesReady) { updateAttributes(); } return executableFlag; } /** * Checks if remote file exists. * * @return */ @Override public boolean exists() { if (!attributesReady) { updateAttributes(); } return existsFlag; } /** * Checks if remote file is a directory. * * @return */ @Override public boolean isDirectory() { if (!attributesReady) { updateAttributes(); } return isDirectoryFlag; } /** * Checks if remote file is a regular file. * * @return */ @Override public boolean isFile() { if (!attributesReady) { updateAttributes(); } return !isDirectoryFlag; } /** * Check if file path is absolute * * @return */ @Override public boolean isAbsolute() { String pathname = getPath(); if (pathname.startsWith(SLASH)) { return true; } return false; } /** * Gets path * * @return path */ @Override public String getPath() { return this.fullpath; } /** * Returns the absolute form of this abstract pathname. Equivalent to <code> * new AnFile(this.{@link #getAbsolutePath})</code>. * * @return The absolute abstract pathname denoting the same file or directory as this abstract * pathname */ @Override public File getAbsoluteFile() { if (Analyzer.getInstance().remoteConnection == null) { // Optimization return super.getAbsoluteFile(); } // NM why not return this? if (!attributesReady) { updateAttributes(); } String absPath = getAbsolutePath(); AnFile af = new AnFile(absPath); af.setAttributes(directory, isDirectoryFlag, existsFlag); return (af); } @Override public File getCanonicalFile() throws IOException { if (Analyzer.getInstance().remoteConnection == null) { // Optimization return super.getCanonicalFile(); } return (getAbsoluteFile()); } @Override public String getCanonicalPath() /* throws IOException */ { return (getAbsolutePath()); } /** * Returns the absolute pathname string of this abstract pathname. * * @return The absolute pathname string denoting the same file or directory as this abstract * pathname */ @Override public String getAbsolutePath() { String pathname = getPath(); if (pathname.startsWith(SLASH)) { // Temporary fix for Windows pathname = AnFileSystemView.slashifyPath(pathname); return pathname; } if (null == directory) { // System.err.println("getAbsolutePath: error: directory=null fullpath="+fullpath); // BUG IPCLogger.logTrace("\n" + "getAbsolutePath: error: directory=null fullpath=" + fullpath); return super.getAbsolutePath(); // This is not AnFile, which means this is the bug! } if (!directory.endsWith(SLASH)) { directory = directory + SLASH; // BUG! } pathname = directory + pathname; // Temporary fix for Windows pathname = AnFileSystemView.slashifyPath(pathname); return pathname; } /** * Returns the pathname string of this abstract pathname's parent, or <code>null</code> if this * pathname does not name a parent directory. * * <p>The <em>parent</em> of an abstract pathname consists of the pathname's prefix, if any, and * each name in the pathname's name sequence except for the last. If the name sequence is empty * then the pathname does not name a parent directory. * * @return The pathname string of the parent directory named by this abstract pathname, or <code> * null</code> if this pathname does not name a parent */ @Override public String getParent() { if (Analyzer.getInstance().remoteConnection == null) { // Optimization return super.getParent(); } String parent = directory; if (null == parent) { // System.err.println("AnFile: error: getParent(); fullpath="+fullpath+" // directory="+directory); // BUG IPCLogger.logTrace( "\n" + "AnFile: error: getParent(); fullpath=" + fullpath + " directory=" + directory); return null; } if (parent.length() > 1) { if (parent.endsWith(SLASH)) { parent = parent.substring(0, parent.length() - 1); } } return parent; } /** * Returns the abstract pathname of this abstract pathname's parent, or <code>null</code> if this * pathname does not name a parent directory. * * <p>The <em>parent</em> of an abstract pathname consists of the pathname's prefix, if any, and * each name in the pathname's name sequence except for the last. If the name sequence is empty * then the pathname does not name a parent directory. * * @return The abstract pathname of the parent directory named by this abstract pathname, or * <code>null</code> if this pathname does not name a parent * @since 1.2 */ @Override public File getParentFile() { if (fullpath == null) { fullpath = SLASH; } if (fullpath.equals(SLASH)) { // Special case to make MetalFileChooser happy: return null return null; } String p = getParent(); if (p == null) { return null; } AnFile af = new AnFile(p); // directory return (af); // return new AnFile(p, this.prefixLength); } /** * Returns the parent directory of <code>dir</code>. * * @param dir the <code>File</code> being queried * @return the parent directory of <code>dir</code>, or <code>null</code> if <code>dir</code> is * <code>null</code> */ public File getParentDirectory(File dir) { if (dir == null || !dir.exists()) { return null; } String psf = dir.getParent(); if (psf == null) { return null; } AnFile pdir = new AnFile(dir.getParent()); return pdir; } /** * Gets path * * @return path */ public String getDirectoryName() { return this.directory; } /** * Renames the file denoted by this abstract pathname. * * <p>Many aspects of the behavior of this method are inherently platform-dependent: The rename * operation might not be able to move a file from one filesystem to another, it might not be * atomic, and it might not succeed if a file with the destination abstract pathname already * exists. The return value should always be checked to make sure that the rename operation was * successful. * * <p>Note that the {@link java.nio.file.Files} class defines the {@link java.nio.file.Files#move * move} method to move or rename a file in a platform independent manner. * * @param dest The new abstract pathname for the named file * @return <code>true</code> if and only if the renaming succeeded; <code>false</code> otherwise * @throws SecurityException If a security manager exists and its <code>{@link * java.lang.SecurityManager#checkWrite(java.lang.String)}</code> method denies write * access to either the old or new pathnames * @throws NullPointerException If parameter <code>dest</code> is <code>null</code> */ @Override public boolean renameTo(File dest) { if (dest == null) { // throw new NullPointerException(); return false; } // if (this.isInvalid() || dest.isInvalid()) { // return false; // } boolean ret = false; if (dest instanceof AnFile) { AnFile newFile = (AnFile) dest; String srcName = getAbsolutePath(); String destName = newFile.getAbsolutePath(); // System.out.println("Rename to: " + newFile.getAbsolutePath()); // ret = AnWindow.getInstance().renameFile(srcName, destName); // Not implemented yet String res = AnWindow.getInstance().createDirectories(destName); if (null == res || res.length() <= 0) { // created res = AnWindow.getInstance().deleteFile(srcName); if (null == res || res.length() <= 0) { // deleted ret = true; } } } return ret; } /** * Sets flag isDirectoryFlag * * @param directory * @param isDirectory * @param exists */ public void setAttributes(String directory, boolean isDirectory, boolean exists) { if (null != directory) { if (!directory.endsWith(SLASH)) { directory = directory + SLASH; // BUG! } this.directory = directory; } isDirectoryFlag = isDirectory; existsFlag = exists; attributesReady = true; } /** * Gets flag attributesReady * * @return boolean attributesReady */ public boolean getAttributesReady() { return attributesReady; } /** Update attributes of this remote file */ public void updateAttributes() { if (!attributesReady) { if (Analyzer.getInstance().remoteConnection != null) { AnWindow aw = AnWindow.getInstance(); AnFileSystemView afsv = null; AnChooser ac = null; // aw.getAnChooserRemote(); if (null != ac) { afsv = ac.getAnFileSystemView(); } else { afsv = AnFileSystemView.getFileSystemView(); if (null != afsv) { afsv.setAnWindow(aw); } } if (null != afsv) { afsv.updateFileAttributes(this); attributesReady = true; } } } } /** * Tests this abstract pathname for equality with the given object. Returns <code>true</code> if * and only if the argument is not <code>null</code> and is an abstract pathname that denotes the * same file or directory as this abstract pathname. Whether or not two abstract pathnames are * equal depends upon the underlying system. On UNIX systems, alphabetic case is significant in * comparing pathnames; on Microsoft Windows systems it is not. * * @param obj The object to be compared with this abstract pathname * @return <code>true</code> if and only if the objects are the same; <code>false</code> otherwise */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj instanceof AnFile)) { return compareTo((AnFile) obj) == 0; } return super.equals(obj); } /** * Compares two abstract pathnames lexicographically. The ordering defined by this method depends * upon the underlying system. On UNIX systems, alphabetic case is significant in comparing * pathnames; on Microsoft Windows systems it is not. * * @param pathname The abstract pathname to be compared to this abstract pathname * @return Zero if the argument is equal to this abstract pathname, a value less than zero if this * abstract pathname is lexicographically less than the argument, or a value greater than zero * if this abstract pathname is lexicographically greater than the argument * @since 1.2 */ @Override public int compareTo(File pathname) { if ((pathname != null) && (pathname instanceof AnFile)) { return ((pathname.getPath()).compareTo(this.getPath())); } return super.compareTo(pathname); } /** * Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a * directory, then the directory must be empty in order to be deleted. * * @return <code>true</code> if and only if the file or directory is successfully deleted; <code> * false</code> otherwise */ @Override public boolean delete() { if (!exists()) { return true; } if (Analyzer.getInstance().remoteConnection != null) { AnWindow aw = AnWindow.getInstance(); String error = aw.deleteFile(fullpath); if (error != null && error.length() > 0) { return false; } } else { return super.delete(); } attributesReady = false; return true; } /** * Creates the directory named by this abstract pathname, including any necessary but nonexistent * parent directories. Note that if this operation fails it may have succeeded in creating some of * the necessary parent directories. * * @return <code>true</code> if and only if the directory was created, along with all necessary * parent directories; <code>false</code> otherwise */ @Override public boolean mkdirs() { if (exists()) { return false; } if (Analyzer.getInstance().remoteConnection != null) { AnWindow aw = AnWindow.getInstance(); String error = aw.createDirectories(fullpath); if (error != null && error.length() > 0) { return false; } } else { return super.mkdirs(); } attributesReady = false; return true; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnTree.java��������������������������������������������������������0000644�0001750�0001750�00000015115�14744453367�015774� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.util.gui.AnJTree; import org.gprofng.mpmt.util.gui.AnTextIcon; import java.awt.Component; import java.awt.event.MouseEvent; import java.util.EventObject; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellEditor; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; public final class AnTree extends AnJTree { private final DefaultMutableTreeNode root; private final DefaultTreeModel model; private final int expand_row; private final AnTreeRenderer renderer; // Constructor public AnTree(final String name, final int row) { super(); root = new DefaultMutableTreeNode(name, true); model = new DefaultTreeModel(root); expand_row = row; model.setAsksAllowsChildren(true); setModel(model); putClientProperty("JTree.lineStyle", "Angled"); setShowsRootHandles(true); setEditable(true); setCellRenderer(renderer = new AnTreeRenderer()); setCellEditor(new AnTreeEditor(this, renderer)); } // Add one node into the root private void addNode(final AnTextIcon item) { final DefaultMutableTreeNode node; node = new DefaultMutableTreeNode(item, true); node.add(new DefaultMutableTreeNode(null, false)); root.add(node); } // Add the extra node; the first child node public int addExtra(final String extra) { int last; // Remove all nodes when restart getCellEditor().cancelCellEditing(); root.removeAllChildren(); last = 0; if (last == 0) { addNode(new AnTextIcon(extra, null)); model.nodeStructureChanged(root); } else { last--; } return last; } // Add nodes public void addNodes(final AnTextIcon[] list, final int last) { final int size; int iv; final int[] indices; size = list.length; indices = new int[size - last]; iv = 0; for (int i = last; i < size; i++) { indices[iv++] = i + 1; addNode(list[i]); } model.nodesWereInserted(root, indices); // Initially expand the first child node if (last == 0) { expandRow(expand_row); } } // Remove nodes public void removeNodes(final int[] remove_index) { final int nd = remove_index.length; final DefaultMutableTreeNode node; final int[] indices; final Object[] rm_node; getCellEditor().cancelCellEditing(); // If remove all, clean up but keep the extra node if (nd >= root.getChildCount() - 1) { node = (DefaultMutableTreeNode) root.getChildAt(0); addExtra(((AnTextIcon) node.getUserObject()).getText()); return; } indices = new int[nd]; rm_node = new Object[nd]; for (int i = nd - 1; i >= 0; i--) { indices[i] = remove_index[i] + 1; rm_node[i] = root.getChildAt(indices[i]); root.remove(indices[i]); } model.nodesWereRemoved(root, indices, rm_node); } // Remove all nodes public void removeAllNodes() { if (root.getChildCount() != 0) { getCellEditor().cancelCellEditing(); root.removeAllChildren(); model.nodeStructureChanged(root); } } // Set object of the content node public void setContent(final int index, final Object object) { final DefaultMutableTreeNode node, content; node = (DefaultMutableTreeNode) root.getChildAt(index); content = (DefaultMutableTreeNode) node.getChildAt(0); content.setUserObject(object); model.nodeChanged(content); } // Tree cell renderer private static final class AnTreeRenderer extends DefaultTreeCellRenderer { public Component getTreeCellRendererComponent( final JTree tree, Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { final Object object; final AnTextIcon item; Icon icon = null; setLeafIcon(null); setClosedIcon(null); setOpenIcon(null); if (value instanceof DefaultMutableTreeNode) { object = ((DefaultMutableTreeNode) value).getUserObject(); if (object instanceof AnTextIcon) { item = (AnTextIcon) object; value = item.getText(); icon = item.getIcon(); } else if (object instanceof JComponent) { ((JComponent) object) .setBorder(hasFocus ? AnVariable.treeFocusBorder : AnVariable.noFocusBorder); return (Component) object; } } super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (icon != null) { setIcon(icon); } return this; } } // Tree cell editor private final class AnTreeEditor extends DefaultTreeCellEditor { public AnTreeEditor(final JTree tree, final DefaultTreeCellRenderer renderer) { super(tree, renderer); } public Component getTreeCellEditorComponent( final JTree tree, final Object value, final boolean isSelected, final boolean expanded, final boolean leaf, final int row) { editingComponent = this.renderer.getTreeCellRendererComponent( tree, value, isSelected, expanded, leaf, row, true); return editingComponent; } public boolean isCellEditable(final EventObject evt) { if (evt instanceof MouseEvent) { final MouseEvent mEvt = (MouseEvent) evt; if (mEvt.getClickCount() == 1) { final TreePath selPath = tree.getPathForLocation(mEvt.getX(), mEvt.getY()); if (selPath == null) { return false; } final DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath.getLastPathComponent(); if (node.getUserObject() instanceof ExperimentsView.AnTreePanel) { return true; } } } return super.isCellEditable(evt); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnFrame.java�������������������������������������������������������0000644�0001750�0001750�00000006176�14744453367�016136� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnMenuBar; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Point; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JMenuBar; public final class AnFrame extends JFrame { private AnWindow window; private Analyzer analyzer; // Constructor public AnFrame(final Analyzer analyzer) { super(Analyzer.getAnalyzerReleaseName()); getAccessibleContext().setAccessibleDescription(Analyzer.getAnalyzerReleaseName()); this.analyzer = analyzer; } /** Doesn't require running IPC. Called once. AWT thread */ public void initComponents() { AnUtility.checkIfOnAWTThread(true); // Menu bar JMenuBar menu_bar = new AnMenuBar(); menu_bar.setBorder(null); setJMenuBar(menu_bar); // Register the event handlers addWindowListener(new WindowHandler(this)); // Adjust the window UserPref userPref = UserPref.getInstance(); Dimension size; Point location; size = userPref.getFrameSize(); location = userPref.getFrameLocation(); if (!insideScreen(size, location)) { // Try move window location = new Point(0, 0); } if (!GUITesting.getInstance().isRunningUnderGUITesting()) { if (!insideScreen(size, location)) { // Try to resize location = userPref.getDefaultFrameLocation(); size = userPref.getDefaultFrameSize(); } } setSize(size); setLocation(location); // AnWindow window = new AnWindow(analyzer, this, getContentPane(), menu_bar); if (AnUtility.analyzer_icon != null) { setIconImage(AnUtility.analyzer_icon.getImage()); } } private boolean insideScreen(Dimension size, Point location) { // Note: add 6 pixels beacuse of full screen mode goes a bit outside screen return (location.x + size.width <= AnVariable.SCREEN_SIZE.width + 6 && location.y + size.height <= AnVariable.SCREEN_SIZE.height); } // Get AnWindow public AnWindow getWindow() { return window; } // Window handler private final class WindowHandler extends WindowAdapter { private AnFrame anFrame; public WindowHandler(AnFrame anFrame) { this.anFrame = anFrame; } @Override public void windowClosing(final WindowEvent event) { AnWindow.getInstance().exitAction(); } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/�������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�016355� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/StackState.java����������������������������������������0000644�0001750�0001750�00000005771�14744453367�021235� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import java.awt.Color; import java.awt.Font; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.WritableRaster; // State represents each element in the callstack // This class is immutable public class StackState { private static final Font f; static { f = javax.swing.UIManager.getFont("List.font"); } private static final int ICON_WIDTH = f.getSize() < 17 ? 19 : f.getSize() + 2; private static final int ICON_HEIGHT = f.getSize() < 17 ? 19 : f.getSize() + 2; private final String fname; // func name private final long fnumber; // Histable::Function* (NOT Function->id) // Constructor public StackState(String fname, long fnumber) { this.fname = fname; this.fnumber = fnumber; } public String getName() { return fname; } public long getNumber() { return fnumber; } @Override public Object clone() { StackState s = new StackState(fname, fnumber); return s; } public static Image createContigIcon(Color color) { return createIcon(color, ICON_WIDTH, ICON_HEIGHT, false); } public static Image createIcon(Color color) { return createIcon(color, ICON_WIDTH - 2, ICON_HEIGHT - 2, true); } public static Image createIcon(Color color, int width, int height, boolean draw_outline) { BufferedImage image; WritableRaster raster; ColorModel model; int argb, x_last, y_last, i, j; Object data; image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); raster = image.getRaster(); model = image.getColorModel(); argb = color.getRGB(); data = model.getDataElements(argb, null); x_last = width - 1; y_last = height - 1; for (i = 1; i < x_last; i++) { for (j = 1; j < y_last; j++) { raster.setDataElements(i, j, data); } } if (draw_outline) { color = Color.black; argb = color.getRGB(); data = model.getDataElements(argb, null); for (i = 0; i < width; i++) { raster.setDataElements(i, 0, data); raster.setDataElements(i, y_last, data); } for (j = 0; j < height; j++) { raster.setDataElements(0, j, data); raster.setDataElements(x_last, j, data); } } return image; } @Override public String toString() { return fname; } } �������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/ChooserStateView.java����������������������������������0000644�0001750�0001750�00000014673�15044710303�022402� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import static java.util.concurrent.TimeUnit.*; import org.gprofng.mpmt.AnEvent; import org.gprofng.mpmt.AnListener; import java.awt.Color; import java.awt.Component; import java.util.*; import java.util.concurrent.*; import javax.swing.DefaultListCellRenderer; import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.ListModel; import javax.swing.SwingUtilities; // Display alphabetically sorted StackStates as Colored boxes labeled with function names public class ChooserStateView extends JList<StackState> implements AnListener { protected final StateColorMap color_map; private StateColorMap.ColorMapSnapshot stateColorSnapshot; private boolean show_duplicates; // one line for each func even if name is same private HashMap<Long, Integer> funcMap; // Maps Func #s to line in list private ArrayList<StackState> sortedData; // copy of original data private final Object updateLock = new Object(); private boolean ignoreUpdates = false; private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); private List<Long> selectedFuncs; // Constructor public ChooserStateView(final StateColorMap color_map) { this.color_map = color_map; stateColorSnapshot = null; ListRenderer lrend; lrend = new ListRenderer(); setCellRenderer(lrend); setBackground(lrend.getBackground()); resetVals(); color_map.addAnListener(this); } private void resetVals() { show_duplicates = false; funcMap = null; sortedData = null; selectedFuncs = new ArrayList<>(); } // Set components (MUST BE CALLED ON AWT THREAD) private void setStackStates(Collection<StackState> states) { ArrayList<StackState> data = (states != null) ? new ArrayList<>(states) : new ArrayList<>(); Collections.sort( data, new Comparator<StackState>() { @Override public int compare(StackState aa, StackState bb) { return aa.getName().compareTo(bb.getName()); } }); sortedData = new ArrayList<>(data); Vector<StackState> dataList = new Vector<StackState>(); funcMap = new HashMap<Long, Integer>(); // map func #s to dataList String recentName = null; // most recently seen name for (StackState state : sortedData) { if (show_duplicates || !state.getName().equals(recentName)) { dataList.add(state); recentName = state.getName(); } funcMap.put(state.getNumber(), dataList.size() - 1); } if (!isSelectionEmpty()) { List<StackState> list = getSelectedValuesList(); selectedFuncs = new ArrayList<>(); for (StackState state : list) { Long val = state.getNumber(); selectedFuncs.add(val); } } setListData(dataList); if (selectedFuncs != null && !selectedFuncs.isEmpty()) { setSelectedFunctions(selectedFuncs); } } private void updateColors() { // only access stateColorSnapshot and setStackStates on AWT thread SwingUtilities.invokeLater( new Runnable() { @Override public void run() { StateColorMap.ColorMapSnapshot latest = color_map.checkForAllUpdates(stateColorSnapshot); if (stateColorSnapshot != latest) { stateColorSnapshot = latest; Collection<StackState> states = stateColorSnapshot.getStackStates(); setStackStates(states); repaint(); } } }); } // color change(s); may be called extremely frequently @Override public void valueChanged(AnEvent ee) { synchronized (updateLock) { if (ignoreUpdates) { return; } // do an immediate update then ignore updates for a while ignoreUpdates = true; updateColors(); } scheduler.schedule( new Runnable() { public void run() { synchronized (updateLock) { // after delay, do an update and reenable future updates ignoreUpdates = false; updateColors(); } } }, 1000, MILLISECONDS); // max rate of refreshing is set here } // Set selected function (MUST BE CALLED ON AWT THREAD) public StackState getState(int ii) { return getModel().getElementAt(ii); } // Set selected function (MUST BE CALLED ON AWT THREAD) public void setSelectedFunctions(List<Long> funcs) { selectedFuncs = funcs; if (funcMap == null) { return; } if (getModel() == null) { return; } if (funcs.isEmpty()) { clearSelection(); return; } int idxs[] = new int[funcs.size()]; int ii = 0; for (Long func : funcs) { Integer idx = funcMap.get(func); if (idx == null) { continue; } idxs[ii++] = idx; } setSelectedIndices(idxs); if (idxs.length == 1) { ensureIndexIsVisible(idxs[0]); } } public void setSelectedFunction(long lfunc) { Long func = lfunc; List<Long> funcs = new ArrayList<>(); funcs.add(func); setSelectedFunctions(funcs); } // Set selected functions (MUST BE CALLED ON AWT THREAD) public void setSelectionFunctions(HashSet<Long> funcList) { for (Long func : funcList) { setSelectedFunction(func); } } // List renderer protected class ListRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); StackState state = (StackState) value; setText(state.getName()); Color color = color_map.getFuncColor(state.getNumber()); setIcon(new ImageIcon(StackState.createIcon(color))); return this; } } } ���������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/StackViewState.java������������������������������������0000644�0001750�0001750�00000002657�14744453367�022070� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; // This class is immutable // State represents each element in the callstack public class StackViewState extends StackState { private final String pcname; private final long pcid; // Histable::DbeInstr* (NOT DbeInstr->id) // Constructor public StackViewState(String fname, String pcname, long fnumber, long pcid) { super(fname, fnumber); this.pcname = pcname; this.pcid = pcid; } // Gets pcname of function as shown in callstack public String getPCName() { return pcname; } public long getPC() { return pcid; } public Object clone() { StackViewState s = new StackViewState(super.getName(), pcname, super.getNumber(), pcid); return s; } public String toString() { return pcname; } } ���������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/StackStateList.java������������������������������������0000644�0001750�0001750�00000005065�14744453367�022065� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import org.gprofng.mpmt.AnWindow; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; /** * Maintains a list of StackState. Given function id as input, performs IPC to look up function * names. This class can be used to cache function id names. */ public class StackStateList { private final AnWindow anWindow; private final HashMap<Long, StackState> function_htable; // unique StackStates; key=function_id public StackStateList(AnWindow _anWindow) { anWindow = _anWindow; function_htable = new HashMap(); } public void clear() { synchronized (function_htable) { function_htable.clear(); } } public StackState get(long fid) { synchronized (function_htable) { return function_htable.get(fid); } } public ArrayList<StackState> ipcAdd(Set<Long> newFids) { // IPC! ArrayList<Long> missing_fids = new ArrayList(); synchronized (function_htable) { for (Long fid : newFids) { if (!function_htable.containsKey(fid)) { missing_fids.add(fid); } } } if (!missing_fids.isEmpty()) { // now go fetch the missing strings int size = missing_fids.size(); final long[] fidArray = new long[size]; int i = 0; for (Long iter : missing_fids) { fidArray[i] = iter.longValue(); i++; } // get function names final String[] names = anWindow.getFuncNames(fidArray); // IPC!! ArrayList<StackState> missing = new ArrayList(); i = 0; synchronized (function_htable) { for (Long iter : missing_fids) { long fid = iter.longValue(); String name = names[i]; StackState stackState = new StackState(name, fid); function_htable.put(fid, stackState); missing.add(stackState); i++; } } return missing; } return null; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/ColorMap.java������������������������������������������0000644�0001750�0001750�00000026777�15044710303�020670� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import org.gprofng.mpmt.AnEvent; import org.gprofng.mpmt.AnListener; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import javax.swing.event.EventListenerList; public abstract class ColorMap { public class ColorMapSnapshot { private final long versionNum; private final HashMap<Long, Color> colorMap; private final Collection<StackState> stackStates; ColorMapSnapshot( long _version, HashMap<Long, Color> _colorMap, HashMap<Long, StackState> _stackStateMap) { versionNum = _version; colorMap = (_colorMap != null) ? (HashMap<Long, Color>) _colorMap.clone() : null; stackStates = (_stackStateMap != null) ? new ArrayList<>(_stackStateMap.values()) : null; } protected long getVersion() { return versionNum; } public HashMap<Long, Color> getColorMap() { return colorMap; } public Collection<StackState> getStackStates() { return stackStates; } } private final ArrayList<ColorRule> activeRules; private final ArrayList<ColorRule> defaultRules; private final HashMap<Long, Color> colorMap; // Maps Func #s to Colors private final HashMap<Long, StackState> stackStateMap; // Maps Func #s to StackState (Names + ID) private long versionNumber; // tracks all changes // Constructor public ColorMap() { versionNumber = 0; colorMap = new HashMap<>(); stackStateMap = new HashMap<>(); activeRules = new ArrayList<>(); defaultRules = new ArrayList<>(); } public synchronized void reset() { updateVersion(); colorMap.clear(); stackStateMap.clear(); activeRules.clear(); defaultRules.clear(); } protected abstract Color getBaseColor(String name); private Color computeColor(StackState state) { Color c = checkRules(state, activeRules); if (c == null) { c = checkRules(state, defaultRules); } if (c == null) { c = getBaseColor(state.getName()); } return c; } private int addState(StackState state) { String name = state.getName(); long number = state.getNumber(); StackState tmp = stackStateMap.put(number, state); if (tmp != null) { if (tmp.getName().equals(name)) { return 0; // already seen this number/name combination; done! } else { ; // weird! Someone used an alternate name for the function? } } Color c = computeColor(state); setFuncColor(state, c); return 1; } private Color checkRules(StackState state, List<ColorRule> rules) { for (int ii = rules.size() - 1; ii >= 0; ii--) { final ColorRule rule = rules.get(ii); final Pattern reg_exp = rule.reg_exp; final String str_class = rule.getText(); final String name = state.getName(); Color c = null; switch (rule.getType()) { case ColorRule.SETC_START: if (name.startsWith(str_class)) { c = rule.getColor(); } break; case ColorRule.SETC_END: if (name.endsWith(str_class)) { c = rule.getColor(); } break; case ColorRule.SETC_CONTAIN: if (name.indexOf(str_class) != -1) { c = rule.getColor(); } break; case ColorRule.SETC_MATCHES: if (name.equals(str_class)) { c = rule.getColor(); } break; case ColorRule.SETC_REGEXP: if (reg_exp != null && reg_exp.matcher(name).matches()) { c = rule.getColor(); } break; case ColorRule.SETC_ALL: c = rule.getColor(); break; default: return null; // weird! } if (c != null) { return c; } } return null; } // Set class to color: handles changes done through color chooser private void internalSetRule(ColorRule rule) { boolean clears_all = false; ColorRule newRule = rule; switch (rule.getType()) { case ColorRule.SETC_ALL: clears_all = true; break; case ColorRule.SETC_REGEXP: try { Pattern reg_exp = Pattern.compile(rule.getText()); newRule = new ColorRule( rule.getColor(), rule.getType(), rule.getText(), rule.getIsDefault(), reg_exp); } catch (PatternSyntaxException ex) { // YXXX warn user here return; } break; default: break; } ArrayList<ColorRule> selectedRules = rule.getIsDefault() ? defaultRules : activeRules; if (clears_all) { selectedRules.clear(); } selectedRules.add(newRule); } // Set selected func to color private void setFuncColor(final StackState state, final Color color) { Color c = colorMap.put(state.getNumber(), color); if (c == null || !c.equals(color)) { ; // colors changed } } private void updateColors() { Collection<StackState> stackStates = stackStateMap.values(); for (StackState state : stackStates) { Color color = computeColor(state); setFuncColor(state, color); } } private void updateVersion() { // may be called from any thread. versionNumber++; AnUtility.invokeLaterOnSwingThread( new Runnable() { @Override public void run() { fireAnEvent(new AnEvent(this, AnEvent.EVT_UPDATE, 0, null)); } }); } // =============== public functions, must be synchronized =============== public synchronized int addStates(Collection<StackState> states) { int numAdded = 0; for (StackState state : states) { numAdded += addState(state); } if (numAdded == 0) { return numAdded; } updateVersion(); return numAdded; } public synchronized Color getFuncColor(long number) { Color c = colorMap.get(number); if (c == null) { c = Color.black; // weird, caller didn't add this function } return c; } public synchronized ColorMapSnapshot checkForColorUpdates(ColorMapSnapshot snapshot) { if (snapshot == null || snapshot.versionNum != versionNumber) { return new ColorMapSnapshot(versionNumber, colorMap, null); } return snapshot; // no changes } public synchronized ColorMapSnapshot checkForAllUpdates(ColorMapSnapshot snapshot) { if (snapshot == null || snapshot.versionNum != versionNumber) { return new ColorMapSnapshot(versionNumber, colorMap, stackStateMap); } return snapshot; // no changes } public synchronized List<ColorRule> getActiveRules() { return activeRules; } public synchronized void setRule( final Color color, final int type, String text, boolean is_default) { ColorRule rule = new ColorRule(color, type, text, is_default); internalSetRule(rule); updateColors(); updateVersion(); } /** * initialize color rules (no events) * * @param rules */ public synchronized void initRules(final List<ColorRule> rules, boolean sendEvent) { activeRules.clear(); for (ColorRule rule : rules) { internalSetRule(rule); } updateColors(); if (sendEvent) { updateVersion(); } } /** * set color rules and send events * * @param rules */ public synchronized void setRules(final List<ColorRule> rules) { for (ColorRule rule : rules) { internalSetRule(rule); } updateColors(); updateVersion(); } // Set all to color public synchronized void setRuleAllFunctions(final Color color) { ColorRule rule = new ColorRule(color, ColorRule.SETC_ALL, null, false); internalSetRule(rule); updateColors(); updateVersion(); } // Reset all function color to default public synchronized void restoreToDefault() { activeRules.clear(); updateColors(); updateVersion(); } // Listener to the event changed private final EventListenerList listenerList = new EventListenerList(); // Add a listener to the list public void addAnListener(final AnListener listener) { listenerList.add(AnListener.class, listener); } // Fire AnEvent to the listener private void fireAnEvent(AnEvent event) { AnUtility.checkIfOnAWTThread(true); // System.out.println("ColorMap fireAnEvent: " + event); Object[] listeners; listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == AnListener.class) { ((AnListener) listeners[i + 1]).valueChanged(event); } } } // public void asyncUpdateFullColorMap() { // AnUtility.dispatchOnAWorkerThread(new Runnable() { // @Override // public void run() { // updateFullColorMapIPC(); // } // }, "ColorMapUpdateFullColorMap"); // } public int updateFullColorMapIPC() { Object[] res = getCallTreeFuncsIPC(); if (res == null) { return 0; } long[] funcs = (long[]) res[0]; String[] names = (String[]) res[1]; long[] functions = (long[]) res[2]; List<StackState> states = new ArrayList<>(); for (int ii = 0; ii < funcs.length; ii++) { if (names[ii] == null) { continue; } StackState state = new StackState(names[ii], functions[ii]); // name, Histable::Function* states.add(state); } int num_added = addStates(states); return num_added; } private Object[] getCallTreeFuncsIPC() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getCallTreeFuncs"); anWindow.IPC().send(0); Object[] res = (Object[]) anWindow.IPC().recvObject(); return res; } } // <newFunctions> is Histable::Function* public List<StackState> addFunctionsIPC(Set<Long> newFunctions) { // IPC! Set<Long> missing_fids = new HashSet<>(); synchronized (this) { for (Long fid : newFunctions) { if (!stackStateMap.containsKey(fid)) { missing_fids.add(fid); } } } if (missing_fids.isEmpty()) { return null; } // now go fetch the missing strings int size = missing_fids.size(); final long[] funcs = new long[size]; int i = 0; for (Long iter : missing_fids) { funcs[i++] = iter.longValue(); } // get function names AnWindow anWindow = AnWindow.getInstance(); final String[] names = anWindow.getFuncNames(funcs); // IPC!! ArrayList<StackState> missing = new ArrayList<>(); for (int ii = 0; ii < funcs.length; ii++) { long func = funcs[ii]; String name = names[ii]; StackState stackState = new StackState(name, func); missing.add(stackState); } addStates(missing); // internally synchronized return missing; } } �gprofng-gui-2.1/org/gprofng/mpmt/statecolors/AnColorChooser.java������������������������������������0000644�0001750�0001750�00000031501�15044710303�022011� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer.HelpAction; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Frame; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.EventObject; import javax.accessibility.AccessibleContext; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; // YXXX some kind of synchronization needs to be added to color classes; they // are sometimes accessed from non-awt threads public final class AnColorChooser extends AnDialog implements ChangeListener, ListSelectionListener, MouseListener { private JColorChooser chooser; private JButton set_sel, set_all, reset, set_class; private JComboBox<String> combo_class; private JTextField str_class; private JRadioButton idle_normal, idle_inv, idle_color; private JLabel idle_label; private ChooserStateView function_list; private final StateColorMap color_map; // Constructor public AnColorChooser(final AnWindow awindow, final Frame frame) { super(awindow, frame, AnLocale.getString("Function Colors"), false, null, null, null); color_map = new StateColorMap(); initComponents(); ok.setVisible(false); apply.setVisible(false); } // Initialize GUI components private void initComponents() { final JComponent preview; JPanel panel; final JPanel set_panel; final JPanel legend_panel; final ImageIcon icon; final ButtonGroup group; JButton closeButton = getDefaultButtons()[2]; // closeButton.setMnemonic(AnLocale.getString('e', "ColorChooserCloseButtonMN")); getRootPane().setDefaultButton(closeButton); // Color chooser panel chooser = new JColorChooser(); AnUtility.setAccessibleContext( chooser.getAccessibleContext(), AnLocale.getString("Color chooser")); chooser.setPreviewPanel(new JPanel()); chooser.getSelectionModel().addChangeListener(this); preview = (JComponent) chooser.getPreviewPanel().getParent(); if (preview != null) { preview.setBorder(null); } icon = new ImageIcon(StackState.createIcon(chooser.getColor(), 12, 12, true)); set_panel = new JPanel(); set_panel.setLayout(new BoxLayout(set_panel, BoxLayout.Y_AXIS)); // Set-all & Reset buttons set_sel = new JButton(AnLocale.getString("Set Selected Functions"), icon); AnUtility.setAccessibleContext(set_sel.getAccessibleContext(), set_sel.getText()); set_sel.setIconTextGap(8); set_sel.setMnemonic(AnLocale.getString('u', "MNEM_COLOR_CHOOSER_SET_SELECTED_FUNCTIONS")); set_sel.addActionListener(this); set_all = new JButton(AnLocale.getString("Set All Functions"), icon); AnUtility.setAccessibleContext(set_all.getAccessibleContext(), set_all.getText()); set_all.setIconTextGap(8); set_all.setMnemonic(AnLocale.getString('A', "MNEM_COLOR_CHOOSER_SET_ALL_FUNCTIONS")); set_all.addActionListener(this); reset = new JButton(AnLocale.getString("Reset Default Colors")); AnUtility.setAccessibleContext(reset.getAccessibleContext(), reset.getText()); reset.setMnemonic(AnLocale.getString('R', "MNEM_COLOR_CHOOSER_RESET_DEFAULT_COLORS")); reset.addActionListener(this); panel = new JPanel(new GridLayout(1, 0, 4, 0)); panel.add(set_sel); panel.add(set_all); panel.add(reset); set_panel.add(panel); set_panel.add(Box.createVerticalStrut(4)); // Set class color panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); set_class = new JButton(AnLocale.getString("Set Functions:"), icon); AnUtility.setAccessibleContext(set_class.getAccessibleContext(), set_class.getText()); set_class.setIconTextGap(8); set_class.setMnemonic(AnLocale.getString('F', "MNEM_COLOR_CHOOSER_SET_FUNCTIONS")); set_class.addActionListener(this); panel.add(set_class); combo_class = new JComboBox<>(ColorRule.SETC_STR); AnUtility.setAccessibleContext( combo_class.getAccessibleContext(), AnLocale.getString("Function filter")); panel.add(combo_class); str_class = new JTextField("", 10); AnUtility.setAccessibleContext( str_class.getAccessibleContext(), AnLocale.getString("Function text")); panel.add(str_class); set_panel.add(panel); set_panel.add(Box.createVerticalStrut(4)); set_panel.add(new JSeparator(SwingConstants.HORIZONTAL)); set_panel.add(Box.createVerticalStrut(4)); // Set CPU idle color idle_normal = new JRadioButton(AnLocale.getString("Normal", "COLOR_CHOOSER_NORMAL"), true); AnUtility.setAccessibleContext(idle_normal.getAccessibleContext(), idle_normal.getText()); idle_normal.setMnemonic(AnLocale.getString('N', "MNEM_COLOR_CHOOSER_NORMAL")); idle_normal.addActionListener(this); idle_inv = new JRadioButton(AnLocale.getString("Invisible"), false); AnUtility.setAccessibleContext(idle_inv.getAccessibleContext(), idle_inv.getText()); idle_inv.setMnemonic(AnLocale.getString('I', "MNEM_COLOR_CHOOSER_INVISIBLE")); idle_inv.addActionListener(this); idle_color = new JRadioButton(AnLocale.getString("Selected Color"), false); AnUtility.setAccessibleContext(idle_color.getAccessibleContext(), idle_color.getText()); idle_color.setMnemonic(AnLocale.getString('o', "MNEM_COLOR_CHOOSER_SELECTED_COLOR")); idle_color.addActionListener(this); idle_label = new JLabel(icon); AnUtility.setAccessibleContext( idle_label.getAccessibleContext(), AnLocale.getString("Selected Color")); group = new ButtonGroup(); group.add(idle_normal); group.add(idle_inv); group.add(idle_color); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); final JLabel lbl = new JLabel(AnLocale.getString("Set CPU Idle Events Color:")); panel.add(lbl); lbl.getAccessibleContext().setAccessibleName(AnLocale.getString("CPU Idle Events Color")); lbl.getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Set CPU Idle Events Color")); panel.add(idle_normal); panel.add(idle_inv); panel.add(idle_color); panel.add(idle_label); panel.add(Box.createGlue()); set_panel.add(panel); // Function List Pane function_list = new ChooserStateView(color_map); function_list.addListSelectionListener(this); function_list.addMouseListener(this); JScrollPane functionListPane = new AnJScrollPane(function_list); HelpAction helpAction = new HelpAction(AnVariable.HELP_TabsLegend); panel.registerKeyboardAction( helpAction, "help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); panel.registerKeyboardAction( helpAction, "help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_FOCUSED); panel.registerKeyboardAction( helpAction, "help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); AccessibleContext context = functionListPane.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Function List")); context.setAccessibleDescription(AnLocale.getString("Function List")); context = function_list.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Function List")); context.setAccessibleDescription(AnLocale.getString("Function List")); // Legend panel to display functions and related colors legend_panel = new JPanel(); legend_panel.setLayout(new BoxLayout(legend_panel, BoxLayout.Y_AXIS)); JTabbedPane pane = new JTabbedPane(); pane.addTab(AnLocale.getString("Legend"), functionListPane); AnUtility.setAccessibleContext(pane.getAccessibleContext(), AnLocale.getString("Legend")); legend_panel.add(pane); // Set chooser outline panel = new JPanel(new BorderLayout()); panel.add(chooser, BorderLayout.WEST); panel.add(legend_panel, BorderLayout.CENTER); panel.add(set_panel, BorderLayout.SOUTH); setAccessory(panel); } // Action performed @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("Set Selected Functions"))) { int indices[] = function_list.getSelectedIndices(); int size = function_list.getModel().getSize(); Color color = chooser.getColor(); if (false /* indices.length == size && size>0 */) { // treat "ctrl-a" as all color_map.setRuleAllFunctions(color); } else { ArrayList<ColorRule> rules = new ArrayList<>(); for (int jj = 0; jj < indices.length; jj++) { int ii = indices[jj]; StackState state = function_list.getState(ii); if (state != null) { ColorRule rule = new ColorRule(color, ColorRule.SETC_MATCHES, state.getName(), false); rules.add(rule); } } color_map.setRules(rules); } } else if (cmd.equals(AnLocale.getString("Set All Functions"))) { color_map.setRuleAllFunctions(chooser.getColor()); } else if (cmd.equals(AnLocale.getString("Reset Default Colors"))) { color_map.restoreToDefault(); } else if (cmd.equals(AnLocale.getString("Set Functions:"))) { String spec = str_class.getText(); spec = spec.trim(); if (!spec.isEmpty()) { color_map.setRule(chooser.getColor(), combo_class.getSelectedIndex(), spec, false); } } else if (cmd.equals(AnLocale.getString("Normal"))) { window.setCPUIdleColor(false, null); // FIXUP: REARCH } else if (cmd.equals(AnLocale.getString("Invisible"))) { window.setCPUIdleColor(true, null); // FIXUP: REARCH } else if (cmd.equals(AnLocale.getString("Selected Color"))) { window.setCPUIdleColor(true, chooser.getColor()); // FIXUP: REARCH } } // Update color from the color chooser @Override public void stateChanged(final ChangeEvent event) { final ImageIcon icon; icon = new ImageIcon(StackState.createIcon(chooser.getColor(), 12, 12, true)); set_class.setIcon(icon); set_sel.setIcon(icon); set_all.setIcon(icon); idle_label.setIcon(icon); } // (MUST BE CALLED ON AWT THREAD) private void funcSelChanged(EventObject event) { if (event.getSource() instanceof StackView) { // ChooserStateView StackView list = (StackView) event.getSource(); StackState state = (StackState) list.getSelectedValue(); if (state != null) { setSelectedFunction(state.getNumber()); } } } @Override public void valueChanged(final ListSelectionEvent event) { funcSelChanged(event); } public final StateColorMap getColorMap() { return color_map; } // (MUST BE CALLED ON AWT THREAD) // <number> should be Histable::Function* (not Function->id) public void setSelectedFunction(long number) { Color c = color_map.getFuncColor(number); function_list.setSelectedFunction(number); chooser.setColor(c); } @Override public void mouseClicked(MouseEvent event) { if (!SwingUtilities.isLeftMouseButton(event)) { return; } funcSelChanged(event); } @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/StateColorMap.java�������������������������������������0000644�0001750�0001750�00000003065�14744453367�021676� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import java.awt.Color; public final class StateColorMap extends ColorMap { private final int rgb_min[] = {110, 120, 200}; private final int rgb_max[] = {195, 195, 255}; private final int max_brightness = 225 * 3; // max possible is 255*3; public StateColorMap() {} @Override protected Color getBaseColor(String name) { Color c; int hc = name.hashCode(); double rgb[] = new double[3]; double brightness = 0; for (int ii = 0; ii < 3; ii++) { rgb[ii] = ((hc >> 8 * ii) & 0xff) / 256.0 * (rgb_max[ii] - rgb_min[ii]) + (double) rgb_min[ii]; brightness += rgb[ii]; } if (brightness > max_brightness) { double dim_factor = max_brightness / brightness; for (int ii = 0; ii < 3; ii++) { rgb[ii] *= dim_factor; } } c = new Color((int) rgb[0], (int) rgb[1], (int) rgb[2]); return c; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/ColorRule.java�����������������������������������������0000644�0001750�0001750�00000004357�14744453367�021074� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import org.gprofng.mpmt.AnLocale; import java.awt.Color; import java.util.regex.Pattern; // This class is immutable public final class ColorRule { public static final String[] SETC_STR = { // YXXX indices must match SETC_* definitions below AnLocale.getString("Starts with"), AnLocale.getString("Contains"), AnLocale.getString("Ends with"), AnLocale.getString("Regular Exp."), AnLocale.getString("Matches exactly") }; public static final int SETC_ALL = -1; public static final int SETC_START = 0; public static final int SETC_CONTAIN = 1; public static final int SETC_END = 2; public static final int SETC_REGEXP = 3; public static final int SETC_MATCHES = 4; private final int type; // SETC_* definition private final String text; private final Color color; private final boolean isDefault; protected final Pattern reg_exp; // may be null public ColorRule(Color _color, int _type, String _nametext, boolean _isDefault) { type = _type; text = _nametext; color = _color; isDefault = _isDefault; reg_exp = null; } public ColorRule( Color _color, int _type, String _nametext, boolean _isDefault, Pattern _reg_exp) { type = _type; text = _nametext; color = _color; isDefault = _isDefault; reg_exp = _reg_exp; } public int getType() { return type; } public String getText() { return text; } public Color getColor() { return color; } public boolean getIsDefault() { return isDefault; } public Pattern getRegExpr() { return reg_exp; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statecolors/StackView.java�����������������������������������������0000644�0001750�0001750�00000035267�14744453367�021072� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statecolors; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.filter.FilterClause; import org.gprofng.mpmt.settings.ViewModeSetting; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.DefaultListCellRenderer; import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.KeyStroke; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; // Stack displayed as Colored boxes labeled with PC names public class StackView extends JList { protected final StateColorMap color_map; private String addFilterString = AnLocale.getString("Add Filter: "); private String viewName = AnLocale.getString("Call Stack"); protected long stackId = -1; private final String exclude_PC_stack = AnLocale.getString("Include only events not containing the current PC stack"); private final String include_PC_stack = AnLocale.getString("Include only events containing the current PC stack"); private final String filter_exclude_PC_stack = addFilterString + exclude_PC_stack; private final String filter_include_PC_stack = addFilterString + include_PC_stack; private final String exclude_function_stack = AnLocale.getString("Include only events not containing the current function stack"); private final String include_function_stack = AnLocale.getString("Include only events containing the current function stack"); private final String filter_exclude_function_stack = addFilterString + exclude_function_stack; private final String filter_include_function_stack = addFilterString + include_function_stack; // Constructor public StackView(final StateColorMap color_map) { this.color_map = color_map; AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Stack View")); ListRenderer lrend; lrend = new ListRenderer(); setCellRenderer(lrend); // setBackground(lrend.getBackground()); // XXXmpview can this be done later, like in setStates? Font font = new Font("Monospaced", Font.PLAIN, getFont().getSize()); setFont(font); setFixedCellHeight(font.getSize() < 17 ? 17 : font.getSize()); KeyStroke keyStroke = KeyboardShortcuts.contextMenuActionShortcut; getInputMap().put(keyStroke, keyStroke); getActionMap() .put( keyStroke, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { StackViewPopupListener popupListener = new StackViewPopupListener(AnWindow.getInstance()); popupListener.showPopup(StackView.this, 0, 0); } }); addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { AnWindow.getInstance().setSelectedView(AnDisplay.DSP_Source); } } }); setSelectionMode( ListSelectionModel.SINGLE_SELECTION); // Allow only single line selection for now. } public void setStackId(final long id) { this.stackId = id; } // Set components public void setStates(Vector<StackState> sv_state, int index) { int size = sv_state.size(); setListData(sv_state); if (size == 0) { return; } // Set selected function if (index == -1) { clearSelection(); ensureIndexIsVisible(0); } else { index = Math.max(index, 0); index = Math.min(index, size - 1); setSelectedIndex(index); ensureIndexIsVisible(index); } } // Clear list public void reset() { setListData(new Vector<StackState>()); } // Set selected function public StackState getSelectedState() { return (StackState) getSelectedValue(); } // Set selected function public void setSelectedFunction(long func) { StackState state; ListModel data = getModel(); if (data == null) return; state = (StackState) getSelectedValue(); if ((state != null) && (state.getNumber() == func)) return; clearSelection(); int ii; for (ii = 0; ii < data.getSize(); ii++) { state = (StackState) data.getElementAt(ii); if (state.getNumber() == func) { setSelectedValue(state, true); // could do a hashmap break; } } // repaint(); } // List renderer protected class ListRenderer extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setText(value.toString()); StackState svstate = (StackState) value; Color color = color_map.getFuncColor(svstate.getNumber()); setIcon(new ImageIcon(StackState.createContigIcon(color))); setBorder(null); return this; } } public class StackViewPopupListener extends MouseAdapter implements PopupMenuListener { private AnWindow window; public StackViewPopupListener(AnWindow w) { window = w; } @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } // public void mouseReleased(MouseEvent e) { // maybeShowPopup(e); // } public void maybeShowPopup(MouseEvent e) { showPopup(e.getComponent(), e.getX(), e.getY()); } public void showPopup(Component component, int x, int y) { JPopupMenu popup = createStackViewPopupMenu(); popup.show(component, x, y); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuCanceled(PopupMenuEvent e) {} class ShowSource extends AbstractAction { public ShowSource() { super(AnLocale.getString("Show Source")); } @Override public void actionPerformed(ActionEvent ev) { window.setSelectedView(AnDisplay.DSP_Source); } } class ShowDisasm extends AbstractAction { public ShowDisasm() { super(AnLocale.getString("Show Disassembly")); } @Override public void actionPerformed(ActionEvent ev) { window.setSelectedView(AnDisplay.DSP_Disassembly); } } class FilterByStackId extends AbstractAction { private boolean isExclude; public FilterByStackId(boolean isE) { super(isE ? filter_exclude_PC_stack : filter_include_PC_stack); isExclude = isE; } @Override public void actionPerformed(ActionEvent ev) { String clause = "("; clause += stackId; clause += ")"; String stack = "STACKID"; clause = "(" + clause + "==" + stack + ")"; if (isExclude) { clause = "(!" + clause + ")"; } String shortName = viewName + ": " + AnLocale.getString("Current PC Stack"); String longName; if (isExclude) { longName = filter_exclude_PC_stack; } else { longName = filter_include_PC_stack; } window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field } } class FilterByStack extends AbstractAction { private boolean isExclude; public FilterByStack(boolean isE) { super(isE ? filter_exclude_function_stack : filter_include_function_stack); isExclude = isE; } @Override public void actionPerformed(ActionEvent ev) { ListModel model = getModel(); long[] funcs = new long[model.getSize()]; for (int i = 0; i < model.getSize(); i++) { StackState state = (StackState) model.getElementAt(i); funcs[model.getSize() - i - 1] = state.getNumber(); } long[] funcIds = window.getFuncIds(funcs); String clause = "("; for (int i = 0; i < funcIds.length; i++) { clause += funcIds[i]; if (i != funcIds.length - 1) { clause += ","; } } clause += ")"; String stack = "USTACK"; if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.MACHINE) { stack = "MSTACK"; } if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.EXPERT) { stack = "XSTACK"; } clause = "(" + clause + " ORDERED IN " + stack + ")"; if (isExclude) { clause = "(!" + clause + ")"; } String shortName = viewName + ": " + AnLocale.getString("Current Function Stack"); String longName; if (isExclude) { longName = filter_exclude_function_stack; } else { longName = filter_include_function_stack; } window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field } } class FilterByFunction extends AbstractAction { public FilterByFunction() { super( AnLocale.getString( addFilterString + "Include only stacks containing the selected function")); } @Override public void actionPerformed(ActionEvent ev) { long ID = window.getSelectedObject().getSelObjV2("FUNCTION"); String clause = "(" + ID + ")"; String stack = "USTACK"; if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.MACHINE) { stack = "MSTACK"; } if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.EXPERT) { stack = "XSTACK"; } clause = "(" + clause + " IN " + stack + ")"; String shortName = viewName + ": " + AnLocale.getString("Selected Function"); String longName = AnLocale.getString("Include only stacks containing the selected function"); window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field } } class FilterByPC extends AbstractAction { public FilterByPC() { super( AnLocale.getString(addFilterString + "Include only stacks containing the selected PC")); } @Override public void actionPerformed(ActionEvent ev) { long LID = window.getSelectedObject().getSelObjV2("INSTRUCTION"); String clause = "(" + LID + ")"; String stack = "USTACK"; if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.MACHINE) { stack = "MSTACK"; } if (window.getSettings().getViewModeSetting().get() == ViewModeSetting.ViewMode.EXPERT) { stack = "XSTACK"; } clause = "(" + clause + " IN " + stack + "I)"; String shortName = viewName + ": " + AnLocale.getString("Selected PC"); String longName = AnLocale.getString("Include only stacks containing the selected PC"); window .getFilters() .addClause( shortName, longName, clause, FilterClause.Kind.STANDARD); // Put the string in text field } } class RemoveLastFilter extends AbstractAction { public RemoveLastFilter() { super(AnLocale.getString("Undo Last Filter")); } @Override public void actionPerformed(ActionEvent ev) { window.getFilters().undoLastFilteraction(); } } class RedoLastFilter extends AbstractAction { public RedoLastFilter() { super(AnLocale.getString("Redo Filter")); } @Override public void actionPerformed(ActionEvent ev) { window.getFilters().redoLastFilteraction(); } } class RemoveAllFilter extends AbstractAction { public RemoveAllFilter() { super(AnLocale.getString("Remove All Filters")); } @Override public void actionPerformed(ActionEvent ev) { window.getFilters().addClause(FilterClause.getNoFiltersClause(), false); } } private JPopupMenu createStackViewPopupMenu() { JMenuItem menuItem; JPopupMenu popup = new JPopupMenu(); menuItem = new JMenuItem(new ShowSource()); popup.add(menuItem); menuItem = new JMenuItem(new ShowDisasm()); popup.add(menuItem); popup.addSeparator(); menuItem = new JMenuItem(new FilterByStack(false)); popup.add(menuItem); menuItem = new JMenuItem(new FilterByStack(true)); popup.add(menuItem); if (stackId != -1) { menuItem = new JMenuItem(new FilterByStackId(false)); popup.add(menuItem); menuItem = new JMenuItem(new FilterByStackId(true)); popup.add(menuItem); } menuItem = new JMenuItem(new FilterByFunction()); popup.add(menuItem); menuItem = new JMenuItem(new FilterByPC()); popup.add(menuItem); menuItem = new JMenuItem(new RemoveLastFilter()); menuItem.setEnabled(window.getFilters().canUndoLastFilter()); popup.add(menuItem); menuItem = new JMenuItem(new RedoLastFilter()); menuItem.setEnabled(window.getFilters().canRedoLastFilter()); popup.add(menuItem); menuItem = new JMenuItem(new RemoveAllFilter()); menuItem.setEnabled(window.getFilters().canRemoveAllFilters()); popup.add(menuItem); return popup; } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/�����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015447� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomeInnerPanel.form�������������������������������������0000644�0001750�0001750�00000003747�14744453367�021652� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-67,0,0,2,-63"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> �������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomePanel.java������������������������������������������0000644�0001750�0001750�00000004505�14744453367�020625� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.welcome; import org.gprofng.analyzer.AnEnvironment; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; public class WelcomePanel extends javax.swing.JPanel { private final WelcomeInnerPanel welcomeInnerPanel; public WelcomePanel() { initComponents(); setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); setLayout(new GridBagLayout()); welcomeInnerPanel = new WelcomeInnerPanel(); welcomeInnerPanel.setMinimumSize(new Dimension(10, 10)); welcomeInnerPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(welcomeInnerPanel, gridBagConstraints); } @Override public void requestFocus() { welcomeInnerPanel.requestFocus(); } protected void doCompute() { welcomeInnerPanel.doCompute(); } protected void enableActions(boolean enable) { welcomeInnerPanel.enableActions(enable); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomeView.java�������������������������������������������0000644�0001750�0001750�00000011056�15044710303�020453� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.welcome; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; public final class WelcomeView extends AnDisplay implements ExportSupport, AnChangeListener { private final WelcomePanel welcomePanel; // Constructor public WelcomeView() { super(AnWindow.getInstance(), AnDisplay.DSP_Welcome, AnVariable.HELP_Welcome); setLayout(new BorderLayout()); welcomePanel = new WelcomePanel(); add(welcomePanel, BorderLayout.CENTER); setAccessibility(AnLocale.getString("Welcome View")); AnEventManager.getInstance().addListener(this); } @Override public void requestFocus() { welcomePanel.requestFocus(); } // Initialize GUI components @Override protected void initComponents() {} public String getShortDescr() { return "Welcome short description..."; } public String getLongDescr() { return "<HTML><b>Welcome View</b><br>Welcome long" + " description......<br>..............................................<br>..............................................</HTML>"; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("WelcomeDisp stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; welcomePanel.enableActions(false); break; case EXPERIMENTS_LOADED_FAILED: welcomePanel.enableActions(true); break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } welcomePanel.enableActions(true); break; case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case FILTER_CHANGED: case SETTING_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void doCompute() { // System.out.println("WelcomeDisp:doCompute: " + selected + " " + computed); AnUtility.checkIfOnAWTThread(false); if (!selected) { // Not selected return; } if (!computed) { // Not computed welcomePanel.doCompute(); computed = true; } } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomeInnerPanel.java�������������������������������������0000644�0001750�0001750�00000046607�15044710303�021606� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.welcome; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnAction; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.ExperimentPickListElement; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Box.Filler; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; public class WelcomeInnerPanel extends javax.swing.JPanel { private final int MOST_RECENT_EXP_LIST_SIZE = 9; private static final Font font12 = new JLabel().getFont().deriveFont(12f); private static final Font bold12Font = font12.deriveFont(Font.BOLD); private static final Font plain12Font = font12.deriveFont(Font.PLAIN); private static final Font bold16Font = bold12Font.deriveFont(16f); private static final Font bold17Font = bold12Font.deriveFont(17f); private static final Font bold18Font = bold12Font.deriveFont(18f); private static final Font bold22Font = bold12Font.deriveFont(22f); private static final Font plain16Font = plain12Font.deriveFont(16f); private static final Font plain17Font = plain12Font.deriveFont(17f); private static final Font plain18Font = plain12Font.deriveFont(18f); private static final Font plain19Font = plain12Font.deriveFont(19f); private static final Font plain22Font = plain12Font.deriveFont(22f); private JPanel leftPanel; private JPanel rightPanel; private ImageIcon backgroundImageIcon; private JLabel createExperimentTitleLabel; private JLabel viewExperimentTitleLabel; private WelcomeButton profileAppButton; private WelcomeButton profileRunningAppButton; private WelcomeButton openExistingExperimentButton; private WelcomeButton openRecentExperimentButton; private List<WelcomeButton> recentExperimentsButtons; private WelcomeButton compareExperimentsButton; private WelcomeButton connectButton; public WelcomeInnerPanel() { backgroundImageIcon = new ImageIcon( // getClass().getResource("/org/gprofng/mpmt/icons/welcomeScreenNoDivider.png")); getClass().getResource("/org/gprofng/mpmt/icons/welcomeBackgroundShadow.png")); // getClass().getResource("/org/gprofng/mpmt/icons/welcomeAlternate.png")); initComponents(); buildForeground(); buildBackground(); } @Override public void requestFocus() { profileAppButton.requestFocus(); // First button } protected void enableActions(boolean enable) { if (!enable) { setConnected(false); connectButton.setEnabled(false); } else { setConnected(Analyzer.getInstance().isConnected()); connectButton.setEnabled(true); } } private void setConnected(boolean connected) { createExperimentTitleLabel.setEnabled(connected); viewExperimentTitleLabel.setEnabled(connected); profileAppButton.setEnabled(connected); profileRunningAppButton.setEnabled(false); // profileKernelButton.setEnabled(connected && // Analyzer.getInstance().isKernelProfilingEnabled()); openExistingExperimentButton.setEnabled(connected); if (openRecentExperimentButton != null) { openRecentExperimentButton.setEnabled(connected); } if (recentExperimentsButtons != null) { for (WelcomeButton welcomeButton : recentExperimentsButtons) { welcomeButton.setEnabled(connected); } } compareExperimentsButton.setEnabled(connected); } private void buildBackground() { GridBagConstraints gridBagConstraints = new GridBagConstraints(); JLabel iconLabel = new JLabel(); AnUtility.setAccessibleContext(iconLabel.getAccessibleContext(), " "); iconLabel.setIcon(backgroundImageIcon); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 1; gridBagConstraints.gridheight = 1; gridBagConstraints.anchor = GridBagConstraints.CENTER; add(iconLabel, gridBagConstraints); } private void buildForeground() { GridBagConstraints gridBagConstraints; JPanel foregroundPanel = new JPanel(); Dimension dim = new Dimension(backgroundImageIcon.getIconWidth(), backgroundImageIcon.getIconHeight()); foregroundPanel.setMinimumSize(dim); foregroundPanel.setPreferredSize(dim); foregroundPanel.setMaximumSize(dim); foregroundPanel.setOpaque(false); foregroundPanel.setLayout(new GridBagLayout()); buildLabelsAndPanels(foregroundPanel); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.anchor = GridBagConstraints.CENTER; add(foregroundPanel, gridBagConstraints); } private void buildLabelsAndPanels(JPanel foregroundPanel) { GridBagConstraints gridBagConstraints; JPanel topLabelPanel = new JPanel(); topLabelPanel.setLayout(new GridBagLayout()); topLabelPanel.setOpaque(false); JLabel label = new JLabel(" "); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setForeground(AnEnvironment.WELCOME_MAIN_LABEL_COLOR); label.setFont(bold16Font); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(0, 0, 0, 0); topLabelPanel.add(label, gridBagConstraints); JLabel label2 = new JLabel(" "); AnUtility.setAccessibleContext(label2.getAccessibleContext(), label2.getText()); label2.setForeground(AnEnvironment.WELCOME_MAIN_LABEL_COLOR); label2.setFont(plain16Font); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(0, 4, 0, 0); topLabelPanel.add(label2, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets = new Insets(60, 200, 0, 0); foregroundPanel.add(topLabelPanel, gridBagConstraints); JLabel label3 = new JLabel(AnLocale.getString("Welcome")); AnUtility.setAccessibleContext(label3.getAccessibleContext(), label3.getText()); label3.setForeground(AnEnvironment.WELCOME_MAIN_LABEL_COLOR); label3.setFont(bold22Font); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(20, 75, 0, 0); foregroundPanel.add(label3, gridBagConstraints); leftPanel = new JPanel(); leftPanel.setLayout(new GridBagLayout()); buildLeftPanel(leftPanel); leftPanel.setOpaque(false); // leftPanel.setBackground(Color.red); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(16, 122, 0, 0); foregroundPanel.add(leftPanel, gridBagConstraints); rightPanel = new JPanel(); rightPanel.setLayout(new GridBagLayout()); buildRightPanel(rightPanel); rightPanel.setOpaque(false); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(16, 40, 0, 0); foregroundPanel.add(rightPanel, gridBagConstraints); } private void buildLeftPanel(JPanel panel) { AnAction action; panel.removeAll(); int gridy = 0; createExperimentTitleLabel = addSectionTitleLabel(panel, AnLocale.getString("Create Experiments"), gridy++); action = AnWindow.getInstance().getProfileApplicationAction(); profileAppButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); action = AnWindow.getInstance().getProfileRunningProcessAction(); profileRunningAppButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); addSpace(panel, 14, gridy++); viewExperimentTitleLabel = addSectionTitleLabel(panel, AnLocale.getString("View Experiments"), gridy++); action = AnWindow.getInstance().getOpenExperimentAction(); openExistingExperimentButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); List<ExperimentPickListElement> recentExperiments = UserPref.getInstance() .getExperimentsPicklists() .getPicklist() .getRecentExperiments(MOST_RECENT_EXP_LIST_SIZE); if (!recentExperiments.isEmpty()) { String buttonText = AnLocale.getString("Open Recent Experiment"); String buttonTT = AnLocale.getString("Click an experiment name below to reopen it"); openRecentExperimentButton = addActionButton(panel, gridy++, buttonText, buttonTT, null); if (Analyzer.getInstance().isConnected()) { recentExperimentsButtons = new ArrayList<>(); for (ExperimentPickListElement experimentElement : recentExperiments) { String displayName = AnUtility.basename(experimentElement.getPath()); int length = displayName.length(); if (length > 25) { // 16 displayName = displayName.substring(0, 54) + "..." + displayName.substring(length - 7); } recentExperimentsButtons.add( addExperimentButton( panel, gridy++, displayName, experimentElement.getToolTip(), new OpenExistingExperimentAction(experimentElement))); } } } action = AnWindow.getInstance().getCompareExperimentsAction(); compareExperimentsButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); addSpace(panel, 14, gridy++); addSectionTitleLabel(panel, AnLocale.getString("Remote"), gridy++); action = AnWindow.getInstance().getConnectAction(); connectButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); addButtomFill(panel, gridy++); addRightFill(panel); } private void buildRightPanel(JPanel panel) { AnAction action; int gridy = 0; /* addSectionTitleLabel(panel, AnLocale.getString("Remote"), gridy++); action = AnWindow.getInstance().getConnectAction(); connectButton = addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); */ addSpace(panel, 14, gridy++); /* addSectionTitleLabel(panel, AnLocale.getString("Learn More"), gridy++); action = AnWindow.getInstance().getHelpAnalyzerAction(); addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); action = AnWindow.getInstance().getHelpNewFeaturesAction(); addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); action = AnWindow.getInstance().getHelpInformationMapAction(); addActionButton(panel, gridy++, action.getTextNoDots(), action.getTooltipText(), action); */ addButtomFill(panel, gridy++); } /* * Picklist changes */ public void doCompute() { // System.out.println("WelcomeInnerPanel doCompute ********************"); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { buildLeftPanel(leftPanel); setConnected(Analyzer.getInstance().isConnected()); validate(); repaint(); } }); } private void addSpace(JPanel panel, int space, int gridy) { Dimension dim = new Dimension(space, space); Filler filler = new Filler(dim, dim, dim); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 0); panel.add(filler, gridBagConstraints); } private JLabel addSectionTitleLabel(JPanel panel, String title, int gridy) { JLabel label = new JLabel(title); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(bold18Font); label.setForeground(AnEnvironment.WELCOME_MAIN_LABEL_COLOR); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); panel.add(label, gridBagConstraints); return label; } private WelcomeButton addActionButton( JPanel panel, int gridy, String labelTxt, String labelTT, Action action) { WelcomeButton button = new WelcomeButton( labelTxt, labelTT, action, 5, AnEnvironment.WELCOME_BUTTON_ACTION_COLOR, Font.BOLD); JLabel label = new JLabel(); label.setIcon(new ImageIcon(getClass().getResource("/org/gprofng/mpmt/icons/tab.png"))); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0); panel.add(label, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = gridy; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0); panel.add(button, gridBagConstraints); return button; } private WelcomeButton addExperimentButton( JPanel panel, int gridy, String labelTxt, String labelTT, Action action) { WelcomeButton button = new WelcomeButton( labelTxt, labelTT, action, 4, AnEnvironment.WELCOME_BUTTON_EXPERIMENT_COLOR, Font.BOLD); JLabel label = new JLabel(); if (labelTxt.endsWith("erg")) { label.setIcon( new ImageIcon(getClass().getResource("/org/gprofng/mpmt/icons/expgroup.png"))); } else { label.setIcon( new ImageIcon(getClass().getResource("/org/gprofng/mpmt/icons/experiment.png"))); } AnUtility.setAccessibleContext(label.getAccessibleContext(), labelTxt); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = gridy; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0); panel.add(label, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = gridy; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0); panel.add(button, gridBagConstraints); return button; } private void addButtomFill(JPanel panel, int gridy) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = gridy; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; panel.add(new JLabel(), gridBagConstraints); } private void addRightFill(JPanel panel) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 100; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets = new Insets(0, 0, 0, 300); Dimension dim = new Dimension(0, 0); Filler filler = new Filler(dim, dim, dim); panel.add(filler, gridBagConstraints); } class OpenExperimentAction implements ActionListener { // @Override @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().openExperimentAction(); } } class ConnectRemoteHostAction implements ActionListener { // @Override @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().connectAction(); } } class CompareExperimentsAction implements ActionListener { // @Override @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().compareExperimentsAction(); } } class OpenExistingExperimentAction extends AbstractAction { private ExperimentPickListElement experimentElement; public OpenExistingExperimentAction(ExperimentPickListElement experimentElement) { this.experimentElement = experimentElement; } @Override public void actionPerformed(ActionEvent e) { ArrayList<String> list = new ArrayList<>(); list.add(experimentElement.getPath()); String confPath; boolean always; if (experimentElement.getConfPath() != null) { confPath = experimentElement.getConfPath(); always = true; } else { confPath = UserPref.getAsWhenClosedConfigPath(experimentElement.getPath()); always = false; } AnWindow.getInstance() .loadExperimentList( list, false, experimentElement.getWorkingDirectory(), true, confPath, always); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomeButton.java�����������������������������������������0000644�0001750�0001750�00000006414�14744453367�021042� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.welcome; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.Action; import javax.swing.JButton; import javax.swing.UIManager; public class WelcomeButton extends JButton { private final Color foreground; public WelcomeButton( String text, String tooltip, Action action, int txtSize, Color foreground, int style) { super(action); setText(text); setToolTipText(tooltip); setIcon(null); AnUtility.setAccessibleContext(getAccessibleContext(), text); this.foreground = foreground; setBorder(null); setBorderPainted(false); setOpaque(false); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); setForeground(foreground); setFont( getFont() .deriveFont(12f)); // Use font size 12 for now. Doesn't resize with --fontsize option setFont(getFont().deriveFont(style)); setFont(getFont().deriveFont((float) getFont().getSize() + txtSize)); if (action != null) { addMouseListener( new MouseAdapter() { private Cursor oldCursor = null; // @Override @Override public void mouseEntered(MouseEvent e) { oldCursor = getCursor(); setCursor(new Cursor(Cursor.HAND_CURSOR)); setForeground(AnEnvironment.WELCOME_BUTTON_FOCUSED_COLOR); } // @Override @Override public void mouseExited(MouseEvent e) { setCursor(oldCursor); setForeground(WelcomeButton.this.foreground); } }); addKeyListener( new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { actionListener.actionPerformed(null); } } }); } } @Override public void paint(Graphics g) { if (!isEnabled()) { Color saveColor = (Color) UIManager.getDefaults().get("Button.disabledText"); UIManager.getDefaults() .put("Button.disabledText", AnEnvironment.WELCOME_BUTTON_DISABLED_COLOR); super.paint(g); UIManager.getDefaults().put("Button.disabledText", saveColor); } else { super.paint(g); if (hasFocus()) { g.setColor(new Color(200, 200, 200)); g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); } } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/welcome/WelcomePanel.form������������������������������������������0000644�0001750�0001750�00000003746�14744453367�020655� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,52,0,0,1,-18"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/�����������������������������������������������������0000755�0001750�0001750�00000000000�15044723233�016651� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/CPToolbarHandler.java��������������������������������0000644�0001750�0001750�00000002641�14744453367�022600� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.control_panel; import java.awt.event.ActionEvent; public interface CPToolbarHandler { public void selectLeft(); public void selectRight(); public void selectDown(); public void selectUp(); public void selectFind(); // TBR? public void selectFirst(); public void toggleMouseMode(); public int getZoomLevelMax(); public void genericZoomToLevel(int n); public void genericZoomIn(); public void genericZoomOut(); public void genericVZoomToLevel(int n); public void genericVZoomIn(); public void genericVZoomOut(); public void resetZoom(); public void undoZoom(); public void redoZoom(); public void zoomToCaliper(); public void chooseColors(); public void showContextMenu(ActionEvent ev); } �����������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/CPFilterPanelHandler.java����������������������������0000644�0001750�0001750�00000001465�14744453367�023406� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.control_panel; public interface CPFilterPanelHandler { public void applyFilter(); public void revalidateFilteredData(); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/CPToolbar.java���������������������������������������0000644�0001750�0001750�00000041347�14744453367�021310� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.control_panel; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnAction; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.toolbar.ToolBarFiller; import org.gprofng.mpmt.toolbar.ToolBarSeparator; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.zoomruler.ZoomRulerComponent; import org.gprofng.mpmt.util.zoomruler.ZoomRulerEvent; import org.gprofng.mpmt.util.zoomruler.ZoomRulerListener; import org.gprofng.mpmt.util.zoomruler.ZoomRulerOverlay; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.KeyStroke; public class CPToolbar extends JToolBar { // components private JToggleButton grabButton; private CPToolbarHandler handler; private final boolean showZoomUndo; private final boolean showZoomRedo; private final boolean showZoomControls; private ZoomRulerComponent hZoomRuler; private ZoomRulerComponent vZoomRuler; // Actions // FIXUP: actions should be moved to TimelineView and the action buttons should be added here in // this file. private AnAction zoomAction; private AnAction undoAction; private AnAction redoAction; private AnAction upOneAction; private AnAction downOneAction; private AnAction leftOneAction; private AnAction rightOneAction; /** Creates a new instance of MPIControlPanel */ public CPToolbar( CPToolbarHandler handler, boolean showZoomControls, boolean showZoomUndo, boolean showZoomRedo) { super(); this.handler = handler; this.showZoomUndo = showZoomUndo; this.showZoomRedo = showZoomRedo; this.showZoomControls = showZoomControls; init(); setOpaque(false); setBorder(null); } private void init() { JToolBar tb = this; tb.setFloatable(false); int mnem; String bname; String keytext; String modtext; JComponent tmp; AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Toolbar")); downOneAction = new AnAction( AnLocale.getString("Down One Event"), AnUtility.down_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (downOneAction.isEnabled()) { selectDown(); } } }); downOneAction.setKeyboardShortCut( null, "TIMELINE_DOWN", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false)); leftOneAction = new AnAction( AnLocale.getString("Left One Event"), AnUtility.back_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (leftOneAction.isEnabled()) { selectLeft(); } } }); leftOneAction.setKeyboardShortCut( null, "TIMELINE_LEFT", KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false)); rightOneAction = new AnAction( AnLocale.getString("Right One Event"), AnUtility.forw_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (rightOneAction.isEnabled()) { selectRight(); } } }); rightOneAction.setKeyboardShortCut( null, "TIMELINE_RIGHT", KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false)); upOneAction = new AnAction( AnLocale.getString("Up One Event"), AnUtility.up_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (upOneAction.isEnabled()) { selectUp(); } } }); upOneAction.setKeyboardShortCut( null, "TIMELINE_UP", KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false)); zoomAction = new AnAction( AnLocale.getString("Zoom to Selected Time Range"), AnUtility.mtall_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (zoomAction.isEnabled()) { zoomToCaliper(); } } }); zoomAction.setKeyboardShortCut( null, "TIMELINE_ZOOM", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false)); grabButton = new JToggleButton(); grabButton.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); mnem = KeyEvent.VK_T; // TimelineView.java installs real handler keytext = KeyEvent.getKeyText(mnem); bname = AnLocale.getString("Toggle between Zoom and Pan mode") + " (" + keytext + ")"; grabButton.setName(bname); grabButton.getAccessibleContext().setAccessibleName(bname); grabButton.getAccessibleContext().setAccessibleDescription(bname); grabButton.setToolTipText(bname); // grabButton.setMnemonic(mnem); grabButton.setEnabled(true); grabButton.setIcon(AnUtility.panhand_icon); grabButton.setMargin(AnVariable.buttonMargin); grabButton.setBorderPainted(false); // grabButton.setSelected(true); grabButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { // toggle between rubberbanding and grabbing mode toggleMouseMode(); } }); undoAction = new AnAction( AnLocale.getString("Undo Zoom Action"), AnUtility.undo_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (undoAction.isEnabled()) { undoZoom(); } } }); undoAction.setKeyboardShortCut( null, "TIMELINE_UNDO", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0, false)); redoAction = new AnAction( AnLocale.getString("Redo Zoom Action"), AnUtility.redo_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (redoAction.isEnabled()) { redoZoom(); } } }); redoAction.setKeyboardShortCut( null, "TIMELINE_REDO", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.SHIFT_DOWN_MASK, false)); if (showZoomControls) { vZoomRuler = new ZoomRulerComponent( ZoomRulerOverlay.VERTICAL_ORIENTATION, 2, // ZoomRulerOverlay.RULER_LD_DEFAULT, false, false, true); AnUtility.setAccessibleContext( vZoomRuler.getAccessibleContext(), AnLocale.getString("Vertical Zoom")); vZoomRuler.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); final ZoomRulerListener vzrl = new ZoomRulerListener() { @Override public void zoomChanged(ZoomRulerEvent event) { if (event.isUndo()) { undoZoom(); } else if (event.isRedo()) { redoZoom(); } else if (event.isLevelChange()) { int lev = event.getZoomLevel(); genericVZoomToLevel(lev); } else if (event.isLevelPlus()) { genericVZoomIn(); } else if (event.isLevelMinus()) { genericVZoomOut(); } else if (event.isReset()) { // resetZoom(); } else if (event.isPan()) { // if (event.getDirection() == ZoomRulerEvent.PAN_UP) // panUp(); // else if (event.getDirection() == ZoomRulerEvent.PAN_RIGHT) // panRight(); // else if (event.getDirection() == ZoomRulerEvent.PAN_DOWN) // panDown(); // else // PAN_LEFT // panLeft(); } } }; vZoomRuler.addZoomRulerListener(vzrl); tmp = vZoomRuler; // tmp.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); bname = AnLocale.getString("Adjust the Veritcal Zoom"); keytext = KeyEvent.getKeyText(KeyEvent.VK_PLUS); // TimelineView.java installs real handler modtext = KeyEvent.getKeyModifiersText(InputEvent.CTRL_MASK); bname += " (" + modtext + "-" + keytext; keytext = KeyEvent.getKeyText(KeyEvent.VK_MINUS); // TimelineView.java installs real handler bname += ", " + modtext + "-" + keytext + ")"; // tmp.getAccessibleContext().setAccessibleName(bname); // tmp.getAccessibleContext().setAccessibleDescription(bname); tmp.setToolTipText(bname); // tmp.setMnemonic(mnem); // tmp.setEnabled(true); hZoomRuler = new ZoomRulerComponent( ZoomRulerOverlay.HORIZONTAL_ORIENTATION, ZoomRulerOverlay.RULER_LD_DEFAULT, true, false, false); AnUtility.setAccessibleContext( hZoomRuler.getAccessibleContext(), AnLocale.getString("Horizontal Zoom")); hZoomRuler.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); final ZoomRulerListener hzrl = new ZoomRulerListener() { @Override public void zoomChanged(ZoomRulerEvent event) { if (event.isUndo()) { undoZoom(); } else if (event.isRedo()) { redoZoom(); } else if (event.isLevelChange()) { int lev = event.getZoomLevel(); genericZoomToLevel(lev); } else if (event.isLevelPlus()) { genericZoomIn(); } else if (event.isLevelMinus()) { genericZoomOut(); } else if (event.isReset()) { resetZoom(); } else if (event.isPan()) { // if (event.getDirection() == ZoomRulerEvent.PAN_UP) // panUp(); // else if (event.getDirection() == ZoomRulerEvent.PAN_RIGHT) // panRight(); // else if (event.getDirection() == ZoomRulerEvent.PAN_DOWN) // panDown(); // else // PAN_LEFT // panLeft(); } } }; hZoomRuler.addZoomRulerListener(hzrl); tmp = hZoomRuler; // tmp.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); bname = AnLocale.getString("Adjust the Horizontal Zoom"); keytext = KeyEvent.getKeyText(KeyEvent.VK_PLUS); // TimelineView.java installs real handler bname += " (" + keytext; keytext = KeyEvent.getKeyText(KeyEvent.VK_MINUS); // TimelineView.java installs real handler bname += ", " + keytext + ")"; // tmp.getAccessibleContext().setAccessibleName(bname); // tmp.getAccessibleContext().setAccessibleDescription(bname); tmp.setToolTipText(bname); // tmp.setMnemonic(mnem); // tmp.setEnabled(true); tb.add(vZoomRuler); tb.add(new ToolBarFiller(2)); tb.add(hZoomRuler); tb.add(new ToolBarFiller(2)); tb.add(zoomAction.createActionButton()); } // showZoomControls if (showZoomUndo) { tb.add(undoAction.createActionButton()); } if (showZoomRedo) { tb.add(redoAction.createActionButton()); } if (showZoomControls || showZoomUndo || showZoomRedo) { tb.add(new ToolBarSeparator(7, 6)); } tb.add(upOneAction.createActionButton()); tb.add(downOneAction.createActionButton()); tb.add(leftOneAction.createActionButton()); tb.add(rightOneAction.createActionButton()); // tb.add(grabButton); TBR? add(AnWindow.getInstance().getFunctionColorsAction().createActionButton()); tb.revalidate(); KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); this.getActionMap() .put( ks, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != handler) { handler.showContextMenu(ev); } } }); } // --- Public API --- /** Turn on navigation controls */ public void enableNavigationButtons( boolean bleft, boolean bright, boolean bup, boolean bdown, boolean bfind) { // YXXX remove bfind? leftOneAction.setEnabled(bleft); rightOneAction.setEnabled(bright); upOneAction.setEnabled(bup); downOneAction.setEnabled(bdown); // zoomAction.setEnabled(bfind); } public void enableZoomToCaliperButton(boolean bfind) { zoomAction.setEnabled(bfind); } public void setZoomLevel(int level) { if (hZoomRuler == null) { return; // weird, caller thinks CPToolbar showZoomControls is true? } hZoomRuler.setZoomLevel(level); } public void setVZoomLevel(int level) { if (vZoomRuler == null) { return; // weird, caller thinks CPToolbar showZoomControls is true? } vZoomRuler.setZoomLevel(level); } public void setNumberOfLevels(int levels) { if (hZoomRuler == null) { return; // weird, caller thinks CPToolbar showZoomControls is true? } hZoomRuler.setNumberOfLevels(levels); } public void setVNumberOfLevels(int levels) { if (vZoomRuler == null) { return; // weird, caller thinks CPToolbar showZoomControls is true? } vZoomRuler.setNumberOfLevels(levels); } /** Turn on navigation controls */ public void enableGrabButton(boolean grab) { grabButton.setEnabled(grab); } public void addToolBarButton(JButton button) { JToolBar tb = this; tb.add(button); tb.revalidate(); } public void enableZoomUndoButton(boolean bfind) { undoAction.setEnabled(bfind); } public void enableZoomRedoButton(boolean bfind) { redoAction.setEnabled(bfind); } // --- wrappers for handler; allows handler to be dynamically replaced private void selectLeft() { handler.selectLeft(); } private void selectRight() { handler.selectRight(); } private void selectDown() { handler.selectDown(); } private void selectUp() { handler.selectUp(); } private void selectFind() { handler.selectFind(); } private void selectFirst() { // no button for this at this time handler.selectFirst(); } private void toggleMouseMode() { handler.toggleMouseMode(); } private void genericZoomIn() { handler.genericZoomIn(); } private void genericZoomOut() { handler.genericZoomOut(); } private void genericZoomToLevel(int n) { handler.genericZoomToLevel(n); } private void genericVZoomIn() { handler.genericVZoomIn(); } private void genericVZoomOut() { handler.genericVZoomOut(); } private void genericVZoomToLevel(int n) { handler.genericVZoomToLevel(n); } private void resetZoom() { handler.resetZoom(); } private void zoomToCaliper() { handler.zoomToCaliper(); } private void undoZoom() { handler.undoZoom(); } private void redoZoom() { handler.redoZoom(); } private void chooseColors() { handler.chooseColors(); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/CPDetailsScrollPane.java�����������������������������0000644�0001750�0001750�00000003132�14744453367�023244� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.control_panel; import org.gprofng.mpmt.util.gui.AnJScrollPane; import java.awt.Dimension; import javax.swing.JComponent; import javax.swing.JScrollBar; import javax.swing.JScrollPane; // the following is an attempt to create a scrollpane that respects // the existing width of the RHT. It's not completely smooth. public class CPDetailsScrollPane extends AnJScrollPane { private JComponent child; public CPDetailsScrollPane(JComponent cc) { super(cc, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); child = cc; } public Dimension getPreferredSize() { Dimension dd = child.getPreferredSize(); JScrollBar hscroll = this.getHorizontalScrollBar(); if (hscroll != null) { // if(true || hscroll.isVisible()){ // isVisible not reliable int s_height = hscroll.getPreferredSize().height; dd.height += s_height; } dd.width = 0; return dd; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/control_panel/CPLayoutPanel.java�����������������������������������0000644�0001750�0001750�00000005344�14744453367�022140� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.control_panel; import java.awt.BorderLayout; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollPane; /** * The MPIConrolPanel class provides the features common to both the MPIChartConrolPanel and * TimelineControlPanel. These include providing the visual features such as the toolbar buttons and * filtering buttons. Some of the processing of the control input is handled but much is done in the * extending classes implementation of the abstract methods. */ public class CPLayoutPanel extends JPanel { public CPLayoutPanel( JComponent tb, JComponent filter_panel, JComponent custom, JComponent details) { super(); this.setLayout(new BorderLayout()); // north = toolbar, center = belowToolbar // --- this.center = belowToolbarPanel JPanel belowToolbarPanel = new JPanel(); belowToolbarPanel.setLayout(new BorderLayout()); // north = aboveDetails, center = Details belowToolbarPanel.setBorder(BorderFactory.createEmptyBorder()); JScrollPane scrollPane = new JScrollPane(belowToolbarPanel); scrollPane.setBorder(null); this.add(scrollPane, BorderLayout.CENTER); // ------- belowToolbarPanel.north = aboveDetailsBox JPanel aboveDetailsBox = new JPanel(); aboveDetailsBox.setLayout(new BoxLayout(aboveDetailsBox, BoxLayout.Y_AXIS)); aboveDetailsBox.setBorder(BorderFactory.createEmptyBorder()); belowToolbarPanel.add(aboveDetailsBox, BorderLayout.NORTH); if (tb != null) { this.add(tb, BorderLayout.NORTH); } // ----------- aboveDetails top box: filtering if (filter_panel != null) { aboveDetailsBox.add(filter_panel); } // ------- more boxes between Details and Toolbar if (custom != null) { aboveDetailsBox.add(custom); } // ------- belowToolbarPanel.center = detailsPanel if (details != null) { belowToolbarPanel.add(details, BorderLayout.CENTER); } belowToolbarPanel.revalidate(); aboveDetailsBox.revalidate(); this.revalidate(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnChooser.java�����������������������������������������������������0000644�0001750�0001750�00000065700�15044710303�016460� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.ipc.IPCLogger; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.filechooser.FileSystemView; public class AnChooser extends JFileChooser implements PropertyChangeListener { private static final int EXP_NOT = 0; private static final int EXP_NORMAL = 1; private static final int EXP_GROUP = 2; private static final int EXP_BAD = 3; private static final int EXP_OLD = 4; public static final int EXP_CHOOSER = 0; public static final int EXP_GROUP_CHOOSER = 1; public static final int TARGET_CHOOSER = 2; public static final int DIR_CHOOSER = 3; public static final int DIR_FILE_CHOOSER = 4; private static String startDir = Analyzer.getInstance().getWorkingDirectory(); private static final String open_text = AnLocale.getString("Open"); private static final String add_text = AnLocale.getString("Add"); private static final String set_text = AnLocale.getString("Set"); private final int chooser_type; private final AnWindow window; private final Component comp; private JPanel previewPanel; private AnList previewList; private ConfigurationPanel anChooserExtraPanel; private String title_str, approve_button_text; private static AnFileSystemView anFileSystemView = null; private AnFile currentRemoteDirectory = null; private final String SLASH = "/"; /** * Common constructor. Used by all constructors in this class. * * @param comp * @param chooser_type * @param window * @param title * @param st_dir * @param rhost * @param fsv */ public AnChooser( final Component comp, final int chooser_type, final AnWindow window, final String title, final String st_dir, String rhost, FileSystemView fsv) { super(st_dir, fsv); this.chooser_type = chooser_type; this.window = window; this.comp = comp; this.anFileSystemView = (AnFileSystemView) fsv; initAnChooser(chooser_type, title, rhost, fsv); } /** * Common constructor. Used by all constructors in remote mode. * * @param comp * @param chooser_type * @param window * @param restart * @param st_dir * @param rhost * @param fsv */ public AnChooser( final Component comp, final int chooser_type, final AnWindow window, final String title, final AnFile st_dir, String rhost, FileSystemView fsv) { super(st_dir, fsv); this.chooser_type = chooser_type; this.window = window; this.comp = comp; this.anFileSystemView = (AnFileSystemView) fsv; initAnChooser(chooser_type, title, rhost, fsv); if (Analyzer.getInstance().remoteConnection != null) { setCurrentDirectory(st_dir); } } /** * Initialize AnChooser * * @param chooser_type * @param title * @param rhost * @param fsv */ private void initAnChooser( final int chooser_type, final String title, String rhost, FileSystemView fsv) { setFileHidingEnabled(false); setFileView(new ExpView()); if (chooser_type != EXP_CHOOSER) { approve_button_text = set_text; } if (chooser_type == EXP_CHOOSER || chooser_type == EXP_GROUP_CHOOSER) { setFileSelectionMode(FILES_AND_DIRECTORIES); setFileFilter(new ExpFilter()); initComponents(); } else if (chooser_type == TARGET_CHOOSER) { setFileSelectionMode(FILES_ONLY); } else if (chooser_type == DIR_FILE_CHOOSER) { setFileSelectionMode(FILES_AND_DIRECTORIES); } else { // chooser_type == DIR_CHOOSER setFileSelectionMode(DIRECTORIES_ONLY); } if (chooser_type == EXP_CHOOSER) { setMultiSelectionEnabled(true); if (null != title) { String newtitle = title; if (rhost != null) { newtitle = title + " " + rhost + ""; } setDialogTitle(newtitle); if (newtitle.startsWith(AnLocale.getString("Add Experiment"))) { approve_button_text = add_text; } else { approve_button_text = open_text; } setApproveButtonText(approve_button_text); } } addPropertyChangeListener(this); } /** * This constructor is used by CollectPanel * * @param comp * @param chooser_type * @param window * @param restart * @param directory */ public AnChooser( final Component comp, final int chooser_type, final AnWindow window, final String directory) { this(comp, chooser_type, window, null /* title */, directory, null, null); } /** * This constructor is used by AnWindow for local file system * * @param comp * @param awindow * @param title * @param restart */ public AnChooser(final Component comp, final AnWindow awindow, final String title) { this(comp, awindow, title, null, null); } /** * This constructor is used by AnWindow for remote file system * * @param comp * @param awindow * @param title * @param title * @param rhost * @param fsv */ public AnChooser( final Component comp, final AnWindow awindow, final String title, String rhost, FileSystemView fsv) { this(comp, EXP_CHOOSER, awindow, title, startDir, rhost, fsv); } @Override public final void setDialogTitle(final String title) { super.setDialogTitle(title); title_str = title; } // @Override // public int showDialog(Component parent, String approveButtonText) throws HeadlessException { // if (chooser_type == EXP_CHOOSER || chooser_type == EXP_GROUP) { // setControlButtonsAreShown(false); // AnDialog2 anDialog2 = new AnDialog2(parent, getDialogTitle()); // anDialog2.getOKButton().setText(getApproveButtonText()); // JPanel panel = new JPanel(); // panel.setLayout(new BorderLayout()); // panel.add(this, BorderLayout.CENTER); // anDialog2.setCustomPanel(panel); // anDialog2.setVisible(true); // AnDialog2.Status status = anDialog2.getStatus(); // if (status == AnDialog2.Status.OK) { // return AnChooser.APPROVE_OPTION; // } // else { // return AnChooser.CANCEL_OPTION; // } // } // else { // setControlButtonsAreShown(true); // return(super.showDialog(parent, approveButtonText)); //To change body of generated // methods, choose Tools | Templates. // } // } /** * Get AnFileSystemView * * @return anFileSystemView */ public final AnFileSystemView getAnFileSystemView() { return anFileSystemView; } /** * Returns the current directory. * * @return the current directory * @see #setCurrentDirectory */ @Override public File getCurrentDirectory() { if (Analyzer.getInstance().remoteConnection != null) { // NM if (null == currentRemoteDirectory) { AnFile af = new AnFile(SLASH); af.setAttributes(SLASH, true, true); // NM Is it correct?? currentRemoteDirectory = af; } // Temporary fix for Windows String dirname = currentRemoteDirectory.getPath(); if (dirname.length() >= 3) { if ((dirname.charAt(1) == ':') && (dirname.charAt(2) == '\\')) { if (dirname.length() > 3) { dirname = SLASH + dirname.substring(3); } else { dirname = SLASH; } AnFile af = new AnFile(dirname); af.setAttributes(dirname, true, true); // NM Is it correct?? currentRemoteDirectory = af; } } return currentRemoteDirectory; } return super.getCurrentDirectory(); } /** * Sets the current directory. * * @param dir */ public void setCurrentDirectory(File curdir) { if (Analyzer.getInstance().remoteConnection == null) { super.setCurrentDirectory(curdir); return; } // NM Temporary implementation for remote case if (curdir == null) { return; } AnFile oldValue = currentRemoteDirectory; String s = curdir.getPath(); // Temporary code for Windows s = AnFileSystemView.slashifyPath(s); AnFile dir = new AnFile(s); // Update attributes if (anFileSystemView != null) { anFileSystemView.updateFileAttributes(dir); } else { // anFileSystemView can be null only during the first call from super currentRemoteDirectory = dir; // just set currentRemoteDirectory and return return; } if (dir != null && !dir.exists()) { // ??? // dir = currentRemoteDirectory; // why not return? return; } // if (dir == null) { // dir = getFileSystemView().getDefaultDirectory(); // } if (currentRemoteDirectory != null) { /* Verify the toString of object */ if (currentRemoteDirectory.equals(dir)) { return; } } AnFile prev = null; while (!isTraversable(dir) && prev != dir) { prev = new AnFile(dir.getParent()); if (prev == null) { return; } dir = prev; // dir = getFileSystemView().getParentDirectory(dir); } currentRemoteDirectory = dir; if (s.startsWith("//")) { prev = null; // BUG } // System.err.println("AnChooser.setCurrentDirectory:"+currentRemoteDirectory); try { firePropertyChange(DIRECTORY_CHANGED_PROPERTY, oldValue, currentRemoteDirectory); } catch (NullPointerException npe) { // CR 7199013, 7200045 // System.err.println("AnChooser.setCurrentDirectory:274: NPE CR 7200045 File=" + // currentRemoteDirectory.getAbsolutePath()); IPCLogger.logTrace( "\n" + "AnChooser.setCurrentDirectory:274: NPE CR 7200045 File=" + currentRemoteDirectory.getAbsolutePath()); // npe.printStackTrace(); currentRemoteDirectory = oldValue; } } /** Returns a list of selected files if the file chooser is set to allow multiple selection. */ public File[] getSelectedAnFiles() { File[] files = getSelectedFiles(); if (Analyzer.getInstance().remoteConnection == null) { return files; } if (anFileSystemView != null) { for (int i = 0; i < files.length; i++) { if (files[i] instanceof AnFile) { continue; } // Replace File with AnFile String file_name = files[i].getAbsolutePath(); AnFile af = new AnFile(file_name); anFileSystemView.updateFileAttributes(af); files[i] = (File) af; } } return files; } /** * Returns the selected file. This can be set either by the programmer via <code>setFile</code> or * by a user action, such as either typing the filename into the UI or selecting the file from a * list in the UI. * * @see #setSelectedFile * @return the selected file */ public File getSelectedAnFile() { File file = getSelectedFile(); if (Analyzer.getInstance().remoteConnection == null) { return file; } if ((file != null) && (anFileSystemView != null)) { if (file instanceof AnFile) { return file; } String file_name = file.getName(); if (null == file_name) { return null; } if (file_name.startsWith(SLASH)) { AnFile af = new AnFile(file_name); anFileSystemView.updateFileAttributes(af); file = (File) af; } else { AnFile dir = (AnFile) getCurrentDirectory(); AnFile af = new AnFile(dir.getPath(), file_name); anFileSystemView.updateFileAttributes(dir, af); file = (File) af /*.getAbsoluteFile() */; } } return file; } // Initialize GUI components private void initComponents() { final JLabel label; final JScrollPane scrollPane; // Add list for preview previewList = new AnList(true); scrollPane = new AnJScrollPane(previewList); scrollPane.setBorder(BorderFactory.createLineBorder(AnEnvironment.SCROLLBAR_BORDER_COLOR)); // Add label for preview label = new JLabel(AnLocale.getString("Experiment Preview:")); label.setBorder(AnVariable.labelBorder); label.setDisplayedMnemonic(AnLocale.getString('E', "MNEM_EXPERIMENT_PREVIEW")); label.setLabelFor(previewList); AccessibleContext context = previewList.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Experiment Preview")); context.setAccessibleDescription(AnLocale.getString("Experiment Preview")); context = label.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Experiment Preview")); context.setAccessibleDescription(AnLocale.getString("Experiment Preview")); previewPanel = new JPanel(new GridBagLayout()); // no ANJPanel previewPanel.setPreferredSize(new Dimension(AnVariable.FVIEW_SIZE)); GridBagConstraints gridBagConstraints; int gridy = 0; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(6, 6, 0, 0); gridBagConstraints.gridy = gridy++; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; previewPanel.add(label, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(12, 6, 0, 0); gridBagConstraints.gridy = gridy++; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; previewPanel.add(scrollPane, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(12, 6, 0, 0); gridBagConstraints.gridy = gridy++; gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; previewPanel.add(anChooserExtraPanel = new ConfigurationPanel(true), gridBagConstraints); anChooserExtraPanel.setVisible(false); setAccessory(previewPanel); } // override createDialog() to workaround JDK accessibility bug @Override protected final JDialog createDialog(final Component parent) { final JDialog dialog = super.createDialog(parent); final AccessibleContext context = dialog.getAccessibleContext(); context.setAccessibleName(title_str); context.setAccessibleDescription(title_str); return dialog; } // Listener for file chooser @Override public final void propertyChange(final PropertyChangeEvent evt) { AnUtility.dispatchOnAWorkerThread( () -> { PropertyChangeInternal(evt); }, "PropertyChangeThread"); // Run this on a thread so that the AWT does not hang when fileChooser is waiting for a bad // remote file } private final void PropertyChangeInternal(final PropertyChangeEvent evt) { final File file; final String[] exp_info; String header, value; final int type, size; final Dimension msize; if (!evt.getPropertyName().equals(SELECTED_FILE_CHANGED_PROPERTY)) { return; } file = getSelectedAnFile(); if (file == null) { return; } type = getExperimentType(file); if ((chooser_type != DIR_CHOOSER) && (chooser_type != DIR_FILE_CHOOSER)) { if (type == EXP_NOT && file.isDirectory()) { setApproveButtonText(open_text); } else { setApproveButtonText(approve_button_text); } } if (previewList == null) { return; } previewList.removeAll(); anChooserExtraPanel.setVisible(false); if ((type == EXP_NORMAL) || (type == EXP_GROUP)) { // Get experiment preview exp_info = window.getExpPreview(file.getAbsolutePath()); size = exp_info.length; anChooserExtraPanel.initConfigurationChoices(file); anChooserExtraPanel.setWorkingDirectory(file.getParent()); anChooserExtraPanel.setVisible(true); for (int i = 0; i < size; ) { header = exp_info[i++]; value = exp_info[i++]; previewList.add( AnUtility.getItem(header + ":"), value.indexOf('\n') == -1 ? AnUtility.getText(value, 0) : AnUtility.getTextArea(value)); } // msize = previewList.getMaximumSize(); // msize.height = previewList.getPreferredSize().height; // previewList.setMaximumSize(msize); } previewList.repaint(); previewList.invalidate(); previewPanel.validate(); } public List<String> getExperiments() { final List<String> list = new ArrayList<>(); String errstr = ""; final File[] files = getSelectedAnFiles(); if (files != null) { // Get file list for (int i = 0; i < files.length; i++) { File file = files[i]; int type = getExperimentType(file); if ((type == EXP_NORMAL) || (type == EXP_GROUP)) { String path = file.getAbsolutePath(); List<String> exp_list = AnUtility.getGroupList(path); if (exp_list.size() > 1) { list.add(path); } else { list.addAll(exp_list); } } else { if (!errstr.equals("")) { errstr += "\n"; } if (type == EXP_OLD) { errstr += AnLocale.getString("Old experiment is not supported:"); } else if (type == EXP_BAD) { errstr += AnLocale.getString("Bad experiment:"); } else { errstr += AnLocale.getString("Not a valid experiment:"); } errstr += " " + file; } } } // Show error mesg if (!errstr.equals("")) { AnUtility.showMessage(comp, errstr, JOptionPane.ERROR_MESSAGE); window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); } return list; } // Get experiment type public static int getExperimentType(final File file) { final String file_name; if (file == null) { return EXP_NOT; } file_name = file.getName(); if (file_name.endsWith(".er")) { if (file.isDirectory()) { return EXP_NORMAL; } else if (file.isFile()) { return EXP_OLD; } else { return EXP_NOT; } } else if (file_name.endsWith(".erg") && file.isFile()) { return EXP_GROUP; } else { return EXP_NOT; } } public String getWorkingDirectory() { String wd = null; if (anChooserExtraPanel != null) { wd = anChooserExtraPanel.getWorkingDirectory(); } return wd; } public String getConfiguration() { String configuration = null; if (anChooserExtraPanel != null) { configuration = anChooserExtraPanel.getConfiguration(); } return configuration; } public boolean alwaysUseThisConfiguration() { boolean always = false; if (anChooserExtraPanel != null) { always = anChooserExtraPanel.alwaysUseThisConfiguration(); } return always; } // Called by the UI when the user hits the Approve button @Override public final void approveSelection() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { ApproveSelectionInternal(); } }, "ApproveSelectionThread"); // Run this on a thread so that the AWT does not hang when fileChooser is waiting for a bad // remote file } private final void ApproveSelectionInternal() { File[] files = null; final /*NM final*/ File file; final int type; if (chooser_type == EXP_CHOOSER) { files = getSelectedAnFiles(); if (files.length == 0) { return; } file = files[0]; } else { file = getSelectedAnFile(); if (file == null) { return; } } /*NM if (anFileSystemView != null) { // TEMPORARY! should be in getSelectedAnFiles() for (int i = 0; i < files.length; i++) { String file_name = files[i].getName(); AnFile af = new AnFile(file_name); File dir = this.getCurrentDirectory(); anFileSystemView.getFileAttributes(dir, af); files[i] = (File) af.getAbsoluteFile(); } file = files[0]; } */ type = getExperimentType(file); String fullpath = file.getAbsolutePath(); // Non-experiment directory been selected if ((chooser_type != DIR_CHOOSER) && (chooser_type != DIR_FILE_CHOOSER) && file.isDirectory() && type == EXP_NOT) { if (chooser_type == EXP_CHOOSER) { startDir = fullpath; } if (Analyzer.getInstance().remoteConnection != null) { // NM final AnFile af = new AnFile(fullpath); // setCurrentDirectory(af); // causes NPE AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { try { setCurrentDirectory(af); } catch (IllegalArgumentException ex) { // no exceptions expected here } } }); return; } // NM // setCurrentDirectory(file); AnUtility.dispatchOnSwingThread( () -> { try { setCurrentDirectory(file); } catch (IllegalArgumentException ex) { // no exceptions expected here } } // @Override ); return; } else { if (chooser_type == EXP_CHOOSER) { startDir = getCurrentDirectory().getAbsolutePath(); } } boolean done = true; if (chooser_type == EXP_GROUP_CHOOSER) { if (type != EXP_GROUP) { AnUtility.showMessage( comp, AnLocale.getString("Not a valid experiment group: ") + file, JOptionPane.ERROR_MESSAGE); done = false; } } else if (chooser_type == TARGET_CHOOSER) { if (!Analyzer.getInstance().isRemote()) { if (!file.isFile() /* AnUtility.isTarget(file) */) { AnUtility.showMessage( comp, AnLocale.getString("Not a valid target: ") + file, JOptionPane.ERROR_MESSAGE); done = false; } } else { // no check in remote mode /* NM This code is not ready yet // setCurrentDirectory(file); final AnFile af = new AnFile(fullpath); start_dir = af.getDirectoryName(); window.dispatchOnSwingThread(new Runnable() { // @Override public void run() { try { setCurrentDirectory(file.getParentFile()); //start_dir = getCurrentDirectory().getAbsolutePath(); } catch (Exception ex) { // no exceptions expected here ex.printStackTrace(); } } }); */ } } if (done) { super.approveSelection(); } } public final void cancelChooser() { super.cancelSelection(); } // Called by the UI when the user chooses the Cancel button. @Override public final void cancelSelection() { if (chooser_type == EXP_CHOOSER) { startDir = getCurrentDirectory().getAbsolutePath(); } /* NM This code does not work (see CR 16617347) final CancelContext cancelContext = window.getProgressCancelContext(); if (cancelContext != null) { window.dispatchOnWorkerThread(new Runnable() { public void run() { cancelContext.getCancellable().cancel(); // actual cancel will be called by the thread receiving // the cancel for the getFiles IPC request } }, "CancelTaskThread"); } */ super.cancelSelection(); } // File filter for experiment final class ExpFilter extends javax.swing.filechooser.FileFilter { @Override public boolean accept(final File file) { final boolean accepted; final int type; type = getExperimentType(file); switch (chooser_type) { case EXP_GROUP_CHOOSER: accepted = (type == EXP_GROUP) || (type == EXP_NOT && file.isDirectory()); break; case TARGET_CHOOSER: accepted = (type == EXP_NOT && file.isDirectory()) || AnUtility.isTarget(file); break; default: // EXP_CHOOSER accepted = (type != EXP_NOT) || file.isDirectory(); break; } return (accepted); } @Override public String getDescription() { switch (chooser_type) { case EXP_GROUP_CHOOSER: return AnLocale.getString("gprofng experiment group (*.erg)"); case TARGET_CHOOSER: return AnLocale.getString("gprofng target (executable files)"); default: // EXP_CHOOSER return AnLocale.getString("gprofng experiment (*.er, *.erg)"); } } } // File view for experiment private final class ExpView extends javax.swing.filechooser.FileView { @Override public Icon getIcon(final File file) { if (chooser_type == TARGET_CHOOSER) { switch (AnUtility.getMimeFormat(file)) { case AnUtility.MIME_DIRECTORY: return getExperimentIcon(file); case AnUtility.MIME_ELF_EXECUTABLE: case AnUtility.MIME_EXECUTABLE: return AnUtility.elf_icon; case AnUtility.MIME_JAVA_CLASS_FILE: return AnUtility.cls_icon; case AnUtility.MIME_JAR_FILE: return AnUtility.jar_icon; } return null; } return getExperimentIcon(file); } private Icon getExperimentIcon(final File file) { switch (getExperimentType(file)) { case EXP_NORMAL: return AnUtility.expt_icon; case EXP_GROUP: return AnUtility.egrp_icon; case EXP_OLD: return AnUtility.eold_icon; case EXP_BAD: return AnUtility.ebad_icon; default: return null; } } @Override public final Boolean isTraversable(final File file) { return getExperimentType(file) == EXP_NOT && file.isDirectory(); } // Compatible with old JDK @Override public String getName(final File f) { return null; } @Override public String getDescription(final File f) { return null; } @Override public String getTypeDescription(final File f) { return null; } } } ����������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/IOView.java��������������������������������������������������������0000644�0001750�0001750�00000151717�15044710303�015745� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.AnDisplay.DSP_IO; import static org.gprofng.mpmt.AnDisplay.DSP_IOCallStacks; import static org.gprofng.mpmt.AnDisplay.DSP_IOFileDescriptors; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.statecolors.StackView; import org.gprofng.mpmt.statecolors.StackViewState; import org.gprofng.mpmt.statecolors.StateColorMap; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.EventObject; import java.util.List; import java.util.Vector; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JViewport; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public final class IOView extends FuncListDisp implements AnListener, MouseListener, AdjustmentListener, ListSelectionListener, AnChangeListener { private boolean inCompute = false; private ButtonControlPanel buttonPanel; private JScrollPane errorPane = null; private Object[][] tableDataFile; private Object[][] tableDataVfd; private Object[][] tableDataCalStk; private long[] dataFileIds = null; private long[] dataVfdIds = null; private long[] dataCalStkIds = null; private JRadioButton actButton; private JRadioButton detButton; private JRadioButton calStkButton; private JPanel statPanel; private AnJScrollPane statScrollPane; private String[][] statisticsData; private final int WRITE = 0; private final int READ = 1; private final int OTHER = 2; private final int ERROR = 3; private JComponent eventPane; private JComponent stackViewPane; private StackView stack_view; // Right-hand Tab's Event Stack Display private final StateColorMap clmap; private int fileRowId; private int vfdRowId; private int stackRowId; private boolean updateIfNotSort; private StackView.StackViewPopupListener stackViewPopupListener; /** Keeps last warning to avoid showing the same warning message many times */ // Constructor public IOView() { super(AnWindow.getInstance(), AnDisplay.DSP_IO, 0, AnVariable.HELP_TabsIOActivity); clmap = window.getColorChooser().getColorMap(); clmap.addAnListener(this); initTab(); stackViewPopupListener = stack_view.new StackViewPopupListener(window); setAccessibility(AnLocale.getString("IO")); AnEventManager.getInstance().addListener(this); updateIfNotSort = true; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("IOView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } private void initTab() { // Event Pane eventPane = new FocusPanel(); eventPane.setLayout(new BorderLayout()); TitledBorder titledBorder = new TitledBorder(AnLocale.getString("I/O Activity")); titledBorder.setBorder(new LineBorder(eventPane.getBackground())); // Event Pane: Call Stack stack_view = new StackView(clmap); stack_view.addMouseListener(this); stack_view.addListSelectionListener(this); stackViewPane = new JPanel(); stackViewPane.setBackground(Color.WHITE); stackViewPane.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(2, 2, 2, 2); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; stackViewPane.add(stack_view, gridBagConstraints); stackViewPane.setVisible(false); stackViewPane.revalidate(); stackViewPane.repaint(); eventPane.add(stackViewPane, BorderLayout.CENTER); eventPane.revalidate(); } class FocusPanel extends JPanel { @Override public void requestFocus() { if (stack_view != null) { stack_view.requestFocus(); } } } @Override public JPopupMenu getFilterPopup() { return table.initPopup(true); } // tab to populate right-side info area public JComponent getStackInfoTabComp() { return eventPane; } // name for tab in right-side info area public String getStackInfoTabName() { return AnLocale.getString("Call Stack - I/O"); } public JComponent getStackViewPane() { return stackViewPane; } @Override public void setSelected(final boolean set) { super.setSelected(set); // Show right pane if we get selected // if (set) { // window.showRightPane(); // } } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); String acName = null; String acDesc = null; JLabel acLabel = null; acName = AnLocale.getString("IOActivity"); acDesc = AnLocale.getString("Show I/O activity for selected application"); if (acName != null) { acLabel = new JLabel(acName, JLabel.RIGHT); AnUtility.setAccessibleContext(acLabel); } table = new AnTable(type, true, true, can_sort, false, true, true, true, acName, acDesc, acLabel); table.setParent(this); if (acLabel != null) { acLabel.setVisible(false); // acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); } table.addAnListener(new TableHandler()); statPanel = new JPanel(); statPanel.setLayout(new GridBagLayout()); statPanel.setBackground(Color.white); statScrollPane = new AnJScrollPane(statPanel); JSplitPane sp = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, table, statScrollPane); sp.setResizeWeight(.75); add(sp, BorderLayout.CENTER); buttonPanel = new ButtonControlPanel(); add(buttonPanel, BorderLayout.NORTH); } class ButtonControlPanel extends JPanel { int sort_ind; MetricLabel[] label; public ButtonControlPanel() { JPanel displayPanel; String acName; String acDesc; fileRowId = 0; vfdRowId = 0; stackRowId = 0; setLayout(new FlowLayout(FlowLayout.LEFT)); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); displayPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); displayPanel.setMinimumSize(new Dimension(20, 20)); // So window can resize properly displayPanel.setBorder(null); ButtonGroup group = new ButtonGroup(); JLabel aggrlabel = new JLabel(AnLocale.getString("Aggregate I/O Data By:")); AnUtility.setAccessibleContext(aggrlabel); displayPanel.add(aggrlabel); // Accessibility acName = AnLocale.getString("Aggregate I/O Data By"); acDesc = AnLocale.getString("Select Aggregate I/O Data By"); aggrlabel.getAccessibleContext().setAccessibleName(acName); aggrlabel.getAccessibleContext().setAccessibleDescription(acDesc); actButton = new JRadioButton(AnLocale.getString("File Name")); actButton.setMnemonic(AnLocale.getString('A', "IOViewFileNameMN")); actButton.setSelected(true); group.add(actButton); displayPanel.add(actButton); // Accessibility acName = AnLocale.getString("Aggregate I/O Data By: File Name"); acDesc = AnLocale.getString("Set Aggregate I/O Data BY: File Name"); actButton.getAccessibleContext().setAccessibleName(acName); actButton.getAccessibleContext().setAccessibleDescription(acDesc); detButton = new JRadioButton(AnLocale.getString("File Descriptor")); detButton.setMnemonic(AnLocale.getString('l', "IOViewFileDescriptorMN")); detButton.setSelected(false); group.add(detButton); displayPanel.add(detButton); // Accessibility acName = AnLocale.getString("Aggregate I/O Data By: File Descriptor"); acDesc = AnLocale.getString("Set Aggregate I/O Data BY: File Descriptor"); detButton.getAccessibleContext().setAccessibleName(acName); detButton.getAccessibleContext().setAccessibleDescription(acDesc); calStkButton = new JRadioButton(AnLocale.getString("Call Stack")); calStkButton.setMnemonic(AnLocale.getString('s', "IOViewCallStackMN")); calStkButton.setSelected(false); group.add(calStkButton); displayPanel.add(calStkButton); // Accessibility acName = AnLocale.getString("Aggregate I/O Data By: Call Stack"); acDesc = AnLocale.getString("Set Aggregate I/O Data BY: Call Stack"); calStkButton.getAccessibleContext().setAccessibleName(acName); calStkButton.getAccessibleContext().setAccessibleDescription(acDesc); add(displayPanel); actButton.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (actButton.isSelected()) { Object[] gtm = getTotalMax(); label = getSettings().getMetricsSetting().getLabel(tableDataFile, gtm, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); AnUtility.checkIPCOnWrongThread(false); names = getNames(type, 0); // IPC - FIXUP: don't do this on AWT AnUtility.checkIPCOnWrongThread(true); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataFile, names, null, 0, name_col, sort_ind); table.setSelectedRow(fileRowId); table.showSelectedRow(); int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IO); window.getSelectionManager().updateSelection(ids, DSP_IO, subtype, 1); } } window.showSubview(window.getIoCallStackSubview(), false); } }); detButton.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (detButton.isSelected()) { Object[] gtm = getTotalMax(); label = getSettings().getMetricsSetting().getLabel(tableDataVfd, gtm, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); AnUtility.checkIPCOnWrongThread(false); names = getNames(type, 0); // IPC - FIXUP: don't do this on AWT AnUtility.checkIPCOnWrongThread(true); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataVfd, names, null, 0, name_col, sort_ind); table.setSelectedRow(vfdRowId); table.showSelectedRow(); int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOFileDescriptors); window .getSelectionManager() .updateSelection(ids, DSP_IOFileDescriptors, subtype, 1); } } window.showSubview(window.getIoCallStackSubview(), false); } }); calStkButton.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (calStkButton.isSelected()) { Object[] gtm = getTotalMax(); label = getSettings().getMetricsSetting().getLabel(tableDataCalStk, gtm, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); AnUtility.checkIPCOnWrongThread(false); names = getNames(type, 0); // IPC - FIXUP: don't do this on AWT AnUtility.checkIPCOnWrongThread(true); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataCalStk, names, null, 0, name_col, sort_ind); table.setSelectedRow(stackRowId); table.showSelectedRow(); if (stackRowId >= dataCalStkIds.length) { stackRowId = dataCalStkIds.length - 1; } long id = dataCalStkIds[stackRowId]; int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOCallStacks); window.getSelectionManager().updateSelection(ids, DSP_IOCallStacks, subtype, 1); } updateStackView(id); } window.showSubview(window.getIoCallStackSubview(), true); } }); } } // Compute & update function list table @Override public void doCompute() { AnUtility.checkIfOnAWTThread(false); MetricLabel[] label; final String pwarnstr; // Not selected if (!selected) { return; } // XXXX show error when compare is on, needs simplified, // but the situation is different for different views if (window.getSettings().getCompareModeSetting().comparingExperiments()) { JLabel error_label = new JLabel(); error_label.setHorizontalAlignment(JLabel.CENTER); error_label.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); error_label .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Error message")); JViewport error_view = new JViewport(); error_view.setView(error_label); String msg = AnLocale.getString("Not available when comparing experiments"); error_label.setText(msg); AnUtility.setAccessibleContext(error_label); if (errorPane == null) { errorPane = new AnJScrollPane(); add(errorPane, BorderLayout.CENTER); } errorPane.setViewportView(error_view); errorPane.setVisible(true); buttonPanel.setVisible(false); statScrollPane.setVisible(false); return; } if (errorPane != null) { errorPane.setVisible(false); } buttonPanel.setVisible(true); statScrollPane.setVisible(true); if (inCompute) { return; } else { inCompute = true; } // int typeForPresentation = type; if (!computed) { // need re-compute reset(); tableDataFile = null; dataFileIds = null; tableDataVfd = null; dataVfdIds = null; tableDataCalStk = null; dataCalStkIds = null; stack_view.reset(); table.setViewport(); final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); Object[] raw_data_with_ids = window.getTableDataV2("MET_IO", "ALL", "IOACTFILE", "" + subtype, null); tableDataFile = localProcessData(mlist, raw_data_with_ids); dataFileIds = current_ids; if (updateIfNotSort) { statisticsData = getIOStatistics(); AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { statPanel.removeAll(); displayStatisticsData(statisticsData); } }); } updateIfNotSort = true; raw_data_with_ids = window.getTableDataV2("MET_IO", "ALL", "IOACTVFD", "" + subtype, null); tableDataVfd = localProcessData(mlist, raw_data_with_ids); dataVfdIds = current_ids; raw_data_with_ids = window.getTableDataV2("MET_IO", "ALL", "IOCALLSTACK", "" + subtype, null); tableDataCalStk = localProcessData(mlist, raw_data_with_ids); dataCalStkIds = current_ids; names = getNames(type, 0); // IPC call, don't do on AWT AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { if (actButton.isSelected()) { MetricLabel[] label = getSettings().getMetricsSetting().getLabel(tableDataFile, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); int sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataFile, names, null, 0, name_col, sort_ind); table.setSelectedRow(fileRowId); table.showSelectedRow(); } else if (detButton.isSelected()) { MetricLabel[] label = getSettings().getMetricsSetting().getLabel(tableDataVfd, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); int sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataVfd, names, null, 0, name_col, sort_ind); table.setSelectedRow(vfdRowId); table.showSelectedRow(); } else if (calStkButton.isSelected()) { MetricLabel[] label = getSettings().getMetricsSetting().getLabel(tableDataCalStk, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); int sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataCalStk, names, null, 0, name_col, sort_ind); table.setSelectedRow(stackRowId); table.showSelectedRow(); } if (table.getTable().getColumnCount() == 1) { table.showMessage(new NoMetricsSelectedPanel(type)); inCompute = false; return; } } }); } // else if (!isUpdated()) { // Object[] gtm = getTotalMax(); // label = getSettings().getMetricsSetting().getLabel(table.getTableData(), // gtm, typeForPresentation, table); // // if (label != null) { // table.setLabel(label); // } // } AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { if (actButton.isSelected()) { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IO); window.getSelectionManager().updateSelection(ids, DSP_IO, subtype, 1); } } else if (detButton.isSelected()) { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOFileDescriptors); window .getSelectionManager() .updateSelection(ids, DSP_IOFileDescriptors, subtype, 1); } } else if (calStkButton.isSelected()) { if (stackRowId >= dataCalStkIds.length) { stackRowId = dataCalStkIds.length - 1; } long id = dataCalStkIds[stackRowId]; int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOCallStacks); window.getSelectionManager().updateSelection(ids, DSP_IOCallStacks, subtype, 1); } updateStackView(id); } } }); computed = true; // setUpdated(true); // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } inCompute = false; } public int getDisplayMode() { int displayMode = DSP_IO; if (detButton.isSelected()) { displayMode = DSP_IOFileDescriptors; } else if (calStkButton.isSelected()) { displayMode = DSP_IOCallStacks; } return displayMode; } public long[] getSelectedIds(int selectedIndices[], int displayMode) { // FIXUP: REARCH long[] ids = null; if (selectedIndices.length >= 1) { ids = new long[selectedIndices.length]; for (int i = 0; i < selectedIndices.length; i++) { if (displayMode == DSP_IO) { ids[i] = dataFileIds[selectedIndices[i]]; } else if (displayMode == DSP_IOFileDescriptors) { ids[i] = dataVfdIds[selectedIndices[i]]; } else { ids[i] = dataCalStkIds[selectedIndices[i]]; } } } return ids; } private String exportStatisticsData(final String[][] raw_data) { if (raw_data == null) { return null; } StringBuilder strBuild = new StringBuilder(); strBuild.append("\n"); if (!AnWindow.getInstance().getFilters().anyFilters()) { strBuild.append(AnLocale.getString("I/O Data Statistics For <Total>")); strBuild.append("\n\n"); } else { strBuild.append(AnLocale.getString("I/O Data Statistics For <Total> (filters on)")); strBuild.append("\n\n"); } if (raw_data[WRITE].length > 1) { strBuild.append(raw_data[WRITE][0]); strBuild.append("\n"); strBuild.append(AnLocale.getString("I/O Size Range")); strBuild.append("\t\t\t"); strBuild.append(AnLocale.getString("Write Calls")); strBuild.append("\n"); for (int i = 1; i < raw_data[WRITE].length; i++) { if (raw_data[WRITE][i].trim().indexOf('-') > 0) { strBuild.append(" "); } strBuild.append(raw_data[WRITE][i]); if (raw_data[WRITE][i].trim().indexOf('-') > 0) { strBuild.append("\t\t\t"); } else { strBuild.append("\t\t"); } i++; strBuild.append(raw_data[WRITE][i]); strBuild.append("\n"); } strBuild.append("\n"); } if (raw_data[READ].length > 1) { strBuild.append(raw_data[READ][0]); strBuild.append("\n"); strBuild.append(AnLocale.getString("I/O Size Range")); strBuild.append("\t\t\t"); strBuild.append(AnLocale.getString("Read Calls")); strBuild.append("\n"); for (int i = 1; i < raw_data[READ].length; i++) { if (raw_data[READ][i].trim().indexOf('-') > 0) { strBuild.append(" "); } strBuild.append(raw_data[READ][i]); if (raw_data[READ][i].trim().indexOf('-') > 0) { strBuild.append("\t\t\t"); } else { strBuild.append("\t\t"); } i++; strBuild.append(raw_data[READ][i]); strBuild.append("\n"); } strBuild.append("\n"); } if (raw_data[OTHER].length > 1) { strBuild.append(raw_data[OTHER][0]); strBuild.append("\n"); for (int i = 1; i < raw_data[OTHER].length; i++) { strBuild.append(raw_data[OTHER][i]); strBuild.append("\t\t"); i++; strBuild.append(raw_data[OTHER][i]); strBuild.append("\n"); } strBuild.append("\n"); } if (raw_data[ERROR].length > 1) { strBuild.append(raw_data[ERROR][0]); strBuild.append("\n"); for (int i = 1; i < raw_data[ERROR].length; i++) { strBuild.append(raw_data[ERROR][i]); strBuild.append("\t\t"); i++; strBuild.append(raw_data[ERROR][i]); strBuild.append("\n"); } strBuild.append("\n"); } return strBuild.toString(); } private void displayStatisticsData(final String[][] raw_data) { if (raw_data == null) { return; } GridBagConstraints gridBagConstraints = new GridBagConstraints(); Color color = new Color(240, 240, 240); if (!AnWindow.getInstance().getFilters().anyFilters()) { JLabel label = new JLabel(AnLocale.getString("I/O Data Statistics For <Total>")); AnUtility.setAccessibleContext(label); label.setFont(table.getFont().deriveFont(Font.BOLD)); label.setOpaque(true); label.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.left = 0; gridBagConstraints.insets.bottom = 10; statPanel.add(label, gridBagConstraints); } else { JLabel label = new JLabel(AnLocale.getString("I/O Data Statistics For <Total> (filters on)")); AnUtility.setAccessibleContext(label); label.setFont(table.getFont().deriveFont(Font.BOLD)); label.setOpaque(true); label.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.left = 0; gridBagConstraints.insets.bottom = 10; statPanel.add(label, gridBagConstraints); } gridBagConstraints.insets.bottom = 0; if (raw_data[WRITE].length > 1) { JPanel writePanel = new JPanel(); writePanel.setLayout(new GridBagLayout()); writePanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsWrite = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[WRITE][0]); AnUtility.setAccessibleContext(label1); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.bottom = 0; gridBagConstraints.insets.top = 0; gridBagConstraints.insets.left = 0; statPanel.add(label1, gridBagConstraints); gridBagConstraintsWrite.gridwidth = 1; JLabel label2 = new JLabel(AnLocale.getString("I/O Size Range")); AnUtility.setAccessibleContext(label2); label2.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsWrite.weightx = 1; gridBagConstraintsWrite.weighty = 0; gridBagConstraintsWrite.gridx = 0; gridBagConstraintsWrite.gridy = 1; gridBagConstraintsWrite.anchor = GridBagConstraints.LINE_START; gridBagConstraintsWrite.fill = GridBagConstraints.NONE; gridBagConstraintsWrite.insets.bottom = 1; gridBagConstraintsWrite.insets.top = 0; gridBagConstraintsWrite.insets.left = 0; writePanel.add(label2, gridBagConstraintsWrite); JLabel label3 = new JLabel(AnLocale.getString("Write Calls")); AnUtility.setAccessibleContext(label3); label3.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsWrite.weightx = 1; gridBagConstraintsWrite.weighty = 0; gridBagConstraintsWrite.gridx = gridBagConstraintsWrite.gridx + 1; gridBagConstraintsWrite.gridy = 1; gridBagConstraintsWrite.anchor = GridBagConstraints.LINE_START; gridBagConstraintsWrite.fill = GridBagConstraints.NONE; gridBagConstraintsWrite.insets.bottom = 1; gridBagConstraintsWrite.insets.top = 0; gridBagConstraintsWrite.insets.left = 120; writePanel.add(label3, gridBagConstraintsWrite); for (int i = 1; i < raw_data[WRITE].length; i++) { JLabel label4 = new JLabel(raw_data[WRITE][i]); AnUtility.setAccessibleContext(label4); label4.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsWrite.weightx = 1; gridBagConstraintsWrite.weighty = 0; gridBagConstraintsWrite.gridx = 0; gridBagConstraintsWrite.gridy = gridBagConstraintsWrite.gridy + 1; gridBagConstraintsWrite.anchor = GridBagConstraints.LINE_START; gridBagConstraintsWrite.fill = GridBagConstraints.NONE; gridBagConstraintsWrite.insets.bottom = 0; gridBagConstraintsWrite.insets.top = 0; if (raw_data[WRITE][i].trim().indexOf('-') > 0) { gridBagConstraintsWrite.insets.left = 5; } else { gridBagConstraintsWrite.insets.left = 0; } writePanel.add(label4, gridBagConstraintsWrite); i++; JLabel label5 = new JLabel(raw_data[WRITE][i]); AnUtility.setAccessibleContext(label5); label5.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsWrite.weightx = 1; gridBagConstraintsWrite.weighty = 0; gridBagConstraintsWrite.gridx = gridBagConstraintsWrite.gridx + 1; gridBagConstraintsWrite.anchor = GridBagConstraints.LINE_START; gridBagConstraintsWrite.fill = GridBagConstraints.NONE; gridBagConstraintsWrite.insets.left = 120; gridBagConstraintsWrite.insets.bottom = 0; writePanel.add(label5, gridBagConstraintsWrite); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(writePanel, gridBagConstraints); } if (raw_data[READ].length > 1) { JPanel readPanel = new JPanel(); readPanel.setLayout(new GridBagLayout()); readPanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsRead = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[READ][0]); AnUtility.setAccessibleContext(label1); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.insets.bottom = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label1, gridBagConstraints); gridBagConstraintsRead.gridwidth = 1; JLabel label2 = new JLabel(AnLocale.getString("I/O Size Range")); AnUtility.setAccessibleContext(label2); label2.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsRead.weightx = 1; gridBagConstraintsRead.weighty = 0; gridBagConstraintsRead.gridx = 0; gridBagConstraintsRead.gridy = 1; gridBagConstraintsRead.anchor = GridBagConstraints.LINE_START; gridBagConstraintsRead.fill = GridBagConstraints.NONE; gridBagConstraintsRead.insets.bottom = 1; readPanel.add(label2, gridBagConstraintsRead); JLabel label3 = new JLabel(AnLocale.getString("Read Calls")); AnUtility.setAccessibleContext(label3); label3.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsRead.weightx = 1; gridBagConstraintsRead.weighty = 0; gridBagConstraintsRead.gridx = gridBagConstraintsRead.gridx + 1; gridBagConstraintsRead.gridy = 1; gridBagConstraintsRead.anchor = GridBagConstraints.LINE_START; gridBagConstraintsRead.fill = GridBagConstraints.NONE; gridBagConstraintsRead.insets.bottom = 1; gridBagConstraintsRead.insets.left = 120; readPanel.add(label3, gridBagConstraintsRead); for (int i = 1; i < raw_data[READ].length; i++) { JLabel label4 = new JLabel(raw_data[READ][i]); AnUtility.setAccessibleContext(label4); label4.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsRead.weightx = 1; gridBagConstraintsRead.weighty = 0; gridBagConstraintsRead.gridx = 0; gridBagConstraintsRead.gridy = gridBagConstraintsRead.gridy + 1; gridBagConstraintsRead.anchor = GridBagConstraints.LINE_START; gridBagConstraintsRead.fill = GridBagConstraints.NONE; gridBagConstraintsRead.insets.bottom = 0; gridBagConstraintsRead.insets.top = 0; if (raw_data[READ][i].trim().indexOf('-') > 0) { gridBagConstraintsRead.insets.left = 5; } else { gridBagConstraintsRead.insets.left = 0; } readPanel.add(label4, gridBagConstraintsRead); i++; JLabel label5 = new JLabel(raw_data[READ][i]); AnUtility.setAccessibleContext(label5); label5.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsRead.weightx = 1; gridBagConstraintsRead.weighty = 0; gridBagConstraintsRead.gridx = gridBagConstraintsRead.gridx + 1; gridBagConstraintsRead.anchor = GridBagConstraints.LINE_START; gridBagConstraintsRead.fill = GridBagConstraints.NONE; gridBagConstraintsRead.insets.left = 120; gridBagConstraintsRead.insets.bottom = 0; readPanel.add(label5, gridBagConstraintsRead); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(readPanel, gridBagConstraints); } if (raw_data[OTHER].length > 1) { JPanel otherPanel = new JPanel(); otherPanel.setLayout(new GridBagLayout()); otherPanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsOther = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[OTHER][0]); AnUtility.setAccessibleContext(label1); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.insets.bottom = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label1, gridBagConstraints); gridBagConstraintsOther.gridwidth = 1; for (int i = 1; i < raw_data[OTHER].length; i++) { JLabel label2 = new JLabel(raw_data[OTHER][i]); AnUtility.setAccessibleContext(label2); label2.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsOther.weightx = 1; gridBagConstraintsOther.weighty = 0; gridBagConstraintsOther.gridx = 0; gridBagConstraintsOther.gridy = gridBagConstraintsOther.gridy + 1; gridBagConstraintsOther.anchor = GridBagConstraints.LINE_START; gridBagConstraintsOther.fill = GridBagConstraints.NONE; gridBagConstraintsOther.insets.left = 0; otherPanel.add(label2, gridBagConstraintsOther); i++; JLabel label3 = new JLabel(raw_data[OTHER][i]); AnUtility.setAccessibleContext(label3); label3.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsOther.weightx = 1; gridBagConstraintsOther.weighty = 0; gridBagConstraintsOther.gridx = gridBagConstraintsOther.gridx + 1; gridBagConstraintsOther.anchor = GridBagConstraints.LINE_START; gridBagConstraintsOther.fill = GridBagConstraints.NONE; gridBagConstraintsOther.insets.left = 175; otherPanel.add(label3, gridBagConstraintsOther); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(otherPanel, gridBagConstraints); } if (raw_data[ERROR].length > 1) { JPanel errorPanel = new JPanel(); errorPanel.setLayout(new GridBagLayout()); errorPanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsError = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[ERROR][0]); AnUtility.setAccessibleContext(label1); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.insets.bottom = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label1, gridBagConstraints); gridBagConstraintsError.gridwidth = 1; for (int i = 1; i < raw_data[ERROR].length; i++) { JLabel label2 = new JLabel(raw_data[ERROR][i]); AnUtility.setAccessibleContext(label2); label2.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsError.weightx = 1; gridBagConstraintsError.weighty = 0; gridBagConstraintsError.gridx = 0; gridBagConstraintsError.gridy = gridBagConstraintsError.gridy + 1; gridBagConstraintsError.anchor = GridBagConstraints.LINE_START; gridBagConstraintsError.fill = GridBagConstraints.NONE; gridBagConstraintsError.insets.left = 0; errorPanel.add(label2, gridBagConstraintsError); i++; JLabel label3 = new JLabel(raw_data[ERROR][i]); AnUtility.setAccessibleContext(label3); label3.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsError.weightx = 1; gridBagConstraintsError.weighty = 0; gridBagConstraintsError.gridx = gridBagConstraintsError.gridx + 1; gridBagConstraintsError.anchor = GridBagConstraints.LINE_START; gridBagConstraintsError.fill = GridBagConstraints.NONE; gridBagConstraintsError.insets.left = 175; errorPanel.add(label3, gridBagConstraintsError); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(errorPanel, gridBagConstraints); } // The last component. It will push everything up. JLabel label = new JLabel(""); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 1; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label, gridBagConstraints); statPanel.invalidate(); statPanel.validate(); statPanel.repaint(); } public void updateStackView(long stackId) { if (stackId == 0 /*null*/) { stack_view.reset(); // update stack in right-hand tab return; // Request for details about uninstrumented code is not supported yet. } AnUtility.checkIPCOnWrongThread(false); long[] pcs = window.getStackPCs(stackId); // IPC! String[] pcnames = window.getStackNames(stackId); // IPC! long[] funcs = window.getStackFunctions(stackId); // IPC! String[] fnames = window.getFuncNames(funcs); // IPC! AnUtility.checkIPCOnWrongThread(true); Vector<StackState> state_vec = new Vector<StackState>(); int i; for (i = 0; i < funcs.length; i++) { StackViewState svstate = new StackViewState(fnames[i], pcnames[i], funcs[i], pcs[i]); state_vec.add(svstate); } final int selected_frame = funcs.length - 1; clmap.addStates(state_vec); AnUtility.checkIPCOnWrongThread(false); stack_view.setStates( state_vec, selected_frame); // update stack in right-hand tab // FIXUP: don't do this on AWT AnUtility.checkIPCOnWrongThread(true); stack_view.setStackId(stackId); stackViewPane.setVisible(true); stackViewPane.revalidate(); AnWindow.getInstance().setSubviewReadyToShow("ioCallStackSubview", true); } // Listener for updating table private final class TableHandler implements AnListener { @Override public void valueChanged(final AnEvent event) { switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting if (actButton.isSelected()) { fileRowId = event.getValue(); computed = false; AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IO); window.getSelectionManager().updateSelection(ids, DSP_IO, subtype, 1); } } }); } else if (detButton.isSelected()) { vfdRowId = event.getValue(); ; computed = false; AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOFileDescriptors); window .getSelectionManager() .updateSelection(ids, DSP_IOFileDescriptors, subtype, 1); } } }); } else if (calStkButton.isSelected()) { stackRowId = event.getValue(); computed = false; AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { long id = dataCalStkIds[stackRowId]; int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_IOCallStacks); window .getSelectionManager() .updateSelection(ids, DSP_IOCallStacks, subtype, 1); } updateStackView(id); } }); } break; case AnEvent.EVT_SORT: // Sorting // save current scroll location updateIfNotSort = false; getSettings() .getMetricsSetting() .setSortMetricByDType(this, ((Integer) event.getAux()).intValue(), type); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } int from = event.getValue(); int to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; case AnEvent.EVT_UPDATE: // setUpdated(false); break; case AnEvent.EVT_COMPUTE: computed = false; break; } } } // color change(s) @Override public void valueChanged(AnEvent e) { // setUpdated(false); stack_view.repaint(); } // Set selected function private void updateSummary(final StackState tmpstate) { if (!(tmpstate instanceof StackViewState)) { System.err.println("XXXmpview ioactivitydisp: not StackViewState"); return; } StackViewState state = (StackViewState) tmpstate; final long sel_func; final long sel_pc; sel_func = state.getNumber(); sel_pc = state.getPC(); long sel_obj = window.getSelectedObject().getObject(sel_func, sel_pc); if (sel_obj != 0L) { window.getSelectedObject().setSelObj(sel_obj, AnDisplay.DSP_IO, 0); // lazy computing may be needed for if Summary is not been selected if (window.getViews().getCurrentViewDisplay() == window.getIOView()) { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, getDisplayMode()); window.getSelectionManager().updateSelection(ids, getDisplayMode(), 0, 1); } } else { AnWindow.getInstance() .getViews() .getCurrentViewDisplay() .computeOnAWorkerThread(); // Update selection. FIXUP: Views that react on selections // should change selction on SELECTION_CHANGED or // SELECTED_OBJECT_CHANGED events if not from own view } } } @Override public void adjustmentValueChanged(final AdjustmentEvent e) { revalidate(); } @Override public void mouseClicked(final MouseEvent event) { if (SwingUtilities.isLeftMouseButton(event)) { funcChanged(event); } if (SwingUtilities.isRightMouseButton(event)) { stackViewPopupListener.maybeShowPopup(event); } } @Override public void mouseEntered(final MouseEvent event) {} @Override public void mouseExited(final MouseEvent event) {} @Override public void mousePressed(final MouseEvent event) {} @Override public void mouseReleased(final MouseEvent event) {} // Will be needed if I want to update summary tab based on selection @Override public void valueChanged(final ListSelectionEvent event) { funcChanged(event); } // (MUST BE CALLED ON AWT THREAD) public void funcChanged(EventObject event) { final JList list; StackState state = null; if (event instanceof MouseEvent) { if (window.getColorChooser().isVisible()) { window.getColorChooser().setVisible(true); } if (((MouseEvent) event).getClickCount() > 1) { window.setSelectedView(AnDisplay.DSP_Source); } } else if (window.getColorChooser().isVisible()) { window.getColorChooser().setVisible(true); } if (event.getSource() instanceof StackView) { list = stack_view; state = (StackState) list.getSelectedValue(); } else { // XXXmpview, figure this out... // System.err.println("XXXmpview ioactivitydisp: eventsource unknown"); return; } if (state == null) { return; } stack_view.setSelectedFunction(state.getNumber()); // is this redundant? window.getColorChooser().setSelectedFunction(state.getNumber()); updateSummary(state); } @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, boolean caseSensitive) { int find_row; if ((str == null) || (str.length() == 0)) { return -1; } find_row = table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = table.findBefore(str, next, caseSensitive); } // Update summary display if (find_row != -1) { goToLine(table, find_row); } return find_row; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = super.exportAsText(limit, format, delimiter); // exports the main table // Export lower panel if format is TEXT if (format == ExportFormat.TEXT && (limit == null || limit >= 0)) { statisticsData = getIOStatistics(); text += exportStatisticsData(statisticsData); } return text; } // Native methods from liber_dbe.so private String[][] getIOStatistics() { synchronized (IPC.lock) { window.IPC().send("getIOStatistics"); window.IPC().send(0); return (String[][]) window.IPC().recvObject(); } } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); if (calStkButton.isSelected()) { list.add(window.getIoCallStackSubview()); } return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); if (calStkButton.isSelected()) { list.add(window.getIoCallStackSubview()); } return list; } @Override public void goToLine(final AnTable tbl, final int row) { tbl.setSelectedRow(row); int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, getDisplayMode()); window.getSelectionManager().updateSelection(ids, getDisplayMode(), subtype, 1); if (calStkButton.isSelected()) { long id = dataCalStkIds[row]; updateStackView(id); } } } } �������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CannotFindFilePanel.form�������������������������������������������0000644�0001750�0001750�00000010602�14744453367�020437� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,2,10"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="textLabel"> <Properties> <Property name="text" type="java.lang.String" value="jLabel1"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="pathTextField"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="resolveButton"> <Properties> <Property name="text" type="java.lang.String" value="jButton1"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="resolveButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723233�015620� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/���������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�017125� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/IOEvent.java���������������������������������������0000644�0001750�0001750�00000005447�14744453367�021250� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline2.TimelineVariable; import java.awt.Color; import java.util.List; import javax.swing.ImageIcon; public class IOEvent extends ExtendedEvent implements DurationEvent, StateEvent { protected final String[] LABELS = { AnLocale.getString("IO Type:"), // NOI18N AnLocale.getString("IO File Descriptor:"), // NOI18N AnLocale.getString("IO Bytes:"), // NOI18N AnLocale.getString("Duration (msec.):") // NOI18N }; public final int type; // IO Type public final int fd; // File Descriptor public final long bytes; // Number of bytes public final long duration; // in nanosec private final String[] eventSpecificInfo; public IOEvent( int lwpid, int thrid, int cpuid, long ts, long stack, long func, List<StackState> stackStates, int type, int fd, long bytes, long duration, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.type = type; this.fd = fd; this.bytes = bytes; this.duration = duration; this.eventSpecificInfo = initEventSpecificInfo(); } public String[] getEventSpecificInfo() { String[] rc = this.eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { String typename; typename = TimelineVariable.iotype_info.getNameByRawIdx(type); return new String[] { typename, new AnInteger(fd).toString(), new AnLong(bytes).toString(), new AnLong(duration).toTime(.000001) }; } public String[] getEventSpecificLabels() { return LABELS; } public long getDuration() { return duration; } public ImageIcon[] getEventSpecificIcons() { Color color = TimelineVariable.iotype_info.getColorByRawIdx(type); ImageIcon icon = new ImageIcon(StackState.createIcon(color)); return new ImageIcon[] { icon, null, null, null, }; } public int getState() { return type; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/ProfileEvent.java����������������������������������0000644�0001750�0001750�00000005176�14744453367�022340� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline2.TimelineVariable; import java.awt.Color; import java.util.List; import javax.swing.ImageIcon; public final class ProfileEvent extends ExtendedEvent implements DurationEvent, StateEvent { private final String[] LABELS = { AnLocale.getString("Duration (msec.):"), // NOI18N AnLocale.getString("Thread State:") // NOI18N }; private final int mstate; private final long interval; // in nanosec private final long duration; // visual duration, in nanosec private final int ompstate; private final String[] eventSpecificInfo; public ProfileEvent( int lwpid, int thrid, int cpuid, long ts, long stack, long func, List<StackState> stackStates, int mstate, long interval, int ompstate, long duration, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.mstate = mstate; this.ompstate = ompstate; // YXXX unused for now this.interval = interval; this.duration = duration; this.eventSpecificInfo = initEventSpecificInfo(); } public String[] getEventSpecificInfo() { String[] rc = this.eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { String state = TimelineVariable.mstate_info.getNameByRawIdx(mstate); return new String[] { new AnLong(interval).toTime(0.000001), state, }; } public String[] getEventSpecificLabels() { return LABELS; } public ImageIcon[] getEventSpecificIcons() { Color color = TimelineVariable.mstate_info.getColorByRawIdx(mstate); ImageIcon icon = new ImageIcon(StackState.createIcon(color)); return new ImageIcon[] { null, icon, }; } public long getDuration() { return duration; } public int getState() { return mstate; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/RaceEvent.java�������������������������������������0000644�0001750�0001750�00000005342�14744453367�021605� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnAddress; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; public final class RaceEvent extends ExtendedEvent { private static final int WRITE_RACE = 0; private static final int WRITE_RACE_RED = 1; private static final int READ_RACE = 2; private static final int READ_RACE_RED = 3; private static final String[] TYPES = { AnLocale.getString("Write"), // NOI18N AnLocale.getString("Write Red"), // NOI18N AnLocale.getString("Read"), // NOI18N AnLocale.getString("Read Red") // NOI18N }; private static final String TYPE = AnLocale.getString("Type:"); // NOI18N private static final String RACE_ID = AnLocale.getString("Race ID:"); // NOI18N private static final String ADDRESS = AnLocale.getString("Address:"); // NOI18N private static final String[] GENERIC_RACE_LABELS = {TYPE, ADDRESS, RACE_ID}; private final int type; private final int race_id; private final long vaddr; public RaceEvent( final int lwpid, final int thrid, final int cpuid, final long ts, final long stack, final long func, List<StackState> stackStates, final int type, final int race_id, final long vaddr, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.type = type; this.race_id = race_id; this.vaddr = vaddr; } public String[] getEventSpecificInfo() { // fixme what about redundancy flag bit? switch (type) { case WRITE_RACE: case WRITE_RACE_RED: case READ_RACE: case READ_RACE_RED: return new String[] { TYPES[type], AnAddress.toHexString(vaddr), new AnInteger(race_id).toString() }; } return null; } public String[] getEventSpecificLabels() { switch (type) { case WRITE_RACE: case WRITE_RACE_RED: case READ_RACE: case READ_RACE_RED: return GENERIC_RACE_LABELS; } return null; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/EventDetail.java�����������������������������������0000644�0001750�0001750�00000003752�14744453367�022140� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ // @(#)EventDetail.java 1.21 11/06/09 package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; import javax.swing.ImageIcon; public abstract class EventDetail { public static final int NO_CPU_INFO = -1; private static final String[] DUMMY_STRINGS = {}; // private final static char[] DUMMY_MNEMONICS = { }; private static final ImageIcon[] DUMMY_ICONS = {}; // TODO: adjust should be moved to DBE so filters work as expected for time-adjust experiments protected final long timestamp; // adjusted timestamp, e.g. as viewed in timeline private final long org_time; // original timestamp public EventDetail(final long original_time, final long time_adjust) { timestamp = original_time - time_adjust; org_time = original_time; } public final long getTimestamp() { return timestamp; } public abstract long getStack(); // for none, DetailsIPC.INVALID_STACK_ID public abstract List<StackState> getStackStates(); // for none, returns NULL public String[] getEventSpecificLabels() { return DUMMY_STRINGS; } public String[] getEventSpecificInfo() { return DUMMY_STRINGS; } // public char[] getEventSpecificMnemonics() { // return DUMMY_MNEMONICS; // } public ImageIcon[] getEventSpecificIcons() { return DUMMY_ICONS; } } ����������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/HWCEvent.java��������������������������������������0000644�0001750�0001750�00000014731�14744453367�021356� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnAddress; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; public final class HWCEvent extends ExtendedEvent { private static final String INTERVAL = AnLocale.getString("Interval:"); // NOI18N private static final String FREQ = AnLocale.getString("Clock Freq (MHz):"); // NOI18N private static final String DATAVADDR = AnLocale.getString("Data Virtual Addr:"); // NOI18N private static final String DATAPADDR = AnLocale.getString("Data Physical Addr:"); // NOI18N private static final String PCVADDR = AnLocale.getString("PC Virtual Addr:"); // NOI18N private static final String PCPADDR = AnLocale.getString("PC Physical Addr:"); // NOI18N private static final String DATADESC = AnLocale.getString("Data Descriptor:"); // NOI18N private static final String[] LABELS = {INTERVAL}; private static final String[] LABELS2 = {INTERVAL, FREQ}; private static final String[] XLABELS = { INTERVAL, DATAVADDR, DATAPADDR, PCVADDR, PCPADDR, DATADESC }; private static final String[] XLABELS2 = { INTERVAL, FREQ, DATAVADDR, DATAPADDR, PCVADDR, PCPADDR, DATADESC }; // ABS encodings must match definitions in ABS.h private static final long ABS_NULL = 0x00L; private static final long ABS_CODE_RANGE = 0xFFL; private static final long ABS_RT_CODEMASK = 0x0FL; private static final long ABS_PP_CODEMASK = 0xF0L; private static final String[] ABS_RT_CODES = { "", // NOI18N AnLocale.getString("(Internal error)"), // NOI18N AnLocale.getString("(Backtracking blocked)"), // NOI18N AnLocale.getString("(Backtracking incomplete)"), // NOI18N AnLocale.getString("(Register lost)"), // NOI18N AnLocale.getString("(Invalid address)"), // NOI18N AnLocale.getString("(UNKNOWN)") // NOI18N }; private static final String[] ABS_PP_CODES = { "", // NOI18N AnLocale.getString("(No Symbolic Information)"), // NOI18N AnLocale.getString("(Backtracking failed)"), // NOI18N AnLocale.getString("(Blocked by branch target)"), // NOI18N AnLocale.getString("(<POST-PROCESSING ERROR>)") // NOI18N }; // passed to constructor private final AnWindow m_window; private final long interval; private final long eventEA, eventPA, eventVPC, eventPPC; private final int cpu_freq; private final String[] eventSpecificInfo; private final String[] eventSpecificLabels; public HWCEvent( final AnWindow awindow, int lwpid, int thrid, int cpuid, // IPC!! long ts, long stack, long func, List<StackState> stackStates, long interval, long eventEA, long eventPA, long eventVPC, long eventPPC, int cpu_freq, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.m_window = awindow; this.interval = interval; this.eventEA = eventEA; this.eventPA = eventPA; this.eventVPC = eventVPC; this.eventPPC = eventPPC; this.cpu_freq = cpu_freq; this.eventSpecificInfo = ipcInitEventSpecificInfo(); this.eventSpecificLabels = initEventSpecificLabels(); } private String ipcGetDataspaceTypeDesc() { long stack = super.getStack(); return ipcGetDataspaceTypeDesc(stack); } private String getDataAddress() { int rt_code, pp_code; if (0 > eventEA || eventEA > ABS_CODE_RANGE) return AnAddress.toHexString(eventEA); else { rt_code = (int) (eventEA & ABS_RT_CODEMASK); pp_code = (int) (eventEA & ABS_PP_CODEMASK) / 0xF; if (rt_code > ABS_RT_CODES.length) rt_code = ABS_RT_CODES.length - 1; if (pp_code > ABS_PP_CODES.length) pp_code = ABS_PP_CODES.length - 1; return ABS_PP_CODES[pp_code] + ABS_RT_CODES[rt_code]; } } private String getPhysicalAddress() { if (eventPA != ABS_NULL) return AnAddress.toHexString(eventPA); else return ""; } private String getVirtualPC() { if (eventVPC != ABS_NULL) return AnAddress.toHexString(eventVPC); else return ""; } private String getPhysicalPC() { if (eventPPC != ABS_NULL) return AnAddress.toHexString(eventPPC); else return ""; } public String[] getEventSpecificInfo() { String[] rc = eventSpecificInfo.clone(); return rc; } // eventEA is only defined for XHWC records private String[] ipcInitEventSpecificInfo() { if ((cpu_freq == 0) && (eventEA == ABS_NULL)) return new String[] {new AnLong(interval).toString()}; else if (eventEA == ABS_NULL) return new String[] {new AnLong(interval).toString(), new AnInteger(cpu_freq).toString()}; else if (cpu_freq == 0) return new String[] { new AnLong(interval).toString(), getDataAddress(), getPhysicalAddress(), getVirtualPC(), getPhysicalPC(), ipcGetDataspaceTypeDesc() }; else return new String[] { new AnLong(interval).toString(), new AnInteger(cpu_freq).toString(), getDataAddress(), getPhysicalAddress(), getVirtualPC(), getPhysicalPC(), ipcGetDataspaceTypeDesc() }; } public String[] getEventSpecificLabels() { String[] rc = this.eventSpecificLabels.clone(); return rc; } private String[] initEventSpecificLabels() { if ((cpu_freq == 0) && (eventEA == ABS_NULL)) return LABELS; else if (eventEA == ABS_NULL) return LABELS2; else if (cpu_freq == 0) return XLABELS; else return XLABELS2; } // Native methods from liber_dbe.so private String ipcGetDataspaceTypeDesc(long stack) { synchronized (IPC.lock) { m_window.IPC().send("getDataspaceTypeDesc"); // NOI18N m_window.IPC().send(stack); return m_window.IPC().recvString(); } } } ���������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/SyncEvent.java�������������������������������������0000644�0001750�0001750�00000004002�14744453367�021637� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnAddress; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; public class SyncEvent extends ExtendedEvent implements DurationEvent { protected final String[] LABELS = { AnLocale.getString("Duration (msec.):"), // NOI18N AnLocale.getString("Lock Address:") // NOI18N }; public final long duration; // in nanosec public final long sobj; // synchronization object (f.e. mutex) private final String[] eventSpecificInfo; public SyncEvent( int lwpid, int thrid, int cpuid, long ts, long stack, long func, List<StackState> stackStates, long duration, long sobj, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.duration = duration; this.sobj = sobj; this.eventSpecificInfo = initEventSpecificInfo(); } public String[] getEventSpecificInfo() { String[] rc = this.eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { return new String[] {new AnLong(duration).toTime(.000001), AnAddress.toHexString(sobj)}; } public String[] getEventSpecificLabels() { return LABELS; } public long getDuration() { return duration; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/MPIEvent.java��������������������������������������0000644�0001750�0001750�00000005053�14744453367�021357� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; public final class MPIEvent extends ExtendedEvent implements DurationEvent { private final String[] LABELS = { AnLocale.getString("Duration (msec.):"), // NOI18N AnLocale.getString("Sub-Type:"), // NOI18N AnLocale.getString("Message Count:"), // NOI18N AnLocale.getString("Bytes:") // NOI18N }; // This order has to match what's in data_pckts.h for MPI stuff private static final String[] MPITYPES = { "mpisend", // NOI18N "mpireceive", // NOI18N "mpisendrecv", // NOI18N "mpiother" // NOI18N }; // passed to constructor private final long duration; // in nanosec private final int sub_type, msg_cnt; private final long msg_bytes; private final String[] eventSpecificInfo; public MPIEvent( int lwpid, int thrid, int cpuid, long ts, long stack, long func, List<StackState> stackStates, long duration, int msg_cnt, int sub_type, long msg_bytes, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.duration = duration; this.sub_type = sub_type; this.msg_cnt = msg_cnt; this.msg_bytes = msg_bytes; this.eventSpecificInfo = initEventSpecificInfo(); } public String[] getEventSpecificInfo() { String[] rc = this.eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { return new String[] { new AnLong(duration).toTime(.000001), MPITYPES[sub_type], new AnInteger(msg_cnt).toString(), new AnLong(msg_bytes).toString() }; } public String[] getEventSpecificLabels() { return LABELS; } public long getDuration() { return duration; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/DeadlockEvent.java���������������������������������0000644�0001750�0001750�00000005372�14744453367�022444� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnAddress; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.statecolors.StackState; import java.util.List; public final class DeadlockEvent extends ExtendedEvent { private static final String[] TYPES = { AnLocale.getString("Lock Held"), // NOI18N AnLocale.getString("Lock Requested"), // NOI18N AnLocale.getString("<Unknown>"), // NOI18N }; private static final String[] DLTYPES = { AnLocale.getString("Potential Deadlock"), // NOI18N AnLocale.getString("Actual Deadlock"), // NOI18N AnLocale.getString("<Unknown>"), // NOI18N }; private static final String TYPE = AnLocale.getString("Lock Event:"); // NOI18N private static final String DLTYPE = AnLocale.getString("Deadlock Type:"); // NOI18N private static final String DEADLOCK_ID = AnLocale.getString("Deadlock ID:"); // NOI18N private static final String ADDRESS = AnLocale.getString("Address:"); // NOI18N private static final String[] GENERIC_RACE_LABELS = {TYPE, DLTYPE, ADDRESS, DEADLOCK_ID}; private final int type; private final int dltype; private final int deadlock_id; private final long vaddr; public DeadlockEvent( final int lwpid, final int thrid, final int cpuid, final long ts, final long stack, final long func, List<StackState> stackStates, final int type, final int dltype, final int deadlock_id, final long vaddr, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.type = (type >= 0 && type < TYPES.length) ? type : TYPES.length - 1; this.dltype = (dltype >= 0 && dltype < DLTYPES.length) ? dltype : DLTYPES.length - 1; this.deadlock_id = deadlock_id; this.vaddr = vaddr; } public String[] getEventSpecificInfo() { return new String[] { TYPES[type], DLTYPES[dltype], AnAddress.toHexString(vaddr), new AnInteger(deadlock_id).toString() }; } public String[] getEventSpecificLabels() { return GENERIC_RACE_LABELS; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/Sample.java����������������������������������������0000644�0001750�0001750�00000014215�14744453367�021151� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnDouble; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline2.TimelineVariable; import java.awt.Color; import java.util.List; import javax.swing.*; public class Sample extends EventDetail implements DurationEvent { private static final double DIV = 1000000000.0; private static ImageIcon[] allIcons; private static Object allIconsLock = new Object(); private static String[] allLabels; private static Object allLabelsLock = new Object(); private static final String[] LABELS = { AnLocale.getString("Process:"), // NOI18N AnLocale.getString("Sample Number:"), // NOI18N AnLocale.getString("Sample Start Label:"), // NOI18N AnLocale.getString("Sample End Label:"), // NOI18N AnLocale.getString("Start Time (sec.):"), // NOI18N AnLocale.getString("End Time (sec.):"), // NOI18N AnLocale.getString("Duration (sec.):"), // NOI18N }; // private final static char[] MNEMONICS = { // AnLocale.getString('E', "MNEM_SAMPLE_EXPERIMENT_NAME"), // NOI18N // AnLocale.getString('m', "MNEM_SAMPLE_SAMPLE_NUMBER"), // NOI18N // AnLocale.getString('L', "MNEM_SAMPLE_SAMPLE_START_LABEL"), // NOI18N // AnLocale.getString('b', "MNEM_SAMPLE_SAMPLE_END_LABEL"), // NOI18N // AnLocale.getString('a', "MNEM_SAMPLE_START_TIME"), // NOI18N // AnLocale.getString('n', "MNEM_SAMPLE_END_TIME"), // NOI18N // AnLocale.getString('D', "MNEM_SAMPLE_DURATION"), // NOI18N // }; // passed to constructor private final int number; private final String start_label, end_label; private final long duration; // in nanosec private final long total; // resource usage in nanosec private final long[] mstates; // resource usage in nanosec private final String expname; private final String[] eventSpecificInfo; private final String[] eventSpecificLabels; // Constructor public Sample( int number, String start_label, String end_label, long start_time, long end_time, long total, long[] mstates, String expname, long time_adjust) { super(end_time, time_adjust); // event timestamps are end times, not start times this.number = number; this.start_label = start_label; this.end_label = end_label; this.duration = end_time - start_time; this.total = total; this.mstates = mstates; this.expname = expname; this.eventSpecificInfo = initEventSpecificInfo(); this.eventSpecificLabels = initEventSpecificLabels(); } public long getStack() { return DetailsIPC.INVALID_STACK_ID; } public final List<StackState> getStackStates() { return null; } public String getStartLabel() { return start_label; } public String getEndLabel() { return end_label; } public long getTotalTime() { return total; } public long getDuration() { return duration; } public Object getData() { return mstates; } public long[] getMStates() { return mstates; } public String[] getEventSpecificLabels() { String[] rc = this.eventSpecificLabels.clone(); return rc; } private String[] initEventSpecificLabels() { synchronized (allLabelsLock) { if (allLabels == null) { int idx = 0; allLabels = new String[LABELS.length + TimelineVariable.NUM_SOLARIS_MSTATES]; for (int ii = 0; ii < LABELS.length; ii++) { allLabels[idx++] = LABELS[ii]; } for (int ii = 0; ii < TimelineVariable.NUM_SOLARIS_MSTATES; ii++) { allLabels[idx++] = TimelineVariable.mstate_info.getNameByDisplayIdx(ii); } } return allLabels; } } public String[] getEventSpecificInfo() { String[] rc = eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { String[] strings; strings = new String[LABELS.length + TimelineVariable.NUM_SOLARIS_MSTATES]; strings[0] = expname; strings[1] = new AnInteger(number).toString(); strings[2] = start_label; strings[3] = end_label; strings[4] = TimelineVariable.strTimestamp(super.getTimestamp() - duration); strings[5] = TimelineVariable.strTimestamp(super.getTimestamp()); strings[6] = TimelineVariable.strTimestamp(duration); // int numLabels = LABELS.length + TimelineVariable.NUM_SOLARIS_MSTATES; for (int ii = 0; ii < mstates.length; ii++) { int idx = TimelineVariable.mstate_info.getDisplayIdx(ii); if (idx >= 0 && idx < TimelineVariable.NUM_SOLARIS_MSTATES) { double time = mstates[ii]; double percent = total == 0 ? total : (time / total) * 100; int labelIdx = LABELS.length + idx; // numLabels-1-idx; strings[labelIdx] = new AnDouble(time / DIV).toPercentQuote(percent); } else { ; // unexpected } } return strings; } public ImageIcon[] getEventSpecificIcons() { synchronized (allIconsLock) { if (allIcons == null) { allIcons = new ImageIcon[LABELS.length + TimelineVariable.NUM_SOLARIS_MSTATES]; int idx = LABELS.length; for (int ii = 0; ii < TimelineVariable.NUM_SOLARIS_MSTATES; ii++) { Color c = TimelineVariable.mstate_info.getColorByDisplayIdx(ii); allIcons[idx++] = new ImageIcon(StackState.createIcon(c)); } } return allIcons; } } // public char[] getEventSpecificMnemonics() { // return MNEMONICS; // } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/DurationEvent.java���������������������������������0000644�0001750�0001750�00000001407�14744453367�022516� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; public interface DurationEvent { public long getDuration(); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/ExtendedEvent.java���������������������������������0000644�0001750�0001750�00000003561�15044710303�022450� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.statecolors.StackState; import java.util.Collections; import java.util.List; public abstract class ExtendedEvent extends EventDetail { private final int lwpid; private final int thrid; private final int cpuid; private final Long stack; private final List<StackState> stackStates; private final long func; // leaf function public ExtendedEvent( final int lwpid, final int thrid, final int cpuid, final long ts, final long stack, final long func, long time_adjust, final List<StackState> stackStates) { super(ts, time_adjust); this.lwpid = lwpid; this.thrid = thrid; this.cpuid = cpuid; if (stack != 0) this.stack = stack; else this.stack = null; this.stackStates = Collections.unmodifiableList(stackStates); this.func = func; } public final int getLWP() { return lwpid; } public final int getThread() { return thrid; } public final int getCPU() { return cpuid; } @Override public final long getStack() { return stack.longValue(); } @Override public final List<StackState> getStackStates() { return stackStates; } } �����������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/HeapEvent.java�������������������������������������0000644�0001750�0001750�00000013462�14744453367�021612� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnAddress; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnLong; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline2.TimelineVariable; import java.awt.Color; import java.util.List; import javax.swing.ImageIcon; public final class HeapEvent extends ExtendedEvent implements StateEvent { private static final int MALLOC = 0; private static final int FREE = 1; private static final int REALLOC = 2; private static final int MMAP = 3; private static final int MUNMAP = 4; private static final String TYPE = AnLocale.getString("Type:"); // NOI18N private static final String ALLOCATED = AnLocale.getString("Event Bytes Allocated:"); // NOI18N private static final String ADDRESS = AnLocale.getString("Address:"); // NOI18N private static final String OADDRESS = AnLocale.getString("Old Address:"); // NOI18N private static final String LEAKED = AnLocale.getString("Event Bytes Leaked:"); // NOI18N private static final String FREED = AnLocale.getString("Event Bytes Freed:"); // NOI18N private static final String HEAPSZ = AnLocale.getString("Net Bytes Allocated:"); // NOI18N private static final String LEAKSZ = AnLocale.getString("Net Bytes Leaked:"); // NOI18N private static final String[] MALLOC_LABELS = { TYPE, ALLOCATED, LEAKED, ADDRESS, HEAPSZ, LEAKSZ, }; private static final String[] FREE_LABELS = { TYPE, FREED, ADDRESS, HEAPSZ, LEAKSZ, }; private static final String[] REALLOC_LABELS = { TYPE, ALLOCATED, FREED, LEAKED, ADDRESS, OADDRESS, HEAPSZ, LEAKSZ, }; private static final String[] MMAP_LABELS = { TYPE, ALLOCATED, FREED, LEAKED, ADDRESS, HEAPSZ, LEAKSZ, }; private static final String[] MUNMAP_LABELS = { TYPE, ALLOCATED, FREED, ADDRESS, HEAPSZ, LEAKSZ, }; private final int type; private final long allocated; private final long vaddr; private final long ovaddr; private final long leaked; private final long freed; private final long heapsz; private final long leaksz; private final String[] eventSpecificInfo; public HeapEvent( final int lwpid, final int thrid, final int cpuid, final long ts, final long stack, final long func, List<StackState> stackStates, final int type, final long allocated, final long vaddr, final long ovaddr, long leaked, long freed, long heapsz, long leaksz, long time_adjust) { super(lwpid, thrid, cpuid, ts, stack, func, time_adjust, stackStates); this.type = type; this.allocated = allocated; this.vaddr = vaddr; this.ovaddr = ovaddr; this.leaked = leaked; this.freed = freed; this.heapsz = heapsz; this.leaksz = leaksz; this.eventSpecificInfo = initEventSpecificInfo(); } public String[] getEventSpecificInfo() { String[] rc = this.eventSpecificInfo.clone(); return rc; } private String[] initEventSpecificInfo() { final String name = TimelineVariable.htype_info.getNameByRawIdx(type); switch (type) { case MALLOC: return new String[] { name, new AnLong(allocated).toString(), new AnLong(leaked).toString(), AnAddress.toHexString(vaddr), new AnLong(heapsz).toString(), new AnLong(leaksz).toString(), }; case MMAP: return new String[] { name, new AnLong(allocated).toString(), new AnLong(freed).toString(), new AnLong(leaked).toString(), AnAddress.toHexString(vaddr), new AnLong(heapsz).toString(), new AnLong(leaksz).toString(), }; case MUNMAP: return new String[] { name, new AnLong(allocated).toString(), new AnLong(freed).toString(), AnAddress.toHexString(vaddr), new AnLong(heapsz).toString(), new AnLong(leaksz).toString(), }; case FREE: return new String[] { name, new AnLong(freed).toString(), AnAddress.toHexString(vaddr), new AnLong(heapsz).toString(), new AnLong(leaksz).toString(), }; case REALLOC: return new String[] { name, new AnLong(allocated).toString(), new AnLong(freed).toString(), new AnLong(leaked).toString(), AnAddress.toHexString(vaddr), AnAddress.toHexString(ovaddr), new AnLong(heapsz).toString(), new AnLong(leaksz).toString(), }; } return null; } public String[] getEventSpecificLabels() { switch (type) { case MALLOC: return MALLOC_LABELS; case FREE: return FREE_LABELS; case REALLOC: return REALLOC_LABELS; case MMAP: return MMAP_LABELS; case MUNMAP: return MUNMAP_LABELS; } return null; } public ImageIcon[] getEventSpecificIcons() { Color color = TimelineVariable.htype_info.getColorByRawIdx(type); ImageIcon icon = new ImageIcon(StackState.createIcon(color)); return new ImageIcon[] { icon, null, null, null, }; } public int getState() { return type; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/StateEvent.java������������������������������������0000644�0001750�0001750�00000001400�14744453367�022002� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; public interface StateEvent { public int getState(); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline/events/DetailsIPC.java������������������������������������0000644�0001750�0001750�00000027056�15044710303�021634� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline.events; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.statecolors.StackViewState; import java.util.ArrayList; import java.util.List; // contents moved here from timeline.Experiment.java // Ideally, IPC related to TL details should be updated to use properties... public class DetailsIPC { public static final long INVALID_STACK_ID = -1; public static EventDetail ipcGetTLDetails( AnWindow m_window, int exp_id, String exp_name, int data_id, Settings.TLData_type tl_type, int entity_prop_id, long event_id, int cpu_freq, long time_adjust) { final EventDetail[] events; if (tl_type.equals(Settings.TLData_type.TL_SAMPLE)) { // YXXX samples has separate processing. Fix when old TL removed events = ipcGetSampleObjs(m_window, exp_id, event_id, event_id, exp_name, time_adjust); } else if (tl_type.equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 events = ipcGetGCEventObjs(m_window, exp_id, event_id, event_id, exp_name, time_adjust); } else { final Object[] detailVals; detailVals = ipcGetTLDetails(m_window, exp_id, data_id, entity_prop_id, event_id); if (detailVals == null) { return null; } final long[] values = (long[]) detailVals[0]; final long[] funcs = (long[]) detailVals[1]; final String[] funcNames = (String[]) detailVals[2]; final long[] pcs = (long[]) detailVals[3]; final String[] pcNames = (String[]) detailVals[4]; List<StackState> stackStates = new ArrayList<>(); for (int i = 0; i < funcs.length; i++) { StackViewState svstate = new StackViewState(funcNames[i], pcNames[i], funcs[i], pcs[i]); stackStates.add(svstate); } // To avoid changing legacy code in ipcFinish_getTLDetailsEvents(), set up arrays of details // here: final long[][] list = new long[1][]; list[0] = values; final List<List<StackState>> stackStatesList = new ArrayList<>(); stackStatesList.add(stackStates); events = ipcFinish_getTLDetailsEvents( m_window, list, stackStatesList, tl_type, cpu_freq, time_adjust); } if (events == null || events.length == 0) { return null; } return events[0]; } // TLData_type is defined in Presentation.java. Make sure // to update TLData_type if there is a new TL_?? type. Also, // The new TL_?? type has to match with the type that is // returned by getTLDetailValues(). This method is defined // in Dbe.cc. private static EventDetail[] ipcFinish_getTLDetailsEvents( AnWindow m_window, final long[][] list, List<List<StackState>> stackStatesList, final Settings.TLData_type tl_type, final int cpu_freq, final long time_adjust) { long[] value; final int size = list.length; final EventDetail events[] = new EventDetail[size]; switch (tl_type) { case TL_CLOCK: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new ProfileEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), (int) value[6], value[7], (int) value[8], value[9], time_adjust); } break; case TL_SYNC: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new SyncEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), value[6], value[7], time_adjust); } break; case TL_HWC: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new HWCEvent( m_window, (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), value[6], value[7], value[8], value[9], value[10], cpu_freq, time_adjust); } break; case TL_HEAP: case TL_HEAPSZ: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new HeapEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), (int) value[6], value[7], value[8], value[9], value[10], value[11], value[12], value[13], time_adjust); } break; case TL_IOTRACE: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new IOEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), (int) value[6], (int) value[7], value[8], value[9], time_adjust); } break; case TL_RACES: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new RaceEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), (int) value[6], (int) value[7], value[8], time_adjust); } break; case TL_DLCK: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new DeadlockEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), (int) value[6], (int) value[7], (int) value[8], value[9], time_adjust); } break; case TL_MPI: for (int i = 0; i < size; i++) { value = list[i]; events[i] = new MPIEvent( (int) value[0], (int) value[1], (int) value[2], value[3], value[4], value[5], stackStatesList.get(i), value[6], (int) value[7], (int) value[8], value[9], time_adjust); } break; default: break; // weird } return events; } private static Sample[] ipcGetSampleObjs( AnWindow m_window, int exp_id, long lo_idx, long hi_idx, String exp_name, long time_adjust) { Sample[] event; final Object[] objs = ipcGetSamples(m_window, exp_id, lo_idx, hi_idx); if (objs != null) { final long[][] array = (long[][]) objs[0]; final long[] starts = (long[]) objs[1]; final long[] ends = (long[]) objs[2]; final long[] rtimes = (long[]) objs[3]; final String[] start_label = (String[]) objs[4]; final String[] end_label = (String[]) objs[5]; final int[] samp_id = (int[]) objs[6]; int nsmp = array.length; event = new Sample[nsmp]; for (int i = 0; i < nsmp; i++) { long[] list = array[i]; long[] mstates = list.clone(); Sample samp = new Sample( samp_id[i], start_label[i], end_label[i], starts[i], ends[i], rtimes[i], mstates, exp_name, time_adjust); event[i] = samp; } } else { event = new Sample[0]; } return event; } // CXXX Bug 20801848 - return type may not be Sample[] private static Sample[] ipcGetGCEventObjs( AnWindow m_window, int exp_id, long lo_idx, long hi_idx, String exp_name, long time_adjust) { Sample[] event; final Object[] objs = ipcGetGCEvents(m_window, exp_id, lo_idx, hi_idx); if (objs != null) { final long[] starts = (long[]) objs[0]; final long[] ends = (long[]) objs[1]; final int[] gcevent_id = (int[]) objs[2]; int nsmp = gcevent_id.length; event = new Sample[nsmp]; long[] mstates = new long[0]; for (int i = 0; i < nsmp; i++) { Sample gcevent = new Sample( gcevent_id[i], null, null, starts[i], ends[i], ends[i] - starts[i], mstates, exp_name, time_adjust); event[i] = gcevent; } } else { event = new Sample[0]; } return event; } private static Object[] ipcGetTLDetails( AnWindow m_window, final int exp_id, final int data_id, final int entity_prop_id, final long event_id) { synchronized (IPC.lock) { m_window.IPC().send("getTLDetails"); // NOI18N m_window.IPC().send(0); m_window.IPC().send(exp_id); m_window.IPC().send(data_id); m_window.IPC().send(entity_prop_id); m_window.IPC().send(event_id); return (Object[]) m_window.IPC().recvObject(); } } private static Object[] ipcGetSamples( AnWindow m_window, final int exp_id, long hi_idx, long lo_idx) { synchronized (IPC.lock) { m_window.IPC().send("getSamples"); // NOI18N m_window.IPC().send(0); m_window.IPC().send(exp_id); m_window.IPC().send(hi_idx); m_window.IPC().send(lo_idx); return (Object[]) m_window.IPC().recvObject(); } } private static Object[] ipcGetGCEvents( AnWindow m_window, final int exp_id, long hi_idx, long lo_idx) { synchronized (IPC.lock) { m_window.IPC().send("getGCEvents"); // NOI18N m_window.IPC().send(0); m_window.IPC().send(exp_id); m_window.IPC().send(hi_idx); m_window.IPC().send(lo_idx); return (Object[]) m_window.IPC().recvObject(); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/event/�������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015134� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/event/AnChangeListener.java����������������������������������������0000644�0001750�0001750�00000001446�14744453367�021113� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.event; /** * @author tpreisle */ public interface AnChangeListener { void stateChanged(AnChangeEvent e); } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/event/AnSelectionEvent.java����������������������������������������0000644�0001750�0001750�00000002653�14744453367�021150� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.event; import java.util.EventObject; public class AnSelectionEvent extends EventObject { private long[] selObj; private int type; private int subtype; private int version; public AnSelectionEvent(Object source, long[] selObj, int type, int subtype, int version) { super(source); this.selObj = selObj; this.type = type; this.subtype = subtype; this.version = version; } /** * @return the selObj */ public long[] getSelObj() { return selObj; } /** * @return the type */ public int getType() { return type; } /** * @return the subtype */ public int getSubtype() { return subtype; } /** * @return the version */ public int getVersion() { return version; } } �������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/event/AnEventManager.java������������������������������������������0000644�0001750�0001750�00000006733�15044710303�020554� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.event; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @author tpreisle */ public class AnEventManager { private boolean logEvents = false; private static AnEventManager instance = null; private List<AnChangeListener> listenerList = null; private AnEventManager() { listenerList = new ArrayList<>(); } /** * @return */ public static AnEventManager getInstance() { if (instance == null) { instance = new AnEventManager(); } return instance; } /** * @param listener */ public synchronized void addListener(AnChangeListener listener) { listenerList.add(listener); } /** * @param listener */ public synchronized void removeListener(AnChangeListener listener) { listenerList.remove(listener); } /** * Fire an AnChangeEvent. Events are always dispatched on AWT thread. Requirements to the event * handler: o When it done handling the event and returns, all the views states need to be * *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param changeEvent the event */ public void fireAnChangeEvent(final AnChangeEvent changeEvent) { long start = 0; if (logEvents) { start = new Date().getTime(); String type = changeEvent.getType().toString(); if (changeEvent.getType() == AnChangeEvent.Type.SETTING_CHANGED || changeEvent.getType() == AnChangeEvent.Type.SETTING_CHANGING) { AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) changeEvent.getSource(); type += " " + anSettingChangeEvent.getType(); } System.out.println("AnEventManager.fireChangeEventInternal begin: " + type); } AnUtility.dispatchOnSwingThread( new Runnable() { // REFACTOR: should this be non-blocking? // AnUtility.invokeLaterOnSwingThread(new Runnable() {// REFACTOR: should // this be non-blocking? @Override public void run() { fireAnChangeEventInternal(changeEvent); } }); if (logEvents) { String type = changeEvent.getType().toString(); System.out.println( "AnEventManager.fireChangeEventInternal end: " + type + " ms=" + (new Date().getTime() - start)); } } private synchronized void fireAnChangeEventInternal(final AnChangeEvent changeEvent) { for (AnChangeListener listener : listenerList) { listener.stateChanged(changeEvent); } } } �������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/event/AnChangeEvent.java�������������������������������������������0000644�0001750�0001750�00000005647�14744453367�020416� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.event; import java.util.EventObject; /** * @author tpreisle */ public class AnChangeEvent extends EventObject { public enum Type { MOST_RECENT_EXPERIMENT_LIST_CHANGED, // fired when there is a change to the most recent // experiments list REMOTE_CONNECTION_CHANGING, // fired when remote connection is about to change REMOTE_CONNECTION_CANCELLED_OR_FAILED, // fired if remove connection cancelled or failed REMOTE_CONNECTION_CHANGED, // fired when remote connection successfully connected FILTER_CHANGING, // fired when filters are about to change FILTER_CHANGED, // fired when filters have changed SOURCE_FINDING_CHANGING, // fired when find source are changing (archive, gp-display-text pathmap, ...) SOURCE_FINDING_CHANGED, // fired when find source are changing (archive, gp-display-text pathmap, ...) EXPERIMENTS_LOADING_NEW, // fired when new experiment(s) are about to be loaded from scratch EXPERIMENTS_LOADING_ADDED_OR_REMOVED, // fired when new experiment(s) are about to be added or // removed (compare, aggregate, ...) EXPERIMENTS_LOADED_FAILED, // fired when new experiment(s) failed to load EXPERIMENTS_LOADED, // fired when new experiment(s) loaded successfully SETTING_CHANGING, // fired when a setting is abot to change. SETTING_CHANGED, // fired when a setting is changed. SELECTED_OBJECT_CHANGED, // fired when selected object has changed from outside a main view // (CalledByCalls) SELECTION_UPDATE, // fired when selection should be changed. Handler of this event will fire a // SELECTION_CHANGING/SELECTION_CHANGED event SELECTION_CHANGING, // fired when selection is about to be changed. SELECTION_CHANGED, // fired when selection has changed. One handler of this event (Summary view) // will update Selection Details panel DEBUG, // for debugging TEST1, // for testing TEST2, // for testing } private final Type type; public AnChangeEvent(Object source, Type type) { super(source); this.type = type; } /** * @return the event type */ public Type getType() { return type; } } �����������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SelectedObject.java������������������������������������������������0000644�0001750�0001750�00000017256�15044710303�017461� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.util.gui.AnUtility; public final class SelectedObject implements AnChangeListener { private long selObjectSelectionTime = 0; private boolean selObjWasSet = false; private long selIndex; private int selType; private int selSubType; public SelectedObject() { AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("RacesView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_NEW: resetSelectedObject(); break; case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADED_FAILED: case EXPERIMENTS_LOADED: // Nothing break; case FILTER_CHANGING: resetSelectedObject(); break; case FILTER_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SETTING_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } private void debug() { System.out.println(this.getClass().getSimpleName()); } public void setSelObjWithEvent(long index, int type, int subtype) { setSelObj(index, type, subtype); AnEventManager.getInstance() .fireAnChangeEvent(new AnChangeEvent(this, AnChangeEvent.Type.SELECTED_OBJECT_CHANGED)); } public void setSelObj(long index, int type, int subtype) { // System.out.println("setSelObj: " + index + " " + type + " " + subtype); synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); getWindow().IPC().send("setSelObj"); getWindow().IPC().send(0); getWindow().IPC().send(index); getWindow().IPC().send(type); getWindow().IPC().send(subtype); getWindow().IPC().recvString(); // synchronize // store the selection selObjectSelectionTime = System.currentTimeMillis(); selObjWasSet = true; selIndex = index; selType = type; selSubType = subtype; AnUtility.checkIPCOnWrongThread(true); } } public boolean wasASelDone() { return selObjWasSet; } private void resetSelectedObject() { selObjWasSet = false; } public long getSelIndex() { return selIndex; } public int getSelType() { return selType; } public int getSelSubType() { return selSubType; } public long getSelObj(int type, int subtype) { synchronized (IPC.lock) { getWindow().IPC().send("getSelObj"); getWindow().IPC().send(0); getWindow().IPC().send(type); getWindow().IPC().send(subtype); long l = getWindow().IPC().recvLong(); // System.out.println("getSelObj: " + l); return l; } } public int getSelIndex(long sel_obj, int type, int subtype) { synchronized (IPC.lock) { getWindow().IPC().send("getSelIndex"); getWindow().IPC().send(0); getWindow().IPC().send(sel_obj); getWindow().IPC().send(type); getWindow().IPC().send(subtype); return getWindow().IPC().recvInt(); } } /** * @return the selObjectSelectionTime */ public long getSelObjectSelectionTime() { return selObjectSelectionTime; } /** * Get Selected Object. New API "V2" (version 2). Based on unique id. * * @param ConvertTo String "FUNCTION" * @return ID */ public long getSelObjV2(String ConvertTo) { synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); getWindow().IPC().send("getSelObjV2"); getWindow().IPC().send(0); getWindow().IPC().send(ConvertTo); long res = getWindow().IPC().recvLong(); AnUtility.checkIPCOnWrongThread(true); return res; } } public void setSelObjV2WithEvent(long id) { setSelObjV2(id); AnEventManager.getInstance() .fireAnChangeEvent(new AnChangeEvent(this, AnChangeEvent.Type.SELECTED_OBJECT_CHANGED)); } public void setSelObjV2(long id) { // System.out.println("setSelObjV2: " + id); AnUtility.checkIPCOnWrongThread(false); synchronized (IPC.lock) { getWindow().IPC().send("setSelObjV2"); getWindow().IPC().send(0); getWindow().IPC().send(id); getWindow().IPC().recvString(); // synchronize // store the selection selObjectSelectionTime = System.currentTimeMillis(); selObjWasSet = true; } AnUtility.checkIPCOnWrongThread(true); } public long[] getSelObjIO(long id, int type) { synchronized (IPC.lock) { final IPC ipc = getWindow().IPC(); ipc.send("getSelObjIO"); ipc.send(0); ipc.send(id); ipc.send(type); return (long[]) ipc.recvObject(); } } public long[] getSelObjsIO(final long[] ids, int type) { synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); final IPC ipc = getWindow().IPC(); ipc.send("getSelObjsIO"); ipc.send(0); ipc.send(ids); ipc.send(type); long[] ll = (long[]) ipc.recvObject(); AnUtility.checkIPCOnWrongThread(true); return ll; } } public long getSelObjHeapTimestamp(long id) { synchronized (IPC.lock) { final IPC ipc = getWindow().IPC(); ipc.send("getSelObjHeapTimestamp"); ipc.send(0); ipc.send(id); return ipc.recvLong(); } } public int getSelObjHeapUserExpId(long id) { synchronized (IPC.lock) { final IPC ipc = getWindow().IPC(); ipc.send("getSelObjHeapUserExpId"); ipc.send(0); ipc.send(id); return ipc.recvInt(); } } public long getObject(final long sel_func, final long sel_pc) { synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); getWindow().IPC().send("getObject"); getWindow().IPC().send(0); getWindow().IPC().send(sel_func); getWindow().IPC().send(sel_pc); long l = getWindow().IPC().recvLong(); AnUtility.checkIPCOnWrongThread(true); return l; } } private AnWindow getWindow() { return AnWindow.getInstance(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ConfigurationPanel.form��������������������������������������������0000644�0001750�0001750�00000020016�14744453367�020423� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-31"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JCheckBox" name="useConfCheckBox"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> <Property name="opaque" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useConfCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="confComboBox"> <Properties> <Property name="editable" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="21" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="confBrowseButton"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="confBrowseButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="alwaysCheckBox"> <Properties> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="18" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="workingDirCheckBox"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> <Property name="opaque" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="workingDirCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="workingDirLabel"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="21" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="workingDirTextField"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="wdBrowseButton"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="wdBrowseButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnFileSystemView.java����������������������������������������������0000644�0001750�0001750�00000050653�15044710303�017776� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.IPC.AnIPCException; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import javax.swing.JFileChooser; import javax.swing.UIManager; import javax.swing.filechooser.FileSystemView; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.util.gui.AnUtility; /** AnFileSystemView - File System View for remote experiments */ public class AnFileSystemView extends FileSystemView { private AnWindow anWindow = null; private AnChooser anChooser = null; private static final String SLASH = "/"; private static final String DOUBLE_SLASH = "//"; private static final char SLASH_CHAR = '/'; private static final char BACKSLASH_CHAR = '\\'; private static final char COLUMN_CHAR = ':'; private static int ThreadID = 0; private File[] roots = null; static AnFileSystemView remoteFileSystemView = null; static boolean useSystemExtensionsHiding = false; private final boolean DONT_USE_LS = false; public static AnFileSystemView getFileSystemView() { useSystemExtensionsHiding = UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding"); UIManager.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("lookAndFeel")) { useSystemExtensionsHiding = UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding"); } } }); if (remoteFileSystemView == null) { remoteFileSystemView = new RemoteFileSystemView(); } return remoteFileSystemView; } /** * Returns all root partitions on this system. For example, on Windows, this would be the * "Desktop" folder, while on DOS this would be the A: through Z: drives. * * @return */ @Override public File[] getRoots() { if (null != roots) { return roots; } roots = new AnFile[1]; AnFile root = new AnFile(SLASH); roots[0] = root; // createFileSystemRoot(root); return roots; } /** * Is dir the root of a tree in the file system, such as a drive or partition. Example: Returns * true for "C:\" on Windows 98. * * @param dir a <code>File</code> object representing a directory * @return <code>true</code> if <code>f</code> is a root of a filesystem * @see #isRoot * @since 1.4 */ @Override public boolean isFileSystemRoot(File dir) { if (dir != null) { String p = dir.getAbsolutePath(); if (SLASH.equals(p)) { return true; } } return false; } /** * Gets the list of shown (i.e.not hidden) files. * Use IPC_getFiles to get the list of remote files * * @param directory * @param isFileHidingEnabled * @return */ @Override public synchronized File[] getFiles(File directory, boolean isFileHidingEnabled) { // Temporary fix for Windows String path = slashifyPath(directory.getPath()); AnFile dir = new AnFile(path); dir.isDirectoryFlag = true; dir.attributesReady = true; ThreadID++; ArrayList<AnFile> anFiles = new ArrayList<>(); String dirname = dir.getAbsolutePath(); // dir.getCanonicalPath(); try { String filenames; if (DONT_USE_LS) { filenames = IPC_getFiles(dirname, "/bin/ls -aF"); } else { String cmd = "/usr/bin/ls -"; if (isFileHidingEnabled) { cmd += "a"; } filenames = AnUtility.getRemoteOutput(cmd + "F1 " + dirname); } // AnLog.log(String.format("getFiles: %d %s\n%s", ThreadID, path, filenames)); while (filenames.length() > 0) { int j = filenames.indexOf("\n"); if (j <= 0) { break; } String fn = filenames.substring(0, j); filenames = filenames.substring(j + 1); char sym = fn.charAt(j - 1); if (sym == '/' || sym == '*' || sym == '@') { fn = fn.substring(0, j - 1); } if (fn.equals(".") || fn.equals("..") || (!isFileHidingEnabled && fn.startsWith("."))) { continue; } AnFile f = new AnFile(fn); anFiles.add(f); f.executableFlag = sym == '*'; f.setAttributes(path, sym == '/', true); } } catch (AnIPCException e) { AnLog.log("AnFileSystemView.getFiles: Thread ID=" + ThreadID + " " + e); } catch (Exception e) { } return anFiles.toArray(new File[anFiles.size()]); } /** * Process File Attributes * * @param dir * @param file * @param filename * @param fattr * @return */ private boolean processFileAttributes( String /*AnFile*/ dir, AnFile file, String filename, String fattr) { int j = fattr.indexOf("\n"); if (j > 0) { fattr = fattr.substring(0, j); } if (fattr.endsWith(filename)) { if (fattr.startsWith("d")) { file.setAttributes(dir, true, true); } if (fattr.startsWith("-")) { file.setAttributes(dir, false, true); } file.attributesReady = true; return true; } return false; } /** * Get file attributes and saves it in AnFile * * @param file * @return true if no exceptions happened */ public boolean updateFileAttributes(AnFile file) { return updateFileAttributes(null, file); } /** * Get file attributes and saves it in AnFile * * @param dir * @param file * @return true if no exceptions happened */ public boolean updateFileAttributes(AnFile dir, AnFile file) { if (file.getAttributesReady()) { return true; } String LS_CMD = "/bin/ls -dl "; try { String dirname = null; if (dir != null) { dirname = dir.getCanonicalPath(); } String filename = file.getPath(); // Try to get this info from gp-display-text String fullfilename = filename; if (!fullfilename.startsWith(SLASH)) { if (null != dirname) { if (!dirname.endsWith(SLASH)) { dirname += SLASH; } // Temporary fix for Windows dirname = slashifyPath(dirname); fullfilename = dirname + filename; } else { fullfilename = SLASH + filename; // BUG! } } String fattr = IPC_getFileAttributes(fullfilename, LS_CMD); if (null != fattr) { if (fattr.length() > 0) { if (processFileAttributes(dirname, file, fullfilename, fattr)) { return true; } } fattr = null; } if (null == fattr) { file.existsFlag = false; file.isDirectoryFlag = false; file.attributesReady = true; } } catch (Exception e) { // e.printStackTrace(); } return false; } /** * Update File Attributes if the name matches * * @param files * @param filename * @param index * @param dir * @return true if updated */ private boolean updateFile(AnFile[] files, String filename, int index, /*AnFile*/ String dir) { boolean isDir = false; boolean exists = true; if (index >= files.length) { return false; } String s = files[index].getName(); // NM was files[index].getPath(); if (filename.endsWith(SLASH)) { isDir = true; filename = filename.substring(0, filename.length() - 1); if (filename.compareTo(s) == 0) { files[index].setAttributes(dir, isDir, exists); return true; } return false; } if (filename.compareTo(s) == 0) { // Regular file files[index].setAttributes(dir, isDir, exists); return true; } else if (filename.endsWith("@")) { // Link String fs = filename.substring(0, filename.length() - 1); if (fs.compareTo(s) == 0) { isDir = true; files[index].setAttributes(dir, isDir, exists); return true; } } else if (filename.endsWith("*")) { String fs = filename.substring(0, filename.length() - 1); if (fs.compareTo(s) == 0) { isDir = false; files[index].setAttributes(dir, isDir, exists); return true; } } return false; } /** * Internal function to process 'ls -aF' output and update file attributes * * @param files * @param filenames * @return */ private boolean processFileAttributes(String dir, AnFile[] files, String filenames) { int index = 0; String fn = filenames; while (filenames.length() > 0) { int j = filenames.indexOf("\n"); if (j > 0) { fn = filenames.substring(0, j); filenames = filenames.substring(j + 1); } else { break; } if (updateFile(files, fn, index, dir)) { if (index < files.length - 1) { index++; } continue; } // Search through all files int i; for (i = 0; i < files.length; i++) { if (updateFile(files, fn, i, dir)) { break; } } if (i < files.length - 1) { index = i + 1; } } return true; } /** * Name of a file, directory, or folder as it would be displayed in a system file browser. Example * from Windows: the "M:\" directory displays as "CD-ROM (M:)" * * <p>The default implementation gets information from the ShellFolder class. * * @param f a <code>File</code> object * @return the file name as it would be displayed by a native file chooser * @see JFileChooser#getName * @since 1.4 */ @Override public String getSystemDisplayName(File f) { if (f == null) { return null; } return f.getName(); } /** Creates a new folder with a default folder name. */ @Override public File createNewFolder(File containingDir) throws IOException { // anWindow.createDirectory(dirname); throw new UnsupportedOperationException("Not supported yet."); } /** Sets AnWindows. * @param a */ public void setAnWindow(AnWindow a) { anWindow = a; } /** Gets AnWindows. * @return */ public AnWindow getAnWindow() { return (anWindow); } public void setAnChooser(AnChooser c) { anChooser = c; } /** * Get File Attributes via IPC call * * @param filename * @param format * @return String */ public String IPC_getFileAttributes(final String filename, final String format) { IPCContext fsvContext = IPCContext.newCurrentContext( AnLocale.getString("File Chooser"), IPCContext.Scope.SYSTEM, false, anWindow); fsvContext.setCancellable(true); IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, fsvContext); ipcHandle.append("getFileAttributes"); ipcHandle.append(filename); ipcHandle.append(format); IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { anChooser.cancelChooser(); } String result = ipcResult.getString(); // blocking if (result == null) { System.err.println("Error: ipcHandle: " + ipcHandle); } anWindow.getSystemProgressPanel().setProgressCancelContext(null); return result; } /** * Get Files via IPC call * * @param dirname * @param format * @return String */ private synchronized String IPC_getFiles(final String dirname, final String format) { IPCContext fsvContext = IPCContext.newCurrentContext( AnLocale.getString("File Chooser"), IPCContext.Scope.SYSTEM, false, anWindow); fsvContext.setCancellable(true); IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, fsvContext); ipcHandle.append("getFiles"); ipcHandle.append(dirname); ipcHandle.append(format); IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { anChooser.cancelChooser(); } String result = ipcResult.getString(); // blocking anWindow.getSystemProgressPanel().setProgressCancelContext(null); // System.out.println("--------------------------- \'" + dirname + "\' \'" + format + // "\'"); // System.out.println("IPC_getFiles: \n" + result); return result; } public static String slashifyPath(String path) { String s = path; if (null == s) { return null; } // Temporary code for Windows if (s.length() >= 3) { if ((s.charAt(1) == COLUMN_CHAR) && (s.charAt(2) == BACKSLASH_CHAR)) { // Special case if (s.length() > 3) { s = SLASH + s.substring(3); } else { s = SLASH; } } } // Replace all \ characters with / characters s = s.replace(BACKSLASH_CHAR, SLASH_CHAR); // Replace double slashes with single slash int n = s.indexOf(DOUBLE_SLASH); while (n >= 0) { s = s.substring(0, n) + s.substring(n + 1); n = s.indexOf(DOUBLE_SLASH); } return s; } } // End of AnFileSystemView /** Remote FileSystemView */ class RemoteFileSystemView extends AnFileSystemView { private static final String SLASH = "/"; private static final char SLASH_CHAR = '/'; private AnFile root = null; private AnFile home = null; /** Returns a File object constructed from the given path string. */ @Override public File createFileObject(String path) { AnFile f = new AnFile(path); updateFileAttributes(f); return f; } /** Returns a File object constructed from the given path string. */ public File createFileObject(File parent, String fileName) { String path = parent.getPath(); if (path.endsWith(SLASH)) { path = path + fileName; } else { path = path + SLASH + fileName; } return createFileObject(path); } /** Creates a new folder with a default folder name. */ @Override public File createNewFolder(File containingDir) throws IOException { if (containingDir == null) { throw new IOException("Containing directory is null:"); } String res = null; AnFile newFolder = null; if (containingDir instanceof AnFile) { String defaultFolderName = UIManager.getString("FileChooser.other.newFolder"); newFolder = (AnFile) containingDir; String folderName = newFolder.getAbsolutePath() + SLASH + defaultFolderName; newFolder = new AnFile(folderName); // System.out.println("Create New Folder: " + newFolder.getAbsolutePath()); res = getAnWindow().createDirectories(newFolder.getAbsolutePath()); } if (null == newFolder) { throw new IOException("Create New Folder is not implemented yet."); } if (null != res && res.length() > 0) { throw new IOException("Create New Folder failed: " + res); } return newFolder; } /** * @param parent a <code>File</code> object representing a directory or special folder * @param fileName a name of a file or folder which exists in <code>parent</code> * @return a File object. This is normally constructed with <code>new * File(parent, fileName)</code> except when parent and child are both special folders, in which * case the <code>File</code> is a wrapper containing a <code>ShellFolder</code> object. * @since 1.4 */ @Override public File getChild(File parent, String fileName) { return createFileObject(parent, fileName); } @Override public File getHomeDirectory() { if (null == home) { String HomeDir = AnWindow.getInstance().getHomeDir(); if (HomeDir != null) { home = new AnFile(HomeDir); return home; } } else { return home; } if (null == root) { root = new AnFile(SLASH); } return (root); } /** * Return the user's default starting directory for the file chooser. * * @return a <code>File</code> object representing the default starting folder * @since 1.4 */ @Override public File getDefaultDirectory() { if (null == root) { root = new AnFile(SLASH); } return (root); } /** * Returns the parent directory of <code>dir</code>. * * @param dir the <code>File</code> being queried * @return the parent directory of <code>dir</code>, or <code>null</code> if <code>dir</code> is * <code>null</code> */ @Override public File getParentDirectory(File dir) { if (dir == null || !dir.exists()) { return null; } String psf = dir.getParent(); if (psf == null) { return null; } AnFile pdir = new AnFile(dir.getParent()); return pdir; } /** * On Windows, a file can appear in multiple folders, other than its parent directory in the * filesystem. Folder could for example be the "Desktop" folder which is not the same as * file.getParentFile(). * * @param folder a <code>File</code> object repesenting a directory or special folder * @param file a <code>File</code> object * @return <code>true</code> if <code>folder</code> is a directory or special folder and contains * <code>file</code>. * @since 1.4 */ @Override public boolean isParent(File folder, File file) { if (folder == null || file == null) { return false; } // NM else if (folder instanceof ShellFolder) { File parent = file.getParentFile(); if (parent != null && parent.equals(folder)) { return true; } File[] children = getFiles(folder, false); for (int i = 0; i < children.length; i++) { if (file.equals(children[i])) { return true; } } return false; // NM } else { // NM return folder.equals(file.getParentFile()); // NM } } /** * Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My * Computer" or a network server. * * <p>The default implementation has no way of knowing, so always returns false. * * @param dir a directory * @return <code>false</code> always * @since 1.4 */ @Override public boolean isComputerNode(File dir) { // return ShellFolder.isComputerNode(dir); return false; } /** * Checks if <code>f</code> represents a real directory or file as opposed to a special folder * such as <code>"Desktop"</code>. Used by UI classes to decide if a folder is selectable when * doing directory choosing. * * @param f a <code>File</code> object * @return <code>true</code> if <code>f</code> is a real file or directory. * @since 1.4 */ @Override public boolean isFileSystem(File f) { if (f.isDirectory()) { return true; } return false; } /* Normalize the given pathname, whose length is len, starting at the given offset; everything before this offset is already normal. */ private String normalize(String pathname, int len, int off) { if (len == 0) return pathname; int n = len; while ((n > 0) && (pathname.charAt(n - 1) == SLASH_CHAR)) n--; if (n == 0) return SLASH; StringBuilder sb = new StringBuilder(pathname.length()); if (off > 0) sb.append(pathname.substring(0, off)); char prevChar = 0; for (int i = off; i < n; i++) { char c = pathname.charAt(i); if ((prevChar == SLASH_CHAR) && (c == SLASH_CHAR)) continue; sb.append(c); prevChar = c; } return sb.toString(); } /* Check that the given pathname is normal. If not, invoke the real normalizer on the part of the pathname that requires normalization. This way we iterate through the whole pathname string only once. */ public String normalize(String pathname) { int n = pathname.length(); char prevChar = 0; for (int i = 0; i < n; i++) { char c = pathname.charAt(i); if ((prevChar == SLASH_CHAR) && (c == SLASH_CHAR)) return normalize(pathname, n, i - 1); prevChar = c; } if (prevChar == SLASH_CHAR) return normalize(pathname, n, n - 1); return pathname; } public int prefixLength(String pathname) { if (pathname.length() == 0) return 0; return (pathname.charAt(0) == SLASH_CHAR) ? 1 : 0; } } // End of RemoteFileSystemView �������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/experiment_props/��������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�017416� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/experiment_props/ExperimentProperties.java�������������������������0000644�0001750�0001750�00000010565�15044710303�024376� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.experiment_props; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; // This class is intended to be immutable // // Mirrors back-end Experiment DataDescriptor and PropDescr information public class ExperimentProperties { public static class BasicInfo { private final int exp_id; // dbe Experiment handle private final int founder_exp_id; // dbe handle of founder experiment (same as exp_id if standalone) private final int user_exp_id; // filter experiment id private final int exp_group_id; // dbe experiment group id private final String exp_name; private final long offset_time, start_time, end_time; private final long start_wall_secs; // wall time-of-day seconds at start_time private final String hostname; private final int cpu_freq; public BasicInfo( final int exp_id, final int founder_exp_id, final int user_exp_id, final String exp_name, final int group_id, final long offset_time, final long start_time, final long end_time, final long start_wall_secs, final String hostname, final int cpu_freq) { this.exp_id = exp_id; this.founder_exp_id = founder_exp_id; this.user_exp_id = user_exp_id; this.exp_name = exp_name; this.exp_group_id = group_id; this.offset_time = offset_time; this.start_time = start_time; this.end_time = end_time; this.start_wall_secs = start_wall_secs; this.hostname = hostname; this.cpu_freq = cpu_freq; } } private final BasicInfo basic_info; private final List<DataDescriptor> data_desc; private final List<DataDescriptor> time_data_desc; private final Map<String, DataDescriptor> desc_map; public ExperimentProperties(final BasicInfo basic_info, List<DataDescriptor> data_desc) { this.basic_info = basic_info; this.data_desc = data_desc; this.time_data_desc = timeDataDescriptions(data_desc); this.desc_map = new HashMap<>(); } public final int getID() { return basic_info.exp_id; } public final int getFounderID() { return basic_info.founder_exp_id; } public final int getUserID() { return basic_info.user_exp_id; } public final long getTimeOffset() { return basic_info.offset_time; } public final long getStartTime() { return basic_info.start_time; } public final long getEndTime() { return basic_info.end_time; } public final long getStartWallSeconds() { return basic_info.start_wall_secs; } public final String getHostname() { return basic_info.hostname; } public final int getCpuFreq() { return basic_info.cpu_freq; } public List<DataDescriptor> getDataDescriptors() { return data_desc; } public List<DataDescriptor> getTstampDataDescriptors() { return time_data_desc; } public DataDescriptor findDataDescriptor(final String name) { if (desc_map.isEmpty()) { if (data_desc == null) { return null; } for (DataDescriptor desc : data_desc) { desc_map.put(desc.getName(), desc); } } return desc_map.get(name); } public String getName() { return basic_info.exp_name; } public int getGroupId() { return basic_info.exp_group_id; } private List<DataDescriptor> timeDataDescriptions(List<DataDescriptor> dataDescriptors) { ArrayList<DataDescriptor> tlDataDescriptors = new ArrayList<>(); if (dataDescriptors == null) { // experiment dropped? return tlDataDescriptors; } for (DataDescriptor ddscr : dataDescriptors) { if (ddscr.findProp("TSTAMP") != null) { tlDataDescriptors.add(ddscr); } } return tlDataDescriptors; } } �������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/experiment_props/PropDescriptor.java�������������������������������0000644�0001750�0001750�00000003453�14744453367�023202� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.experiment_props; // This class is intended to be immutable. // // PropDescriptor is a container to hold the DBE description of a metric // to be d[isplayed. (e.g. CPU Cycles) public final class PropDescriptor { private final String name; // identifier name private final String uname; // printable name private final int prop_id; // Dbe PROP_* value private final String stateNames[]; private final String stateUNames[]; public PropDescriptor( final String name, final String uname, int prop_id, final String stateNames[], final String stateUNames[]) { // used for HWC data, where aux is needed to specify counter this.name = name; this.uname = uname; this.prop_id = prop_id; this.stateNames = stateNames; this.stateUNames = stateUNames; } public String getName() { return name; } public String getDescription() { return uname; } public int getPropId() { return prop_id; } public String[] getStateNames() { // may return null return stateNames; } public String[] getStateUNames() { // may return null return stateUNames; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/experiment_props/Experiments.java����������������������������������0000644�0001750�0001750�00000032165�15044710303�022504� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.experiment_props; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import java.util.ArrayList; import java.util.Collections; import java.util.List; // ExperimentProperties sync'd with back-end experiments. // NOTE: Synchronization on all public interfaces is required because calls may come from // more than one thread. public final class Experiments { private final AnWindow w_IPC; private final ArrayList<ExperimentProperties> experiments; // Constructor public Experiments(final AnWindow awindow) { this.w_IPC = awindow; experiments = new ArrayList<>(); } // --- public experiment interface ---- public synchronized ExperimentProperties getExperimentProperties(int expId) { if (expId < 0 || expId >= experiments.size()) { return null; } return experiments.get(expId); } public synchronized List<ExperimentProperties> getAllExperimentProperties() { return Collections.unmodifiableList(experiments); } // Drop all experiments public synchronized void resetAll() { dropAllExps(); } public synchronized void ipcUpdateExps() { // IPC! dropAllExps(); // YXXX might much better to check for changes boolean[] enable = w_IPC.getExpEnable(); // IPC!! if (enable == null) { return; } final int size = enable.length; final int experimentIds[] = new int[size]; for (int i = 0; i < size; i++) { experimentIds[i] = i; } // Use "async" IPC calls to minimize the "high latency" effect IPCResult ipcr_founderExpIds = getFounderExpIdIPCRequest(experimentIds); // ASYNC IPC IPCResult ipcr_userExpIds = getUserExpIdIPCRequest(experimentIds); // ASYNC IPC IPCResult ipcr_names = getExpVerboseNameIPCRequest(experimentIds); // ASYNC IPC IPCResult ipcr_groupIds = getExpGroupIdIPCRequest(experimentIds); // ASYNC IPC IPCResult ipcr_timeObject = getExperimentTimeInfoIPCRequest(experimentIds); // ASYNC IPC IPCResult ipcr_ddscrObject = getExperimentDataDescriptorsIPCRequest(experimentIds); // ASYNC IPC // Get the results fron those "async" IPC calls // Old code used "sync" IPC calls int[] founderExpIds = ipcr_founderExpIds.getInts(); // w_IPC.getFounderExpId(experimentIds); // SYNC IPC int[] userExpIds = ipcr_userExpIds.getInts(); // w_IPC.getUserExpId(experimentIds); // SYNC IPC String[] names = ipcr_names.getStrings(); // w_IPC.getExpVerboseName(experimentIds); // SYNC IPC int[] groupIds = ipcr_groupIds.getInts(); // w_IPC.getExpGroupId(experimentIds); // SYNC IPC Object[] timeObject = ipcr_timeObject.getObjects(); // ipcGetExperimentTimeInfo(experimentIds); // SYNC IPC List<ExperimentProperties.BasicInfo> basicInfoList = processGetExperimentBasicInfo( experimentIds, founderExpIds, userExpIds, names, groupIds, timeObject); final Object[] ddscrObject = ipcr_ddscrObject.getObjects(); // ipcGetExperimentDataDescriptors(experimentIds); // SYNC IPC List<List<DataDescriptor>> dataDescriptorsList = processGetExperimentDataDescriptors(ddscrObject); if (basicInfoList == null || dataDescriptorsList == null) { return; // weird } for (int i = 0; i < size; i++) { ExperimentProperties.BasicInfo metaData = basicInfoList.get(i); List<DataDescriptor> dataDescriptors = dataDescriptorsList.get(i); ExperimentProperties expProps = new ExperimentProperties(metaData, dataDescriptors); experiments.add(expProps); } } // --- internal stuff private void dropAllExps() { experiments.clear(); } // ---IPC--- (Native methods from liber_dbe.so) private List<ExperimentProperties.BasicInfo> processGetExperimentBasicInfo( final int[] expIds, final int[] founderExpIds, final int[] userExpIds, final String[] names, final int[] groupIds, final Object[] timeObject) { if (timeObject == null || expIds == null || founderExpIds == null || userExpIds == null || groupIds == null) { return null; } final List<ExperimentProperties.BasicInfo> basicInfoList = new ArrayList<>(); final long[] offset_time = (long[]) timeObject[0]; // ipcGetRelativeStartTime(exp_id); final long[] start_time = (long[]) timeObject[1]; // ipcGetStartTime(exp_id); final long[] end_time = (long[]) timeObject[2]; // ipcGetEndTime (exp_id); final long[] start_wall_sec = (long[]) timeObject[3]; // ipcGetWallStartSec(exp_id); final String[] hostname = (String[]) timeObject[4]; // final int[] cpu_freq = (int[]) timeObject[5]; // ipcGetClock (exp_id); final int size = expIds.length; if (size != founderExpIds.length || size != userExpIds.length || size != names.length || size != groupIds.length || size != start_time.length || size != offset_time.length || size != end_time.length || size != start_wall_sec.length || size != hostname.length || size != cpu_freq.length) { return null; // weird } for (int i = 0; i < size; i++) { // loop for each experiment ExperimentProperties.BasicInfo metaData = new ExperimentProperties.BasicInfo( expIds[i], founderExpIds[i], userExpIds[i], names[i], groupIds[i], offset_time[i], start_time[i], end_time[i], start_wall_sec[i], hostname[i], cpu_freq[i]); basicInfoList.add(metaData); } return basicInfoList; } private List<List<DataDescriptor>> processGetExperimentDataDescriptors(final Object[] list) { if (list == null) { return null; } final List<List<DataDescriptor>> dataDescriptorList = new ArrayList<>(); final Object[] dataDescrsInfo = (Object[]) (list[0]); final Object[] dataDescrsProps = (Object[]) (list[1]); // array of dbeGetDataPropertiesV2() final int size = dataDescrsInfo.length; for (int i = 0; i < size; i++) { // loop for each experiment final List<DataDescriptor> exp_descrs = processGetExperimentDataDescriptors_experiment( (Object[]) dataDescrsInfo[i], (Object[]) dataDescrsProps[i]); dataDescriptorList.add(exp_descrs); } return dataDescriptorList; } private List<DataDescriptor> processGetExperimentDataDescriptors_experiment( final Object[] dataDescrsInfo, // ipcGetDataDescriptorsV2(exp_id); final Object[] dataDescrsProps) { final ArrayList<DataDescriptor> dataDescriptors = new ArrayList<>(); if (dataDescrsProps == null || dataDescrsInfo == null) { return dataDescriptors; } final Object[] list = dataDescrsInfo; if (list.length == 0) { return dataDescriptors; } final int[] data_id = (int[]) list[0]; final String[] name = (String[]) list[1]; final String[] uname = (String[]) list[2]; final int[] aux_prop_id = (int[]) list[3]; int size = data_id.length; if (size != dataDescrsProps.length) { return dataDescriptors; // weird } for (int i = 0; i < size; i++) { final ArrayList<PropDescriptor> props = processDataPropertiesV2((Object[]) dataDescrsProps[i]); DataDescriptor ddscr = new DataDescriptor(name[i], uname[i], data_id[i], props, aux_prop_id[i]); dataDescriptors.add(ddscr); } return dataDescriptors; } private ArrayList<PropDescriptor> processDataPropertiesV2(final Object[] list) { final ArrayList<PropDescriptor> propDescriptors = new ArrayList<>(); if (list == null || list.length == 0) { return propDescriptors; } final int[] propId = (int[]) list[0]; final String[] propUName = (String[]) list[1]; final int[] propTypeId = (int[]) list[2]; final String[] propTypeName = (String[]) list[3]; // YXXX add this final int[] propFlags = (int[]) list[4]; final String[] propName = (String[]) list[5]; final Object[] propStates = (Object[]) list[6]; final Object[] propUStates = (Object[]) list[7]; int size = propId.length; for (int i = 0; i < size; i++) { String[] states = (String[]) propStates[i]; String[] ustates = (String[]) propUStates[i]; String name = propName[i]; String uname = propUName[i]; int id = propId[i]; PropDescriptor propDscr = new PropDescriptor(name, uname, id, states, ustates); propDescriptors.add(propDscr); } return propDescriptors; } // private Object[] ipcGetExperimentTimeInfo(final int experimentIds[]){ // synchronized( IPC.lock ) { // w_IPC.IPC().send("getExperimentTimeInfo"); // // w_IPC.IPC().send(w_IPC.getWindowID()); // w_IPC.IPC().send(experimentIds); // return (Object[])w_IPC.IPC().recvObject(); // } // } // // private Object[] ipcGetExperimentDataDescriptors(final int experimentIds[]){ // synchronized( IPC.lock ) { // w_IPC.IPC().send("getExperimentDataDescriptors"); // // w_IPC.IPC().send(w_IPC.getWindowID()); // w_IPC.IPC().send(experimentIds); // return (Object[])w_IPC.IPC().recvObject(); // } // } /** * Send request to get corresponding Exp Verbose Names. Non-blocking IPC call. Caller should call * ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp indexes * * @return IPCResult */ public IPCResult getExpVerboseNameIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getExpVerboseName"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // String[] result = ipcResult.getObject() // blocking return ipcResult; } /** * Send request to get corresponding Exp Group IDs. Non-blocking IPC call. Caller should call * ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp indexes * * @return IPCResult */ public IPCResult getExpGroupIdIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getExpGroupId"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getObject() // blocking return ipcResult; } /** * Send request to get corresponding founderExpIds. Non-blocking IPC call. Caller should call * ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp indexes * * @return IPCResult */ public IPCResult getFounderExpIdIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getFounderExpId"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getObject() // blocking return ipcResult; } /** * Send request to get corresponding userExpIds. Non-blocking IPC call. Caller should call * ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp indexes * * @return IPCResult */ public IPCResult getUserExpIdIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getUserExpId"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getObject() // blocking return ipcResult; } /** * Send request to get corresponding Experiment Time Info. Non-blocking IPC call. Caller should * call ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp indexes * * @return IPCResult */ public IPCResult getExperimentTimeInfoIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getExperimentTimeInfo"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getObject() // blocking return ipcResult; } /** * Send request to get corresponding Experiment Data Descriptors. Non-blocking IPC call. Caller * should call ipcResult.getObject() to get the result @Parameters: expIds - experimentsDisp * indexes * * @return IPCResult */ public IPCResult getExperimentDataDescriptorsIPCRequest(final int[] expIds) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getExperimentDataDescriptors"); ipcHandle.append(expIds); IPCResult ipcResult = ipcHandle.sendRequest(); // int[] result = ipcResult.getObject() // blocking return ipcResult; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/experiment_props/DataDescriptor.java�������������������������������0000644�0001750�0001750�00000007723�14744453367�023137� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.experiment_props; import org.gprofng.mpmt.settings.Settings; import java.util.ArrayList; // This class is intended to be immutable. // // DataDescriptor is a container to hold the DBE description of a metric // to be displayed. (e.g. CPU Cycles) public final class DataDescriptor { private final String name; private final String uname; private final Settings.TLData_type tldata_type; // enum/bitmask TBR? private final int data_id; // Dbe DATA_* value private final ArrayList<PropDescriptor> props; private final int aux_prop_id; // e.g. PROP_HWCTAG private final int aux_count; // number of values for aux_prop_id private final boolean has_callstacks; public DataDescriptor( final String name, final String uname, final int data_id, final ArrayList<PropDescriptor> props, final int aux_prop_id) { this.name = name; this.uname = uname; this.tldata_type = Settings.TLData_type.find(name); this.data_id = data_id; this.props = props; this.aux_prop_id = aux_prop_id; PropDescriptor prop = findProp(aux_prop_id); if (prop != null && prop.getStateNames() != null) { aux_count = prop.getStateNames().length; } else { aux_count = 0; } if (findProp("FRINFO") != null) { has_callstacks = true; } else { has_callstacks = false; } } public String getName() { return name; } public String getAuxName(int aux) { // gp-display-text metrics command for HWCs if (aux_count == 0) { return null; } PropDescriptor prop = findProp(aux_prop_id); if (aux < 0 || aux >= aux_count || prop == null) { return null; // unexpected } String auxName = prop.getStateNames()[aux]; return auxName; } public String getAuxUName(int aux) { // gp-display-text metrics command for HWCs' description if (aux_count == 0) { return null; } PropDescriptor prop = findProp(aux_prop_id); if (aux < 0 || aux >= aux_count || prop == null) { return null; // unexpected } String auxName = prop.getStateUNames()[aux]; return auxName; } public String getErRcTLDataCmdName(int aux) { // tldata .gprofng.rc command String cmd = Settings.getErRcTLDataCmdName(tldata_type, getAuxName(aux)); return cmd; } public String getLongUName(int aux) { // long user-visible name String longUName = Settings.getErRcTLDataLongUName(uname, getAuxUName(aux)); return longUName; } public Settings.TLData_type getTLDataType() { // TBR? return tldata_type; } public int getDataId() { return data_id; } public final ArrayList<PropDescriptor> getProps() { return props; } public final PropDescriptor findProp(int prop_id) { if (props == null) { return null; } for (PropDescriptor prop : props) { if (prop_id == prop.getPropId()) { return prop; } } return null; } public final PropDescriptor findProp(String propName) { if (props == null) { return null; } for (PropDescriptor prop : props) { if (propName.equals(prop.getName())) { return prop; } } return null; } public int getAuxPropId() { return aux_prop_id; } public int getAuxCount() { return aux_count; } public boolean hasCallstacks() { return has_callstacks; } } ���������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/LibraryVisibilityDialog.java���������������������������������������0000644�0001750�0001750�00000004101�14744453367�021403� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; import java.util.List; public class LibraryVisibilityDialog extends AnDialog2 { private final LibraryVisibilityPanel libraryVisibilityPanel; public LibraryVisibilityDialog(Frame owner) { super(owner, owner, AnLocale.getString("Library and Class Visibility")); libraryVisibilityPanel = new LibraryVisibilityPanel(this); setHelpTag(AnVariable.HELP_ShowHideFunctions); setCustomPanel(libraryVisibilityPanel); getHelpButton().setVisible(true); } @Override public void setVisible(boolean b) { if (b) { libraryVisibilityPanel.reset(); } super.setVisible(b); } @Override protected void setStatus(Status status) { super.setStatus(status); if (status == Status.OK) { libraryVisibilityPanel.save(); } } public void initStates( boolean java, List<String> initStates, StringPickList hideFuncsIncludePickList, String currentIncludeFilter, StringPickList hideFuncsExcludePickList, String currentExcludeFilter) { libraryVisibilityPanel.initStates( java, hideFuncsIncludePickList, currentIncludeFilter, hideFuncsExcludePickList, currentExcludeFilter); } // For persistance public boolean isJava() { return libraryVisibilityPanel.isJava(); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/�����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015442� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareSimplePanel.form������������������������������������0000644�0001750�0001750�00000004034�14744453367�022004� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> </AuxValues> <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="400" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="300" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareGroupsPanel.form������������������������������������0000644�0001750�0001750�00000004034�14744453367�022032� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> </AuxValues> <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="400" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="300" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareNavigationPanel.java��������������������������������0000644�0001750�0001750�00000003351�14744453367�022631� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.analyzer.AnEnvironment; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.JPanel; public class CompareNavigationPanel extends JPanel { private CompareStatusPanel compareStatusPanel; public CompareNavigationPanel() { setBorder( BorderFactory.createMatteBorder(1, 0, 0, 1, AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); compareStatusPanel = new CompareStatusPanel(); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(2, 4, 6, 4); add(compareStatusPanel, gridBagConstraints); compareStatusPanel.repaint(); } public int getDiffFromInitialHeight() { return compareStatusPanel.getDiffFromInitialHeight(); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/ExperimentGroupsPanel.java���������������������������������0000644�0001750�0001750�00000027522�15044710303�022525� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.JComponent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; /** * @author vmezents */ public class ExperimentGroupsPanel extends javax.swing.JPanel implements ActionListener { private AnWindow window; private Frame frame; private String title; public List<String> listAbsPathes; private static int IdCount = 0; private final int id; /** Creates new form ExpGrpJPanel */ public ExperimentGroupsPanel( final AnWindow window, final Frame frame, final String title, String toolTip, char mnemonic) { this.window = window; this.frame = frame; this.title = title; id = ++IdCount; init(); label.setText(title); label.setToolTipText(toolTip); if (mnemonic != ' ') { label.setDisplayedMnemonic(mnemonic); label.setLabelFor(listExpNames); } listExpNames.setToolTipText(toolTip); } private void init() { initComponents(); btnRemove.setText(AnLocale.getString("Remove")); btnRemove.setToolTipText(AnLocale.getString("Remove experiment from the group")); btnRemove.addActionListener(this); btnAddExp.setText(AnLocale.getString("Add...")); btnAddExp.setToolTipText(AnLocale.getString("Add experiment to the group")); btnAddExp.addActionListener(this); listExpNames.setDragEnabled(true); listExpNames.setTransferHandler(new ListTransferHandler()); listExpNames.addListSelectionListener( new ListSelectionListener() { // This method is called each time the user changes the set of selected items // @Override public void valueChanged(ListSelectionEvent evt) { // When the user release the mouse button and completes the selection, // getValueIsAdjusting() becomes false if (!evt.getValueIsAdjusting()) { update_btnRemove(); } } }); update_exps_list(null); setVisible(true); jScrollPane1.setMinimumSize(new Dimension(10, 10)); listExpNames.setMinimumSize(new Dimension(10, 10)); // setBorder(javax.swing.BorderFactory.createTitledBorder(title)); } public void update_exps_list(final List<String> lst) { final List<String> listAbsNames = new ArrayList<>(); final List<String> listBaseNames = new ArrayList<>(); L_LOOP: for (int i = 0, sz = (lst == null) ? 0 : lst.size(); i < sz; i++) { String fname = lst.get(i); for (int j = 0; j < i; j++) { if (fname.compareTo(lst.get(j)) == 0) { continue L_LOOP; } } String bname = AnUtility.basename(fname); listBaseNames.add(bname); listAbsNames.add(fname); } listAbsPathes = listAbsNames; listExpNames.setListData(listBaseNames.toArray()); update_btnRemove(); } private void update_btnRemove() { btnRemove.setEnabled(listExpNames.getSelectedIndices().length != 0); } /** * Action performed * * @param event */ // @Override public void actionPerformed(final ActionEvent event) { String cmd = event.getActionCommand(); if (cmd.equals("btnAddExp")) { AnChooser ac = window.getAnChooser(AnLocale.getString("Select Experiment"), AnChooser.EXP_CHOOSER, null); if (ac.showDialog(this, null) == AnChooser.APPROVE_OPTION) { File files[] = ac.getSelectedAnFiles(); if (files != null) { List<String> lst = new ArrayList<>(); if (listAbsPathes != null) { lst.addAll(listAbsPathes); } for (File f : files) { String path = f.getAbsolutePath(); add_exp_or_grp(lst, path); } update_exps_list(lst); } } } else if (cmd.equals("btnRemove")) { int[] sel = listExpNames.getSelectedIndices(); if (sel.length > 0) { List<String> lst = new ArrayList<>(); if (listAbsPathes != null) { lst.addAll(listAbsPathes); } for (int i = sel.length - 1; i >= 0; i--) { int ind = sel[i]; if (ind < lst.size()) { lst.remove(ind); } } update_exps_list(lst); } } } public void add_exp_or_grp(List<String> lst, String path) { if ((path == null) || (path.length() == 0)) { return; } List<String> vec = AnUtility.getGroupList(path); for (String s : vec) { if (s.length() != 0) { lst.add(s); } } } // Support Drag and Drop, Copy/Paste private class ListTransferHandler extends AnTransferHandler { private int[] indices = null; // Bundle up the selected items in the list // as a single string, for export. @Override protected String exportString(JComponent c) { indices = listExpNames.getSelectedIndices(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < indices.length; i++) { if (indices[i] < listAbsPathes.size()) { if (sb.length() != 0) { sb.append("\n"); } sb.append(listAbsPathes.get(indices[i])); } } String str = sb.toString(); debug("ListTransferHandler::exportString: " + str); return str; } // Take the incoming string and wherever there is a // newline, break it into a separate item in the list. @Override protected void importString(JComponent c, String str) { debug("ListTransferHandler::importString: " + str); List<String> lst = new ArrayList<>(); if (listAbsPathes != null) { lst.addAll(listAbsPathes); } if (indices != null) { // Drag & Drop in the same list for (int i = 0; i < indices.length; i++) { lst.remove(indices[indices.length - 1 - i]); lst.add(listAbsPathes.get(indices[i])); } indices = null; } else { for (String s = str; true; ) { int ind = s.indexOf("\n"); if (ind == -1) { add_exp_or_grp(lst, s); break; } add_exp_or_grp(lst, s.substring(0, ind)); s = s.substring(ind + 1); } } update_exps_list(lst); } // If the remove argument is true, the drop has been // successful and it's time to remove the selected items // from the list. If the remove argument is false, it // was a Copy operation and the original list is left // intact. @Override protected void cleanup(JComponent c, boolean remove) { debug("ListTransferHandler::cleanup: " + id + " " + remove); if (remove && (indices != null)) { List<String> lst = new ArrayList<>(); if (listAbsPathes != null) { lst.addAll(listAbsPathes); } for (int i = indices.length - 1; i >= 0; i--) { debug( "ListTransferHandler::cleanup: " + id + " " + indices[i] + " " + lst.get(indices[i])); lst.remove(indices[i]); } update_exps_list(lst); } indices = null; } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; innerPanel = new javax.swing.JPanel(); label = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); listExpNames = new javax.swing.JList(); btnAddExp = new javax.swing.JButton(); btnRemove = new javax.swing.JButton(); setPreferredSize(new java.awt.Dimension(800, 150)); setLayout(new java.awt.GridBagLayout()); innerPanel.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); innerPanel.add(label, gridBagConstraints); listExpNames.setVisibleRowCount(3); jScrollPane1.setViewportView(listExpNames); listExpNames.getAccessibleContext().setAccessibleName("Experiments list"); listExpNames.getAccessibleContext().setAccessibleDescription("Experiments list"); listExpNames.getAccessibleContext().setAccessibleParent(listExpNames); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 384; gridBagConstraints.ipady = 71; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 8, 0); innerPanel.add(jScrollPane1, gridBagConstraints); btnAddExp.setText("Add..."); btnAddExp.setActionCommand("btnAddExp"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 4); innerPanel.add(btnAddExp, gridBagConstraints); btnRemove.setText("Remove"); btnRemove.setActionCommand("btnRemove"); btnRemove.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnRemoveActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 4); innerPanel.add(btnRemove, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(innerPanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void btnRemoveActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnRemoveActionPerformed // TODO add your handling code here: } // GEN-LAST:event_btnRemoveActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables public javax.swing.JButton btnAddExp; public javax.swing.JButton btnRemove; private javax.swing.JPanel innerPanel; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel label; public javax.swing.JList listExpNames; // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareSimplePanel.java������������������������������������0000644�0001750�0001750�00000034606�15044710303�021746� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnChooser; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.ExperimentPickListElement; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnGradientPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.event.MouseInputAdapter; /** * @author tpreisle */ public class CompareSimplePanel extends javax.swing.JPanel { protected static final int MAX_GROUPS = 20; private CompareSimpleDialog compareSimpleDialog; private int gridy; private JPanel buttonPanel; private JButton addExperimentChooserButton; private JButton reverseButton; private int noExperimentChoosers; private ExperimentComboBox[] experimentChooserComboBoxes; private String[] experimentChooserLabelTexts; private char[] experimentChooserLabelMN; public CompareSimplePanel(CompareSimpleDialog compareSimpleDialog) { this.compareSimpleDialog = compareSimpleDialog; initComponents(); setLayout(new GridBagLayout()); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); experimentChooserComboBoxes = new ExperimentComboBox[MAX_GROUPS]; experimentChooserLabelTexts = new String[MAX_GROUPS]; experimentChooserLabelMN = new char[MAX_GROUPS]; for (int i = 0; i < MAX_GROUPS; i++) { experimentChooserComboBoxes[i] = new ExperimentComboBox(); if (i == 0) { experimentChooserLabelTexts[i] = AnLocale.getString("Baseline Experiment:"); experimentChooserLabelMN[i] = AnLocale.getString('B', "CompareSimpleDialog_BaselineExperiment"); } else { experimentChooserLabelTexts[i] = AnLocale.getString("Comparison Experiment") + " " + i + ":"; if (i < 10) { experimentChooserLabelMN[i] = ("" + i).charAt(0); } } } gridy = 0; addGuidanceText(); addButtonPanel(); noExperimentChoosers = 0; String[][] groups = AnWindow.getInstance().getExperimentGroups(); addExperimentChooser(); addExperimentChooser(); for (int i = 2; i < groups.length; i++) { addExperimentChooser(); } if (groups.length >= 1) { experimentChooserComboBoxes[0].setSelectedItem(groups[0][0]); } if (groups.length >= 2) { experimentChooserComboBoxes[1].setSelectedItem(groups[1][0]); } for (int i = 2; i < groups.length; i++) { experimentChooserComboBoxes[i].setSelectedItem(groups[i][0]); } addFiller(); } private void addButtonPanel() { GridBagConstraints gridBagConstraints; buttonPanel = new AnGradientPanel( AnEnvironment.FILTER_TOOLBAR_BACKGROUND1_COLOR, AnEnvironment.FILTER_TOOLBAR_BACKGROUND2_COLOR); buttonPanel.setLayout(new GridBagLayout()); addExperimentChooserButton = new JButton(); addExperimentChooserButton.setText(AnLocale.getString("More")); addExperimentChooserButton.setIcon(AnUtility.moreIcon); addExperimentChooserButton.setBorderPainted(false); addExperimentChooserButton.setMargin(new java.awt.Insets(1, 1, 1, 1)); addExperimentChooserButton.setOpaque(false); addExperimentChooserButton.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); addExperimentChooserButton.setToolTipText(AnLocale.getString("Add a Comparison Experiment")); addExperimentChooserButton.setMnemonic(AnLocale.getString('M', "CompareSimpleDialog_More")); addExperimentChooserButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addExperimentChooser(); compareSimpleDialog.pack(); } }); addExperimentChooserButton.addMouseListener( new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(true); } } @Override public void mouseExited(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(false); } } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(2, 2, 2, 0); buttonPanel.add(addExperimentChooserButton, gridBagConstraints); reverseButton = new JButton(); reverseButton.setText(AnLocale.getString("Reverse")); reverseButton.setIcon(AnUtility.compareReverseIcon); reverseButton.setBorderPainted(false); reverseButton.setMargin(new java.awt.Insets(1, 1, 1, 1)); reverseButton.setOpaque(false); reverseButton.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); reverseButton.setToolTipText(AnLocale.getString("Reverse comparison order")); reverseButton.setMnemonic(AnLocale.getString('R', "CompareSimpleDialog_ReverseButton")); reverseButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String[] selected = new String[MAX_GROUPS]; for (int i = 0; i < MAX_GROUPS; i++) { selected[i] = (String) experimentChooserComboBoxes[i].getSelectedItem(); } for (int i = 0; i < noExperimentChoosers; i++) { experimentChooserComboBoxes[i].setSelectedItem( selected[noExperimentChoosers - i - 1]); } } }); reverseButton.addMouseListener( new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(true); } } @Override public void mouseExited(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(false); } } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(2, 0, 2, 2); buttonPanel.add(reverseButton, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridy++; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets = new Insets(5, 0, 0, 0); add(buttonPanel, gridBagConstraints); } private void addExperimentChooser() { JLabel label = new JLabel(); AnUtility.setTextAndAccessibleContext(label, experimentChooserLabelTexts[noExperimentChoosers]); addExperimentChooserGUI(label, experimentChooserComboBoxes[noExperimentChoosers]); label.setLabelFor(experimentChooserComboBoxes[noExperimentChoosers]); label.setDisplayedMnemonic(experimentChooserLabelMN[noExperimentChoosers]); noExperimentChoosers++; updateState(); } private void updateState() { addExperimentChooserButton.setEnabled(noExperimentChoosers < MAX_GROUPS); } private void addFiller() { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 20; gridBagConstraints.weighty = 1.0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(0, 0, 16, 0); add(new JLabel(), gridBagConstraints); } private void addGuidanceText() { JTextArea textArea = new JTextArea(); AnUtility.setAccessibleContext( textArea.getAccessibleContext(), AnLocale.getString("Infomation area")); textArea.setEditable(false); textArea.setBorder(null); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); textArea.setText( AnLocale.getString( "Comparing experiments. The Comparison experiment(s) are compared against the Baseline" + " experiment. Most data views support comparing experiments. When you compare" + " experiments, gprofng GUI displays data from the experiments or groups" + " in adjacent columns. The Advanced option allows grouping (aggregating) of" + " experiments before comparing them.")); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy++; gridBagConstraints.weightx = 1.0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(6, 0, 6, 0); add(textArea, gridBagConstraints); } private void addExperimentChooserGUI(JLabel label, final ExperimentComboBox combobox) { GridBagConstraints gridBagConstraints; combobox.setPreferredSize(new Dimension(600, combobox.getPreferredSize().height)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy++; gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(10, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; add(label, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy; gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; add(combobox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy++; gridBagConstraints.gridx = 1; gridBagConstraints.insets = new Insets(0, 4, 0, 0); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; JButton selectExperimentButton = new JButton("..."); selectExperimentButton.setToolTipText(AnLocale.getString("Browse for experiment...")); selectExperimentButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnChooser ac = AnWindow.getInstance() .getAnChooser( AnLocale.getString("Select Experiment"), AnChooser.EXP_CHOOSER, null); // ac.setMultiSelectionEnabled(false); // Doesn't work ????? if (ac.showDialog(AnWindow.getInstance().getFrame(), null) == AnChooser.APPROVE_OPTION) { File file = ac.getSelectedAnFile(); String path = file.getAbsolutePath(); combobox.setSelectedItem(path); } } }); add(selectExperimentButton, gridBagConstraints); } public String[][] getExperimentGroups() { List<String> experiments = new ArrayList<>(); for (int i = 0; i < noExperimentChoosers; i++) { String experimentPath = (String) experimentChooserComboBoxes[i].getSelectedItem(); if (experimentPath != null && experimentPath.length() > 0) { experiments.add(experimentPath.trim()); } } String[][] groups = new String[experiments.size()][]; for (int i = 0; i < experiments.size(); i++) { groups[i] = new String[1]; groups[i][0] = experiments.get(i); } return groups; } private class ExperimentComboBox extends JComboBox { public ExperimentComboBox() { setEditable(true); addItem(""); List<ExperimentPickListElement> paths = UserPref.getInstance().getExperimentsPicklists().getPicklist().getRecentExperiments(20); for (ExperimentPickListElement eple : paths) { addItem(eple.getPath()); } setSelectedItem(""); } @Override public void setSelectedItem(Object anObject) { super.setSelectedItem( anObject); // To change body of generated methods, choose Tools | Templates. setToolTipText(anObject.toString()); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE)); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ��������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareSimpleDialog.java�����������������������������������0000644�0001750�0001750�00000004315�14744453367�022124� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class CompareSimpleDialog extends AnDialog2 { private CompareSimplePanel compareSimplePanel; public CompareSimpleDialog(Frame owner) { super(owner, owner, AnLocale.getString("Compare Experiments")); setHelpTag(AnVariable.HELP_Compare); compareSimplePanel = new CompareSimplePanel(this); setCustomPanel(compareSimplePanel); JButton advancedButton = new JButton(AnLocale.getString("Advanced")); advancedButton.setMnemonic(AnLocale.getString('D', "CompareSimpleDialog_Advanced")); advancedButton.setToolTipText(AnLocale.getString("Advanced options (aggregating experiments)")); advancedButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); AnWindow.getInstance().compareExperimentsAdvancedDialog(); } }); addAuxButton(advancedButton); pack(); } @Override protected void setStatus(Status status) { super.setStatus(status); if (status == Status.OK) { String[][] groups = compareSimplePanel.getExperimentGroups(); AnWindow anWindow = AnWindow.getInstance(); anWindow.loadExperimentGroups(groups, null, !anWindow.experimentsLoaded(), null, false); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareStatusPanel.form������������������������������������0000644�0001750�0001750�00000003745�14744453367�022046� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,2,76"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> ���������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareAdvancedDialog.java���������������������������������0000644�0001750�0001750�00000034210�15044710303�022351� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.border.EmptyBorder; public final class CompareAdvancedDialog extends JDialog implements ItemListener, ActionListener { private AnWindow window; private final Frame frame; private final boolean compare_mode; private String[][] experimentGrops = null; private List<ExperimentGroupsPanel> expGrops; private JPanel workPanel; private JScrollPane scrollPane; private int maxGroups; private JPanel warningPanel = null; // Constructor public CompareAdvancedDialog( final AnWindow window, final Frame frame, final boolean compare_mode, String title) { super(frame, title, true); this.window = window; this.frame = frame; this.compare_mode = compare_mode; maxGroups = compare_mode ? CompareSimplePanel.MAX_GROUPS : 1; experimentGrops = window.getExperimentGroups(); initComponents(); pack(); setLocationRelativeTo(frame); // close/dispose when ESC getRootPane() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "esc"); getRootPane() .getActionMap() .put( "esc", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); getRootPane() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "F1"); getRootPane() .getActionMap() .put( "F1", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { showHelp(); } }); } private javax.swing.JButton btnOk; private javax.swing.JButton btnCancel; private javax.swing.JButton btnAddGrp; private javax.swing.JButton btnHelp; // Initialize GUI components private void initComponents() { expGrops = new ArrayList<>(); String groupTitle; String groupToolTip; char mnemonic; if (compare_mode) { groupTitle = AnLocale.getString("Baseline:"); groupToolTip = AnLocale.getString("Experiment(s) to be compared aginst"); mnemonic = AnLocale.getString('B', "CompareDialogBaselineMN"); } else { groupTitle = AnLocale.getString("Experiments:"); groupToolTip = AnLocale.getString("List of experiments to aggregate"); mnemonic = AnLocale.getString('E', "CompareDialogExperimentMN"); } expGrops.add(new ExperimentGroupsPanel(window, frame, groupTitle, groupToolTip, mnemonic)); if (compare_mode) { mnemonic = AnLocale.getString('C', "CompareDialogComparisonGroupMN"); expGrops.add( new ExperimentGroupsPanel( window, frame, AnLocale.getString("Comparison Group:"), AnLocale.getString("Exeriment(s) to compare against baseline experiments(s)"), mnemonic)); } else if (experimentGrops != null && experimentGrops.length > 1) { List<String> lst = new ArrayList<>(); for (String[] arr : experimentGrops) { for (String s : arr) { lst.add(s); } } experimentGrops = new String[1][]; experimentGrops[0] = lst.toArray(new String[lst.size()]); } if (experimentGrops != null) { String fmt = AnLocale.getString("Comparison Group %d"); String toolTip = AnLocale.getString("Exeriment(s) to compare against baseline experiment(s)"); for (int i = 2; i < experimentGrops.length; i++) { expGrops.add(new ExperimentGroupsPanel(window, frame, String.format(fmt, i), toolTip, ' ')); // expGrops.add(new ExpGrpJPanel(window, frame, String.format(fmt))); } for (int i = 0; i < experimentGrops.length; i++) { ExperimentGroupsPanel grp = expGrops.get(i); String[] names = experimentGrops[i]; List<String> lst = new ArrayList<>(); for (String s : names) { grp.add_exp_or_grp(lst, s); } grp.update_exps_list(lst); } } workPanel = new JPanel(); workPanel.setLayout(new BoxLayout(workPanel, BoxLayout.Y_AXIS)); for (ExperimentGroupsPanel pnl : expGrops) { workPanel.add(pnl); } btnOk = newButton(AnLocale.getString("OK"), "btnOk"); btnCancel = newButton(AnLocale.getString("Cancel"), "btnCancel"); btnAddGrp = newButton(AnLocale.getString("Add More"), "btnAddGrp"); btnAddGrp.setToolTipText(AnLocale.getString("Add a group")); btnHelp = newButton(AnLocale.getString("Help"), "btnHelp"); btnHelp.setMnemonic(AnLocale.getString('H', "CompareDialogHelpButtonMN")); btnHelp.setEnabled(false); getRootPane().setDefaultButton(btnOk); // default action (Return key) JPanel btnPanel = new JPanel(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); final JCheckBox showWarningCheckBox = new JCheckBox(AnLocale.getString("Show warning")); AnUtility.setAccessibleContext( showWarningCheckBox.getAccessibleContext(), showWarningCheckBox.getText()); showWarningCheckBox.setMnemonic(AnLocale.getString('S', "CompareDialogShowWarningButtonMN")); showWarningCheckBox.setSelected(UserPref.getInstance().showCompareSourceWarning()); showWarningCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UserPref.getInstance().setShowCompareSourceWarning(showWarningCheckBox.isSelected()); warningPanel.setVisible(showWarningCheckBox.isSelected()); pack(); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(0, 4, 0, 0); btnPanel.add(showWarningCheckBox, gridBagConstraints); JLabel warningIconLabel = new JLabel(); warningIconLabel.setIcon(AnUtility.warningIcon); JTextArea textArea = new JTextArea( AnLocale.getString( "To compare sources in experiments, first archive the sources in each experiment" + " using the command \"er_archive -s all <experiment-name>\". See er_archive" + " man page for details.")); textArea.getAccessibleContext().setAccessibleName(AnLocale.getString("Text Area")); textArea.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Text Area")); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setEditable(false); // textArea.setRows(4); textArea.setOpaque(false); warningPanel = new JPanel(); warningPanel.setBorder(BorderFactory.createLineBorder(AnEnvironment.ABOUT_BOX_BORDER_COLOR)); warningPanel.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 2, 0, 0); warningPanel.add(warningIconLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 8, 0, 0); warningPanel.add(textArea, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets = new Insets(4, 8, 0, 8); btnPanel.add(warningPanel, gridBagConstraints); warningPanel.setVisible(showWarningCheckBox.isSelected()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.LINE_START; // gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(12, 8, 8, 0); btnPanel.add(btnAddGrp, gridBagConstraints); btnAddGrp.setVisible(expGrops.size() < maxGroups); // btnAddGrp.setEnabled(expGrops.size() < Max_Exp_Groups); gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; btnPanel.add(new JLabel(""), gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(12, 0, 8, 0); btnPanel.add(btnOk, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(12, 6, 8, 0); btnPanel.add(btnCancel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(12, 6, 8, 8); btnPanel.add(btnHelp, gridBagConstraints); scrollPane = new AnJScrollPane(workPanel); scrollPane.setBorder(new EmptyBorder(0, 4, 0, 4)); scrollPane.setPreferredSize(new Dimension(AnVariable.WIN_SIZE)); final Container cnt = getContentPane(); cnt.setLayout(new BorderLayout()); cnt.add(scrollPane, BorderLayout.CENTER); cnt.add(btnPanel, BorderLayout.SOUTH); pack(); } private JButton newButton(String txt, String cmd) { JButton btn = new JButton(); btn.setText(txt); AnUtility.setAccessibleContext(btn.getAccessibleContext(), txt); btn.setActionCommand(cmd); btn.addActionListener(this); return btn; } // Set visible public void setVisible(final boolean set, final int active_id) { CompareAdvancedDialog.super.setVisible(set); // SwingUtilities.invokeLater(new Runnable() { // @Override // public void run() { // CompareDialog.super.setVisible(set); // } // }); // if (UserPref.getInstance().showCompareSourceWarning()) { // showSourceWarningDialog(); // } } /** Listener to switch between file/printer */ @Override public void itemStateChanged(final ItemEvent event) { // final Object source = event.getItemSelectable(); } /** * Action performed * * @param event */ // @Override public void actionPerformed(final ActionEvent event) { String cmd = event.getActionCommand(); if (cmd.equals("btnAddGrp")) { int sz = expGrops.size(); String nm = sz > 1 ? String.format(AnLocale.getString("Comparison Group %d:"), sz) : // String.format(AnLocale.getString("And Compare Baseline to:")) : AnLocale.getString("Compare Group:"); ExperimentGroupsPanel pnl = new ExperimentGroupsPanel( window, frame, nm, "Experiment(s) to compare against baseline experiment(s)", ' '); expGrops.add(pnl); int ind = workPanel.getComponentZOrder(expGrops.get(sz - 1)); workPanel.add(pnl, ind + 1); btnAddGrp.setVisible(expGrops.size() < maxGroups); pack(); } else if (cmd.equals("btnOk")) { setExperimentsGroups(); setVisible(false); } else if (cmd.equals("btnCancel")) { setVisible(false); } else if (cmd.equals("btnHelp")) { showHelp(); } } private void showHelp() { if (compare_mode) { Analyzer.showHelp(AnVariable.HELP_Compare); } else { Analyzer.showHelp(AnVariable.HELP_Aggregate); } } private void setExperimentsGroups() { int cnt = 0; for (ExperimentGroupsPanel expGroup : expGrops) { if (!expGroup.listAbsPathes.isEmpty()) { cnt++; } } String[][] arr = new String[cnt][]; cnt = 0; for (ExperimentGroupsPanel expGroup : expGrops) { List<String> lst = expGroup.listAbsPathes; if (!lst.isEmpty()) { arr[cnt] = lst.toArray(new String[lst.size()]); cnt++; } } window.loadExperimentGroups(arr, null, !window.experimentsLoaded(), null, false); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/AnTransferHandler.java�������������������������������������0000644�0001750�0001750�00000005135�14744453367�021606� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import javax.swing.JComponent; import javax.swing.TransferHandler; abstract class AnTransferHandler extends TransferHandler { protected abstract String exportString(JComponent c); protected abstract void importString(JComponent c, String str); protected abstract void cleanup(JComponent c, boolean remove); protected Transferable createTransferable(JComponent c) { return new StringSelection(exportString(c)); } public int getSourceActions(JComponent c) { debug("AnTransferHandler::getSourceActions:"); return COPY_OR_MOVE; } public boolean importData(JComponent c, Transferable t) { debug("AnTransferHandler::importData:"); if (canImport(c, t.getTransferDataFlavors())) { try { String str = (String) t.getTransferData(DataFlavor.stringFlavor); importString(c, str); return true; } catch (UnsupportedFlavorException ex) { debug("AnTransferHandler::importData: " + ex); } catch (IOException ex) { debug("AnTransferHandler::importData: " + ex); } } return false; } protected void exportDone(JComponent c, Transferable data, int action) { debug("AnTransferHandler::exportDone: " + (action == MOVE) + " " + action); debug("AnTransferHandler::exportDone: " + data); cleanup(c, action == MOVE); } public boolean canImport(JComponent c, DataFlavor[] flavors) { for (int i = 0; i < flavors.length; i++) { if (DataFlavor.stringFlavor.equals(flavors[i])) { debug("AnTransferHandler::canImport: true"); return true; } } debug("AnTransferHandler::canImport: false"); return false; } protected void debug(final String msg) { // System.out.println(msg); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareStatusPanel.java������������������������������������0000644�0001750�0001750�00000051162�14744453367�022020� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import static org.gprofng.mpmt.event.AnChangeEvent.Type.DEBUG; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADED_FAILED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADING_ADDED_OR_REMOVED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.EXPERIMENTS_LOADING_NEW; import static org.gprofng.mpmt.event.AnChangeEvent.Type.FILTER_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.FILTER_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.MOST_RECENT_EXPERIMENT_LIST_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.REMOTE_CONNECTION_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTED_OBJECT_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SELECTION_UPDATE; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGING; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SOURCE_FINDING_CHANGED; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SOURCE_FINDING_CHANGING; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnIconButton; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.CompareModeSetting; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.util.gui.AnGradientPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; public class CompareStatusPanel extends javax.swing.JPanel implements AnChangeListener { private javax.swing.JLabel compareLabel; private ToolbarToggleButton absoluteButton; private ToolbarToggleButton deltaButton; private ToolbarToggleButton ratioButton; private JButton reverseButton; private JButton configureButton; private CompareGroupsPanel compareGroupsPanel; private int initialHeight; /** Creates new form CompareNavigationPanel */ public CompareStatusPanel() { initComponents(); setOpaque(false); GridBagConstraints gridBagConstraints = new GridBagConstraints(); // Label compareLabel = new JLabel(); compareLabel.setText(AnLocale.getString("Compare")); AnUtility.setAccessibleContext(compareLabel.getAccessibleContext(), compareLabel.getText()); compareLabel.setFont(compareLabel.getFont().deriveFont(Font.BOLD)); compareLabel.setForeground(AnEnvironment.FILTER_HEADER_COLOR); compareLabel.setDisplayedMnemonic(AnLocale.getString('p', "CompareStatusPanelMN")); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; add(compareLabel, gridBagConstraints); // Button panel absoluteButton = new ToolbarToggleButton(AnUtility.compareAbsoluteIcon); absoluteButton.setToolTipText(AnLocale.getString("Absolute: show absolute numbers in tables")); absoluteButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CompareModeSetting compareModeSetting = AnWindow.getInstance().getSettings().getCompareModeSetting(); if (compareModeSetting.get() != CompareModeSetting.CompareMode.CMP_ENABLE) { compareModeSetting.set( CompareStatusPanel.this, CompareModeSetting.CompareMode.CMP_ENABLE); } } }); deltaButton = new ToolbarToggleButton(AnUtility.compareDeltaIcon); deltaButton.setToolTipText( AnLocale.getString("Delta: show numbers in tables as +/- difference")); deltaButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CompareModeSetting compareModeSetting = AnWindow.getInstance().getSettings().getCompareModeSetting(); if (compareModeSetting.get() != CompareModeSetting.CompareMode.CMP_DELTA) { compareModeSetting.set( CompareStatusPanel.this, CompareModeSetting.CompareMode.CMP_DELTA); } } }); ratioButton = new ToolbarToggleButton(AnUtility.compareRatioIcon); ratioButton.setToolTipText(AnLocale.getString("Ratio: show numbers in tables as ratio")); ratioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CompareModeSetting compareModeSetting = AnWindow.getInstance().getSettings().getCompareModeSetting(); if (compareModeSetting.get() != CompareModeSetting.CompareMode.CMP_RATIO) { compareModeSetting.set( CompareStatusPanel.this, CompareModeSetting.CompareMode.CMP_RATIO); } } }); reverseButton = new AnIconButton(AnUtility.compareReverseIcon); reverseButton.setToolTipText(AnLocale.getString("Reverse comparison order")); reverseButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow anWindow = AnWindow.getInstance(); String groups[][] = anWindow.getExperimentGroups(); int nGroups = groups.length; if (nGroups > 1) { String newGroups[][] = new String[nGroups][]; for (int n = 0; n < nGroups; n++) { newGroups[n] = groups[nGroups - 1 - n]; } anWindow.loadExperimentGroups( newGroups, null, !anWindow.experimentsLoaded(), null, false); } } }); configureButton = new AnIconButton(AnUtility.compareHamburgerIcon); compareLabel.setLabelFor(configureButton); configureButton.setToolTipText(AnLocale.getString("Configure comparison")); configureButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().compareExperimentsAction(); } }); JPanel buttonPanel = new AnGradientPanel( AnEnvironment.FILTER_TOOLBAR_BACKGROUND1_COLOR, AnEnvironment.FILTER_TOOLBAR_BACKGROUND2_COLOR); buttonPanel.setLayout(new GridBagLayout()); buttonPanel.setBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, AnEnvironment.FILTER_STATUS_BORDER_COLOR)); gridBagConstraints = new GridBagConstraints(); int gridX = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(2, 3, 2, 0); buttonPanel.add(absoluteButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(2, 2, 2, 0); buttonPanel.add(deltaButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(2, 2, 2, 0); buttonPanel.add(ratioButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(2, 2, 2, 0); buttonPanel.add(reverseButton, gridBagConstraints); // gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridx = gridX++; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 0.0; gridBagConstraints.insets = new Insets(2, 0, 2, 3); buttonPanel.add(configureButton, gridBagConstraints); JPanel buttonAndFiltersPanel = new JPanel(new GridBagLayout()); buttonAndFiltersPanel.setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); // buttonAndFiltersPanel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, // AnEnvironment.NAVIGATION_SPLIT_PANE_DIVIDER_COLOR)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); buttonAndFiltersPanel.add(buttonPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(3, 0, 0, 0); add(buttonAndFiltersPanel, gridBagConstraints); CompareGroupsPanel compareGroupsPanel = new CompareGroupsPanel(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(compareGroupsPanel, gridBagConstraints); updateCompareModeStatus(); AnEventManager.getInstance().addListener(this); updateAllButtonStates(false); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_FOCUSED) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getActionMap() .put( KeyboardShortcuts.helpActionShortcut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { Analyzer.getInstance().showHelp(AnVariable.HELP_Compare); } }); initialHeight = getPreferredSize().height; } public int getDiffFromInitialHeight() { int diff = getPreferredSize().height - initialHeight; return diff; } private void updateToggleButtons(ToolbarToggleButton toolbarToggleButton) { if (toolbarToggleButton != absoluteButton) { absoluteButton.toggle(false); } if (toolbarToggleButton != deltaButton) { deltaButton.toggle(false); } if (toolbarToggleButton != ratioButton) { ratioButton.toggle(false); } } private void updateCompareButtonStates() { String groups[][] = AnWindow.getInstance().getExperimentGroups(); boolean on = groups != null && groups.length > 1; if (!on) { absoluteButton.toggle(false); deltaButton.toggle(false); ratioButton.toggle(false); } absoluteButton.setEnabled(on); deltaButton.setEnabled(on); ratioButton.setEnabled(on); reverseButton.setEnabled(on); } private void updateAllButtonStates(boolean on) { absoluteButton.setEnabled(on); deltaButton.setEnabled(on); ratioButton.setEnabled(on); reverseButton.setEnabled(on); configureButton.setEnabled(on); } class ToolbarToggleButton extends JButton { private boolean on; public ToolbarToggleButton(ImageIcon image) { this(image, true); } public ToolbarToggleButton(ImageIcon image, final boolean toggle) { super(image); setBorder(BorderFactory.createLineBorder(AnEnvironment.COMPARE_TOGGLE_ICON_BORDER_COLOR, 1)); setBackground(AnEnvironment.COMPARE_ICON_TOGGLE_BACKGROUND_COLOR); setContentAreaFilled(true); toggle(false); if (toggle) { addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!on) { on = true; toggle(on); updateToggleButtons(ToolbarToggleButton.this); } } }); } addMouseListener( new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { if (!isEnabled()) { return; } setBorder( BorderFactory.createLineBorder( AnEnvironment.COMPARE_TOGGLE_ICON_BORDER_FOCUSED_COLOR, 1)); } @Override public void mouseExited(MouseEvent e) { if (!isEnabled()) { return; } setBorder( BorderFactory.createLineBorder( AnEnvironment.COMPARE_TOGGLE_ICON_BORDER_COLOR, 1)); } @Override public void mousePressed(MouseEvent e) { if (!isEnabled()) { return; } if (!on) { setBackground(AnEnvironment.COMPARE_ICON_MOUSE_PRESSED_BACKGROUND_COLOR); setContentAreaFilled(true); } } @Override public void mouseReleased(MouseEvent e) { if (!isEnabled()) { return; } if (!on) { setBackground(AnEnvironment.COMPARE_TOGGLE_ICON_SELECTED_COLOR); setContentAreaFilled(true); } } }); addFocusListener( new FocusListener() { @Override public void focusGained(FocusEvent e) { setBorder( BorderFactory.createLineBorder( AnEnvironment.COMPARE_TOGGLE_ICON_BORDER_FOCUSED_COLOR, 1)); validate(); repaint(); } @Override public void focusLost(FocusEvent e) { setBorder( BorderFactory.createLineBorder( AnEnvironment.COMPARE_TOGGLE_ICON_BORDER_COLOR, 1)); validate(); repaint(); } }); } public void toggle(boolean on) { this.on = on; if (on) { setContentAreaFilled(true); setBackground(AnEnvironment.COMPARE_TOGGLE_ICON_SELECTED_COLOR); } else { setContentAreaFilled(true); setBackground(AnEnvironment.COMPARE_ICON_TOGGLE_BACKGROUND_COLOR); } } /** * @return the on */ public boolean isOn() { return on; } } /** Called from settings */ private void updateCompareModeStatus() { CompareMode compareMode = AnWindow.getInstance().getSettings().getCompareModeSetting().get(); // System.out.println(compareMode); if (compareMode == CompareModeSetting.CompareMode.CMP_ENABLE) { absoluteButton.toggle(true); updateToggleButtons(absoluteButton); } else if (compareMode == CompareModeSetting.CompareMode.CMP_DELTA) { deltaButton.toggle(true); updateToggleButtons(deltaButton); } else if (compareMode == CompareModeSetting.CompareMode.CMP_RATIO) { ratioButton.toggle(true); updateToggleButtons(ratioButton); } else { // nothing } } private void updateCompareGroupPanel() { // Compare groups panel if (compareGroupsPanel != null) { remove(compareGroupsPanel); } compareGroupsPanel = new CompareGroupsPanel(); GridBagConstraints gridBagConstraints; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(compareGroupsPanel, gridBagConstraints); setMinimumSize(getPreferredSize()); } private void updateHeight(int oldHeight) { int newHeight = getPreferredSize().height; int diff = newHeight - oldHeight; if (oldHeight == 0 || (diff >= -1 && diff <= 1)) { return; } AnWindow.getInstance().getNavigationPanel().adjustCompareNavigationPanelHeightChanged(diff); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("FilterStatusPanel stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: updateAllButtonStates(false); break; case EXPERIMENTS_LOADED: int oldHeight = getPreferredSize().height; updateCompareGroupPanel(); updateAllButtonStates(true); updateCompareButtonStates(); updateHeight(oldHeight); break; case FILTER_CHANGED: case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getOriginalSource() != this) { if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE) { updateCompareModeStatus(); } } break; case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case DEBUG: break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/ExperimentGroupsPanel.form���������������������������������0000644�0001750�0001750�00000017240�14744453367�022567� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Properties> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[800, 150]"/> </Property> </Properties> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-88"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="innerPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="label"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="jScrollPane1"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="3" fill="1" ipadX="384" ipadY="71" insetsTop="4" insetsLeft="4" insetsBottom="8" insetsRight="0" anchor="18" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JList" name="listExpNames"> <Properties> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> <StringArray count="0"/> </Property> <Property name="visibleRowCount" type="int" value="3"/> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Experiments list"/> <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="Experiments list"/> <Property name="AccessibleContext.accessibleParent" type="javax.accessibility.Accessible" editor="org.netbeans.modules.form.ComponentChooserEditor"> <ComponentRef name="listExpNames"/> </Property> </AccessibilityProperties> <AuxValues> <AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="ExpGrpJPanel_listExpNames"/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/> <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/> </AuxValues> </Component> </SubComponents> </Container> <Component class="javax.swing.JButton" name="btnAddExp"> <Properties> <Property name="text" type="java.lang.String" value="Add..."/> <Property name="actionCommand" type="java.lang.String" value="btnAddExp"/> </Properties> <AuxValues> <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="8" insetsBottom="0" insetsRight="4" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="btnRemove"> <Properties> <Property name="text" type="java.lang.String" value="Remove"/> <Property name="actionCommand" type="java.lang.String" value="btnRemove"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveActionPerformed"/> </Events> <AuxValues> <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="8" insetsBottom="0" insetsRight="4" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/compare/CompareGroupsPanel.java������������������������������������0000644�0001750�0001750�00000013441�14744453367�022012� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.compare; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.ActionTextField; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JLabel; public class CompareGroupsPanel extends javax.swing.JPanel { private JLabel[] labels; private ActionTextField[] textFields; public CompareGroupsPanel() { String[][] groups = AnWindow.getInstance().getExperimentGroups(); initComponents(); setLayout(new GridBagLayout()); // setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, // AnEnvironment.FILTER_STATUS_BORDER_COLOR)); setBackground(AnEnvironment.FILTER_TOOLBAR_BACKGROUND1_COLOR); if (groups == null) { return; } if (groups.length == 1) { return; } labels = new JLabel[groups.length]; textFields = new ActionTextField[groups.length]; for (int n = 0; n < groups.length; n++) { String groupText = ""; String groupTTText = ""; GridBagConstraints gridBagConstraints; if (n == 0) { labels[n] = new JLabel(AnLocale.getString("Baseline:")); groupTTText = AnLocale.getString("Comparison Baseline: "); } else { String text; String ttText; if (AnWindow.getInstance().isExperimentGroupsSimple()) { text = AnLocale.getString("Exp."); ttText = AnLocale.getString("Comparison Experiment"); } else { text = AnLocale.getString("Group"); ttText = AnLocale.getString("Comparison Group"); } labels[n] = new JLabel(text + " " + n + ":"); groupTTText = ttText + " " + n + ": "; } for (int i = 0; i < groups[n].length; i++) { if (i > 0) { groupText = groupText + ", "; groupTTText = groupTTText + ", "; } groupText = groupText + AnUtility.basename(groups[n][i]); groupTTText = groupTTText + groups[n][i]; } labels[n].setToolTipText(groupTTText); textFields[n] = new ActionTextField(groupText); textFields[n].setEditable(false); textFields[n].setToolTipText(groupTTText); textFields[n].setBorder( BorderFactory.createLineBorder(AnEnvironment.FILTER_TOOLBAR_BACKGROUND2_COLOR, 1)); textFields[n].setBackground(new Color(243, 243, 243)); textFields[n].addActionListener(new TextFieldRemoveAction(n)); textFields[n].setActionToolTipText(AnLocale.getString("Remove this experiment/group")); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = n; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 2, 2, 2); add(labels[n], gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = n; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(2, 2, 2, 2); add(textFields[n], gridBagConstraints); } setBorder( BorderFactory.createMatteBorder(0, 1, 1, 1, AnEnvironment.FILTER_STATUS_BORDER_COLOR)); } class TextFieldRemoveAction implements ActionListener { private int groupNo; public TextFieldRemoveAction(int groupNo) { this.groupNo = groupNo; } @Override public void actionPerformed(ActionEvent e) { AnWindow anWindow = AnWindow.getInstance(); String groups[][] = anWindow.getExperimentGroups(); int nGroups = groups.length; String newGroups[][] = new String[nGroups - 1][]; int index = 0; for (int i = 0; i < nGroups; i++) { if (i == groupNo) { i++; // Skip the deleted one if (i == nGroups) { break; } } newGroups[index++] = groups[i]; } anWindow.loadExperimentGroups(newGroups, null, !anWindow.experimentsLoaded(), null, false); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE)); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnCompDisp.java����������������������������������������������������0000644�0001750�0001750�00000100370�15044710303�016565� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSplitPane; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; public class AnCompDisp extends FuncListDisp implements ExportSupport { protected FuncListDisp oneDispPanel; private Component multiDispPanel; private boolean initialized, inCompute; private CardLayout cardLayout; // private FuncListDisp[] funcDisps; private AnTable[] tables; private AnHotGap[] hotGps; private int[] groupIds; private JPanel[] jpanels; private Object[] raw_datas, raw_data_ids, src_types, met_labels, marks, marks_inc; private AnObject[][] cmp_totals; private long[] sel_objs; private int[] sel_indexes; private int focusedTable; private String[] str_errors; private final String help_id; // private JPanel cards; public AnCompDisp(final AnWindow w, final int type, final String help_id) { super(w, type, 0, help_id); this.help_id = help_id; initialized = inCompute = false; cardLayout = null; multiDispPanel = null; } @Override protected void initComponents() {} @Override public void requestFocus() { if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { if (oneDispPanel != null) { oneDispPanel.requestFocus(); } } else { AnTable table = tables[focusedTable]; if (table != null) { table.requestFocus(); } } } public int getTableIndex(AnTable table) { int index = -1; for (AnTable at : tables) { index++; if (at == table) { return index; } } return -1; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = ""; if ((null == tables) || (tables.length < 2)) { // Not comparison text = oneDispPanel.exportAsText(limit, format, delimiter); // exports the main table } else { // Comparison String sortedby = null; // Source and Disassembly are not sorted if (null == MaximumValues) { // Print error message and stack trace System.err.println("Internal Error: MaximumValues is null"); Exception e = new Exception(); e.printStackTrace(); return text; // empty report } int printLimit = limit != null ? limit : 0; // Export tables for (int i = 0; i < tables.length; i++) { table = tables[i]; if (i > 0) { text += "\n\n\n"; // Separator } int st = i + 1; AnObject[] totals = getTotals(type, st); // IPC call if (totals != null) { if (MaximumValues == null) { MaximumValues = new Object[2][totals.length]; MaximumValues[1] = totals; } MaximumValues[0] = totals; } text += table.printTableHeader(sortedby, MaximumValues); text += table.printTableContents(MaximumValues, printLimit); } } return text; } @Override public JPopupMenu getFilterPopup() { if (oneDispPanel != null) { return oneDispPanel.getFilterPopup(); } return null; } private static JPanel toolbarPanel = null; // Fixup: pass it to SourceDisp instead of being static!!!! public static JPanel getToolbarPanelInternal() { if (toolbarPanel == null) { toolbarPanel = new JPanel(); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); toolbarPanel.setLayout(new BorderLayout()); } return toolbarPanel; } @Override public JPanel getToolbarPanel() { return getToolbarPanelInternal(); } // Update view specific tool bar public void updateToolBar() { if ((jpanels.length == 1) && oneDispPanel != null) { oneDispPanel.updateToolBar(); } else { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (backForwardControls == null) { backForwardControls = new CompBackForwardControls(); } backForwardControls.updateToolBarStatus(); AnCompDisp.getToolbarPanelInternal().removeAll(); AnCompDisp.getToolbarPanelInternal().add(backForwardControls, BorderLayout.CENTER); AnCompDisp.getToolbarPanelInternal().repaint(); } }); } } protected class CompBackForwardControls extends BackForwardControls { public CompBackForwardControls() { setOpaque(false); this.removeAll(); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; // Back button gridBagConstraints = new GridBagConstraints(); backButton = new AnIconButton(AnUtility.goBackwardIcon); backButton.setMargin(new Insets(2, 4, 2, 4)); backButton.setToolTipText( AnLocale.getString("Back") + AnUtility.keyStrokeToStringFormatted(KeyboardShortcuts.backwardActionShortcut)); backButton.setEnabled(true); backButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Hook it up to back action; tables[focusedTable].goBack(); } }); // Backward KeyStroke keyStrokeBackward = KeyboardShortcuts.backwardActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeBackward, keyStrokeBackward); getActionMap() .put( keyStrokeBackward, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { backButton.doClick(); } }); add(backButton, gridBagConstraints); // Back button gridBagConstraints = new GridBagConstraints(); forwardButton = new AnIconButton(AnUtility.goForwardIcon); forwardButton.setMargin(new Insets(2, 4, 2, 4)); forwardButton.setToolTipText( AnLocale.getString("Forward") + AnUtility.keyStrokeToStringFormatted(KeyboardShortcuts.forwardActionShortcut)); forwardButton.setEnabled(true); forwardButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Hook it up to forward action; tables[focusedTable].goForward(); } }); // Forward KeyStroke keyStrokeForward = KeyboardShortcuts.forwardActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeForward, keyStrokeForward); getActionMap() .put( keyStrokeForward, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { forwardButton.doClick(); } }); add(forwardButton, gridBagConstraints); } public void updateToolBarStatus() { backButton.setEnabled(tables[focusedTable].canGoBack()); forwardButton.setEnabled(tables[focusedTable].canGoForward()); } } private FuncListDisp newFuncListDisp(final int dsp, final String help_id) { FuncListDisp fd = null; if (AnDisplay.DSP_Source == dsp) { fd = new SourceDisp(window, dsp, help_id); } else if (AnDisplay.DSP_Disassembly == dsp) { fd = new DisasmDisp(window, dsp, help_id); } else { fd = new FuncListDisp(window, dsp, 0, help_id); } fd.setMinimumSize(new Dimension(0, 0)); // make the both parts to be 0ed return fd; } private void init() { if (cardLayout == null) { cardLayout = new CardLayout(); setLayout(cardLayout); oneDispPanel = newFuncListDisp(type, help_id); add(oneDispPanel, ONE_DISP_PANEL); } if (multiDispPanel != null) { cardLayout.removeLayoutComponent(multiDispPanel); } String acName = AnLocale.getString("Source"); String acDesc = AnLocale.getString("Show source for selected function"); if ((type == AnDisplay.DSP_Disassembly) || (type == AnDisplay.DSP_DisassemblyV2)) { acName = AnLocale.getString("Disassembly"); acDesc = AnLocale.getString("Show disassembled code for selected function"); } JLabel acLabel = new JLabel(acName, JLabel.RIGHT); focusedTable = 0; groupIds = window.getGroupIds(); int sz = groupIds.length; if (sz <= 0) { // no experiments loaded return; } tables = new AnTable[sz]; hotGps = new AnHotGap[sz]; jpanels = new JPanel[sz]; for (int i = 0; i < sz; i++) { tables[i] = new AnTable( type == AnDisplay.DSP_Source ? AnDisplay.DSP_SourceV2 : AnDisplay.DSP_DisassemblyV2, true, true, false, false, true, true, (i == 0 ? true : false), acName, acDesc, acLabel); tables[i].setParent(this); tables[i].setGroupId(i); tables[i].addAnListener(new TableHandler(i)); jpanels[i] = new JPanel(new BorderLayout()); hotGps[i] = new AnHotGap(this, tables[i], 47); // FIXUP jpanels[i].add(tables[i], BorderLayout.CENTER); JPanel buttonPan = new JPanel(new GridBagLayout()); buttonPan.setBackground(Color.WHITE); JButton upButton = new AnIconButton(AnUtility.goUpIcon); JButton downButton = new AnIconButton(AnUtility.goDownIcon); upButton.addActionListener(new CompDispButtonListener(i, false)); downButton.addActionListener(new CompDispButtonListener(i, true)); upButton.setToolTipText( AnLocale.getString("Previous Hot Line") + AnUtility.keyStrokeToStringFormatted( KeyboardShortcuts.sourcePreviousHotLineActionShortcut)); downButton.setToolTipText( AnLocale.getString("Next Hot Line") + AnUtility.keyStrokeToStringFormatted( KeyboardShortcuts.sourceNextHotLineActionShortcut)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; buttonPan.add(upButton, gridBagConstraints); gridBagConstraints.gridy = 1; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; buttonPan.add(downButton, gridBagConstraints); Dimension dim = new Dimension(AnHotGap.HOTGAP_WIDTH, 3 * (tables[i].getFont().getSize() + 3) + 2); buttonPan.setPreferredSize(dim); JPanel gapPan = new JPanel(); gapPan.setLayout(new BorderLayout()); gapPan.add(buttonPan, BorderLayout.NORTH); gapPan.add(hotGps[i]); gapPan.setBorder( BorderFactory.createMatteBorder(0, 1, 0, 0, AnEnvironment.SCROLLBAR_BORDER_COLOR)); jpanels[i].add(gapPan, BorderLayout.EAST); } // Previous Hot Line KeyStroke keyStrokeUp = KeyboardShortcuts.sourcePreviousHotLineActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeUp, keyStrokeUp); getActionMap() .put( keyStrokeUp, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (focusedTable >= 0 && focusedTable < hotGps.length) { hotGps[focusedTable].HG_Prev_Hot_Line(); } } }); // Next Hot Line KeyStroke keyStrokeDown = KeyboardShortcuts.sourceNextHotLineActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeDown, keyStrokeDown); getActionMap() .put( keyStrokeDown, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (focusedTable >= 0 && focusedTable < hotGps.length) { hotGps[focusedTable].HG_Next_Hot_Line(); } } }); // Next NZ Line KeyStroke keyStrokeNextNZ = KeyboardShortcuts.sourceNextNonZeroLineActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeNextNZ, keyStrokeNextNZ); getActionMap() .put( keyStrokeNextNZ, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (focusedTable >= 0 && focusedTable < hotGps.length) { hotGps[focusedTable].HG_Next_NZ_Line(); } } }); // Previous NZ Line KeyStroke keyStrokePreviousNZ = KeyboardShortcuts.sourcePreviousNonZeroLineActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokePreviousNZ, keyStrokePreviousNZ); getActionMap() .put( keyStrokePreviousNZ, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (focusedTable >= 0 && focusedTable < hotGps.length) { hotGps[focusedTable].HG_Prev_NZ_Line(); } } }); table = tables[0]; if (jpanels.length == 1) { add(jpanels[0], MULTI_DISP_PANEL); multiDispPanel = jpanels[0]; } else if (jpanels.length > 1) { JSplitPane sp = null; for (int i = jpanels.length - 2; i >= 0; i--) { if (sp == null) { sp = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, jpanels[i], jpanels[i + 1]); } else { sp = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, jpanels[i], sp); } sp.setMinimumSize(new Dimension(0, 0)); sp.setContinuousLayout(true); sp.setResizeWeight(0.5); } add(sp, MULTI_DISP_PANEL); multiDispPanel = sp; } getToolbarPanelInternal().removeAll(); initialized = true; } private class CompDispButtonListener implements ActionListener { private int compIdx; private boolean findNext; public CompDispButtonListener(int idx, boolean next) { compIdx = idx; findNext = next; } public void actionPerformed(ActionEvent e) { focusedTable = compIdx; find(null, findNext, true); hotGps[compIdx].update(); } } protected void addExperiment() { initialized = false; computed = false; } @Override public synchronized void doCompute() { AnUtility.checkIfOnAWTThread(false); if (!selected) { return; } if (!initialized) { init(); if (!initialized) { return; } } if (inCompute) { return; } inCompute = true; // cards.setPreferredSize(new Dimension(AnVariable.WIN_SIZE)); // cards.setPreferredSize(oneDispPanel.getPreferredSize()); if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { // XXXX oneDispPanel's computed should have been set through AnCompDisp.setComputed(). // But it's not. So we set computed here. oneDispPanel.setComputed(computed); oneDispPanel.setSelected(true); // oneDispPanel.doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) oneDispPanel .computeOnAWorkerThread(); // 22131013 - Analyzer GUI: Drag-n-drop a table header can // cause a deadlock cardLayout.show(this, ONE_DISP_PANEL); computed = true; inCompute = false; return; } long sel_func = window.getSelectedObject().getSelObj(DSP_Functions, 0); if (sel_func == 0) { // Functions tab is not updated yet. // Let's try to update Functions tab window .getFunctionsView() .computeIfNeeded(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) sel_func = window.getSelectedObject().getSelObj(DSP_Functions, 0); } long sel_obj = window.getSelectedObject().getSelObj(type, 0); // sel_objs = getComparableObjsV2(sel_obj); sel_objs = getComparableObjsV2(sel_func); long[] cmpObjs = getComparableObjsV2(sel_func); oneDispPanel.setSelected(false); raw_datas = new Object[tables.length]; raw_data_ids = new Object[tables.length]; met_labels = new Object[tables.length]; src_types = new Object[tables.length]; str_errors = new String[tables.length]; sel_indexes = new int[tables.length]; marks = new Object[tables.length]; marks_inc = new Object[tables.length]; cmp_totals = new AnObject[tables.length][]; MaximumValues = null; if (focusedTable >= tables.length) { focusedTable = 0; } for (int i = 0; i < tables.length; i++) { long cmpObj = cmpObjs[i]; if (cmpObj == 0) { str_errors[i] = AnLocale.getString("No comparable object"); continue; } int met_type = MetricsSetting.MET_COMMON | COMPARE_BIT | ((i + 1) << GROUP_ID_SHIFT); sel_objs[i] = dbeConvertSelObj(cmpObj, type); Object[] raw_data_with_ids = getFuncListV2(met_type, cmpObj, type, subtype); Object[] raw_marks = getHotMarks(type); Object[] raw_marks_inc = getHotMarksInc(type); int[][] hot_marks = new int[2][]; hot_marks[0] = (int[]) raw_marks[0]; hot_marks[1] = (int[]) raw_marks[1]; int[][] hot_marks_inc = new int[2][]; hot_marks_inc[0] = (int[]) raw_marks_inc[0]; hot_marks_inc[1] = (int[]) raw_marks_inc[1]; marks[i] = hot_marks; marks_inc[i] = hot_marks_inc; String errstr = window.getMsg(AnUtility.ERROR_MSG); if (errstr != null) { str_errors[i] = errstr; raw_datas[i] = null; marks[i] = null; marks_inc[i] = null; continue; } str_errors[i] = null; int last_ind = raw_data_with_ids.length - 1; Object[] metrics_data = (Object[]) raw_data_with_ids[last_ind]; met_labels[i] = getSettings().getMetricList(metrics_data); long[] raw_data_id = (long[]) raw_data_with_ids[last_ind - 1]; raw_data_ids[i] = raw_data_id; src_types[i] = raw_data_with_ids[last_ind - 2]; final Object[][] data = get_data((AnMetric[]) met_labels[i], raw_data_with_ids); updateMaximumValues(data); raw_datas[i] = data; cmp_totals[i] = getTotals(type, i + 1); // IPC call int sel_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); if (sel_ind != -1) { sel_indexes[i] = sel_ind; } else { sel_indexes[i] = getSelIndex(raw_data_id, sel_objs[i]); } } SwingUtilities.invokeLater( new Runnable() { // 22131013 - Analyzer GUI: Drag-n-drop a table header can cause a deadlock @Override public void run() { update_tables(); } }); // Set toolbar and select subviews updateToolBar(); computed = true; if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } inCompute = false; } private void update_tables() { long sel_obj = 0; for (int i = 0; i < tables.length; i++) { table = tables[i]; table.setViewport(); String errstr = str_errors[i]; if (errstr != null) { window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); table.showMessage(errstr); hotGps[i].update(); continue; } Object[][] raw_data = (Object[][]) raw_datas[i]; int[][] mark = (int[][]) marks[i]; int[][] mark_inc = (int[][]) marks_inc[i]; int[] src_type = (int[]) src_types[i]; if (cmp_totals[i] != null) { if (MaximumValues == null) { MaximumValues = new Object[2][cmp_totals[i].length]; MaximumValues[1] = cmp_totals[i]; } MaximumValues[0] = cmp_totals[i]; } AnMetric[] mlist = (AnMetric[]) met_labels[i]; MetricLabel[] label = getSettings().getMetricsSetting().getLabel(raw_data, MaximumValues, mlist, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndex(mlist); int sort_ind = getSettings().getMetricsSetting().getSortIndex(mlist); long sel = sel_objs[i]; AnUtility.checkIPCOnWrongThread(false); String[] hdrContent = getNames(type, sel); // name column table header contents (?) AnUtility.checkIPCOnWrongThread(true); if (sel_obj == 0) { sel_obj = sel; } AnUtility.checkIPCOnWrongThread(false); table.setData( label, raw_data, hdrContent, src_type, sel_indexes[i], name_col, sort_ind, mark, mark_inc); AnUtility.checkIPCOnWrongThread(true); table.setSelectedRow(sel_indexes[i]); hotGps[i].update(); } cardLayout.show(this, MULTI_DISP_PANEL); table = tables[0]; updateSummary(sel_obj); } public void goToLine(final AnTable tbl, final int row) { for (int i = 0, sz = tables != null ? tables.length : 0; i < sz; i++) { if (tbl == tables[i]) { if (tables[i].getNavigationHistoryPool() != null) { if (type == DSP_Source || type == DSP_SourceV2) { tables[i].getNavigationHistoryPool().getHistory().goToSrcNew(row); } else if (type == DSP_Disassembly || type == DSP_DisassemblyV2) { tables[i].getNavigationHistoryPool().getHistory().goToDisNew(row); } updateToolBar(); } goToLine(i, row); } } } private void goToLine(final int cmp_index, final int row) { table = tables[cmp_index]; long[] raw_data_id = (long[]) raw_data_ids[cmp_index]; if (raw_data_id == null) { return; } if (row < 0 || row >= raw_data_id.length) { return; } long sel_obj = raw_data_id[row]; int sz_table = tables != null ? tables.length : 0; for (int i = 0; i < sz_table; i++) { tables[i].clearSelection(); } tables[cmp_index].setSelectedRow(row); int selType = type; if (type == AnDisplay.DSP_Source) { selType = AnDisplay.DSP_SourceV2; } else if (type == AnDisplay.DSP_Disassembly) { selType = AnDisplay.DSP_DisassemblyV2; } window.getSelectedObject().setSelObj(sel_obj, selType, subtype); updateSummary(sel_obj); AnUtility.checkIPCOnWrongThread(false); long[] cmpObjs = getComparableObjsV2(sel_obj); AnUtility.checkIPCOnWrongThread(true); if (cmpObjs == null) { return; } for (int i = 0; i < sz_table; i++) { if (cmpObjs[i] != 0 && cmp_index != i) { long[] ids = (long[]) raw_data_ids[i]; int sel_ind = getSelIndex(ids, cmpObjs[i]); if (sel_ind != -1) { long curRow = ((tables[i].srcRenderer != null) ? tables[i].srcRenderer : tables[i].disRenderer) .getFunctionBaseRowWhenCompare(tables[i].getSelectedRow()); long tgtRow = ((tables[i].srcRenderer != null) ? tables[i].srcRenderer : tables[i].disRenderer) .getFunctionBaseRowWhenCompare(sel_ind); if (tgtRow != curRow) { tables[i].setSelectedRow(sel_ind); } } } } } private int getSelIndex(long[] raw_data_id, long sel_obj) { if (raw_data_id == null || sel_obj == 0) { return -1; } for (int i = 0; i < raw_data_id.length; i++) { if (raw_data_id[i] == sel_obj) { return i; } } return -1; } private void updateMaximumValues(final Object[][] data) { int nc = (data == null) ? 0 : data.length; // Updates MaximumValues (Total and Max values) // Note: Total is not used, so only Maximum is updated. if (MaximumValues == null) { MaximumValues = new Object[2][nc]; AnAddress aa = new AnAddress(0); AnDouble ad = new AnDouble(0.0); AnInteger ai = new AnInteger(0); AnLong al = new AnLong(0); AnString as = new AnString(""); for (int i = 0; i < nc; i++) { Object obj, arr = data[i]; if (arr instanceof AnDouble[]) { obj = ad; } else if (arr instanceof AnInteger[]) { obj = ai; } else if (arr instanceof AnLong[]) { obj = al; } else if (arr instanceof AnAddress[]) { obj = aa; } else { obj = as; } MaximumValues[0][i] = obj; MaximumValues[1][i] = obj; } } for (int i = 0; i < nc; i++) { Object[] arr = data[i]; Object obj = MaximumValues[1][i]; int max_len = obj.toString().length(); for (int k = 0; k < arr.length; k++) { int len = arr[k].toString().length(); if (max_len < len) { max_len = len; obj = arr[k]; } } MaximumValues[0][i] = obj; MaximumValues[1][i] = obj; } } // Listener for updating table private final class TableHandler implements AnListener { private int cmp_index; TableHandler(int ind) { super(); cmp_index = ind; } public void valueChanged(final AnEvent event) { switch (event.getType()) { case AnEvent.EVT_SELECT: { table = tables[cmp_index]; int row = event.getValue(); focusedTable = cmp_index; boolean[] enabled = new boolean[tables.length]; for (int i = 0; i < tables.length; i++) { enabled[i] = tables[i].getNavigationHistoryPool().getHistory().enabled; tables[i].getNavigationHistoryPool().getHistory().enabled = false; } int[] sel_rows = table.getSelectedRows(); if (sel_rows.length > 1) { // multi-selection // Update Summary int len = sel_rows.length; long[] raw_data_id = (long[]) raw_data_ids[cmp_index]; long[] multi_sel_objs = new long[len]; for (int i = 0; i < len; i++) { multi_sel_objs[i] = raw_data_id[sel_rows[i]]; } window.getSelectionManager().updateSelection(multi_sel_objs, type, subtype, 2); break; } goToLine(cmp_index, row); for (int i = 0; i < tables.length; i++) { tables[i].getNavigationHistoryPool().getHistory().enabled = enabled[i]; } break; } case AnEvent.EVT_SORT: // Sorting break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: { // Column switching table = tables[cmp_index]; if (table != null) { table.columnsSaved = false; } int from = event.getValue(); int to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; } } } } protected void filterChanged() { // System.out.println("AnCompDisp:filterChanged: " + this); if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { if (oneDispPanel == null) { return; } if (oneDispPanel instanceof SourceDisp) { // FIXUP: REARCH: this is a mess. Just following previous code logic! ((SourceDisp) oneDispPanel).filterChanged(); } } } public void clearHistory() { if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { if (oneDispPanel == null) { return; } oneDispPanel.clearHistory(); } } @Override protected boolean supportsFindText() { return true; } @Override public int find(final String str, final boolean next, boolean caseSensitive) { if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { return oneDispPanel.find(str, next, caseSensitive); } AnTable tbl = tables[focusedTable]; if (tbl != null) { int find_row = table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = table.findBefore(str, next, caseSensitive); } if (find_row != -1) { goToLine(tbl, find_row); return find_row; } } return -1; } private long[] getComparableObjsV2(long sel_obj) { synchronized (IPC.lock) { window.IPC().send("getComparableObjsV2"); window.IPC().send(0); window.IPC().send(sel_obj); window.IPC().send(type); return (long[]) window.IPC().recvObject(); } } protected Object[] getFuncListV2( final int met_type, final long sel_func, final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("getFuncListV2"); window.IPC().send(0); window.IPC().send(met_type); window.IPC().send(sel_func); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } protected long dbeConvertSelObj(final long obj, final int type) { synchronized (IPC.lock) { window.IPC().send("dbeConvertSelObj"); window.IPC().send(obj); window.IPC().send(type); return window.IPC().recvLong(); } } protected void updateSummary(final long sel_obj) { // final Object[] data; // long[] objs = new long[1]; // objs[0] = sel_obj; // synchronized (IPC.lock) { // window.IPC().send("getSummaryV2"); // window.IPC().send(window.getWindowID()); // window.IPC().send(objs); // window.IPC().send(type); // window.IPC().send(subtype); // data = (Object[]) window.IPC().recvObject(); // } // AnUtility.dispatchOnSwingThread(new Runnable() { // @Override // public void run() { // window.getSummaryPanel().updateSummary(data, type); // } // }); window.getSelectionManager().updateSelection(sel_obj, type, subtype, 2); } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getTimelineCallStackSubview()); list.add(window.getIoCallStackSubview()); list.add(window.getHeapCallStackSubview()); if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { if (type == AnDisplay.DSP_Source) { list.add(window.getCalledByCallsSrcSubview()); } else if (type == AnDisplay.DSP_Disassembly) { list.add(window.getCalledByCallsDisSubview()); } } return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } private final String MULTI_DISP_PANEL = "multiDispPanel"; private final String ONE_DISP_PANEL = "oneDispPanel"; private final int COMPARE_BIT = 1 << 8; private final int GROUP_ID_SHIFT = 16; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/DataLayoutView.java������������������������������������������������0000644�0001750�0001750�00000007464�14744453367�017530� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import javax.swing.JPanel; public final class DataLayoutView extends FuncListDisp implements AnChangeListener { public DataLayoutView() { super(AnWindow.getInstance(), AnDisplay.DSP_DataLayout, 0, AnVariable.HELP_TabsDataLayout); setAccessibility(AnLocale.getString("Data Layout")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("DataLayoutView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnAddress.java�����������������������������������������������������0000644�0001750�0001750�00000005471�15044710303�016442� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; // Analyzer Address object public final class AnAddress extends AnObject implements Comparable<AnAddress> { static final long HI_BIT = 0x8000000000000000L; private static final String hexChars = "0123456789ABCDEF"; private final long value; private final Long obj; // Constructor public AnAddress(long value) { this.value = value & (~HI_BIT); obj = this.value; } // Analyzer Address printing format @Override public String toString() { if (value == 0) { if (!showZero) { return quote_space; } } return Integer.toString((int) (value >> 32)) + ":" + toHexString((int) (value & 0xFFFFFFFFL)); } // To Long private Long toLong() { return obj; } // To double @Override public double doubleValue() { return value; } // As Long.compareTo @Override public int compareTo(AnAddress o) { return obj.compareTo(o.toLong()); } // String representation as an unsigned integer in base 16 public static String toHexString(int i) { return toUnsignedString((long) i, 4, 8); } // String representation as an unsigned integer in base 16 public static String toHexString(long i) { return toUnsignedString(i, 4, 16); } // String representation as an unsigned integer in base 2^shift private static String toUnsignedString(long i, int shift, int min_len) { char[] buf = new char[32]; int charPos = 32; int end = 32 - min_len; int radix = 1 << shift; int mask = radix - 1; // Get the digits do { buf[--charPos] = hexChars.charAt((int) (i & mask)); i >>>= shift; } while (i != 0); // Fill zeros while (charPos > end) { buf[--charPos] = '0'; } return "0x" + new String(buf, charPos, (32 - charPos)); } // Check if an address element public static boolean isAddress(long value) { return (value & HI_BIT) != 0; } // Convert long[] to AnAddress[] public static AnAddress[] toArray(long[] list) { int length = list.length; AnAddress[] new_list = new AnAddress[length]; for (int i = 0; i < length; i++) { new_list[i] = new AnAddress(list[i]); } return new_list; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/InstructionFrequencyView.java��������������������������������������0000644�0001750�0001750�00000014246�15044710303�021634� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Font; import java.util.ArrayList; import java.util.List; import javax.swing.JTable; public final class InstructionFrequencyView extends AnDisplay implements ExportSupport, AnChangeListener { private static final Font table_font; private AnUtility.AnTextArea inst_log; static { JTable jtable = new JTable(); Font org_font = jtable.getFont(); table_font = new Font("Monospaced", org_font.getStyle(), org_font.getSize()); } // Constructor public InstructionFrequencyView() { super( AnWindow.getInstance(), AnDisplay.DSP_InstructionFrequency, AnVariable.HELP_WelcomeAnalyzer); setAccessibility(AnLocale.getString("Instruction Frequency")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("InstructionFrequencyView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: addExperiment(); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { StringBuilder buf = new StringBuilder(); buf.append(getAnDispTab().getTName()); buf.append("\n"); buf.append(inst_log.getText()); return buf.toString(); } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); // formats.add(ExportFormat.HTML); // formats.add(ExportFormat.CSV); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); inst_log = new AnUtility.AnTextArea(null, false); inst_log.setFont(table_font); add(new AnJScrollPane(inst_log), BorderLayout.CENTER); } // Clear the text area on add experiment private void addExperiment() { inst_log.setText(""); } // Compute & update Statistics display @Override public void doCompute() { String[] inst_data; int size; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (!computed) { // need re-compute // Get data inst_log.setText(""); inst_data = getIfreqData(); if (inst_data != null) { size = inst_data.length; for (int i = 0; i < size; i++) { inst_log.append(AnUtility.trimNewLine(inst_data[i]) + "\n"); } } } computed = true; } // Native methods from liber_dbe.so private String[] getIfreqData() { synchronized (IPC.lock) { window.IPC().send("getIfreqData"); window.IPC().send(0); return (String[]) window.IPC().recvObject(); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnList.java��������������������������������������������������������0000644�0001750�0001750�00000010242�14744453367�016004� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnJPanel; import java.awt.*; import javax.swing.*; public final class AnList extends AnJPanel { private final boolean resizable; private final JPanel label; private final JPanel value; // Constructor public AnList(final boolean resizable) { this.resizable = resizable; label = new AnJPanel(); label.setLayout(new BoxLayout(label, BoxLayout.Y_AXIS)); value = new AnJPanel(); value.setLayout(new BoxLayout(value, BoxLayout.Y_AXIS)); if (resizable) { BorderLayout borderLayout = new BorderLayout(); if (AnEnvironment.isLFNimbus()) { borderLayout.setHgap(4); } setLayout(borderLayout); add(label, BorderLayout.WEST); add(value, BorderLayout.CENTER); } else { add(label); add(value); } } // Add label public JComponent addLabel(final JComponent item) { return (JComponent) label.add((item != null) ? item : new AnJPanel()); } // Add value private JComponent addValue(final JComponent item) { return (JComponent) value.add((item != null) ? item : new AnJPanel()); } // Add label and value public void add(final JComponent litem, final JComponent vitem) { setAlignmentY(addLabel(litem), addValue(vitem)); } // Align labels and values vertically private void setAlignmentY(final JComponent litem, final JComponent vitem) { final Dimension lsize; final Dimension vsize; Dimension msize; lsize = new Dimension(litem.getPreferredSize()); vsize = new Dimension(vitem.getPreferredSize()); if (lsize.height < vsize.height) { lsize.height = vsize.height; } else { vsize.height = lsize.height; } // Set labels size if (resizable) { msize = litem.getMaximumSize(); msize.height = lsize.height; litem.setMaximumSize(msize); } else { litem.setMaximumSize(new Dimension(lsize)); } litem.setMinimumSize(new Dimension(lsize)); litem.setPreferredSize(new Dimension(lsize)); // Set values size if (resizable) { msize = vitem.getMaximumSize(); msize.height = vsize.height; vitem.setMaximumSize(msize); } else { vitem.setMaximumSize(new Dimension(vsize)); } vitem.setMinimumSize(new Dimension(vsize)); vitem.setPreferredSize(new Dimension(vsize)); } // Align Labels and Values vertically public void setAlignmentY() { final Component[] labels = label.getComponents(); final Component[] values = value.getComponents(); final int size = Math.min(labels.length, values.length); for (int i = 0; i < size; i++) { setAlignmentY((JComponent) labels[i], (JComponent) values[i]); } } // Align items horizontally private void setAlignmentX(final Component[] items) { final int size; int width; int max_width; Dimension psize; size = items.length; max_width = 0; for (int i = 0; i < size; i++) { width = items[i].getPreferredSize().width; if (max_width < width) { max_width = width; } } for (int i = 0; i < size; i++) { psize = items[i].getPreferredSize(); psize.width = max_width; ((JComponent) items[i]).setPreferredSize(psize); } } // Align the Values only horizontally, usually the Labels does not need // further alignment public void setAlignmentX() { setAlignmentX(value.getComponents()); } // Clean up public void removeAll() { label.removeAll(); value.removeAll(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/MemoryIndexObjectView.java�����������������������������������������0000644�0001750�0001750�00000010677�15044710303�021024� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; public final class MemoryIndexObjectView extends FuncListDisp implements AnChangeListener { // Constructor public MemoryIndexObjectView(final int type, final int subtype, final String help_id) { super(AnWindow.getInstance(), type, subtype, help_id); setAccessibility(AnLocale.getString("Memory or Index Object")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("MemoryIndexObjectView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } /** * Called before new memory/index objects are created. Cleanup old ones before they are removed. */ public void toBeRemoved() { // Remove listeners AnEventManager.getInstance().removeListener(this); } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } } �����������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/PCsView.java�������������������������������������������������������0000644�0001750�0001750�00000007411�14744453367�016136� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import javax.swing.JPanel; public final class PCsView extends FuncListDisp implements AnChangeListener { public PCsView() { super(AnWindow.getInstance(), AnDisplay.DSP_PCs, 0, AnVariable.HELP_TabsPCs); setAccessibility(AnLocale.getString("PCs")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("PCsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnWindow.java������������������������������������������������������0000644�0001750�0001750�00000446734�15044710303�016337� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.collect.CollectDialog; import org.gprofng.mpmt.collect.CollectPanel; import org.gprofng.mpmt.collect.Collector; import org.gprofng.mpmt.compare.CompareAdvancedDialog; import org.gprofng.mpmt.compare.CompareSimpleDialog; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.experiment_props.Experiments; import org.gprofng.mpmt.export.Export; import org.gprofng.mpmt.export.ExportDialog; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.export.ExportSupport.ExportFormat; import org.gprofng.mpmt.filter.Filters; import org.gprofng.mpmt.flame.FlameView; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.ipc.IPCCancelledException; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.mainview.MainViewPanel; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.IPCMetricsAPI; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.navigation.NavigationPanel; import org.gprofng.mpmt.navigation.View; import org.gprofng.mpmt.navigation.ViewsPanel; import org.gprofng.mpmt.overview.OverviewView; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.picklist.PickListElement; import org.gprofng.mpmt.progress.SystemProgressPanel; import org.gprofng.mpmt.remote.CloseExperimentDialog; import org.gprofng.mpmt.remote.ConnectionDialog; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.CompareModeSetting; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.settings.ExportSettingsDialog; import org.gprofng.mpmt.settings.FormatSetting; import org.gprofng.mpmt.settings.ImportSettingsDialog; import org.gprofng.mpmt.settings.LibraryVisibilitySetting; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.PathMapSetting; import org.gprofng.mpmt.settings.SearchPathSetting; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.TimelineSetting; import org.gprofng.mpmt.settings.ViewModeEnabledSetting; import org.gprofng.mpmt.settings.ViewModeSetting; import org.gprofng.mpmt.settings.ViewModeSetting.ViewMode; import org.gprofng.mpmt.settings.ViewsSetting; import org.gprofng.mpmt.settings.ViewsSetting.CustomObject; import org.gprofng.mpmt.statecolors.AnColorChooser; import org.gprofng.mpmt.statuspanel.StatusHandleFactory; import org.gprofng.mpmt.statuspanel.StatusLabelHandle; import org.gprofng.mpmt.statuspanel.StatusLabelValueHandle; import org.gprofng.mpmt.statuspanel.StatusPanel; import org.gprofng.mpmt.timeline2.TimelineView; import org.gprofng.mpmt.toolbar.ToolBarFiller; import org.gprofng.mpmt.toolbar.ToolBarPanel; import org.gprofng.mpmt.toolbar.ToolBarSeparator; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnSplitPane; import org.gprofng.mpmt.util.gui.AnTextIcon; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.ToolTipPopup; import org.gprofng.mpmt.welcome.WelcomeView; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JToolBar; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public final class AnWindow implements AnChangeListener { private static AnWindow instance; // Actions private static final String ACTION_PROFILE_APP = AnLocale.getString("Profile Application...", "ACTION_PROFILE_APP"); private static final String ACTION_PROFILE_APP_TT = AnLocale.getString( "Start an application and collect profiling data to create an experiment", "ACTION_PROFILE_APP_TT"); // GUI test failures!!! private static final String ACTION_PROFILE_APP_TT_GUITESTING = AnLocale.getString("Profile Application", "ACTION_PROFILE_APP_TT"); private static final String ACTION_PROFILE_APP_AC = ACTION_PROFILE_APP_TT; private static final String ACTION_PROFILE_RUNNING_PROCESS = AnLocale.getString("Profile Running Process...", "ACTION_PROFILE_RUNNING_PROCESS"); private static final String ACTION_PROFILE_RUNNING_PROCESS_TT = AnLocale.getString( "Attach to a running process and create an experiment", "ACTION_PROFILE_RUNNING_PROCESS_TT"); private static final String ACTION_PROFILE_RUNNING_PROCESS_AC = ACTION_PROFILE_RUNNING_PROCESS_TT; private static final String ACTION_PROFILE_KERNEL = AnLocale.getString("Profile Kernel...", "ACTION_PROFILE_KERNEL"); private static final String ACTION_PROFILE_KERNEL_TT = AnLocale.getString("Profile Kernel", "ACTION_PROFILE_KERNEL_TT"); private static final String ACTION_PROFILE_KERNEL_AC = ACTION_PROFILE_KERNEL_TT; private static final String ACTION_OPEN_EXPERIMENT = AnLocale.getString("Open Experiment...", "ACTION_OPEN_EXPERIMENT"); private static final String ACTION_OPEN_EXPERIMENT_TT = AnLocale.getString( "Select an experiment to view", "ACTION_OPEN_EXPERIMENT_TT"); // GUI test failures!!! private static final String ACTION_OPEN_EXPERIMENT_TT_GUITESTING = AnLocale.getString("Open Experiment", "ACTION_OPEN_EXPERIMENT_TT"); private static final String ACTION_OPEN_EXPERIMENT_AC = ACTION_OPEN_EXPERIMENT_TT; private static final String ACTION_COMPARE = AnLocale.getString("Compare Experiments...", "ACTION_COMPARE"); private static final String ACTION_COMPARE_TT = AnLocale.getString( "Select multiple experiments and compare their data", "ACTION_COMPARE_TT"); // GUI test failures!!! private static final String ACTION_COMPARE_TT_GUITESTING = AnLocale.getString("Compare Experiments", "ACTION_COMPARE_TT"); private static final String ACTION_COMPARE_AC = ACTION_COMPARE_TT; private static final String ACTION_AGGREGATE = AnLocale.getString("Aggregate Experiments...", "ACTION_AGGREGATE"); private static final String ACTION_AGGREGATE_TT = AnLocale.getString("Aggregate Experiments", "ACTION_AGGREGATE_TT"); private static final String ACTION_AGGREGATE_AC = ACTION_AGGREGATE_TT; private static final String ACTION_SHOW_ERRORS_WARNINGS = AnLocale.getString("Show Errors & Warnings", "ACTION_SHOW_ERRORS_WARNINGS"); private static final String ACTION_SHOW_ERRORS_WARNINGS_TT = AnLocale.getString("Show Errors & Warnings", "ACTION_SHOW_ERRORS_WARNINGS_TT"); private static final String ACTION_SHOW_ERRORS_WARNINGS_AC = ACTION_SHOW_ERRORS_WARNINGS_TT; private static final String ACTION_CONNECT = AnLocale.getString("Connect to Remote Host...", "ACTION_CONNECT"); private static final String ACTION_CONNECT_TT = AnLocale.getString( "Connect to a remote host to profile applications or view experiments", "ACTION_CONNECT_TT"); private static final String ACTION_CONNECT_AC = ACTION_CONNECT_TT; private static final String ACTION_EXPORT = AnLocale.getString("Export...", "ACTION_EXPORT"); private static final String ACTION_EXPORT_TT = AnLocale.getString("Export", "ACTION_EXPORT_TT"); private static final String ACTION_EXPORT_AC = ACTION_EXPORT_TT; private static final String ACTION_EXIT = AnLocale.getString("Exit", "ACTION_EXIT"); private static final String ACTION_PREVIOUS_VIEW = AnLocale.getString("Previous View", "ACTION_PREVIOUS_VIEW"); private static final String ACTION_PREVIOUS_VIEW_TT = AnLocale.getString("Previous View (Shift+F7)", "ACTION_PREVIOUS_VIEW_TT"); private static final String ACTION_PREVIOUS_VIEW_AC = ACTION_PREVIOUS_VIEW_TT; private static final String ACTION_NEXT_VIEW = AnLocale.getString("Next View", "ACTION_NEXT_VIEW"); private static final String ACTION_NEXT_VIEW_TT = AnLocale.getString("Next View (F7)", "ACTION_NEXT_VIEW_TT"); private static final String ACTION_NEXT_VIEW_AC = ACTION_PREVIOUS_VIEW_TT; private static final String ACTION_VIEWS_SETTINGS = AnLocale.getString("Views Settings...", "ACTION_VIEWS_SETTINGS"); private static final String ACTION_VIEWS_SETTINGS_TT = AnLocale.getString("Views Settings", "ACTION_VIEWS_SETTINGS_TT"); private static final String ACTION_VIEWS_SETTINGS_AC = ACTION_VIEWS_SETTINGS_TT; private static final String ACTION_METRICS_SETTINGS = AnLocale.getString("Metrics Settings...", "ACTION_METRICS_SETTINGS"); private static final String ACTION_METRICS_SETTINGS_TT = AnLocale.getString("Metrics Settings", "ACTION_METRICS_SETTINGS_TT"); private static final String ACTION_METRICS_SETTINGS_AC = ACTION_METRICS_SETTINGS_TT; private static final String ACTION_ADD_REMOVE_FILTERS = AnLocale.getString("Add or remove filters...", "ACTION_ADD_REMOVE_FILTERS"); private static final String ACTION_ADD_REMOVE_FILTERS_TT = AnLocale.getString("Add or remove filters", "ACTION_ADD_REMOVE_FILTERS_TT"); private static final String ACTION_ADD_REMOVE_FILTERS_AC = ACTION_ADD_REMOVE_FILTERS_TT; private static final String ACTION_LIBRARY_VISIBILITY = AnLocale.getString("Library Visibility...", "ACTION_LIBRARY_VISIBILITY"); private static final String ACTION_LIBRARY_VISIBILITY_TT = AnLocale.getString("Library Visibility", "ACTION_LIBRARY_VISIBILITY_TT"); private static final String ACTION_LIBRARY_VISIBILITY_AC = ACTION_LIBRARY_VISIBILITY_TT; private static final String ACTION_FUNCTION_COLORS = AnLocale.getString("Function Colors...", "ACTION_FUNCTION_COLORS"); private static final String ACTION_FUNCTION_COLORS_TT = AnLocale.getString("Function Colors", "ACTION_FUNCTION_COLORS_TT"); private static final String ACTION_FUNCTION_COLORS_AC = ACTION_FUNCTION_COLORS_TT; private static final String ACTION_SETTINGS = AnLocale.getString("Settings...", "ACTION_SETTINGS"); private static final String ACTION_SETTINGS_TT = AnLocale.getString("Settings", "ACTION_SETTINGS_TT"); private static final String ACTION_SETTINGS_AC = ACTION_SETTINGS_TT; private static final String ACTION_EXPORT_SETTINGS = AnLocale.getString("Export Settings...", "ACTION_EXPORT_SETTINGS"); private static final String ACTION_IMPORT_SETTINGS = AnLocale.getString("Import Settings...", "ACTION_IMPORT_SETTINGS"); private static final String ACTION_EXPORT_SETTINGS_AS = AnLocale.getString("Export Settings as .er.rc...", "ACTION_EXPORT_SETTINGS_AS"); private static final String ACTION_HELP_TT = AnLocale.getString("Opens a documentation window in the gprofng GUI"); private static final String ACTION_HELP_AC = ACTION_HELP_TT; private static final String ACTION_HELP_PERFORMANCE_ANALYZER = AnLocale.getString("gprofng GUI"); private static final String ACTION_HELP_NEW_FEATURES = AnLocale.getString("New Features"); private static final String ACTION_HELP_INFORMATION_MAP = AnLocale.getString("Information Map"); private static final String ACTION_HELP_KEYBOARD_SHORTCUTS = AnLocale.getString("Keyboard Shortcuts"); private static final String ACTION_HELP_SHORTCUTS = AnLocale.getString("Help Shortcuts"); private static final String ACTION_HELP_TROUBLESHOOTING = AnLocale.getString("Troubleshooting"); private static final String ACTION_ABOUT_ANALYZER = AnLocale.getString("About gprofng GUI"); // Experiment status private static final int EXP_SUCCESS = 0; private static final int EXP_BROKEN = 4; private static final int EXP_OBSOLETE = 8; // Panels/Panes/Components private final AnFrame frame; private JPanel mainPanel; private ToolBarPanel toolBarPanel; private JPanel centerPanel; private StatusPanel statusPanel; private JComponent menuBar; private JPanel centerPanelSplit; private MainViewPanel mainViewPanel; private AnSplitPane navigationPanelSplitPane; private NavigationPanel navigationPanel; private SystemProgressPanel systemProgressPanel; private StatusLabelHandle tableStatusHandle; private StatusLabelValueHandle localHostStatusHandle; private StatusLabelValueHandle remoteHostStatusHandle; private StatusLabelValueHandle compareStatusHandle; private StatusLabelValueHandle showErrorsWarningsStatusHandle; private StatusLabelValueHandle filterStatusHandle; private StatusLabelValueHandle workingDirectoryStatusHandle; private StatusLabelValueHandle debugStatusHandle; private SummaryPanel summaryPanel; // Dialogs private Settings settings = null; private AnColorChooser colorChooser; private AnChooser anFileChooser; private ConnectionDialog connectionChooser = null; private AnChooser anRemoteFileChooser; private JLabel viewModeLabel; private JComboBox<ViewMode> viewModeComboBox; private ToolBarSeparator viewModeSeparator; private ToolBarFiller viewModeFiller; private CollectDialog profileApplicationDialog = null; private CollectDialog profileRunningProcessDialog = null; private CollectDialog profileKernelDialog = null; private LibraryVisibilityDialog libraryVisibilityDialog = null; // Actions private AnAction profileApplicationAction; private AnAction profileRunningProcessAction; private AnAction profileKernelAction; private AnAction openExperimentAction; private AnAction compareExperimentsAction; private AnAction aggregateExperimentsAction; private AnAction showErrorsWarningsAction; private AnAction connectAction; private AnAction exportAction; private AnAction exitAction; // private AnAction previousViewAction; private AnAction nextViewAction; private AnAction viewsSettingsAction; // private AnAction metricsSettingsAction; // private AnAction addRemoveFiltersAction; private AnAction libraryVisibilityAction; private AnAction functionColorsAction; private AnAction settingsAction; private AnAction exportSettingsAction; private AnAction importSettingsAction; private AnAction exportSettingsAsAction; // private AnAction helpAnalyzerAction; private AnAction helpNewFeaturesAction; private AnAction helpInformationMapAction; private AnAction helpKeyboardShortcutsAction; private AnAction helpShortcutsAction; private AnAction helpTroubleShootingAction; private AnAction aboutAnalyzerAction; // Menus private JMenu fileMenu; private JMenu recentExperimentsMenu; private JMenu metricsMenu; private JMenu viewsMenu; private JMenu toolsMenu; private JMenu filtersMenu; private JMenu helpMenu; private JSeparator showErrorsWarningsSeparator; private JMenuItem showErrorsWarningsMenuItem; // States private Analyzer analyzer; private ViewDisplayPanel viewDisplayPanel; private Filters filters = null; // Holding and managing filters private Experiments experimentProperties; private SelectedObject selectedObject = null; private SelectionManager selectionManager = null; private String[][] experimentGroups = null; // The groups of loaded experiments private boolean hasErrorsAndWarnings = false; // AnDispTab's private AnDispTab welcomeDispTab = null; private AnDispTab overviewDispTab = null; // Current View and View lists private List<AnDisplay> standardDisplayList; // Display list (static) private List<AnDisplay> memoryIndexDisplayList; // Memory/Index objects Display list (dynamic) // Main Views (AnDisplay) private WelcomeView welcomeView; private OverviewView overviewView; private FunctionsView functionsView; private CallerCalleesView callerCalleesView; private CallTreeView callTreeView; private FlameView flameView; private SourceView sourceView; private DisassemblyView disassemblyView; private LinesView linesView; private PCsView pcsView; private DataLayoutView dataLayoutView; private DataObjectsView dataObjectsView; private IOView ioView; private HeapView heapView; private StatisticsView statisticsView; private SourceDisassemblyView sourceDisassemblyView; private ExperimentsView experimentsView; private TimelineView timelineView; private DualSourceView dualSourceView; private InstructionFrequencyView instructionFrequencyView; // Others views private CalledByCallsSourceView calledByCallsSourceView; private CalledByCallsDisassemblyView calledByCallsDisassemblyView; private CalledByCallsFunctionsView calledByCallsFunctionsView; // Subviews private List<Subview> subviewList = new ArrayList<>(); // List of all subviews, may contain null's private Subview selectedDetailsSubview = null; private Subview selectedDetailsSubviewTimeLine = null; private Subview timelineCallStackSubview = null; private Subview ioCallStackSubview = null; private Subview heapCallStackSubview = null; private Subview calledByCallsSrcSubview = null; private Subview calledByCallsDisSubview = null; private Subview calledByCallsFuncSubview = null; // ********************************************************************************************** // Constructor public AnWindow(Analyzer parent, AnFrame frame, Container contentPane, JComponent manuBar) { instance = this; this.analyzer = parent; this.frame = frame; this.menuBar = manuBar; manuBar.setBackground(AnEnvironment.MENUBAR_BACKGROUND_COLOR); initComponents(); enableSessionActions(false, false); selectedObject = new SelectedObject(); selectionManager = new SelectionManager(); AnEventManager.getInstance().addListener(this); } public static AnWindow getInstance() { return instance; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("AnWindow stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: break; case EXPERIMENTS_LOADED: if (connectionChooser != null) { if (connectionChooser.isVisible()) { connectionChooser.requestFocus(); } } break; case FILTER_CHANGED: case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE) { updateViewMode(); } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE_ENABLED) { updateViewModeVisibility(); } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEWS) { ViewsSetting.Setting oldSetting = (ViewsSetting.Setting) anSettingChangeEvent.getOldValue(); ViewsSetting.Setting newSetting = (ViewsSetting.Setting) anSettingChangeEvent.getNewValue(); updateViews(oldSetting, newSetting); } else if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE) { updateCompareModeStatus(); } break; case DEBUG: // debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } // Initialize GUI components private void initComponents() { mainPanel = new JPanel(new BorderLayout()); getFrame().getContentPane().add(mainPanel); initActions(); toolBarPanel = initToolBarPanel(); initMenus(); initViewsAndOtherComponents(); centerPanel = initCenterPanel(); statusPanel = initStatusPanel(); mainPanel.add(toolBarPanel, BorderLayout.NORTH); mainPanel.add(centerPanel, BorderLayout.CENTER); mainPanel.add(statusPanel, BorderLayout.SOUTH); } private void initActions() { profileApplicationAction = new AnAction( ACTION_PROFILE_APP, AnUtility.collect_icon, GUITesting.getInstance().isRunningUnderGUITesting() ? ACTION_PROFILE_APP_TT_GUITESTING : ACTION_PROFILE_APP_TT, ACTION_PROFILE_APP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { profileApplicationAction(null); } }); profileApplicationAction.setKeyboardShortCut( KeyboardShortcuts.profileApplicationActionShortcut); profileApplicationAction.setMnemonic(AnLocale.getString('E', "ACTION_PROFILE_APP_MN")); profileRunningProcessAction = new AnAction( ACTION_PROFILE_RUNNING_PROCESS, null, ACTION_PROFILE_RUNNING_PROCESS_TT, ACTION_PROFILE_RUNNING_PROCESS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { profileRunningProcessAction(); } }); profileRunningProcessAction.setKeyboardShortCut( KeyboardShortcuts.profileRunningProcessActionShortcut); profileRunningProcessAction.setMnemonic( AnLocale.getString('R', "ACTION_PROFILE_RUNNING_PROCESS_MN")); profileKernelAction = new AnAction( ACTION_PROFILE_KERNEL, null, ACTION_PROFILE_KERNEL_TT, ACTION_PROFILE_KERNEL_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { profileKernelAction(); } }); profileKernelAction.setKeyboardShortCut(KeyboardShortcuts.profileKernelActionShortcut); profileKernelAction.setMnemonic(AnLocale.getString('K', "ACTION_PROFILE_KERNEL_MN")); openExperimentAction = new AnAction( ACTION_OPEN_EXPERIMENT, AnUtility.open_icon, GUITesting.getInstance().isRunningUnderGUITesting() ? ACTION_OPEN_EXPERIMENT_TT_GUITESTING : ACTION_OPEN_EXPERIMENT_TT, ACTION_OPEN_EXPERIMENT_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { openExperimentAction(); } }); openExperimentAction.setKeyboardShortCut(KeyboardShortcuts.openExperimentActionShortcut); openExperimentAction.setMnemonic(AnLocale.getString('O', "ACTION_OPEN_EXPERIMENT_MN")); compareExperimentsAction = new AnAction( ACTION_COMPARE, AnUtility.compare_icon, GUITesting.getInstance().isRunningUnderGUITesting() ? ACTION_COMPARE_TT_GUITESTING : ACTION_COMPARE_TT, ACTION_COMPARE_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { compareExperimentsAction(); } }); compareExperimentsAction.setKeyboardShortCut( KeyboardShortcuts.compareExperimentsActionShortcut); compareExperimentsAction.setMnemonic(AnLocale.getString('m', "ACTION_COMPARE_MN")); aggregateExperimentsAction = new AnAction( ACTION_AGGREGATE, AnUtility.add_icon, ACTION_AGGREGATE_TT, ACTION_AGGREGATE_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { aggregateExperimentsAction(); } }); aggregateExperimentsAction.setKeyboardShortCut( KeyboardShortcuts.aggregateExperimentsActionShortcut); aggregateExperimentsAction.setMnemonic(AnLocale.getString('A', "ACTION_AGGREGATE_MN")); showErrorsWarningsAction = new AnAction( ACTION_SHOW_ERRORS_WARNINGS, null, ACTION_SHOW_ERRORS_WARNINGS_TT, ACTION_SHOW_ERRORS_WARNINGS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { showErrorsWarningsAction(); } }); showErrorsWarningsAction.setKeyboardShortCut( KeyboardShortcuts.showErrorsWarningsActionShortcut); showErrorsWarningsAction.setMnemonic(AnLocale.getString('W', "ACTION_SHOW_ERRORS_WARNINGS_MN")); connectAction = new AnAction( ACTION_CONNECT, AnUtility.connect_icon, ACTION_CONNECT_TT, ACTION_CONNECT_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { connectAction(); } }); connectAction.setKeyboardShortCut(KeyboardShortcuts.connectActionShortcut); connectAction.setMnemonic(AnLocale.getString('C', "ACTION_CONNECT_MN")); exportAction = new AnAction( ACTION_EXPORT, null, ACTION_EXPORT_TT, ACTION_EXPORT_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { exportAction(); } }); exportAction.setKeyboardShortCut(KeyboardShortcuts.exportActionShortcut); exportAction.setMnemonic(AnLocale.getString('P', "ACTION_EXPORT_MN")); exitAction = new AnAction( ACTION_EXIT, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { exitAction(); } }); exitAction.setMnemonic(AnLocale.getString('x', "ACTION_EXIT_MN")); previousViewAction = new AnAction( ACTION_PREVIOUS_VIEW, AnUtility.previousViewIcon, ACTION_PREVIOUS_VIEW_TT, ACTION_PREVIOUS_VIEW_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { previousViewAction(); } }); previousViewAction.setKeyboardShortCut(KeyboardShortcuts.previousViewActionShortcut); nextViewAction = new AnAction( ACTION_NEXT_VIEW, AnUtility.nextViewIcon, ACTION_NEXT_VIEW_TT, ACTION_NEXT_VIEW_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { nextViewAction(); } }); nextViewAction.setKeyboardShortCut(KeyboardShortcuts.nextViewActionShortcut); viewsSettingsAction = new AnAction( ACTION_VIEWS_SETTINGS, null, ACTION_VIEWS_SETTINGS_TT, ACTION_VIEWS_SETTINGS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { viewsSettingsAction(); } }); viewsSettingsAction.setKeyboardShortCut(KeyboardShortcuts.viewsSettingsActionShortcut); metricsSettingsAction = new AnAction( ACTION_METRICS_SETTINGS, null, ACTION_METRICS_SETTINGS_TT, ACTION_METRICS_SETTINGS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { metricsSettingsAction(); } }); metricsSettingsAction.setKeyboardShortCut(KeyboardShortcuts.metricsSettingsShortcut); addRemoveFiltersAction = new AnAction( ACTION_ADD_REMOVE_FILTERS, AnUtility.filt_icon, ACTION_ADD_REMOVE_FILTERS_TT, ACTION_ADD_REMOVE_FILTERS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { addRemoveFiltersAction(e.getSource()); } }); libraryVisibilityAction = new AnAction( ACTION_LIBRARY_VISIBILITY, AnUtility.epcl_icon, ACTION_LIBRARY_VISIBILITY_TT, ACTION_LIBRARY_VISIBILITY_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { libraryVisibilityAction(); } }); libraryVisibilityAction.setKeyboardShortCut(KeyboardShortcuts.libraryVisibilityActionShortcut); libraryVisibilityAction.setMnemonic(AnLocale.getString('L', "ACTION_LIBRARY_VISIBILITY_MN")); functionColorsAction = new AnAction( ACTION_FUNCTION_COLORS, AnUtility.colr_icon, ACTION_FUNCTION_COLORS_TT, ACTION_FUNCTION_COLORS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { functionColorsAction(); } }); functionColorsAction.setKeyboardShortCut(KeyboardShortcuts.functionColorsActionShortcut); functionColorsAction.setMnemonic(AnLocale.getString('C', "ACTION_FUNCTION_COLORS_MN")); settingsAction = new AnAction( ACTION_SETTINGS, AnUtility.gear_icon, ACTION_SETTINGS_TT, ACTION_SETTINGS_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { settingsAction(); } }); settingsAction.setKeyboardShortCut(KeyboardShortcuts.settingsActionShortcut); settingsAction.setMnemonic(AnLocale.getString('S', "ACTION_SETTINGS_MN")); exportSettingsAction = new AnAction( ACTION_EXPORT_SETTINGS, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { exportSettingsAction(); } }); exportSettingsAction.setKeyboardShortCut(KeyboardShortcuts.exportSettingsActionShortcut); exportSettingsAction.setMnemonic(AnLocale.getString('x', "ACTION_EXPORT_SETTINGS_MN")); ; importSettingsAction = new AnAction( ACTION_IMPORT_SETTINGS, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { importSettingsAction(); } }); importSettingsAction.setMnemonic(AnLocale.getString('i', "ACTION_IMPORT_SETTINGS_MN")); ; importSettingsAction.setKeyboardShortCut(KeyboardShortcuts.importSettingsActionShortcut); exportSettingsAsAction = new AnAction( ACTION_EXPORT_SETTINGS_AS, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { exportSettingsAsAction(); } }); exportSettingsAsAction.setMnemonic(AnLocale.getString('A', "ACTION_EXPORT_SETTINGS_AS_MN")); helpAnalyzerAction = new AnAction( ACTION_HELP_PERFORMANCE_ANALYZER, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpAnalyzerAction(); } }); helpAnalyzerAction.setMnemonic(AnLocale.getString('P', "ACTION_HELP_PERFORMANCE_ANALYZER_MN")); helpNewFeaturesAction = new AnAction( ACTION_HELP_NEW_FEATURES, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpNewFeaturesAction(); } }); helpNewFeaturesAction.setMnemonic(AnLocale.getString('N', "ACTION_HELP_NEW_FEATURES_MN")); helpInformationMapAction = new AnAction( ACTION_HELP_INFORMATION_MAP, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpInformationMapAction(); } }); helpInformationMapAction.setMnemonic(AnLocale.getString('I', "ACTION_HELP_INFORMATION_MAP_MN")); helpKeyboardShortcutsAction = new AnAction( ACTION_HELP_KEYBOARD_SHORTCUTS, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpKeyboardShortcutsAction(); } }); helpKeyboardShortcutsAction.setMnemonic( AnLocale.getString('K', "ACTION_HELP_KEYBOARD_SHORTCUTS_MN")); helpShortcutsAction = new AnAction( ACTION_HELP_SHORTCUTS, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpShortcutsAction(); } }); helpShortcutsAction.setMnemonic(AnLocale.getString('S', "ACTION_HELP_SHORTCUTS_MN")); helpTroubleShootingAction = new AnAction( ACTION_HELP_TROUBLESHOOTING, null, ACTION_HELP_TT, ACTION_HELP_AC, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { helpTroubleShootingAction(); } }); helpTroubleShootingAction.setMnemonic( AnLocale.getString('r', "ACTION_HELP_TROUBLESHOOTING_MN")); aboutAnalyzerAction = new AnAction( ACTION_ABOUT_ANALYZER, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { aboutAnalyzerAction(); } }); aboutAnalyzerAction.setMnemonic(AnLocale.getString('A', "ACTION_ABOUT_ANALYZER_MN")); } private ToolBarPanel initToolBarPanel() { return new ToolBarPanel(initToolBar()); } // Initialize tool bar area private JToolBar initToolBar() { JToolBar toolBar = new JToolBar(); AnUtility.setAccessibleContext(toolBar.getAccessibleContext(), AnLocale.getString("Toolbar")); toolBar.setBorder(null); toolBar.setOpaque(false); toolBar.add(profileApplicationAction.createActionButton()); toolBar.add(openExperimentAction.createActionButton()); toolBar.add(compareExperimentsAction.createActionButton()); toolBar.add(aggregateExperimentsAction.createActionButton()); toolBar.add(connectAction.createActionButton()); toolBar.add(new ToolBarSeparator(8, 7)); toolBar.add(addRemoveFiltersAction.createActionButton()); toolBar.add(libraryVisibilityAction.createActionButton()); toolBar.add(settingsAction.createActionButton()); // View mode toolBar.add(viewModeSeparator = new ToolBarSeparator(7, 11)); viewModeLabel = new JLabel(AnLocale.getString("View Mode: ")); viewModeLabel.setDisplayedMnemonic(AnLocale.getString('d', "ViewMode")); toolBar.add(viewModeLabel); String viewModeComboBoxName = AnLocale.getString("View Mode: "); String viewModeComboBoxDesc = AnLocale.getString("Select View Mode"); String viewModeComboBoxTT = AnLocale.getString( "The View Mode setting controls the processing of Java experiments and OpenMP" + " experiments"); viewModeComboBox = new JComboBox<ViewMode>(); viewModeLabel.setLabelFor(viewModeComboBox); viewModeComboBox.setFont(viewModeComboBox.getFont().deriveFont(Font.PLAIN)); viewModeComboBox.setToolTipText(viewModeComboBoxTT); viewModeComboBox.getAccessibleContext().setAccessibleName(viewModeComboBoxName); viewModeComboBox.getAccessibleContext().setAccessibleDescription(viewModeComboBoxDesc); viewModeComboBox.addItem(ViewModeSetting.ViewMode.USER); viewModeComboBox.addItem(ViewModeSetting.ViewMode.EXPERT); viewModeComboBox.addItem(ViewModeSetting.ViewMode.MACHINE); viewModeComboBox.setSelectedIndex(0); viewModeComboBox.setPreferredSize(new Dimension(viewModeComboBox.getPreferredSize().width, 20)); viewModeComboBox.setMaximumSize(viewModeComboBox.getPreferredSize()); viewModeComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { ViewMode viewMode = (ViewMode) viewModeComboBox.getSelectedItem(); getSettings().getViewModeSetting().set(this, viewMode); } @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); toolBar.add(viewModeComboBox); toolBar.add(viewModeFiller = new ToolBarFiller(5)); updateViewModeVisibility(false); return toolBar; } // Initialize menu items private void initMenus() { // File Menu menuBar.add(fileMenu = new JMenu(AnLocale.getString("File"))); AnUtility.setAccessibleContext(fileMenu.getAccessibleContext(), fileMenu.getText()); fileMenu.setMnemonic(AnLocale.getString('F', "MNEM_MENU_FILE")); fileMenu.add(profileApplicationAction.getMenuItem()); fileMenu.add(profileRunningProcessAction.getMenuItem()); fileMenu.add(profileKernelAction.getMenuItem()); fileMenu.addSeparator(); fileMenu.add(openExperimentAction.getMenuItem()); fileMenu.add(initOpenRecentExperiments()); fileMenu.add(compareExperimentsAction.getMenuItem()); fileMenu.add(aggregateExperimentsAction.getMenuItem()); fileMenu.add(showErrorsWarningsSeparator = new JSeparator()); fileMenu.add(showErrorsWarningsMenuItem = showErrorsWarningsAction.getMenuItem()); fileMenu.addSeparator(); fileMenu.add(connectAction.getMenuItem()); fileMenu.add(exportAction.getMenuItem()); fileMenu.addSeparator(); fileMenu.add(exitAction.getMenuItem()); // Views Menu. Note: this menu is dynamic menuBar.add(viewsMenu = new JMenu(AnLocale.getString("Views"))); AnUtility.setAccessibleContext(viewsMenu.getAccessibleContext(), viewsMenu.getText()); viewsMenu.setMnemonic(AnLocale.getString('V', "MNEM_MENU_VIEWS")); viewsMenu.addMenuListener(new ViewsMenuListener(viewsMenu)); // Metrics Menu. Note: this menu is dynamic menuBar.add(metricsMenu = new JMenu(AnLocale.getString("Metrics"))); AnUtility.setAccessibleContext(metricsMenu.getAccessibleContext(), metricsMenu.getText()); metricsMenu.setMnemonic(AnLocale.getString('M', "MNEM_MENU_METRICS")); metricsMenu.addMenuListener(new MetricsMenuListener(metricsMenu)); // Tools Menu menuBar.add(toolsMenu = new JMenu(AnLocale.getString("Tools"))); AnUtility.setAccessibleContext(toolsMenu.getAccessibleContext(), toolsMenu.getText()); toolsMenu.setMnemonic(AnLocale.getString('T', "MNEM_MENU_TOOLS")); filtersMenu = new JMenu(AnLocale.getString("Filters")); AnUtility.setAccessibleContext(filtersMenu.getAccessibleContext(), filtersMenu.getText()); filtersMenu.setMnemonic(AnLocale.getString('F', "MNEM_MENU_FILTER")); filtersMenu.setIcon(AnUtility.filt_icon); toolsMenu.add(filtersMenu); filtersMenu.addMenuListener( new MenuListener() { @Override public void menuSelected(MenuEvent e) { filtersMenu.removeAll(); JPopupMenu popup = getViews().getCurrentViewDisplay().getFilterPopup(); if (popup == null) { popup = getViews().getCurrentViewDisplay().getDefaultFilterPopup(); } Component[] components = popup.getComponents(); for (Component component : components) { filtersMenu.add(component); } } @Override public void menuDeselected(MenuEvent e) {} @Override public void menuCanceled(MenuEvent e) {} }); toolsMenu.add(libraryVisibilityAction.getMenuItem()); toolsMenu.add(functionColorsAction.getMenuItem()); toolsMenu.add(settingsAction.getMenuItem()); toolsMenu.addSeparator(); toolsMenu.add(exportSettingsAction.getMenuItem()); toolsMenu.add(importSettingsAction.getMenuItem()); toolsMenu.add(exportSettingsAsAction.getMenuItem()); // Help menu menuBar.add(helpMenu = new JMenu(AnLocale.getString("Help", "MENU_HELP"))); AnUtility.setAccessibleContext(helpMenu.getAccessibleContext(), helpMenu.getText()); helpMenu.setMnemonic(AnLocale.getString('H', "MNEM_MENU_HELP")); helpMenu.add(helpAnalyzerAction.getMenuItem()); helpMenu.add(helpNewFeaturesAction.getMenuItem()); helpMenu.add(helpInformationMapAction.getMenuItem()); helpMenu.add(helpKeyboardShortcutsAction.getMenuItem()); helpMenu.add(helpShortcutsAction.getMenuItem()); helpMenu.add(helpTroubleShootingAction.getMenuItem()); helpAnalyzerAction.setEnabled(false); helpNewFeaturesAction.setEnabled(false); helpInformationMapAction.setEnabled(false); helpKeyboardShortcutsAction.setEnabled(false); helpShortcutsAction.setEnabled(false); helpTroubleShootingAction.setEnabled(false); helpMenu.addSeparator(); helpMenu.add(aboutAnalyzerAction.getMenuItem()); } private JMenu initOpenRecentExperiments() { recentExperimentsMenu = new JMenu(AnLocale.getString("Open Recent Experiment")); AnUtility.setAccessibleContext( recentExperimentsMenu.getAccessibleContext(), recentExperimentsMenu.getText()); recentExperimentsMenu.setMnemonic(AnLocale.getString('n', "MNEM_MENU_OPEN_RECENT_EXPERIMENT")); recentExperimentsMenu.addMenuListener( new MenuListener() { @Override public void menuSelected(MenuEvent e) { recentExperimentsMenu.removeAll(); List<ExperimentPickListElement> paths = UserPref.getInstance() .getExperimentsPicklists() .getPicklist() .getRecentExperiments(20); // Collections.sort(paths, new Comparator<ExperimentPickListElement>() { // @Override // public int compare(ExperimentPickListElement f1, // ExperimentPickListElement f2) { // String f11 = AnUtility.basename(f1.getPath()); // String f22 = AnUtility.basename(f2.getPath()); // return f11.toString().compareTo(f22.toString()); // } // }); for (ExperimentPickListElement experimentElement : paths) { String name = AnUtility.basename(experimentElement.getPath()); JMenuItem menuItem = new JMenuItem(name); AnUtility.setAccessibleContext(menuItem.getAccessibleContext(), " "); if (experimentElement.getPath().endsWith("erg")) { menuItem.setIcon( new ImageIcon( getClass() .getResource( "/org/gprofng/mpmt/icons/expgroup.png"))); // FIXUP: make // static } else { menuItem.setIcon( new ImageIcon( getClass() .getResource( "/org/gprofng/mpmt/icons/experiment.png"))); // FIXUP: make // static } menuItem.setActionCommand(experimentElement.getPath()); menuItem.setToolTipText(experimentElement.getToolTip()); menuItem.addActionListener(new RecentExperimentActionListener(experimentElement)); recentExperimentsMenu.add(menuItem); } if (!paths.isEmpty()) { recentExperimentsMenu.addSeparator(); JMenuItem clearMenuItem = new JMenuItem(AnLocale.getString("Clear Recent History")); AnUtility.setAccessibleContext( clearMenuItem.getAccessibleContext(), clearMenuItem.getText()); clearMenuItem.setMnemonic(AnLocale.getString('C', "ClearRecentHistoryMenuMN")); clearMenuItem.addActionListener(new ClearRecentHistoryActionListener()); recentExperimentsMenu.add(clearMenuItem); } } // @Override @Override public void menuDeselected(MenuEvent e) {} // @Override @Override public void menuCanceled(MenuEvent e) {} }); return recentExperimentsMenu; } private class ClearRecentHistoryActionListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { String asWhenClosedConfigDirPath = UserPref.getAsWhenClosedConfigDirPath(); File[] files = new File(asWhenClosedConfigDirPath).listFiles(); for (File file : files) { file.delete(); } UserPref.getInstance().getExperimentsPicklists().getPicklist().removeAllElements(); saveAnalyzerSettings(); } } private class RecentExperimentActionListener implements ActionListener { ExperimentPickListElement experimentPickListElement; public RecentExperimentActionListener(ExperimentPickListElement experimentPickListElement) { this.experimentPickListElement = experimentPickListElement; } @Override public void actionPerformed(ActionEvent e) { ArrayList<String> list = new ArrayList<>(); list.add(experimentPickListElement.getPath()); String confPath; boolean always; if (experimentPickListElement.getConfPath() != null) { confPath = experimentPickListElement.getConfPath(); always = true; } else { confPath = UserPref.getAsWhenClosedConfigPath(experimentPickListElement.getPath()); always = false; } loadExperimentList( list, false, experimentPickListElement.getWorkingDirectory(), true, confPath, always); } } /** Called after startup */ private void initViewsAndOtherComponents() { // System.out.println("initViewsAndOtherComponents"); // Misc filters = new Filters(this, frame); experimentProperties = new Experiments(this); settings = new Settings(this, frame); colorChooser = new AnColorChooser(this, frame); summaryPanel = new SummaryPanel(); // Views viewDisplayPanel = new ViewDisplayPanel(); AccessibleContext context = viewDisplayPanel.getAccessibleContext(); String loc_string = AnLocale.getString("gprofng Main Window"); context.setAccessibleName(loc_string); context.setAccessibleDescription(loc_string); standardDisplayList = new ArrayList<>(); // welcomeDisp pane welcomeView = new WelcomeView(); standardDisplayList.add(welcomeView); // Overview view overviewView = new OverviewView(); standardDisplayList.add(overviewView); // functions view functionsView = new FunctionsView(); standardDisplayList.add(functionsView); // caller-callee view callerCalleesView = new CallerCalleesView(); standardDisplayList.add(callerCalleesView); // Call Tree view callTreeView = new CallTreeView(); standardDisplayList.add(callTreeView); // Flame view flameView = new FlameView(); // flameView = new FlameViewCallTreeIPC(); standardDisplayList.add(flameView); // Source view sourceView = new SourceView(); standardDisplayList.add(sourceView); // Disassembly view disassemblyView = new DisassemblyView(); standardDisplayList.add(disassemblyView); // Lines view linesView = new LinesView(); standardDisplayList.add(linesView); // PCs view pcsView = new PCsView(); standardDisplayList.add(pcsView); // DataLayout view dataLayoutView = new DataLayoutView(); standardDisplayList.add(dataLayoutView); // DataObjects view dataObjectsView = new DataObjectsView(); standardDisplayList.add(dataObjectsView); // IO view ioView = new IOView(); standardDisplayList.add(ioView); // Heap view heapView = new HeapView(); standardDisplayList.add(heapView); // Statistics view statisticsView = new StatisticsView(); standardDisplayList.add(statisticsView); // Source/Disassembly view sourceDisassemblyView = new SourceDisassemblyView(); standardDisplayList.add(sourceDisassemblyView); // Experiments view experimentsView = new ExperimentsView(); standardDisplayList.add(experimentsView); // Timeline view timelineView = new TimelineView(); standardDisplayList.add(timelineView); // Dual Source view dualSourceView = new DualSourceView(); standardDisplayList.add(dualSourceView); // Instruction Frequency view instructionFrequencyView = new InstructionFrequencyView(); standardDisplayList.add(instructionFrequencyView); // Called By Calls Source view calledByCallsSourceView = new CalledByCallsSourceView(); standardDisplayList.add(calledByCallsSourceView); // Called By Calls Disassembly view calledByCallsDisassemblyView = new CalledByCallsDisassemblyView(); standardDisplayList.add(calledByCallsDisassemblyView); // Called By Calls Functions view calledByCallsFunctionsView = new CalledByCallsFunctionsView(); standardDisplayList.add(calledByCallsFunctionsView); } private JPanel initCenterPanel() { mainViewPanel = new MainViewPanel(); navigationPanel = new NavigationPanel(this); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; centerPanelSplit = new JPanel(new BorderLayout()); centerPanelSplit.add(mainViewPanel, BorderLayout.CENTER); JPanel centerPanelNoSplitOrSplit = new JPanel(new GridBagLayout()); centerPanelNoSplitOrSplit.setBorder( BorderFactory.createMatteBorder( 5, 0, 5, 4, AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR)); centerPanelNoSplitOrSplit.add(centerPanelSplit, gridBagConstraints); navigationPanelSplitPane = new AnSplitPane( JSplitPane.HORIZONTAL_SPLIT, navigationPanel, centerPanelNoSplitOrSplit, UserPref.getInstance().getNavigationPanelDividerPosition()); centerPanel = new JPanel(new GridBagLayout()); centerPanel.add(navigationPanelSplitPane, gridBagConstraints); navigationPanelSplitPane.setHidden(true); mainViewPanel.getMainview().add(viewDisplayPanel); return centerPanel; } private StatusPanel initStatusPanel() { statusPanel = new StatusPanel(); // Table status tableStatusHandle = StatusHandleFactory.createStatusLabel( this, "", AnLocale.getString("Selected row(s)/Total rows"), StatusPanel.Orientation.RIGHT); // Progress status systemProgressPanel = new SystemProgressPanel(); StatusHandleFactory.createStatusComponent( this, systemProgressPanel, StatusPanel.Orientation.RIGHT); // Local Host status localHostStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Local Host"), AnLocale.getString("Local Host"), null); String localHost = analyzer.getLocalHostName(); if (localHost != null) { localHostStatusHandle.update(AnUtility.getShortString(analyzer.getLocalHostName(), 30)); } localHostStatusHandle.setVisible(true); final KeyStroke statusFocusShortCut = KeyboardShortcuts.statusAreaShortCut; localHostStatusHandle .getTextLabel() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(statusFocusShortCut, statusFocusShortCut); localHostStatusHandle .getTextLabel() .getActionMap() .put( statusFocusShortCut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { localHostStatusHandle.getTextLabel().requestFocus(); } }); // Remote Host status remoteHostStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Remote Host"), AnLocale.getString("Connect to remote host...") + AnUtility.keyStrokeToStringFormatted(KeyboardShortcuts.connectActionShortcut), new ActionListener() { // @Override @Override public void actionPerformed(ActionEvent e) { connectAction(); } }); remoteHostStatusHandle.update("localhost"); if (!Analyzer.getInstance().IPC_started) { remoteHostStatusHandle.update(""); /* "not connected" */ } // Working Directory workingDirectoryStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Working Directory"), AnLocale.getString("Current working directory"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String currentWD = analyzer.getWorkingDirectory(); // AnChooser chooser = new AnChooser(frame, AnChooser.DIR_CHOOSER, // AnWindow.this, (boolean)false, (String)currentWD); AnChooser chooser = getAnChooser( AnLocale.getString("Working Directory"), AnChooser.DIR_CHOOSER, currentWD); int res = chooser.showDialog(frame, null); if (res == AnChooser.APPROVE_OPTION) { File wdFile = chooser.getSelectedAnFile(); String wd = wdFile.getAbsolutePath(); AnUtility.checkIPCOnWrongThread(false); analyzer.setWorkingDirectory(wd); // IPC call AnUtility.checkIPCOnWrongThread(true); // readRCFile(".er.rc"); // IPC call // viewMode = null; // Clean cache <=== FIXUP: need to refresh // other states too.... } } }); updateWorkingDirectoryStatus(); // Compare status compareStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Compare"), AnLocale.getString("Compare experiments...") + AnUtility.keyStrokeToStringFormatted( KeyboardShortcuts.compareExperimentsActionShortcut), new ActionListener() { // @Override @Override public void actionPerformed(ActionEvent e) { compareExperimentsAction(); } }); updateCompareModeStatus(); // Filter status filterStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Filters"), AnLocale.getString("Add or remove filters"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getViews() .getCurrentViewDisplay() .showFilterPopup(filterStatusHandle.getValueLabel()); } }); filterStatusHandle.update(AnLocale.getString("off")); // Dump if (GUITesting.getInstance().guiTestingExtraEnabled()) { debugStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, AnLocale.getString("Debug"), AnLocale.getString("Debug(GUI testing)"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String dump; // dump = GUITesting.getInstance().dumpMainview(); // System.out.println(dump); // dump = GUITesting.getInstance().dumpViewsVisibility(); // System.out.println(dump); // dump = GUITesting.getInstance().dumpSubviews(); // System.out.println(dump); // // System.out.println(""); //// AnEventManager.getInstance().fireAnChangeEvent(new // AnChangeEvent(this, AnChangeEvent.Type.DEBUG)); //// AnEventManager.getInstance().fireAnChangeEvent(new // AnChangeEvent(this, AnChangeEvent.Type.TEST1)); // AnUtility.dispatchOnAWorkerThread(new // IPCTester.IPCTestSender(), "CCSender"); // IPCLogger.setIpcDelay(500); // int dtype = getViews().getCurrentViewDisplay().getType(); // getSettings().getMetricsSetting().dumpMetricsByDType(dtype); // getSettings().getMetricsSetting().dump(); // getSettings().getMetricsSetting().dumpSelections(); // getSettings().getMetricsSetting().getMetricStates().dump(); // // // System.out.println(GUITesting.getInstance().dumpAvailableViews()); // // AnTable.setUseAllHeaderPanel(!AnTable.isUseAllHeaderPanel()); // getSettings().getTableSettings().setWrapMetricNames(this, // !getSettings().getTableSettings().wrapMetricNames()); // // AnDisplay currentAnDisplay = // getViews().getCurrentViewDisplay(); // int dtype = currentAnDisplay.getType(); // int mtype = MetricsSetting.dtype2mtype(dtype); // System.out.println(String.format("%2d", dtype) + " " + mtype // + " " + currentAnDisplay.getAnDispTab().getTName() + " " + // currentAnDisplay.getAnDispTab().getTCmd()); // FilterClause clause = new FilterClause("1", "1", "1", // FilterClause.Kind.STANDARD); // getFilters().addClause(clause, false); System.out.println(GUITesting.getInstance().dumpMainview(7)); } }); } // Error/Warning status showErrorsWarningsStatusHandle = StatusHandleFactory.createStatusLabelValue( this, null, null, AnLocale.getString( "Experiment has errors or warnings. Click for details... (Ctrl+Shift-W)"), getShowErrorsWarningsAction()); showErrorsWarningsStatusHandle.setVisible(false); // Focus (tab) traversal localHostStatusHandle .getTextLabel() .setNextFocusableComponent(localHostStatusHandle.getValueLabel()); localHostStatusHandle .getValueLabel() .setNextFocusableComponent(remoteHostStatusHandle.getTextLabel()); remoteHostStatusHandle .getTextLabel() .setNextFocusableComponent(remoteHostStatusHandle.getValueLabel()); remoteHostStatusHandle .getValueLabel() .setNextFocusableComponent(workingDirectoryStatusHandle.getTextLabel()); workingDirectoryStatusHandle .getTextLabel() .setNextFocusableComponent(workingDirectoryStatusHandle.getValueLabel()); workingDirectoryStatusHandle .getValueLabel() .setNextFocusableComponent(compareStatusHandle.getTextLabel()); compareStatusHandle .getTextLabel() .setNextFocusableComponent(compareStatusHandle.getValueLabel()); compareStatusHandle .getValueLabel() .setNextFocusableComponent(filterStatusHandle.getTextLabel()); filterStatusHandle.getTextLabel().setNextFocusableComponent(filterStatusHandle.getValueLabel()); filterStatusHandle .getValueLabel() .setNextFocusableComponent(showErrorsWarningsStatusHandle.getTextLabel()); showErrorsWarningsStatusHandle .getTextLabel() .setNextFocusableComponent(showErrorsWarningsStatusHandle.getValueLabel()); return statusPanel; } public StatusLabelHandle getTableStatusHandle() { return tableStatusHandle; } public SystemProgressPanel getSystemProgressPanel() { return systemProgressPanel; } /** Called when IPC successfully started when connecting or re-connecting (remote). */ public void initializeAfterIPCStarted() { if (!analyzer.IPC_started) { return; } initView(0, -1); analyzer.initWorkingDirectory(); updateWorkingDirectoryStatus(); } // ********************************************************************************************** private void updateViews(ViewsSetting.Setting oldSetting, ViewsSetting.Setting newSetting) { AnUtility.checkIfOnAWTThread(true); if (ViewsSetting.viewsChanged(oldSetting, newSetting)) { addVisibleViewsInternal(); } updateSelectedDisplay(); } private void updateViewMode() { viewModeComboBox.setSelectedItem(getSettings().getViewModeSetting().get()); } private void updateViewModeVisibility() { boolean visible = getSettings().getViewModeEnabledSetting().isViewModeEnabled(); updateViewModeVisibility(visible); } private void updateViewModeVisibility(boolean val) { AnUtility.checkIfOnAWTThread(true); viewModeSeparator.setVisible(val); viewModeLabel.setVisible(val); viewModeComboBox.setVisible(val); viewModeFiller.setVisible(val); } /** * @return the filters */ public Filters getFilters() { return filters; } /** * @return the experimentNames */ public String[][] getExperimentGroups() { return experimentGroups; } public boolean isExperimentGroupsSimple() { String[][] groups = getExperimentGroups(); if (groups == null) { return true; } boolean simple = true; for (int i = 0; i < groups.length; i++) { if (groups[i].length > 1) { simple = false; break; } } return simple; } /** * @return whether experiments are loaded */ public boolean experimentsLoaded() { return getExperimentGroups() != null && getExperimentGroups().length > 0; } public boolean hasErrorsAndWarnings() { return hasErrorsAndWarnings; } public AnDispTab getWelcomeDispTab() { if (welcomeDispTab == null) { welcomeDispTab = new AnDispTab(AnDisplay.DSP_Welcome, "welcome", null, null); } return welcomeDispTab; } public AnDispTab getOverviewDispTab() { if (overviewDispTab == null) { overviewDispTab = new AnDispTab(AnDisplay.DSP_Overview, "overview", null, null); } return overviewDispTab; } public ViewsPanel getViewsPanel() { return getNavigationPanel().getViewsPanel(); } public ViewDisplayPanel getViews() { return viewDisplayPanel; } public NavigationPanel getNavigationPanel() { return navigationPanel; } public StatusPanel getStatusPanel() { return statusPanel; } public Analyzer getAnalyzer() { return analyzer; } public IPC IPC() { return analyzer.IPC_session; } public StatusLabelValueHandle getFilterStatusHandle() { return filterStatusHandle; } private void updateCompareModeStatus() { if (compareStatusHandle != null && getSettings() != null) { if (getSettings().getCompareModeSetting().comparingExperiments()) { compareStatusHandle.update(AnLocale.getString("on"), StatusLabelValueHandle.Mode.SET); } else { compareStatusHandle.update(AnLocale.getString("off"), StatusLabelValueHandle.Mode.DEFAULT); } } } public ToolBarPanel getToolBarPanel() { return toolBarPanel; } public void updateWorkingDirectoryStatus() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { String wd = analyzer.getWorkingDirectory(); int i = wd.lastIndexOf("/"); if (i > 0) { wd = "..." + wd.substring(i); } workingDirectoryStatusHandle.updateToolTip( AnLocale.getString("Current working directory: ") + analyzer.getWorkingDirectory()); workingDirectoryStatusHandle.update(wd); } }); } public WelcomeView getWelcomeView() { return welcomeView; } public OverviewView getOverviewView() { return overviewView; } private SummaryPanel getSummaryPanel() { return summaryPanel; } public FunctionsView getFunctionsView() { return functionsView; } public CallerCalleesView getCallerCalleesView() { return callerCalleesView; } public CallTreeView getCallTreeView() { return callTreeView; } public FlameView getFlameView() { return flameView; } public SourceDisassemblyView getSourceDisassemblyView() { return sourceDisassemblyView; } public SourceView getSourceView() { return sourceView; } public LinesView getLinesView() { return linesView; } public DisassemblyView getDisassemblyView() { return disassemblyView; } public PCsView getPcsView() { return pcsView; } public TimelineView getTimelineView() { return timelineView; } public ExperimentsView getExperimentsView() { return experimentsView; } public IOView getIOView() { return ioView; } public HeapView getHeapView() { return heapView; } public StatisticsView getStatisticsView() { return statisticsView; } public DataLayoutView getDataLayoutView() { return dataLayoutView; } public DataObjectsView getDataObjectsView() { return dataObjectsView; } public DualSourceView getDualSourceView() { return dualSourceView; } public InstructionFrequencyView getInstructionFrequencyView() { return instructionFrequencyView; } public CalledByCallsSourceView getCalledByCallsSourceView() { return calledByCallsSourceView; } public CalledByCallsDisassemblyView getCalledByCallsDisassemblyView() { return calledByCallsDisassemblyView; } public CalledByCallsFunctionsView getCalledByCallsFunctionsView() { return calledByCallsFunctionsView; } public Settings getSettings() { return settings; } public Experiments getExperimentProperties() { return experimentProperties; } class ViewsMenuListener implements MenuListener { private JMenu viewsMenu; public ViewsMenuListener(JMenu viewsMenu) { this.viewsMenu = viewsMenu; } @Override public void menuCanceled(MenuEvent e) {} @Override public void menuDeselected(MenuEvent e) {} @Override public void menuSelected(MenuEvent e) { if (experimentsLoaded()) { getViewsPanel().createViewsMenu(viewsMenu); } } } class MetricsMenuListener implements MenuListener { private JMenu metricsMenu; public MetricsMenuListener(JMenu metricsMenu) { this.metricsMenu = metricsMenu; } @Override public void menuCanceled(MenuEvent e) {} @Override public void menuDeselected(MenuEvent e) {} @Override public void menuSelected(MenuEvent e) { metricsMenu.removeAll(); if (experimentsLoaded()) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricMenuSelector(metricsMenu, getViews().getCurrentViewDisplay().getType(), true); metricsMenu.add(new JSeparator(SwingConstants.HORIZONTAL)); for (JComponent component : getSettings().getMetricsSetting().createMetricSettingsSelector()) { metricsMenu.add(component); } } } } public void welcomeViewOnly() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { List<AnDispTab> list = new ArrayList<>(); getViewsPanel().removeAllViews(); AnDispTab welcome = getWelcomeDispTab(); welcome.getTComp().setSelected(true); welcome.getTComp().setAvailable(true); list.add(welcome); getViewsPanel().createView(instance, welcome, View.Type.STATIC_VIEW); boolean[] selected = new boolean[list.size()]; for (int i = 0; i < selected.length; i++) { selected[i] = true; } getSettings().getViewsSetting().init(this, list, selected, welcome.getTCmd()); addVisibleViews(); showHideNavigationAndSubviews(welcome.getTComp()); } }); } private void welcomeAndOverviewViewsOnly() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { List<AnDispTab> list = new ArrayList<>(); getViewsPanel().removeAllViews(); AnDispTab welcome = getWelcomeDispTab(); welcome.getTComp().setAvailable(true); list.add(welcome); getViewsPanel().createView(instance, welcome, View.Type.STATIC_VIEW); AnDispTab overview = getOverviewDispTab(); overview.getTComp().setAvailable(true); overview.getTComp().setSelected(true); list.add(overview); getViewsPanel().createView(instance, overview, View.Type.STATIC_VIEW); boolean[] selected = new boolean[list.size()]; for (int i = 0; i < selected.length; i++) { selected[i] = true; } getSettings().getViewsSetting().init(this, list, selected, overview.getTCmd()); addVisibleViews(); showHideNavigationAndSubviews(overview.getTComp()); } }); } /** Called every time an experimentsDisp is loaded */ private void resetSubviews() { hideAllSubviews(); if (selectedDetailsSubview == null) { createSubviews(); } getTimelineCallStackSubview().setReadyToShow(false); getIoCallStackSubview().setReadyToShow(false); getHeapCallStackSubview().setReadyToShow(false); } /** Called only once */ private void createSubviews() { selectedDetailsSubview = new Subview( "selectedDetailsSubview", AnLocale.getString("Selection Details"), getSummaryPanel(), MainViewPanel.SubviewArea.SUBVIEW_AREA_1); selectedDetailsSubviewTimeLine = new Subview( "selectedDetailsSubviewTimeLine", AnLocale.getString("Selection Details "), getTimelineView().getDetailsInfoTabComp(), MainViewPanel.SubviewArea.SUBVIEW_AREA_1); timelineCallStackSubview = new Subview( "timelineCallStackSubview", getTimelineView().getStackInfoTabName(), getTimelineView().getStackInfoTabComp(), MainViewPanel.SubviewArea.SUBVIEW_AREA_3); ioCallStackSubview = new Subview( "ioCallStackSubview", getIOView().getStackInfoTabName(), getIOView().getStackInfoTabComp(), MainViewPanel.SubviewArea.SUBVIEW_AREA_3); heapCallStackSubview = new Subview( "heapCallStackSubview", getHeapView().getStackInfoTabName(), getHeapView().getStackInfoTabComp(), MainViewPanel.SubviewArea.SUBVIEW_AREA_3); calledByCallsSrcSubview = new Subview( "calledByCallsSrcSubview", AnLocale.getString("Called-by / Calls"), getCalledByCallsSourceView(), MainViewPanel.SubviewArea.SUBVIEW_AREA_2); calledByCallsDisSubview = new Subview( "calledByCallsDisSubview", AnLocale.getString("Called-by / Calls"), getCalledByCallsDisassemblyView(), MainViewPanel.SubviewArea.SUBVIEW_AREA_2); calledByCallsFuncSubview = new Subview( "calledByCallsFuncSubview", AnLocale.getString("Called-by / Calls"), getCalledByCallsFunctionsView(), MainViewPanel.SubviewArea.SUBVIEW_AREA_2); // Add all subviews to list subviewList.clear(); subviewList.add(selectedDetailsSubview); subviewList.add(selectedDetailsSubviewTimeLine); subviewList.add(timelineCallStackSubview); subviewList.add(ioCallStackSubview); subviewList.add(heapCallStackSubview); subviewList.add(calledByCallsSrcSubview); subviewList.add(calledByCallsDisSubview); subviewList.add(calledByCallsFuncSubview); } private void hideAllSubviews() { mainViewPanel.hideAllSubviews(); } public void setSubviewReadyToShow(String subviewName, boolean value) { Subview subview = mainViewPanel.findSubview(subviewName); if (subview != null && subview.isReadyToShow() != value) { subview.setReadyToShow(value); showHideNavigationAndSubviews(getViews().getCurrentViewDisplay()); } } private void showHideNavigationAndSubviews(AnDisplay anDisplay) { // show/hide subviews List<Subview> visibleSubviews = anDisplay.getVisibleSubviews(); if (visibleSubviews != null) { for (Subview subview : subviewList) { if (subview != null) { boolean visible = visibleSubviews.contains(subview); subview.showSubview(visible); } } } // set selected subviews List<Subview> selectedSubviews = anDisplay.getSelectedSubviews(); if (selectedSubviews != null) { for (Subview subview : selectedSubviews) { subview.setSelected(); } } // Toolbar JPanel toolbarPanel = anDisplay.getToolbarPanel(); if (toolbarPanel != null) { getToolBarPanel().setControls(toolbarPanel); } // Show or hide navigation area? getNavigationPanelSplitPane().setHidden(getViewsPanel().onlyWelcomeView()); // Show or hide sub view areas? mainViewPanel.showHideSubviewAreas(); return; } public void showSubview(Subview subview, boolean show) { subview.showSubview(show); mainViewPanel.showHideSubviewAreas(); // check whether to show or hide a subview area } public Subview getSelectedDetailsSubview() { return selectedDetailsSubview; } public Subview getSelectedDetailsSubviewTimeLine() { return selectedDetailsSubviewTimeLine; } public Subview getTimelineCallStackSubview() { return timelineCallStackSubview; } public Subview getIoCallStackSubview() { return ioCallStackSubview; } public Subview getHeapCallStackSubview() { return heapCallStackSubview; } public Subview getCalledByCallsSrcSubview() { return calledByCallsSrcSubview; } public Subview getCalledByCallsDisSubview() { return calledByCallsDisSubview; } public Subview getCalledByCallsFuncSubview() { return calledByCallsFuncSubview; } /** * Called when clicking on a view * * @param cmd */ public void setSelectedView(String cmd) { setSelectedViewInternal(cmd); // direct call allowing to switch views during doCompute. } /** * Called from other views when switching view. View may not be viewing. Can be called from any * thread. * * @param dtype */ public void setSelectedView(int dtype) { ViewsSetting.View view = settings.getViewsSetting().findView(dtype); if (view != null) { final String cmd = view.getAnDispTab().getTCmd(); if (!getSettings().getViewsSetting().isAvailableAndShowing(cmd)) { getSettings().getViewsSetting().toggleTab(cmd, cmd); // Will fire AnChangeEvent } else { // getSettings().getViewsSetting().setPreferredViewName(this, cmd); // Will // fire AnChangeEvent AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { setSelectedViewInternal( cmd); // direct call allowing to switch views during doCompute. } }); } } } private void setSelectedViewInternal(String cmd) { // System.out.println("setSelectedViewInternal " + cmd + " " + viewStackDirection); AnUtility.checkIfOnAWTThread(true); if (getSettings().getViewsSetting().isAvailableAndShowing(cmd)) { boolean viewChanged = viewDisplayPanel.viewComponent(cmd); if (viewChanged) { changeView(); getNavigationPanel().getViewsPanel().setSelectedComponent(cmd); } } } private void addVisibleViews() { AnUtility.checkIfOnAWTThread(true); addVisibleViewsInternal(); updateSelectedDisplay(); } private void addVisibleViewsInternal() { AnUtility.checkIfOnAWTThread(true); getNavigationPanel().getViewsPanel().resetAllViews(); List<AnDispTab> list = getSettings().getViewsSetting().getSelectedViews(); for (AnDispTab anDispTab : list) { getNavigationPanel().getViewsPanel().showView(anDispTab); } getNavigationPanel().getViewsPanel().refresh(); } private void updateSelectedDisplay() { boolean nameChanged = false; String currentViewName = getViews().getCurrentViewName(); String preferredViewName = getSettings().getViewsSetting().getPreferredViewName(); String newPreferredViewName = preferredViewName; if (preferredViewName != null && getSettings().getViewsSetting().isAvailableAndShowing(preferredViewName)) { newPreferredViewName = preferredViewName; nameChanged = true; } else if (currentViewName != null && getSettings().getViewsSetting().isAvailableAndShowing(currentViewName)) { newPreferredViewName = currentViewName; nameChanged = true; } else { ViewsSetting.View dataView = getSettings().getViewsSetting().getFirstDataView(); if (dataView != null) { newPreferredViewName = dataView.getAnDispTab().getTCmd(); nameChanged = true; } } if (nameChanged) { setSelectedViewInternal(newPreferredViewName); } } /** * Enable/disable session actions Called at initMetricListsByMType Called when loading * experiment(s) */ public void enableSessionActions(boolean loadingExperiments, boolean experimentsLoaded) { AnUtility.checkIfOnAWTThread(true); boolean connected = Analyzer.getInstance().isConnected(); // Hide if no experiment and during experiment loading filterStatusHandle.setVisible(!loadingExperiments && experimentsLoaded); // Hide during experiment loading compareStatusHandle.setVisible(!loadingExperiments); workingDirectoryStatusHandle.setVisible(!loadingExperiments); if (debugStatusHandle != null) { debugStatusHandle.setVisible(!loadingExperiments); } // Disable during experiment loading connectAction.setEnabled(!loadingExperiments && Analyzer.getInstance().connectingToRemoteHostEnabled); remoteHostStatusHandle.setEnabled(!loadingExperiments); // Disable during experiment loading and enabled only if connected profileApplicationAction.setEnabled(!loadingExperiments && connected); profileKernelAction.setEnabled( !loadingExperiments && connected && Analyzer.getInstance().isKernelProfilingEnabled()); profileRunningProcessAction.setEnabled(!loadingExperiments && connected && Analyzer.getInstance().profileRunningProcessEnabled); openExperimentAction.setEnabled(!loadingExperiments && connected); recentExperimentsMenu.setEnabled(!loadingExperiments && connected); compareExperimentsAction.setEnabled(!loadingExperiments && connected); aggregateExperimentsAction.setEnabled(!loadingExperiments && connected); // Disable during experiment loading and enabled only if experiments loaded metricsMenu.setEnabled(!loadingExperiments && experimentsLoaded); settingsAction.setEnabled(!loadingExperiments && experimentsLoaded); viewsSettingsAction.setEnabled(!loadingExperiments && experimentsLoaded); metricsSettingsAction.setEnabled(!loadingExperiments && experimentsLoaded); addRemoveFiltersAction.setEnabled(!loadingExperiments && experimentsLoaded); filtersMenu.setEnabled(!loadingExperiments && experimentsLoaded); libraryVisibilityAction.setEnabled(!loadingExperiments && experimentsLoaded); functionColorsAction.setEnabled(!loadingExperiments && experimentsLoaded); exportSettingsAction.setEnabled(!loadingExperiments && experimentsLoaded); importSettingsAction.setEnabled(!loadingExperiments && experimentsLoaded); exportSettingsAsAction.setEnabled(!loadingExperiments && experimentsLoaded); exportAction.setEnabled(!loadingExperiments && experimentsLoaded); showErrorsWarningsAction.setEnabled( !loadingExperiments && experimentsLoaded && hasErrorsAndWarnings()); showErrorsWarningsSeparator.setVisible( !loadingExperiments && experimentsLoaded && hasErrorsAndWarnings()); showErrorsWarningsMenuItem.setVisible( !loadingExperiments && experimentsLoaded && hasErrorsAndWarnings()); } /** Enable/disable per-view actions Called when switching view */ private void enablePerViewActions(AnDisplay currentDisplay) { getToolBarPanel().getFindTextPanel().setConrolsEnabled(currentDisplay.supportsFindText()); exportAction.setEnabled(currentDisplay instanceof ExportSupport); previousViewAction.setEnabled(getNavigationPanel().getViewsPanel().hasPreviousViewName()); nextViewAction.setEnabled(getNavigationPanel().getViewsPanel().hasNextViewName()); } public JFrame getFrame() { return frame; } public MainViewPanel getMainViewPanel() { return mainViewPanel; } public JPanel getMainPanel() { return mainPanel; } public AnSplitPane getNavigationPanelSplitPane() { return navigationPanelSplitPane; } public View getSelectedView() { return getViewsPanel().getSelectedViewPanel().getView(); } public AnColorChooser getColorChooser() { return colorChooser; } public LibraryVisibilityDialog getLibraryVisibilityDialog() { // Create dialog if it is not created yet if (libraryVisibilityDialog == null) { libraryVisibilityDialog = new LibraryVisibilityDialog(getFrame()); } return libraryVisibilityDialog; } // AnColorChooser calls this //XXXmpview bogus! // FIXUP: REARCH public void setCPUIdleColor(final boolean set, final Color color) { getTimelineView().setCPUIdleColor(set, color); } // Export main view as text private String exportAsText(Integer limit, ExportFormat format, Character delimiter) { String text = getViews().getCurrentViewDisplay().exportAsText(limit, format, delimiter); // Export subviews if format is TEXT if (format == ExportFormat.TEXT) { // text += ... } return text; } /** * GUI testing. Use GUITesting.dumpMainview * * @param maxLines * @return */ public String dumpMainview(int maxLines) { String text = exportAsText(maxLines, ExportFormat.TEXT, null); return text; } /** * GUI testing. Use GUITesting.dumpSubviews * * @return */ public String dumpSubviews() { StringBuilder buf = new StringBuilder(); buf.append(getMainViewPanel().dumpSubviews()); return buf.toString(); } /** * GUI testing. Use GUITesting.dumpViewsVisibility() * * @return */ public String dumpViewsVisibility() { StringBuilder buf = new StringBuilder(); buf.append(getMainViewPanel().dumpMainviewAreaVisibility()); buf.append(getMainViewPanel().dumpSubviewAreasVisibility()); return buf.toString(); } public String[][] getExperimentGroupsIPC() { synchronized (IPC.lock) { String task = "Load experiments..."; IPCContext ipcContext = IPCContext.getCurrentContext(); ipcContext.setTaskName(task); ipcContext.setCancellable(false); final IPC ipc = IPC(); ipc.send("getExperimentsGroups"); String[][] grops = (String[][]) (ipc.recvObject()); return grops; } } private void setTitle() { String experimentsTitle = null; if (getExperimentGroups() == null || getExperimentGroups().length == 0 || getExperimentGroups()[0] == null) { experimentsTitle = null; } else { StringBuilder buf = new StringBuilder(); int got = 0; outer: for (int i = 0; i < getExperimentGroups().length; i++) { for (int j = 0; j < getExperimentGroups()[i].length; j++) { if (getExperimentGroups()[i][j] != null) { if (got >= 1) { buf.append(", ..."); break outer; } buf.append(AnUtility.basename(getExperimentGroups()[i][j])); got++; } } } experimentsTitle = buf.toString(); setTitle(experimentsTitle); } } private void setTitle(String experimentsTitle) { String title = Analyzer.getAnalyzerReleaseName(); if (experimentsTitle != null) { title = experimentsTitle + " - " + title; } getFrame().setTitle(title); } private void saveExperimentSettings(String[][] groups) { // System.out.println("AnWindow:saveExperimentSettings"); if (groups != null && groups.length > 0) { String configPath = UserPref.getAsWhenClosedConfigPath(groups[0][0]); // System.out.println("AnWindow:saveExperimentSettings:configPath: " + configPath); List<UserPref.What> what = new ArrayList<>(); what.add(UserPref.What.VIEWS); what.add(UserPref.What.METRICS); what.add(UserPref.What.TIMELINE); what.add(UserPref.What.SOURCEDISASSEMBLY); what.add(UserPref.What.CALLTREE); what.add(UserPref.What.FORMATS); what.add(UserPref.What.SEARCHPATH); what.add(UserPref.What.PATHMAP); what.add(UserPref.What.FUNCTIONCOLORS); what.add(UserPref.What.LIBRARYVISIBILITY); what.add(UserPref.What.MISC); UserPref.getInstance().save(configPath, what); // Always local! UserPref.getInstance().setLastClosedExpConfPath(configPath); } } private void saveAnalyzerSettings() { List<UserPref.What> what = new ArrayList<>(); what.add(UserPref.What.USER); UserPref.getInstance().save(UserPref.getAnalyzerInitFilePath(), what); } private void restoreExperimentSettings(String confPath) { if (confPath != null) { AnLog.log("Configuration file to be processed: " + confPath); boolean homeDefaultConfiguration = confPath.startsWith(UserPref.getAnalyzerDirPath()); // home default configuration is always on local machine if (Analyzer.getInstance().isRemote() && !homeDefaultConfiguration) { confPath = AnWindow.copyFromRemote(confPath); } if (confPath != null) { UserPref.getInstance().restore(confPath); } } } /** Open and load experiment(s) from chooser */ public void openExperimentAction() { AnChooser ac = getAnChooser(AnLocale.getString("Open Experiment"), AnChooser.EXP_CHOOSER, null); int res = ac.showDialog(frame, null); if (res == AnChooser.APPROVE_OPTION) { String wd = ac.getWorkingDirectory(); String confPath = ac.getConfiguration(); boolean alwaysUseThisConf = ac.alwaysUseThisConfiguration(); List<String> expList = ac.getExperiments(); if (expList != null && expList.size() > 0) { loadExperimentList(expList, false, wd, true, confPath, alwaysUseThisConf); } } } /** * @param experimentList * @param cmpMode * @param workingDirectory * @param restartEngine * @param confPath * @param alwaysUseThisConf */ public void loadExperimentList( final List<String> experimentList, final boolean cmpMode, String workingDirectory, boolean restartEngine, String confPath, boolean alwaysUseThisConf) { String[][] arr; if (cmpMode) { arr = new String[experimentList.size()][]; for (int i = 0; i < experimentList.size(); i++) { String[] expName = new String[1]; expName[0] = experimentList.get(i); arr[i] = expName; } } else if (experimentList.size() > 0) { String[] expName = new String[experimentList.size()]; for (int i = 0; i < experimentList.size(); i++) { expName[i] = experimentList.get(i); } arr = new String[1][]; arr[0] = expName; } else { arr = new String[0][]; } loadExperimentGroups(arr, workingDirectory, restartEngine, confPath, alwaysUseThisConf); } /** * @param grops * @param workingDirectory * @param restartEngine * @param confPath * @param alwaysUseThisConf */ public void loadExperimentGroups( final String[][] grops, final String workingDirectory, final boolean restartEngine, final String confPath, final boolean alwaysUseThisConf) { AnUtility.checkIfOnAWTThread(true); AnUtility.dispatchOnAWorkerThread( () -> { synchronized (AnVariable.mainFlowLock) { loadExperimentGroupsInternal( grops, workingDirectory, restartEngine, confPath, alwaysUseThisConf); } }, "Set Experiments Thread"); } private void loadExperimentGroupsInternal( final String[][] groups, final String workingDirectory, final boolean restartEngine, final String confPath, final boolean alwaysUseThisConf) { // AnUtility.checkIfOnAWTThread(false); final boolean restart = experimentsLoaded() ? true : restartEngine; final boolean anyExperiments = groups.length > 0; final UserPref userPref = UserPref.getInstance(); AnUtility.dispatchOnSwingThread( () -> { showErrorsWarningsStatusHandle.setVisible(false); enableSessionActions(true, false); // Close all (non-modal) dialogs getSettings().showDialog(false); colorChooser.setVisible(false); saveExperimentSettings(getExperimentGroups()); if (restart) { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(groups, AnChangeEvent.Type.EXPERIMENTS_LOADING_NEW)); userPref.resetExperimentPreferences(); } else { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent( groups, AnChangeEvent.Type.EXPERIMENTS_LOADING_ADDED_OR_REMOVED)); } }); hasErrorsAndWarnings = false; IPCContext.newCurrentContext( AnLocale.getString("Loading experiment(s)..."), IPCContext.Scope.SESSION, false, AnWindow.this); Object progressBarHandle = getSystemProgressPanel().progressBarStart(AnLocale.getString("Loading Experiment(s)")); resetAllViews(); if (restart) { // <=== FIXUP: check // re-exec gp-display-text Analyzer.getInstance() .restartEngine(); // Note: do this early so it has a chance to start! FIXUP: need a way to // find out when it has starte } // getSettings().getMetricsSetting().initMetricListsByMType(); // AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { memoryIndexDisplayList = new ArrayList<>(); getFilters().resetAllFiltersAction(); setTitle(null); if (anyExperiments) { welcomeAndOverviewViewsOnly(); } else { welcomeViewOnly(); } getSettings().getViewModeEnabledSetting().init(false); updateViewModeVisibility(); resetSubviews(); } }); try { final String msg; restoreExperimentSettings(confPath); // Writes into UserPref if (anyExperiments) { try { if (workingDirectory != null) { synchronized (IPC.lock) { analyzer.setWorkingDirectory(workingDirectory); // IPC } } } catch (Exception e) { } } // Set search path and pathmap efter restart but before loading if (groups.length > 0 && !GUITesting.getInstance().isRunningUnderGUITesting()) { // Accept search path and pathmaps from .gprofng.rc if first time experiment is being loaded String experiment = groups[0][0]; String asClosedPath = UserPref.getAsWhenClosedConfigPath(experiment); if (!new File(asClosedPath).exists()) { String[][] pathMaps = PathMapSetting.getPathMapsIPC(); String[] searchPath = SearchPathSetting.getSearchPathIPC(); UserPref.getInstance().setPathmap(pathMaps); UserPref.getInstance().setSearchPath(Arrays.asList(searchPath)); } } if (groups.length > 0) { getSettings().getSearchPathSetting().init(this, UserPref.getInstance().getSearchPath()); getSettings().getPathMapSetting().init(this, UserPref.getInstance().getPathmap()); } synchronized (IPC.lock) { IPC().send("setExperimentsGroups"); IPC().send(groups); msg = IPC().recvString(); } if (msg == null) { // Experiment(s) did load but may have non-fatal errors or warnings getSettings() .getFormatSetting() .init( this, FormatSetting.Style.fromValue(userPref.getFormatsStyle()), userPref.getFormatsAppendSoName()); IPCResult compareModeIPC = CompareModeSetting.getCompareModeV2IPCRequest(); // ASYNC IPC IPCResult machineModelIPC = ViewsSetting.getMachineModelIPCRequest(); // ASYNC IPC // Capture Experiment Data Descriptors and Properties experimentProperties.ipcUpdateExps(); CompareMode compareMode = CompareMode.fromValue(compareModeIPC.getInt()); getSettings().getCompareModeSetting().init(this, compareMode); IPCResult viewModeEnabledIPC = ViewModeEnabledSetting.getViewModeEnabledIPCRequest(); // ASYNC IPC IPCResult tlEntpropsIPC = TimelineSetting.ipcGetEntityPropsRequest(); // ASYNC IPC final boolean viewModeEnabled = viewModeEnabledIPC.getBoolean(); final Object[] tlEntprops = tlEntpropsIPC.getObjects(); // Metrics getSettings().getMetricsSetting().initMetricListsByMType(); Object[] ref_data = MetricsSetting.getRefMetricsV2(); IPCMetricsAPI.getJavaEnableIPC(); MetricNode metricsRootNode = IPCMetricsAPI.getAllAvailableMetricsIPC(0); getSettings() .getMetricsSetting() .init( this, userPref.getMetricSelectionList(), ref_data, metricsRootNode, userPref.getMetricReversedSort(), userPref.getMetricSortByMTypeList(), userPref.getMetricOrderLists()); // Views. Load machine model and custom index/memmory objects before // asking for available views final String machineModel; final String loadedMachineModel = machineModelIPC.getString(); String savedMachineModel = userPref.getMachineModel(); if (savedMachineModel != null && !savedMachineModel.equals(loadedMachineModel)) { machineModel = savedMachineModel; ViewsSetting.loadMachineModelIPC(machineModel); // SYNC IPC } else { machineModel = loadedMachineModel; } final String[] availableMachineModels = ViewsSetting.listMachineModelsIPC(); final List<CustomObject> customIndexObjects = userPref.getCustomIndexObjects(); if (customIndexObjects != null) { for (CustomObject customObject : customIndexObjects) { ViewsSetting.defineIndxObjIPC( customObject.getName(), customObject.getFormula(), customObject.getShortDesc(), customObject.getLongDesc()); } } final List<CustomObject> customMemoryObjects = userPref.getCustomMemoryObjects(); if (customMemoryObjects != null) { for (CustomObject customObject : customMemoryObjects) { ViewsSetting.defineMemObjIPC( customObject.getName(), customObject.getFormula(), customObject.getShortDesc(), customObject.getLongDesc()); } } // Use "async" IPC calls to minimize the "high latency" effect IPCResult standardViewsIPC = ViewsSetting.getTabListInfoIPCRequest(); // ASYNC IPC IPCResult standardViewsSelectedIPC = ViewsSetting.getTabSelectionStateIPCRequest(); // ASYNC IPC IPCResult indexViewsIPC = ViewsSetting.getIndxObjDescriptionsIPCRequest(); // ASYNC IPC IPCResult indexViewsSelectedIPC = ViewsSetting.getIndxTabSelectionStateIPCRequest(); // ASYNC IPC IPCResult memoryViewsIPC = ViewsSetting.getMemObjectsIPCRequest(); // ASYNC IPC IPCResult memoryViewsSelectedIPC = ViewsSetting.getMemTabSelectionStateIPCRequest(); // ASYNC IPC IPCResult libraryVisibilityIPC = LibraryVisibilitySetting.getLoadObjectListIPCRequest(0); // ASYNC IPC // Get the results from those "async" IPC calls final Object[] standardViews = standardViewsIPC.getObjects(); final boolean[] standardViewsSelected = standardViewsSelectedIPC.getBooleans(); final Object[] indexViews = indexViewsIPC.getObjects(); final boolean[] indexViewsSelected = indexViewsSelectedIPC.getBooleans(); final Object[] memoryViews = memoryViewsIPC.getObjects(); final boolean[] memoryViewsSelected = memoryViewsSelectedIPC.getBooleans(); getColorChooser().getColorMap().initRules(userPref.getActiveColorRules(), false); Object[] libraryVisibility = libraryVisibilityIPC.getObjects(); getSettings() .getLibraryVisibilitySetting() .init(this, libraryVisibility, userPref.getLibraryVisibilitySettings()); final String[] errors = getExperimentErrorsIPC(); final String[] warnings = getExperimentWarningsIPC(); // ------------------- IPC END AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (errors != null || warnings != null) { hasErrorsAndWarnings = true; handleErrorsAndWarnings(errors, warnings); } getExperimentsView().initErrorsAndWarnings(errors, warnings); // Set settings (GUI updates) // Note: change events are not fired until experiments finished loading getLibraryVisibilityDialog() .initStates( userPref.getLibraryVisibilityJava(), userPref.getLibraryVisibilitySettings(), userPref.getLibraryVisibilityIncludePickList(), userPref.getLibraryVisibilityIncludeFilter(), userPref.getLibraryVisibilityExcludePickList(), userPref.getCurrenLibraryVisibilityExcludeFilter()); // getSettings().getViewModeSetting().init(this, // ViewModeSetting.ViewMode.fromValue(viewModeValue)); // getSettings().getFormatSetting().init(this, // FormatSetting.Style.fromValue(nameFormat), soName); getSettings().getViewModeEnabledSetting().init(this, viewModeEnabled); // getSettings().getSourceDisassemblySetting().init(this, // srcDisSettings); getSettings() .getTimelineSetting() .init( this, tlEntprops, userPref.getTimelineTLDataCmd(), userPref.getTimelineGroupDataByButtonName(), userPref.getTimelineStackAlign(), userPref.getTimelineStackDepth(), userPref.getTimelineStackFramePixels(), userPref.getTimelineShowEventStates(), userPref.getTimelineShowEventDensity()); getSettings() .getViewsSetting() .init( this, userPref.getViewPanelOrder(), groups, standardViews, standardViewsSelected, indexViews, indexViewsSelected, memoryViews, memoryViewsSelected, availableMachineModels, machineModel, customIndexObjects, customMemoryObjects); if (restart) { getToolBarPanel() .getFindTextPanel() .initializeFindTexts(userPref.getFindPickList(), null); // Find text getSettings() .getCallTreeSetting() .setThreshold(this, userPref.getCallStackThreshold()); // Call Tree properties getSettings() .getViewModeSetting() .set( null, ViewModeSetting.ViewMode.fromValue( userPref.getFormatsViewMode())); // View Mode property getSettings() .getFormatSetting() .set( this, FormatSetting.Style.fromValue(userPref.getFormatsStyle()), userPref.getFormatsAppendSoName()); getSettings() .getSourceDisassemblySetting() .set(null, userPref.getSourceDisassemblySettings()); // View Mode property } if (comparingExperiments(groups)) { if (userPref.getFormatsCompareMode() != userPref.getFormatsCompareModeDefault()) { getSettings() .getCompareModeSetting() .set(this, CompareMode.fromValue(userPref.getFormatsCompareMode())); } } getSettings() .getTableSettings() .initWrapMetricNames(userPref.wrapMetricNamesInTables()); experimentGroups = groups; setTitle(); updatePickList(groups, workingDirectory, confPath, alwaysUseThisConf); // enableSessionActions(false, anyExperiments); AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(groups, AnChangeEvent.Type.EXPERIMENTS_LOADED)); } }); } else { AnUtility.dispatchOnSwingThread( () -> { AnEventManager.getInstance() .fireAnChangeEvent( new AnChangeEvent(groups, AnChangeEvent.Type.EXPERIMENTS_LOADED_FAILED)); // Error(s) handleFatalError(msg); if (anyExperiments) { String exp = groups[0][0]; userPref.getExperimentsPicklists().getPicklist().removeExperiment(exp); } welcomeViewOnly(); enableSessionActions(false, false); }); } } catch (IPCCancelledException ex) { System.out.println("\nloadExperiments cancelled..."); welcomeViewOnly(); } getSystemProgressPanel().progressBarStop(progressBarHandle); IPCContext.newCurrentContext(null, IPCContext.Scope.SESSION, false, AnWindow.this); } private boolean comparingExperiments(String[][] groups) { return groups != null && groups.length > 1 && groups[1] != null && groups[1].length > 0; } private void updatePickList( String[][] groups, String workingDirectory, String confPath, boolean alwaysUseThisConf) { List<PickListElement> list = new ArrayList<>(); for (String[] group : groups) { for (String experiment : group) { experiment = AnUtility.toFullPath(experiment); list.add( new ExperimentPickListElement( experiment, workingDirectory, alwaysUseThisConf ? confPath : null)); } } UserPref.getInstance().getExperimentsPicklists().getPicklist().addElements(list); } private void handleFatalError(String msg) { JTextArea textArea = new JTextArea(); textArea.setText(AnLocale.getString("Experiment(s) failed to load.\n\n")); textArea.append(msg); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setOpaque(false); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setOpaque(true); textArea.setBackground(AnEnvironment.DEFAULT_DIALOG_BACKGROUND); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setBorder(BorderFactory.createLineBorder(AnEnvironment.SCROLLBAR_BORDER_COLOR)); scrollPane.setPreferredSize(new Dimension(700, 160)); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); JOptionPane pane = new JOptionPane(panel, JOptionPane.ERROR_MESSAGE); JDialog dialog = pane.createDialog(frame, AnLocale.getString("Error")); dialog.setResizable(true); dialog.setVisible(true); } /** * Handle non-fatal errors and warnings * * @param errors * @param warnings */ private void handleErrorsAndWarnings(String[] errors, String[] warnings) { showErrorsWarningsStatusHandle.setVisible(false); String labelText = null; ImageIcon labelIcon = null; if (errors != null && warnings != null) { labelIcon = AnUtility.errorWarningNewIcon; labelText = AnLocale.getString("Errors & Warnings"); } else if (errors != null) { labelIcon = AnUtility.errorNewIcon; labelText = AnLocale.getString("Errors"); } else if (warnings != null) { labelIcon = AnUtility.warningNewIcon; labelText = AnLocale.getString("Warnings"); } showErrorsWarningsStatusHandle.update(labelText); showErrorsWarningsStatusHandle.update(labelIcon); showErrorsWarningsStatusHandle.setVisible(true); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { showErrorsWarningsTooltipPopup(); } }); } private void showErrorsWarningsTooltipPopup() { JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); int gridx = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; JLabel label0 = new JLabel(); label0.setText(AnLocale.getString("Experiment has errors or wanings:")); label0.setForeground(AnEnvironment.TOOLTIP_POPUP_FOREGROUND_COLOR); label0.setFont(label0.getFont().deriveFont(Font.BOLD)); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 0, 0, 0); panel.add(label0, gridBagConstraints); JLabel label1 = new JLabel(); label1.setFont(label1.getFont().deriveFont(Font.BOLD)); label1.setText(AnLocale.getString("Click flag for details...")); label1.setForeground(AnEnvironment.FILTER_FOREGROUND_COLOR); gridBagConstraints.gridx = gridx++; gridBagConstraints.insets = new Insets(0, 4, 0, 0); panel.add(label1, gridBagConstraints); ToolTipPopup toolTipPopup = new ToolTipPopup( showErrorsWarningsStatusHandle.getTextLabel(), panel, ToolTipPopup.Location.NORTHEAST, true); toolTipPopup.show(750, 5000); } /** Drops all experimentsDisp */ private void dropAllExperiments() { if (experimentsLoaded()) { AnUtility.checkIPCOnWrongThread(false); loadExperimentGroupsInternal(new String[0][0], null, false, null, false); AnUtility.checkIPCOnWrongThread(true); } } /** Reset Collect Dialogs */ public synchronized void resetProfileDialogs() { profileApplicationDialog = null; profileRunningProcessDialog = null; profileKernelDialog = null; } // ********************************************************************************* public AnAction getProfileApplicationAction() { return profileApplicationAction; } public AnAction getProfileRunningProcessAction() { return profileRunningProcessAction; } public AnAction getProfileKernelAction() { return profileKernelAction; } public AnAction getOpenExperimentAction() { return openExperimentAction; } public AnAction getCompareExperimentsAction() { return compareExperimentsAction; } public AnAction getAggregateExperimentsAction() { return aggregateExperimentsAction; } public AnAction getShowErrorsWarningsAction() { return showErrorsWarningsAction; } public AnAction getConnectAction() { return connectAction; } public AnAction getExportAction() { return exportAction; } public AnAction getExitAction() { return exitAction; } public AnAction getPreviousViewAction() { return previousViewAction; } public AnAction getNextViewAction() { return nextViewAction; } public AnAction getViewsSettingsAction() { return viewsSettingsAction; } public AnAction getMetricsSettingsAction() { return metricsSettingsAction; } public AnAction getAddRemoveFiltersAction() { return addRemoveFiltersAction; } public AnAction getLibraryVisibilityAction() { return libraryVisibilityAction; } public AnAction getFunctionColorsAction() { return functionColorsAction; } public AnAction getSettingsAction() { return settingsAction; } public AnAction getExportSettingsAction() { return exportSettingsAction; } public AnAction getImportSettingsAction() { return importSettingsAction; } public AnAction getExportSettingsAsAction() { return exportSettingsAsAction; } public AnAction getHelpAnalyzerAction() { return helpAnalyzerAction; } public AnAction getHelpNewFeaturesAction() { return helpNewFeaturesAction; } public AnAction getHelpInformationMapAction() { return helpInformationMapAction; } public AnAction getHelpKeyboardShortcutsAction() { return helpKeyboardShortcutsAction; } public AnAction getHelpShortcutsAction() { return helpShortcutsAction; } public AnAction getHelpTroubleShootingAction() { return helpTroubleShootingAction; } public AnAction getAboutAnalyzerAction() { return aboutAnalyzerAction; } // ********************************************************************************* public void profileApplicationAction(String[] arguments) { if (profileApplicationAction.isEnabled()) { if (null == profileApplicationDialog) { profileApplicationDialog = new CollectDialog(this, getFrame(), Collector.PROFILE_APPLICATION, CollectPanel.title); } profileApplicationDialog.doDialog(arguments); } } public void profileRunningProcessAction() { if (profileRunningProcessAction.isEnabled()) { if (null == profileRunningProcessDialog) { profileRunningProcessDialog = new CollectDialog( this, getFrame(), Collector.PROFILE_RUNNING_APPLICATION, CollectPanel.title1); } profileRunningProcessDialog.doDialog(); } } public void profileKernelAction() { if (profileKernelAction.isEnabled()) { if (null == profileKernelDialog) { profileKernelDialog = new CollectDialog(this, getFrame(), Collector.SYSTEM_PROFILING, CollectPanel.title2); } profileKernelDialog.doDialog(); } } public void showErrorsWarningsAction() { if (showErrorsWarningsAction.isEnabled()) { String experimentsViewName = "header"; getNavigationPanel().getViewsPanel().selectView(experimentsViewName); } } public void aggregateExperimentsAction() { if (aggregateExperimentsAction.isEnabled()) { String title = AnLocale.getString("Aggregate Experiments"); CompareAdvancedDialog dlg = new CompareAdvancedDialog(this, getFrame(), false, title); dlg.setVisible(true, 0); } } public void compareExperimentsAction() { if (compareExperimentsAction.isEnabled()) { // if (GUITesting.getInstance().isRunningUnderGUITesting()) { // compareExperimentsAdvancedDialog(); // return; // } if (isExperimentGroupsSimple()) { CompareSimpleDialog compareSimpleDialog = new CompareSimpleDialog(getFrame()); compareSimpleDialog.setVisible(true); } else { compareExperimentsAdvancedDialog(); } } } public void compareExperimentsAdvancedDialog() { String title = AnLocale.getString("Compare Experiments"); CompareAdvancedDialog dlg = new CompareAdvancedDialog(this, getFrame(), true, title); dlg.setVisible(true, 0); } public void connectAction() { if (connectAction.isEnabled()) { // Check if there are loaded experimentsDisp if (experimentsLoaded()) { CloseExperimentDialog closeExperientDialog = new CloseExperimentDialog(getFrame()); closeExperientDialog.setVisible(true); if (closeExperientDialog.getStatus() == AnDialog2.Status.OK) { try { dropAllExperiments(); } catch (Exception e) { // We can get an exception if IPC is not connected } } else { return; } } Object progressBarHandle = getSystemProgressPanel().progressBarStart(AnLocale.getString("Connecting")); if (null == connectionChooser) { connectionChooser = new ConnectionDialog(this, frame, remoteHostStatusHandle); } getSystemProgressPanel().progressBarStop(progressBarHandle); connectionChooser.setVisible(true, 0); // Requesting connectionChooser focus here may not work because unloading experiments // may be running in the background and steel the focus. Also requesting focus when // experiments have done unloading (AnChangeEvent.EXPERIMENTS_LOADED). connectionChooser.requestFocus(); } } public void exportAction() { if (exportAction.isEnabled()) { if (!(getViews().getCurrentViewDisplay() instanceof ExportSupport)) { return; } ExportSupport exportSupport = (ExportSupport) getViews().getCurrentViewDisplay(); // List<ExportFormat> formats = exportSupport.getSupportedExportFormats(); ExportDialog exportDialog = new ExportDialog(frame, exportSupport); exportDialog.setVisible(true); if (exportDialog.getStatus() == ExportDialog.Status.OK) { ExportSupport.ExportFormat format = exportDialog.getExportFormat(); if (format == ExportFormat.JPG) { boolean includeSubvies = exportDialog.getIncludeSubviews(); String outputFilePath = exportDialog.getOutputFilePath(); Component component; if (includeSubvies) { component = getMainViewPanel(); } else { component = getViews().getCurrentViewDisplay(); } Export.exportImage(component, outputFilePath); } else { Integer limit = exportDialog.getLimit(); Character delimiter = exportDialog.getDelimiter(); String text = exportAsText(limit, format, delimiter); String outputFilePath = exportDialog.getOutputFilePath(); Export.exportText(text, outputFilePath); } } } } public void exitAction() { AnUtility.checkIfOnAWTThread(true); frame.setVisible(false); /* Everything below should be done on a worker thread */ AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { saveExperimentSettings(getExperimentGroups()); if (!GUITesting.getInstance().isRunningUnderGUITesting()) { saveAnalyzerSettings(); } UserPref.getInstance().cleanupAsWhenClosedFolder(); analyzer.IPC_session.destroyIPCProc(); if (null != analyzer.old_IPC_session) { analyzer.old_IPC_session.destroyIPCProc(); } System.exit(0); } }, "Exit Thread"); } public void previousViewAction() { if (previousViewAction.isEnabled()) { String previousViewName = getNavigationPanel().getViewsPanel().previousViewName(); if (previousViewName != null) { // setSelectedViewInternal(previousViewName, -1); getNavigationPanel().getViewsPanel().moveViewStackPointer(-1); getNavigationPanel().getViewsPanel().selectView(previousViewName); } } } public void nextViewAction() { if (nextViewAction.isEnabled()) { String nextViewName = getNavigationPanel().getViewsPanel().nextViewName(); if (nextViewName != null) { // setSelectedViewInternal(nextViewName, 1); getNavigationPanel().getViewsPanel().moveViewStackPointer(+1); getNavigationPanel().getViewsPanel().selectView(nextViewName); } } } public void viewsSettingsAction() { if (viewsSettingsAction.isEnabled()) { if (experimentsLoaded()) { getSettings().showDialog(getSettings().settingsviewsIndex); } } } public void metricsSettingsAction() { if (metricsSettingsAction.isEnabled()) { if (experimentsLoaded()) { getSettings().showDialog(getSettings().settingsMetricsIndex); } } } public void addRemoveFiltersAction(Object source) { if (addRemoveFiltersAction.isEnabled()) { Component parent = null; if (source != null && (source instanceof Component)) { parent = (Component) source; } getViews().getCurrentViewDisplay().showFilterPopup(parent); } } public void libraryVisibilityAction() { if (libraryVisibilityAction.isEnabled()) { if (libraryVisibilityDialog == null) { libraryVisibilityDialog = new LibraryVisibilityDialog(getFrame()); } libraryVisibilityDialog.setVisible(true); } } public void functionColorsAction() { if (functionColorsAction.isEnabled()) { colorChooser.setVisible(true); } } public void settingsAction() { if (settingsAction.isEnabled()) { int index = -1; if (getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_Timeline) { index = getSettings().settingsTimelineIndex; } else if (getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_CallTree) { index = getSettings().settingsCalltreeIndex; } else if (getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_Source || getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_Disassembly || getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_SourceDisassembly) { index = getSettings().settingsSourceDisassemblyIndex; } else if (getViews().getCurrentViewDisplay().getType() == AnDisplay.DSP_Overview) { index = getSettings().settingsMetricsIndex; } getSettings().showDialog(index); } } public void exportSettingsAction() { if (exportSettingsAction.isEnabled()) { new ExportSettingsDialog(frame).setVisible(true); } } public void importSettingsAction() { if (importSettingsAction.isEnabled()) { new ImportSettingsDialog(frame).setVisible(true); } } public void exportSettingsAsAction() { if (exportSettingsAsAction.isEnabled()) { getSettings().saveAsDotErRc(); } } public void helpAnalyzerAction() { if (helpAnalyzerAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_WelcomeAnalyzer); } } public void helpNewFeaturesAction() { if (helpNewFeaturesAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_NewFeatures); } } public void helpInformationMapAction() { if (helpInformationMapAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_InformationMap); } } public void helpKeyboardShortcutsAction() { if (helpKeyboardShortcutsAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_KeyboardShortcuts); } } public void helpShortcutsAction() { if (helpShortcutsAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_HelpShortcuts); } } public void helpTroubleShootingAction() { if (helpTroubleShootingAction.isEnabled()) { Analyzer.showHelp(AnVariable.HELP_Troubleshooting); } } public void aboutAnalyzerAction() { if (aboutAnalyzerAction.isEnabled()) { AboutPanel.showDialog(); } } // ********************************************************************************* /** * Get AnFile with correct AnFileSystemView for remote case * * @param path * @return AnFile */ public AnFile getAnFile(final String path) { if (path == null) { return null; } AnFile afile = new AnFile(path); if (analyzer.remoteConnection != null) { AnFileSystemView afsv = AnFileSystemView.getFileSystemView(); afsv.setAnWindow(this); afsv.updateFileAttributes(afile); } else { File f = new File(path); if (!f.exists()) { afile.existsFlag = false; } if (!f.isDirectory()) { afile.isDirectoryFlag = false; } } return afile; } /** * Gets current remote AnChooser * * @return anRemoteFileChooser */ public AnChooser getAnChooserRemote() { return anRemoteFileChooser; } /** * return files in remote directory * * @param remoteDirectoryPath * @return */ public File[] getFiles(String remoteDirectoryPath) { AnFileSystemView afsv = AnFileSystemView.getFileSystemView(); File[] ret = afsv.getFiles(new File(remoteDirectoryPath), false); return ret; } /** * Get AnChooser with correct AnFileSystemView for remote case * * @param title * @param chooser_type * @param st_dir * @return AnChooser */ public AnChooser getAnChooser(final String title, final int chooser_type, String st_dir) { AnFileSystemView afsv = null; String host = null; if (analyzer.remoteConnection != null) { if (st_dir == null) { st_dir = getCurrentRemoteDirectory(); if (st_dir == null) { st_dir = analyzer.getWorkingDirectory(); if (st_dir == null) { st_dir = "/"; } } } host = AnLocale.getString("Remote host: ") + analyzer.remoteHost; afsv = AnFileSystemView.getFileSystemView(); afsv.setAnWindow(this); AnFile dir = new AnFile(st_dir); // NM incomplete initMetricListsByMType anRemoteFileChooser = new AnChooser(frame, chooser_type, this, title, dir, host, afsv); anRemoteFileChooser.setFileHidingEnabled(true); afsv.setAnChooser(anRemoteFileChooser); return anRemoteFileChooser; } else { if (st_dir == null) { st_dir = Analyzer.getInstance().getWorkingDirectory(); String cd = null; if (null != anFileChooser) { if (null != anFileChooser.getCurrentDirectory()) { cd = anFileChooser.getCurrentDirectory().getPath(); if (null != cd) { st_dir = cd; } } } } afsv = null; if (null != analyzer.localHost) { host = AnLocale.getString("Host: ") + analyzer.localHost; } anFileChooser = new AnChooser(frame, chooser_type, this, title, st_dir, host, afsv); anFileChooser.setFileHidingEnabled(true); return anFileChooser; } } /** * Gets Current Remote Directory * * @return */ public String getCurrentRemoteDirectory() { String cd = null; if (null != anRemoteFileChooser) { if (null != anRemoteFileChooser.getCurrentDirectory()) { cd = anRemoteFileChooser.getCurrentDirectory().getPath(); } } return cd; } private void unSelectAllViews() { for (AnDisplay anDisplay : standardDisplayList) { anDisplay.setSelected(false); } if (memoryIndexDisplayList != null) { for (AnDisplay anDisplay : memoryIndexDisplayList) { anDisplay.setSelected(false); } } } private void resetAllViews() { for (AnDisplay anDisplay : standardDisplayList) { anDisplay.setSelected(false); anDisplay.setAvailable(false); } if (memoryIndexDisplayList != null) { for (AnDisplay anDisplay : memoryIndexDisplayList) { anDisplay.setSelected(false); anDisplay.setAvailable(false); } } } private void changeView() { // System.out.println("AnWindow:changeView"); tableStatusHandle.setVisible(false); AnUtility.checkIfOnAWTThread(true); // AnMemoryManager.getInstance().checkMemoryUsage(); getToolBarPanel().removeControls(); unSelectAllViews(); final AnDisplay sel = getViews().getCurrentViewDisplay(); if (sel == null) { return; } showHideNavigationAndSubviews(sel); sel.setSelected(true); sel.computeOnAWorkerThread( null, new AbstractAction() { // ?????? FIXUP Don't do Swing stuff on worker thread!!!! @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getViews().getCurrentViewDisplay().requestFocus(); enablePerViewActions(sel); // AnMemoryManager.getInstance().checkMemoryUsage(); // AnMain.showImportOldSettingsDialog(); // Do this after request view // focus.... } }); // Set table status visible for most table views if (sel instanceof FuncListDisp && sel.getType() != AnDisplay.DSP_Callers) { tableStatusHandle.setVisible(true); } } public class AnDispTab { private final int type; private final int subtype; private String tname; private char tmnem; private final String cmd; private AnDisplay tcomp; private String shortDescr; private String longDescr; public AnDispTab(int dtype, String cmdstr, String shortDescr, String longDescr) { // System.out.println("AnWindow.AnDispTab standard: " + cmdstr + " " + shortDescr + // " " + longDescr); type = dtype; cmd = cmdstr; subtype = 0; // Only relevant for memobj this.shortDescr = shortDescr; this.longDescr = longDescr; initDispTab(); } // fixme, Code should move to mem/index classes public AnDispTab( int dtype, int sub, String sname, char mnem, String cmdstr, String shortDesc, String longDesc) { // System.out.println("AnWindow.AnDispTab index/memory: " + dtype + " " + sub + " " // + sname + " " + cmdstr); type = dtype; cmd = cmdstr; tname = sname; tmnem = mnem; subtype = sub; this.shortDescr = shortDesc; this.longDescr = longDesc; String HELP_token_ID = null; if (type == AnDisplay.DSP_MemoryObject) { HELP_token_ID = AnVariable.HELP_TabsMemObj; } else if (type == AnDisplay.DSP_IndexObject) { switch (cmd) { case "Threads": HELP_token_ID = AnVariable.HELP_TabsThreads; break; case "CPUs": HELP_token_ID = AnVariable.HELP_TabsCPUs; break; case "Samples": HELP_token_ID = AnVariable.HELP_TabsSamples; break; case "GCEvents": HELP_token_ID = null; // AnVariable.HELP_TabsIndxObj; break; case "Seconds": HELP_token_ID = AnVariable.HELP_TabsSeconds; break; case "Processes": HELP_token_ID = AnVariable.HELP_TabsProcesses; break; case "Experiment_IDs": HELP_token_ID = AnVariable.HELP_TabsExperimentIDs; break; case "Datasize": HELP_token_ID = AnVariable.HELP_DataSize; break; case "Duration": HELP_token_ID = AnVariable.HELP_Duration; break; case "OMP_preg": HELP_token_ID = AnVariable.HELP_TabsOMPParallelRegions; break; case "OMP_task": HELP_token_ID = AnVariable.HELP_TabsOpenMPTasks; break; default: HELP_token_ID = null; // AnVariable.HELP_TabsIndxObj; break; } } // System.out.println("HELP_token_ID:" + HELP_token_ID); MemoryIndexObjectView memoryIndexAnDisplay = new MemoryIndexObjectView(dtype, subtype, HELP_token_ID); memoryIndexDisplayList.add(memoryIndexAnDisplay); tcomp = memoryIndexAnDisplay; tcomp.setAnDispTab(this); tcomp.setAvailable(true); } private void initDispTab() { switch (type) { case AnDisplay.DSP_Welcome: tname = AnLocale.getString("Welcome"); tmnem = AnLocale.getString('W', "MNEM_TAB_WELCOME"); tcomp = getWelcomeView(); shortDescr = getWelcomeView().getShortDescr(); longDescr = getWelcomeView().getLongDescr(); break; case AnDisplay.DSP_Overview: tname = AnLocale.getString("Overview"); tmnem = AnLocale.getString('i', "MNEM_TAB_OVERVIEW"); tcomp = getOverviewView(); shortDescr = getOverviewView().getShortDescr(); longDescr = getOverviewView().getLongDescr(); break; case AnDisplay.DSP_Functions: tname = AnLocale.getString("Functions"); tmnem = AnLocale.getString('F', "MNEM_TAB_FUNCTION"); tcomp = getFunctionsView(); break; case AnDisplay.DSP_Callers: tname = AnLocale.getString("Callers-Callees"); tmnem = AnLocale.getString('e', "MNEM_TAB_CALL"); tcomp = getCallerCalleesView(); break; case AnDisplay.DSP_CallTree: tname = AnLocale.getString("Call Tree"); tmnem = AnLocale.getString('t', "MNEM_TAB_CALLTREE"); tcomp = getCallTreeView(); break; case AnDisplay.DSP_CallFlame: // tname = AnLocale.getString("Visual Call Tree"); // tmnem = AnLocale.getString('v', "MNEM_TAB_FLAME"); tname = AnLocale.getString("Flame Graph"); tmnem = AnLocale.getString('m', "MNEM_TAB_FLAME"); tcomp = getFlameView(); break; case AnDisplay.DSP_Source: case AnDisplay.DSP_SourceV2: tname = AnLocale.getString("Source"); tmnem = AnLocale.getString('r', "MNEM_TAB_SOURCE"); tcomp = getSourceView(); break; case AnDisplay.DSP_Lines: tname = AnLocale.getString("Lines"); tmnem = AnLocale.getString('L', "MNEM_TAB_LINES"); tcomp = getLinesView(); break; case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_DisassemblyV2: tname = AnLocale.getString("Disassembly"); tmnem = AnLocale.getString('D', "MNEM_TAB_DISASM"); tcomp = getDisassemblyView(); break; case AnDisplay.DSP_PCs: tname = AnLocale.getString("PCs"); tmnem = AnLocale.getString('P', "MNEM_TAB_PCS"); tcomp = getPcsView(); break; case AnDisplay.DSP_DataLayout: tname = AnLocale.getString("DataLayout"); tmnem = AnLocale.getString('u', "MNEM_TAB_DATALAY"); tcomp = getDataLayoutView(); break; case AnDisplay.DSP_DataObjects: tname = AnLocale.getString("DataObjects"); tmnem = AnLocale.getString('O', "MNEM_TAB_DATAOBJ"); tcomp = getDataObjectsView(); break; case AnDisplay.DSP_Timeline: tname = AnLocale.getString("Timeline"); tmnem = AnLocale.getString('T', "MNEM_TAB_TIMELINE_V2"); tcomp = getTimelineView(); // YXXX what is purpose of above linesDisp? break; // case AnDisplay.DSP_LEAKLIST: // tname = AnLocale.getString("Leaks"); // tmnem = AnLocale.getString('k', "MNEM_TAB_LEAKLIST"); // tcomp = getLeaksView(); // break; case AnDisplay.DSP_Heap: tname = AnLocale.getString("Heap"); tmnem = AnLocale.getString('H', "MNEM_TAB_HEAPCALLSTACK"); tcomp = getHeapView(); break; case AnDisplay.DSP_IO: tname = AnLocale.getString("I/O"); tmnem = AnLocale.getString('A', "MNEM_TAB_IOACTIVITY"); tcomp = getIOView(); break; case AnDisplay.DSP_Statistics: tname = AnLocale.getString("Statistics"); tmnem = AnLocale.getString('i', "MNEM_TAB_STATIS"); tcomp = getStatisticsView(); break; case AnDisplay.DSP_Experiments: tname = AnLocale.getString("Experiments"); tmnem = AnLocale.getString('n', "MNEM_TAB_EXPERIMENT"); tcomp = getExperimentsView(); break; case AnDisplay.DSP_InstructionFrequency: tname = AnLocale.getString("Instruction Frequency"); tmnem = AnLocale.getString('q', "MNEM_TAB_IFREQ"); tcomp = getInstructionFrequencyView(); break; case AnDisplay.DSP_DualSource: tname = AnLocale.getString("Dual Source"); tmnem = AnLocale.getString('R', "MNEM_TAB_DUALSOURCES"); tcomp = getDualSourceView(); break; case AnDisplay.DSP_SourceDisassembly: tname = AnLocale.getString("Source/Disassembly"); tmnem = AnLocale.getString('u', "MNEM_TAB_SOURCE_DISASM"); tcomp = getSourceDisassemblyView(); break; default: System.err.println("Anwindow: unknown view: " + type); tname = "Unknown"; // tmnem = AnLocale.getString('W', "MNEM_TAB_WELCOME"); tcomp = getWelcomeView(); break; } tcomp.setAnDispTab(this); tcomp.setAvailable(true); } public int getTType() { return type; } public String getTName() { return tname; } public char getTMnem() { return tmnem; } public AnDisplay getTComp() { return tcomp; } public String getTCmd() { return cmd; } public String getShortDescr() { return shortDescr; } public String getLongDesc() { return longDescr; } } public void showError(final String msg) { if (msg != null) { getExperimentsView().appendLog(AnLocale.getString("Error: ") + msg); AnUtility.showMessage(frame, msg, JOptionPane.ERROR_MESSAGE); } } public void showWarning(final String msg) { if (msg != null) { getExperimentsView().appendLog(AnLocale.getString("Warning: ") + msg); // AnUtility.showMessage(frame, msg, JOptionPane.WARNING_MESSAGE); } } public void showProcessorWarning(final String msg) { if (msg != null) { getExperimentsView().appendLog(msg); AnUtility.showMessage(frame, msg, JOptionPane.WARNING_MESSAGE); } } /** * Copy file from local host to remote host * * @param from * @param to * @return res (number of bytes, or -1 - error) */ public int cp(File from, AnFile to) { int res = 0; String contents = ""; // Read file from local host try { final java.io.FileReader fr = new java.io.FileReader(from); java.io.BufferedReader br = new java.io.BufferedReader(fr); String s = br.readLine(); while (null != s) { s += "\n"; // Line feed is not passed by readLine() res += s.length(); contents += s; s = br.readLine(); } } catch (java.io.IOException ex) { return -1; // Error: cannot read file } // Write file to remote host String dir = to.getDirectoryName(); createDirectories(dir); String sto = to.getAbsolutePath(); // res = writeFile(sto, " "); // Hack to work-around problem with remote doesn't always // create a new file when written to the first time res = writeFile(sto, contents); // System.out.println("Remote: " + dir + " " + to + " " + res); return res; } public static String copyFromRemote(String remotePath) { AnFile anFile = new AnFile(remotePath); String toFilePath = null; if (anFile.exists()) { File tempFile = tempFile(); if (tempFile != null) { AnWindow.getInstance().cp(anFile, tempFile); toFilePath = tempFile.getAbsolutePath(); } } return toFilePath; } public static File tempFile() { File tempFile = null; try { tempFile = File.createTempFile("configuration", ".tmp"); tempFile.deleteOnExit(); } catch (IOException ioe) { System.err.println(ioe); } return tempFile; } public static int copyToRemote(String fromPath, String toRemotePath) { String dirs = AnUtility.dirname(toRemotePath); new AnFile(dirs).mkdir(); File fromFile = new File(fromPath); AnFile anFile = new AnFile(toRemotePath); int res = 0; if (fromFile.exists()) { res = AnWindow.getInstance().cp(fromFile, anFile); } return res; } /** * Copy file from remote host to local host * * @param from * @param to * @return res (number of bytes, or -1 - error) */ public int cp(AnFile from, File to) { // Read file from remote host String[] in = readFile(from.getAbsolutePath()); String contents = in[0]; // Write file to local host if (contents != null) { try { final java.io.FileWriter fw = new java.io.FileWriter(to); java.io.BufferedWriter bw = new java.io.BufferedWriter(fw); bw.write(contents, 0, contents.length()); bw.flush(); bw.close(); fw.close(); return contents.length(); } catch (java.io.IOException ex) { return -1; // Error: cannot write file } } return -1; } // ========================================================================// // Native methods from liber_dbe.so public void initView(final int win_id, final int clone_id) { synchronized (IPC.lock) { IPC().send("initView"); IPC().send(win_id); IPC().send(clone_id); IPC().recvString(); // synchronize } } /** * A method to create directory. * * @param path - full path * @return String - error */ public String createDirectories(final String path) { synchronized (IPC.lock) { IPC().send("dbeCreateDirectories"); IPC().send(path); return IPC().recvString(); } } /** * A method to delete file or directory. * * @param path - full path * @return String - error */ public String deleteFile(final String path) { synchronized (IPC.lock) { IPC().send("dbeDeleteFile"); IPC().send(path); return IPC().recvString(); } } /** * Read File If the operation was successful, the contents is in the first element, and second * element is NULL. If the operation failed, then first element is NULL, and second element * contains the error message. * * @param file_name * @return String[] result */ public final String[] readFile(final String file_name) { synchronized (IPC.lock) { IPC().send("dbeReadFile"); IPC().send(file_name); return (String[]) IPC().recvObject(); } } /** * Write File * * @param file_name * @param contents * @return result (written bytes) */ public final int writeFile(final String file_name, final String contents) { synchronized (IPC.lock) { IPC().send("dbeWriteFile"); IPC().send(file_name); IPC().send(contents); return IPC().recvInt(); } } public final String getHomeDir() { synchronized (IPC.lock) { IPC().send("getHomeDirectory"); return IPC().recvString(); } } // Native methods from liber_dbe.so public String[] getExpPreview(final String exp_name) { synchronized (IPC.lock) { IPC().send("getExpPreview"); IPC().send(exp_name); return (String[]) IPC().recvObject(); } } private int[] getUserExpId(final int[] expIds) { synchronized (IPC.lock) { IPC().send("getUserExpId"); IPC().send(expIds); return (int[]) IPC().recvObject(); } } public String[] getExpName() { synchronized (IPC.lock) { IPC().send("getExpName"); return (String[]) IPC().recvObject(); } } private int[] getExpState() { synchronized (IPC.lock) { IPC().send("getExpState"); return (int[]) IPC().recvObject(); } } public boolean[] getExpEnable() { synchronized (IPC.lock) { IPC().send("getExpEnable"); IPC().send(0); return (boolean[]) IPC().recvObject(); } } public String[] getExpInfo() { synchronized (IPC.lock) { IPC().send("getExpInfo"); IPC().send(0); return (String[]) IPC().recvObject(); } } protected String composeFilterClause( final int type, final int subtype, final int[] selected_ids) { synchronized (IPC.lock) { IPC().send("composeFilterClause"); IPC().send(0); IPC().send(type); IPC().send(subtype); IPC().send(selected_ids); return IPC().recvString(); } } public String getMsg(final int type) { synchronized (IPC.lock) { IPC().send("getMsg"); IPC().send(0); IPC().send(type); return IPC().recvString(); } } // Get experimentsDisp list with icons public AnTextIcon[] getExperimentList() { final String[] names; final int[] state; final AnTextIcon[] exp_list; final int size; ImageIcon ex_icon; names = getExpName(); // IPC state = getExpState(); // IPC if (names == null) { return null; } int expIds[] = new int[names.length]; for (int i = 0; i < expIds.length; i++) { expIds[i] = i; } int userExpIds[] = getUserExpId(expIds); // IPC int maxUserExpId = 0; for (int id : userExpIds) { if (id > maxUserExpId) { maxUserExpId = id; } } // Get icons for experimentsDisp size = names.length; exp_list = new AnTextIcon[size]; for (int i = 0; i < size; i++) { if (state[i] == EXP_SUCCESS) { ex_icon = AnUtility.expt_icon; } else if ((state[i] & EXP_OBSOLETE) != 0) { ex_icon = AnUtility.eold_icon; } else if ((state[i] & EXP_BROKEN) != 0) { ex_icon = AnUtility.ebad_icon; } else { ex_icon = AnUtility.ewarn_icon; } String padding = ""; if (maxUserExpId >= 10 && userExpIds[i] < 10) { padding = " "; } exp_list[i] = new AnTextIcon(padding + userExpIds[i] + " " + names[i], ex_icon); } return exp_list; } public SelectedObject getSelectedObject() { return selectedObject; } public SelectionManager getSelectionManager() { return selectionManager; } public String[] getStackNames(final long stack) { synchronized (IPC.lock) { IPC().send("getStackNames"); IPC().send(0); IPC().send(stack); return (String[]) IPC().recvObject(); } } // Histable::Function* public long[] getStackFunctions(final long stack) { synchronized (IPC.lock) { IPC().send("getStackFunctions"); IPC().send(stack); return (long[]) IPC().recvObject(); } } // Histable::Function* public Object[] getStacksFunctions(final long stacks[]) { synchronized (IPC.lock) { IPC().send("getStacksFunctions"); IPC().send(stacks); return (Object[]) IPC().recvObject(); } } // Histable::DbeInstr* public long[] getStackPCs(final long stack) { synchronized (IPC.lock) { IPC().send("getStackPCs"); IPC().send(stack); return (long[]) IPC().recvObject(); } } public String getFuncName(final long func) { synchronized (IPC.lock) { IPC().send("getFuncName"); IPC().send(0); IPC().send(func); return IPC().recvString(); } } public String[] getFuncNames(final long[] funcs) { synchronized (IPC.lock) { IPC().send("getFuncNames"); IPC().send(0); IPC().send(funcs); return (String[]) IPC().recvObject(); } } public long[] getFuncIds(final long[] funcs) { synchronized (IPC.lock) { AnUtility.checkIPCOnWrongThread(false); IPC().send("getFuncIds"); IPC().send(0); IPC().send(funcs); long[] ll = (long[]) IPC().recvObject(); AnUtility.checkIPCOnWrongThread(true); return ll; } } public String getFilterStr() { synchronized (IPC.lock) { IPC().send("getFilterStr"); IPC().send(0); return IPC().recvString(); } } /** * A generic method to get data for gprofng-gui tabs. * * @param mlistStr metric list: "MET_NORMAL", "MET_CALL", "MET_CALL_AGR", ... * @param modeStr mode: "ALL", "CALLERS", "CALLEES", "SELF" * @param typeStr type: "FUNCTION", "INDEXOBJ" * @param subtypeStr string of subtype for index objects, e.q. "0", "1", ... * @param cstack array of function IDs (can be null if modeStr="ALL") * @return */ public Object[] getTableDataV2( final String mlistStr, final String modeStr, final String typeStr, final String subtypeStr, final long[] cstack) { synchronized (IPC.lock) { IPC().send("getTableDataV2"); IPC().send(0); IPC().send(mlistStr); IPC().send(modeStr); IPC().send(typeStr); IPC().send(subtypeStr); IPC().send(cstack); return (Object[]) IPC().recvObject(); } } public String getObjNameV2(final long id) { synchronized (IPC.lock) { IPC().send("getObjNameV2"); IPC().send(0); IPC().send(id); return IPC().recvString(); } } public String[] getObjNamesV2(final long[] ids) { synchronized (IPC.lock) { IPC().send("getObjNamesV2"); IPC().send(0); IPC().send(ids); return (String[]) IPC().recvObject(); } } public int[] getGroupIds() { synchronized (IPC.lock) { final IPC ipc = IPC(); ipc.send("getGroupIds"); ipc.send(0); return (int[]) ipc.recvObject(); } } private String[] getExperimentWarningsIPC() { String s = ""; IPC().send("getExpsProperty"); // IPC IPC().send("WARNINGS"); // IPC String[] msgs = (String[]) IPC().recvObject(); return msgs; } private String[] getExperimentErrorsIPC() { String s = ""; IPC().send("getExpsProperty"); // IPC IPC().send("ERRORS"); // IPC String[] msgs = (String[]) IPC().recvObject(); return msgs; } /** * Check Remote Connection * * @param s * @return s */ public String checkConnection(final String s) { synchronized (IPC.lock) { IPC().send("checkConnection"); IPC().send(s); return IPC().recvString(); } } } ������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnListener.java����������������������������������������������������0000644�0001750�0001750�00000001457�14744453367�016666� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.util.EventListener; public interface AnListener extends EventListener { void valueChanged(AnEvent e); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CalledByCallsFunctionsView.java������������������������������������0000644�0001750�0001750�00000002001�14744453367�021766� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; public final class CalledByCallsFunctionsView extends CalledByCallsDisp { public CalledByCallsFunctionsView() { super( AnWindow.getInstance(), AnDisplay.DSP_Callers, AnVariable.HELP_TabsFunctions, AnDisplay.DSP_Functions); setAccessibility(AnLocale.getString("Called By Calls")); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/���������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015703� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TL2DataFetcher.java��������������������������������������0000644�0001750�0001750�00000051472�15044710303�021164� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCListener; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.timeline.events.DetailsIPC; import org.gprofng.mpmt.timeline2.data.GenericEvent; import org.gprofng.mpmt.timeline2.data.SampleEvent; import org.gprofng.mpmt.timeline2.data.StackEvent; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; // Fetches requested rows (RowDataRequestParams) from gp-display-text and places // row data in TL2DataSnapshot. Data fetch is asynchronous to the awt thread. public final class TL2DataFetcher { // passed in on contstruction public final AnWindow anWindow; // for IPC //YXXX make private private final TimelineView timelineView; // for doRepaint() // storage for timeline data private boolean needsFetchAllStackStates; private final HashMap<Long, long[]> stack_htable; // unique stacks; key=stack_id, value=array of function IDs private final HashSet<Long> stacks_pending; // unique stacks; key=stack_id private final BlockingQueue<Boolean> stackFetcherQ; // use the following lock with members below private final Object dataRequestLock; private RowDataRequestParams dataRequestOnDeck; // on deck private RowDataRequestParams dataRequestHead; // in progress // use the following lock with members below private final Object snapshotLock; private TL2DataSnapshot tl2DataSnapshot; // info for all rows private final ArrayList<TL2DataFetchListener> fetchTLRowDataListeners; private final IPCContext ipcContext; public TL2DataFetcher(TimelineView tl2Disp, final AnWindow awindow) { this.anWindow = awindow; this.timelineView = tl2Disp; needsFetchAllStackStates = true; stack_htable = new HashMap<Long, long[]>(1024); stacks_pending = new HashSet<Long>(); stackFetcherQ = new LinkedBlockingQueue<>(); dataRequestLock = new Object(); dataRequestOnDeck = null; dataRequestHead = null; snapshotLock = new Object(); tl2DataSnapshot = null; fetchTLRowDataListeners = new ArrayList<>(); ipcContext = IPCContext.newDBEIPCContext( "TL2DataFetcher", IPCContext.Scope.SESSION, false, false /* true*/, IPCContext.Request.GROUP, anWindow); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { try { while (true) { stackFetcherQ.take(); if (needsFetchAllStackStates) { int numAdded = anWindow.getColorChooser().getColorMap().updateFullColorMapIPC(); needsFetchAllStackStates = false; } ipcAddStackIds(); } } catch (InterruptedException ex) { int ii = 1; } } }, "TL2StackFetcherThread"); } // ---- called from non-awt threads public void resetAll() { /* start over including colors, selection */ synchronized (stack_htable) { stack_htable.clear(); stacks_pending.clear(); } needsFetchAllStackStates = true; anWindow .getColorChooser() .getColorMap() .reset(); // YXXX should instead be called from AnWindow or something? resetSnapshot(); } public void resetSnapshot() { /* clear screen but keep selection, colors */ setTL2DataSnapshot(null); enqueueRequest(null); } public void setTL2DataSnapshot(TL2DataSnapshot snapshot) { boolean updated = false; synchronized (snapshotLock) { if (tl2DataSnapshot != snapshot) { updated = true; tl2DataSnapshot = snapshot; // YXXX cancel old IPC when that becomes possible } } if (updated) { notifyNewDataSnapshot(); } } public TL2DataSnapshot getTL2DataSnapshot() { synchronized (snapshotLock) { return tl2DataSnapshot; } } // ---- listeners public interface TL2DataFetchListener { public void not_edt_newDataSnapshot(); } public void addTL2DataFetchListener(TL2DataFetchListener listener) { fetchTLRowDataListeners.add(listener); // assumes single threaded init } private void notifyNewDataSnapshot() { for (TL2DataFetchListener listener : fetchTLRowDataListeners) { listener.not_edt_newDataSnapshot(); } } // ---- request queue (2 deep. If full, previous on-deck request discarded) private int enqueueRequest(RowDataRequestParams newReq) { final int newSize; synchronized (dataRequestLock) { if (dataRequestHead == null) { dataRequestHead = newReq; newSize = 1; } else { // replace any old request with new request (intentionally lossy) dataRequestOnDeck = newReq; dataRequestHead.cancel(); // aborts loop in fetchTLRows() newSize = 2; } } return newSize; } private RowDataRequestParams nextRequest() { synchronized (dataRequestLock) { dataRequestHead = dataRequestOnDeck; dataRequestOnDeck = null; return dataRequestHead; } } private RowDataRequestParams headRequest() { synchronized (dataRequestLock) { return dataRequestHead; } } // ---- called from AWT thread: public boolean edt_fetchTLRowDataInitiate(final RowDataRequestParams newReq) { if (newReq.snapshot == null) { return false; // probably waiting for experiment to load } synchronized (snapshotLock) { if (newReq.snapshot != tl2DataSnapshot) { return false; // request is out of date. } } int newSize = enqueueRequest(newReq); if (newSize > 1) { return true; // request is not first in queue, loop below will get to it eventually } AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { RowDataRequestParams currReq = headRequest(); while (currReq != null) { not_edt_fetchTLRows(currReq); currReq = nextRequest(); } } }, "TL2DataFetcherThread"); return true; } private boolean subsetOf(RowDataRequestParams master, RowDataRequestParams request) { if (master == null || request == null) { return false; } if (master.binTime == request.binTime && master.alignedTimeStart <= request.required_timeStart && master.timeEnd >= request.required_timeEnd && master.snapshot == request.snapshot) { return true; } return false; } private void invalidateRowData(TL2DataSnapshot tl2DataSnapshot) { List<RowData> rowDataArray = tl2DataSnapshot.getRowData(); for (RowData rowData : rowDataArray) { rowData.invalidateEventData(); // YXXX cancel old IPC? } } private void invalidateRowsWithChanges(RowDataRequestParams request) { // Causes row.getEvents() and row.getChartData() // to return null until data is refreshed. List<RowData> rowDataArray = request.snapshot.getRowData(); int nRows = rowDataArray.size(); // rowDataArray defines "all rows" at full zoom out for (int i = request.rowStart; i <= request.rowEnd; i++) { if (i >= nRows) { break; // weird } RowData row = rowDataArray.get(i); RowDataRequestParams oldParams = row.getParams(); // params mutated by not_edt_fetchTLRows() if (request.forceLoad || !subsetOf(oldParams, request)) { row.invalidateEventData(); } } } private synchronized void not_edt_fetchTLRows(final RowDataRequestParams request) { // note: above "synchronized" not needed if calls never overlap { if (request.snapshot != getTL2DataSnapshot()) { // request is no longer valid // ...change in [exp add/drop, filters, grouping, mode] invalidateRowData(request.snapshot); // YXXX do we need to free old IPC Context here? THOMAS? return; } invalidateRowsWithChanges(request); // doesn't need to be sync'd // start fetching new data. List<RowData> rowDataArray = request.snapshot.getRowData(); List<RowData> fetchRows = new ArrayList<>(); // add required rows for (int i = request.required_rowStart; i <= request.required_rowEnd; i++) { RowData row = rowDataArray.get(i); fetchRows.add(row); } // add prefetch rows, starting with those nearest required rows int lo = request.required_rowStart - 1; int hi = request.required_rowEnd + 1; while (lo >= request.rowStart || hi <= request.rowEnd) { if (lo >= request.rowStart) { RowData row = rowDataArray.get(lo); fetchRows.add(row); } if (hi <= request.rowEnd) { RowData row = rowDataArray.get(hi); fetchRows.add(row); } hi++; lo--; } Queue<IPCResult> ipcResultQ = new LinkedList<>(); Queue<RowData> rowQ = new LinkedList<>(); for (RowData row : fetchRows) { if (request.isCancelled()) { // fetchTLRowDataInitiate() called, new TLDataSnapshot not required (e.g. for pan, zoom) // ipcContext.cancel(); // YXXX IPC is not complete here. Should // probably cancel ipcContext? // THOMAS FIXME break; } if (row.eventDataIsValid()) { // old data is fine; skip fetch continue; } IPCResult ipcResult = ipcStart_getTLData(ipcContext, null, row, request); // non-blocking ipc start ipcResultQ.add(ipcResult); rowQ.add(row); if (ipcResultQ.size() > 5) { // because cancel isn't implemented right, need to cap this process_fetchTLRows(request, rowQ, ipcResultQ); } } // last rows process_fetchTLRows(request, rowQ, ipcResultQ); } } private void process_fetchTLRows( final RowDataRequestParams request, Queue<RowData> rows, Queue<IPCResult> ipcResults) { while (ipcResults.size() > 0) { IPCResult savedIpcResult = ipcResults.remove(); RowData savedRow = rows.remove(); Object[] data = (Object[]) savedIpcResult.getObject(); if (request.isCancelled()) { continue; } if (data != null) { ipcFinish_getTLData(data, savedRow, request); } } } // ---- from MetaExperiment.java public long[] getStackFuncArray(final long stackId) { // YXXX slow long[] stackFuncs; Long stackIdL = stackId; synchronized (stack_htable) { stackFuncs = stack_htable.get(stackIdL); } if (stackFuncs == null) { stackFuncs = new long[0]; // System.err.println("XXXmpview Experiment.java::getStackFuncArray("+stackId+") returning // null"); } return stackFuncs; } public void ipcSetStackFuncArray(final long stackId) { // IPC!! long stackIds[] = new long[1]; stackIds[0] = stackId; detectNewStackIds(stackIds); } // ---IPC--- (Native methods from liber_dbe.so) private IPCResult ipcStart_getTLData( final IPCContext ipcContext, final IPCListener ipcListener, final RowData rowData, final RowDataRequestParams request) { final RowDefinition rowDef = rowData.rowDefinition; long current_time_adjust = rowDef.getTimeOrigin(); long startt = request.alignedTimeStart + current_time_adjust; IPCResult ipcResult = ipcStart_getTLData( ipcContext, ipcListener, rowDef.getExpID(), rowDef.getDataDescriptor().getDataId(), rowDef.getEntity().getPropId(), rowDef.getEntity().getPropValue(), rowDef.getAux(), startt, request.binTime, request.nbins, true, rowDef.getChartPropNames()); return ipcResult; } private void ipcFinish_getTLData( Object data[], final RowData rowData, // IPC!! final RowDataRequestParams request) { Object representatives[] = (Object[]) data[0]; final GenericEvent[] events; if (representatives == null) { events = null; } else { // each of the following is the same length: int startbins[] = (int[]) representatives[0]; int eventbins[] = (int[]) representatives[1]; long event_ids[] = (long[]) representatives[2]; // DataView indexes long stack_ids[] = (long[]) representatives[3]; int mstate[] = (int[]) representatives[4]; long sampleVals[][] = (long[][]) representatives[5]; long timeStart[] = (long[]) representatives[6]; long timeEnd[] = (long[]) representatives[7]; long timeAdjust = rowData.rowDefinition.getTimeOrigin(); if (rowData.getRowDef().getTLDataType().equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 - maybe create GCEvent instead of GenericEvent events = new GenericEvent[event_ids.length]; for (int k = 0; k < event_ids.length; k++) { events[k] = new GenericEvent( event_ids[k], startbins[k], eventbins[k], timeStart[k] - timeAdjust, timeEnd[k] - timeAdjust); } } else if (sampleVals != null) { // if (tltype == Presentation.TLData_type.TL_SAMPLE }) { events = new SampleEvent[event_ids.length]; for (int k = 0; k < event_ids.length; k++) { events[k] = new SampleEvent( event_ids[k], startbins[k], eventbins[k], timeStart[k] - timeAdjust, timeEnd[k] - timeAdjust, sampleVals[k]); } } else { events = new StackEvent[event_ids.length]; for (int k = 0; k < event_ids.length; k++) { final long stack_id; if (stack_ids == null) { stack_id = DetailsIPC.INVALID_STACK_ID; } else { stack_id = stack_ids[k]; } events[k] = new StackEvent( event_ids[k], startbins[k], eventbins[k], timeStart[k] - timeAdjust, timeEnd[k] - timeAdjust, stack_id, mstate != null ? mstate[k] : -1); } } detectNewStackIds(stack_ids); } final Object chartPropVals[] = (Object[]) data[1]; if (chartPropVals != null) { for (int propNum = 0; propNum < chartPropVals.length; propNum++) { Object thisProp = chartPropVals[propNum]; if (thisProp == null) { continue; } if (thisProp instanceof long[][]) { // thisProp represents multiple states; convert to Events long perBinStates[][] = (long[][]) thisProp; // sparsely populated; determine how many actual samples int nSamples = 0; for (Object binData : perBinStates) { if (binData != null) { nSamples++; } } SampleEvent sampleEvents[] = new SampleEvent[nSamples]; int sampleIdx = 0; // for now, charts binTimeStart/binTimeEnd not used; use request duration final long binTimeStart = 0; final long binTimeEnd = request.binTime - 1; for (int bin = 0; bin < perBinStates.length; bin++) { long stateVals[] = perBinStates[bin]; if (stateVals == null) { continue; } sampleEvents[sampleIdx++] = new SampleEvent(-1, bin, 1, binTimeStart, binTimeEnd, stateVals); } chartPropVals[propNum] = sampleEvents; // replace w/ Events } } } { // IPC: if needed, code from here down could be done in separate thread rowData.setEventData(request, events, chartPropVals); timelineView.repaintTLDrawer(); } } public void detectNewStackIds(long stack_ids[]) { if (stack_ids == null || stack_ids.length == 0) { return; } boolean missing = false; synchronized (stack_htable) { for (long stack_id : stack_ids) { if (!stack_htable.containsKey(stack_id)) { stacks_pending.add(stack_id); missing = true; } } } if (missing) { try { stackFetcherQ.put(true); } catch (InterruptedException ex) { int ii = 1; } // send wakeup } } private void ipcAddStackIds() { // IPC!! final int sz; final long newStackIdsArray[]; synchronized (stack_htable) { if (stacks_pending == null || stacks_pending.isEmpty()) { return; } sz = stacks_pending.size(); newStackIdsArray = new long[sz]; int ii = 0; for (Long stackId : stacks_pending) { newStackIdsArray[ii++] = stackId.longValue(); } } Object[] stacks = anWindow.getStacksFunctions(newStackIdsArray); // IPC!! HashSet<Long> newFunctions = new HashSet<Long>(); synchronized (stack_htable) { for (int ii = 0; ii < sz; ii++) { long stack_id = newStackIdsArray[ii]; long[] stack = (long[]) stacks[ii]; long[] old = stack_htable.put(stack_id, stack); if (old == null) { // new stack detected stacks_pending.remove(stack_id); // store unique functions for (long function : stack) { newFunctions.add(function); } } } } anWindow.getColorChooser().getColorMap().addFunctionsIPC(newFunctions); timelineView.repaintTLDrawer(); } private IPCResult ipcStart_getTLData( IPCContext ipcContext, IPCListener ipcListener, int exp_id, int data_id, int entity_prop_id, int entity_prop_val, int hwctag, long start_ts, long delta, int ndelta, boolean getRepresentatives, final String[] chartProperties) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); { ipcHandle.append("getTLData"); ipcHandle.append(0); ipcHandle.append(exp_id); ipcHandle.append(data_id); ipcHandle.append(entity_prop_id); ipcHandle.append(entity_prop_val); ipcHandle.append(hwctag); ipcHandle.append(start_ts); ipcHandle.append(delta); ipcHandle.append(ndelta); ipcHandle.append(getRepresentatives); ipcHandle.append(chartProperties); } if (ipcListener != null) { ipcHandle.addIPCListener(ipcListener); } IPCResult ipcResult = ipcHandle.sendRequest(); return ipcResult; } public IPCResult ipcStart_getTLEventCenterTime( IPCContext ipcContext, IPCListener ipcListener, int exp_id, int data_id, int entity_prop_id, int entity_prop_val, int hwctag, long event_idx, long move_count) { if (ipcContext == null) { ipcContext = this.ipcContext; } IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); { ipcHandle.append("getTLEventCenterTime"); ipcHandle.append(0); ipcHandle.append(exp_id); ipcHandle.append(data_id); ipcHandle.append(entity_prop_id); ipcHandle.append(entity_prop_val); ipcHandle.append(hwctag); ipcHandle.append(event_idx); ipcHandle.append(move_count); } if (ipcListener != null) { ipcHandle.addIPCListener(ipcListener); } IPCResult ipcResult = ipcHandle.sendRequest(); return ipcResult; } public long ipcGetTLEventIdxNearTime( int exp_id, int data_id, int entity_prop_id, int entity_prop_val, int hwctag, int searchDirection, long ts) { synchronized (IPC.lock) { anWindow.IPC().send("getTLEventIdxNearTime"); anWindow.IPC().send(0); anWindow.IPC().send(exp_id); anWindow.IPC().send(data_id); anWindow.IPC().send(entity_prop_id); anWindow.IPC().send(entity_prop_val); anWindow.IPC().send(hwctag); anWindow.IPC().send(searchDirection); anWindow.IPC().send(ts); return anWindow.IPC().recvLong(); } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TL2Drawer.java�������������������������������������������0000644�0001750�0001750�00000117222�15044710303�020232� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline.events.*; import org.gprofng.mpmt.timeline2.TL2DataSnapshot.*; import org.gprofng.mpmt.timeline2.cursorevent.*; import org.gprofng.mpmt.timeline_common.*; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.ruler.valuetypes.ValuesLong; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import java.util.TreeSet; import java.util.Vector; import java.util.concurrent.LinkedBlockingQueue; import javax.swing.SwingUtilities; // This class' public methods MUST only be accessed from AWT event thread public final class TL2Drawer implements TimelineDrawer { // params private TimelinePanel timelinePanel; private final TL2DataFetcher tl2DataFetcher; // image data private final CoordCalcTimeMaster timeAxisMaster; private final CoordCalcTimeReader timeAxisReader; private final CoordCalcDataMaster dataAxisMaster; private final CoordCalcDataReader dataAxisReader; public TimelineDraw event_drawer; // listeners private ArrayList<TimelineSelectionListener> selection_listeners; // cursor location (most recent location of user focus) private RowGeometry cursor_rowGeometry = null; private RowGeometry cursor_rowGeometry_alt = null; // cursor movement event queue private final LinkedBlockingQueue<CursorEvent> cursorEventQ; // Use queue because up/down/left/right need IPC private final Object cursorEventQLock = new Object(); // used for syncing peek/take combos // selection of row blocks (entities/samples for use in filters) private TreeSet<Integer> selected_row_blocks; // indices for selected_row_blocks_info private List<EntityDefinitions> selected_entity_info; private int selected_row_blocks_anchor = -1; // for shift-click multiselect // zoom private long old_time_range = 0; // components // private RangeRuler verticalRuler; private IconRuler verticalRuler; // fetching private long data_time_start; private long data_bin_time; private int data_time_nbins; private int data_row_start; private int data_row_end; // options public TL2Drawer( // Called even before TL tab is popped to top final TL2DataFetcher tl2DataFetcher) { this.tl2DataFetcher = tl2DataFetcher; // placeholder initialization; real init is later via TL2DataFetchListener timeAxisMaster = new CoordCalcTimeImpl(TimelineDraw.HMARGIN); timeAxisReader = timeAxisMaster; dataAxisMaster = new TL2CoordCalcData(0); dataAxisMaster.setExpandToFill(false); dataAxisReader = dataAxisMaster; verticalRuler = new IconRuler(new ValuesLong(0, 0)); selection_listeners = new ArrayList<>(); cursorEventQ = new LinkedBlockingQueue(); cursorEventQueueInit(); resetSelRowBlocks(); resetFetchHistory(); event_drawer = new TimelineDraw( tl2DataFetcher, tl2DataFetcher.anWindow.getColorChooser().getColorMap(), verticalRuler, timeAxisReader, dataAxisMaster); tl2DataFetcher.addTL2DataFetchListener( new TL2DataFetcher.TL2DataFetchListener() { public void not_edt_newDataSnapshot() { AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { TL2DataSnapshot tl2DataSnapshot = tl2DataFetcher.getTL2DataSnapshot(); event_drawer.edt_processDataSnapshot(tl2DataSnapshot, true, null); if (timelinePanel != null) { long new_range = event_drawer.getAbsoluteTimeEnd(); if (new_range != 0 && old_time_range != new_range) { // YXXX should we only do this once? old_time_range = new_range; timelinePanel.edt_resetTLRanges(); // timelinePanel.zoomHistoryAdd(); attemptToSelectVisibleStackEvent(); } else { // for example, filter set remapSelections(); } timelinePanel.edt_revalidateAll( true); // init timeAxisCalculator, dataAxisCalculator } } }); } }); } public void edt_resetAll() { old_time_range = 0; resetFetchHistory(); event_drawer.edt_resetAll(); cursorEventQueueClear(); edt_processTimelineSelectionEvent_internal( null, true); // sends TimelineSelectionEvent notifications } private void resetFetchHistory() { data_time_start = 0; data_bin_time = 0; data_time_nbins = 0; data_row_start = 0; data_row_end = 0; } public void setParent(TimelinePanel parent) { this.timelinePanel = parent; } public CoordCalcTimeMaster getTimeAxisMaster() { return timeAxisMaster; } public CoordCalcDataMaster getDataAxisMaster() { return dataAxisMaster; } public CoordCalcTimeReader getTimeAxisReader() { return timeAxisReader; } public CoordCalcDataReader getDataAxisReader() { return dataAxisReader; } public VerticalRowRuler getVerticalRuler() { return verticalRuler; } public boolean getEnableZoomVertical() { return false; // disable 2-d drag zoom and the overlay version of the zoom slider } public boolean getEnableZoomOverlays() { return false; // disable the overlay version of the zoom sliders } public boolean getEnableUnalignedRows() { return true; } public boolean getEnableTimeCaliper() { return true; } // ------ get X & Y max dimensions public long getAbsoluteTimeStart() { return event_drawer.getAbsoluteTimeStart(); } public long getAbsoluteTimeEnd() { return event_drawer.getAbsoluteTimeEnd(); } public long getAbsoluteTimeDuration() { return getAbsoluteTimeEnd() - getAbsoluteTimeStart() + 1; } public int getAbsoluteRowEnd() { return dataAxisReader.getAbsRowEnd(); // YXXX shouldn't we get this from event_drawer? } public int getAbsoluteRowCount() { return dataAxisReader.getAbsRowCount(); // YXXX shouldn't we get this from event_drawer? } public void zoomCenterSelection() { // no state to change } public boolean selectionActive() { return event_drawer.selectionActive(); } public long getSelectionTimeCenter() { long center = (event_drawer.getSelectionTimeEnd() + event_drawer.getSelectionTimeStart()) / 2; // YXXX perhaps not the same formula used for zoom or dbe return center; } public long getSelectionTimeStart() { return event_drawer.getSelectionTimeStart(); } public long getSelectionTimeEnd() { return event_drawer.getSelectionTimeEnd(); } public double getSelectionYCenter() { return event_drawer.getSelectionYCenter(); } // --- "state" selection via cursor public boolean getSelectionNavigationEnabled() { // if(event_drawer.getVisibleSelection()==null){ if (event_drawer.getSelection() == null) { return false; } return true; } // --- combined selection and selRowBlock ops private void remapSelections() { // AWT thread only TL2DataSnapshot tl2DataSnapshot = event_drawer.getDataSnapshot(); if (tl2DataSnapshot == null) { return; // refetch in progress; don't check or update old selections } remapSelRowBlocks(); TimelineSelectionEvent oldEvt = event_drawer.getRecentSelection(); if (oldEvt == null) { // no previous selection to remap edt_processTimelineSelectionEvent(null); // IPC not needed to clear selections, do it now return; } final RowGeometry newRow = remapRow(oldEvt.getRowGeometry()); final CursorSetEvent newEvent; if (newRow == null) { // row could not be remapped, select an event near that row if possible int rowNum = oldEvt.rowNum; if (rowNum > event_drawer.getRowGeometry().size() - 1) { rowNum = event_drawer.getRowGeometry().size() - 1; } if (rowNum < 0) { // don't even have a row to select edt_processTimelineSelectionEvent(null); // IPC not needed to clear selections, do it now return; } RowGeometry row = event_drawer.getRowGeometry().get(rowNum); row = row.getMasterRow(); newEvent = new CursorSetEvent(row, oldEvt.clickTime, false, false, false, false); } else { newEvent = new CursorSetEvent( newRow, oldEvt.clickTime, false, false, // oldEvt.eventIdx, // filters may have changed... -1, // ... so search by time oldEvt.eventTimeStart, oldEvt.eventTimeEnd, false, false, false); } cursorEventQueueSet(newEvent); // To avoid delayed Y scrolling while waiting for selection details... // ... we could generate a new kind of no-ipc Y selection event } public boolean attemptToSelectVisibleStackEvent() { TimelineSelectionEvent selection_event = event_drawer.getSelection(); if (selection_event != null) { return false; // selection already exists, don't undo it } // no row selected, try to find a row with a callstack. double pct_start = dataAxisReader.getVisibleStart(); int row_start = dataAxisReader.getRowNearPercent(pct_start); RowGeometry rowGeometry; rowGeometry = getNearbyRowForEventSelection(row_start, true); if (rowGeometry == null) { rowGeometry = getNearbyRowForEventSelection(row_start, false); } if (rowGeometry != null) { long start_time = timeAxisReader.getTimeStart(); long end_time = timeAxisReader.getTimeEnd(); long mid_time = (start_time + end_time) / 2; cursorEventQueueAdd(new CursorSetEvent(rowGeometry, mid_time, false, false, true, true)); return true; } // processTimelineSelectionEvent(null);// force unselect; call directly, no IPC needed return false; } // --- multi-selection of row blocks (i.e. entities + samples) private void resetSelRowBlocks() { selected_row_blocks = new TreeSet(); selected_row_blocks_anchor = -1; selected_entity_info = null; cursor_rowGeometry = null; cursor_rowGeometry_alt = null; } private void updateSelRowBlocks( TL2DataSnapshot dataSnapshot, int blockNum, boolean ctrl, boolean shift) { if (blockNum < 0) { int foo = 1; // when resetting blocks } else if ((!ctrl && !shift) || (shift && selected_row_blocks_anchor == -1)) { selected_row_blocks.clear(); selected_row_blocks.add(blockNum); selected_row_blocks_anchor = blockNum; } else if (ctrl) { if (!selected_row_blocks.remove(blockNum)) { selected_row_blocks.add(blockNum); selected_row_blocks_anchor = blockNum; } } else if (shift) { selected_row_blocks.clear(); final int lo, hi; if (selected_row_blocks_anchor < blockNum) { lo = selected_row_blocks_anchor; hi = blockNum; } else { lo = blockNum; hi = selected_row_blocks_anchor; } for (int ii = lo; ii <= hi; ii++) { selected_row_blocks.add(ii); } } // save the mapping of blocks final TimelineSelectionRowEvent rowEvent; if (dataSnapshot == null) { rowEvent = new TimelineSelectionRowEvent(false); } else { selected_entity_info = dataSnapshot.getEntityDefinitions(); rowEvent = new TimelineSelectionRowEvent(!selected_row_blocks.isEmpty()); } event_drawer.setSelectedRows(selected_row_blocks); // YXXX could we refactor this? genericNotifyTimelineSelectionListeners(rowEvent); } private void remapSelRowBlocks() { TL2DataSnapshot tl2DataSnapshot = event_drawer.getDataSnapshot(); if (tl2DataSnapshot == null) { return; // refetch in progress; don't check or update old selections } if (selected_entity_info == null) { selected_row_blocks = new TreeSet(); return; // no history } TreeSet<Integer> newBlockSelList = new TreeSet(); for (Integer oldBlockNum : selected_row_blocks) { if (oldBlockNum >= selected_entity_info.size()) { return; // weird } RowDefinition rowDef0 = selected_entity_info.get(oldBlockNum).entityRows.get(0); List<EntityDefinitions> newBlocks = tl2DataSnapshot.getEntityDefinitions(); int newBlockNum = 0; for (EntityDefinitions rowBlock : newBlocks) { RowDefinition tmpRowDef = rowBlock.entityRows.get(0); if (rowDef0.matches(-1, tmpRowDef, -1)) { newBlockSelList.add(newBlockNum); break; } newBlockNum++; } } selected_row_blocks = newBlockSelList; selected_entity_info = tl2DataSnapshot.getEntityDefinitions(); TimelineSelectionRowEvent rowEvent = new TimelineSelectionRowEvent(!selected_row_blocks.isEmpty()); event_drawer.setSelectedRows(selected_row_blocks); // YXXX could we refactor this? genericNotifyTimelineSelectionListeners(rowEvent); } private RowGeometry remapRow(RowGeometry oldGeometry) { if (oldGeometry == null) { return null; } List<RowGeometry> currentRows = event_drawer.getRowGeometry(); int oldChartPropIdx = oldGeometry.chartPropIdx; RowDefinition oldRowDef = oldGeometry.rowData.getRowDef(); for (RowGeometry curGeo : currentRows) { int curChartPropIdx = curGeo.chartPropIdx; RowDefinition currRowDef = curGeo.rowData.getRowDef(); if (currRowDef.matches(curChartPropIdx, oldRowDef, oldChartPropIdx)) { return curGeo; } } return null; } // --- event selection private RowGeometry getAdjacentRowGeo(int rowNum) { List<RowGeometry> tmpGeoList = event_drawer.getRowGeometry(); for (int kk = rowNum + 1, direction = 1; ; kk += direction) { if (kk >= tmpGeoList.size()) { // hit last row; start at middle and go backwards kk = rowNum - 1; direction = -1; } if (kk < 0 || kk >= tmpGeoList.size()) { break; } int blkNum = event_drawer.rowNum2EntityNum(kk); if (!selected_row_blocks.contains(blkNum)) { // row is not part of current block of rows return tmpGeoList.get(kk); } } return null; } private RowGeometry getNearbyRowForEventSelection(int rowNum, boolean onlyWithStacks) { List<RowGeometry> tmpGeoList = event_drawer.getRowGeometry(); for (int kk = rowNum, direction = 1; ; kk += direction) { if (kk >= tmpGeoList.size()) { // hit last row; start at middle and go backwards kk = rowNum - 1; direction = -1; } if (kk < 0 || kk >= tmpGeoList.size()) { break; } RowGeometry row = tmpGeoList.get(kk); if (row.isChartData()) { // this row is a data chart continue; } Settings.TLData_type tlData_type = row.rowData.rowDefinition.getDataDescriptor().getTLDataType(); if (onlyWithStacks && (tlData_type.equals(Settings.TLData_type.TL_SAMPLE) || tlData_type.equals(Settings.TLData_type.TL_HEAPSZ) || // YXXX add property for no stacks? tlData_type.equals(Settings.TLData_type.TL_GCEVENT))) { // CXXX Bug 20801848 // ignore samples and heapsz when searching for a good row for initial selection continue; } return row; } return null; } private TimelineSelectionEvent ipcNewSelectionEvent( // not AWT thread. Must only access final data. RowGeometry rowGeometry, // must be valid long clickTime, // must be valid boolean ctrlKey, boolean shiftKey, TimelineSelectionEvent.CursorAxis axis, long eventIdx, // may be -1 boolean requestCaliperRefresh, boolean updateRowSelections) { RowDefinition rowDef = rowGeometry.rowData.rowDefinition; final IPCResult leftResult, rightResult; if (eventIdx == TimelineSelectionEvent.EVT_IDX_INVALID) { leftResult = rightResult = null; } else { leftResult = ipcStart_getTLEventCenterTime(rowDef, eventIdx, -1); rightResult = ipcStart_getTLEventCenterTime(rowDef, eventIdx, 1); } int rowNum = rowGeometry.rowNum; final EventDetail details; if (eventIdx == TimelineSelectionEvent.EVT_IDX_INVALID) { details = null; } else { details = DetailsIPC.ipcGetTLDetails( this.tl2DataFetcher.anWindow, rowDef.getExpID(), rowDef.getExpName(), rowDef.getDataDescriptor().getDataId(), rowDef.getDataDescriptor().getTLDataType(), rowDef.getEntity().getPropId(), eventIdx, rowDef.getCpuFreq(), rowDef.getTimeOrigin()); } final Vector<StackState> stackFrames; if (details == null || details.getStackStates() == null) { stackFrames = null; } else { stackFrames = new Vector(details.getStackStates()); } final boolean left = (leftResult != null && ipcFinish_getTLEventCenterTime(leftResult, rowDef) != null); final boolean right = (rightResult != null && ipcFinish_getTLEventCenterTime(rightResult, rowDef) != null); final boolean up; final boolean down; { int lastIdx = rowGeometry.parent.size() - 1; int masterOfLastRow = rowGeometry.parent.get(lastIdx).getMasterRow().rowNum; int thisMaster = rowGeometry.getMasterRow().rowNum; up = (rowNum < 1) ? false : true; down = (masterOfLastRow == thisMaster) ? false : true; } final long eventStartTime, eventEndTime; if (details != null) { eventEndTime = details.getTimestamp(); if (details instanceof DurationEvent) { long duration = ((DurationEvent) details).getDuration(); eventStartTime = eventEndTime - duration; } else { eventStartTime = eventEndTime; } } else { eventStartTime = eventEndTime = clickTime; } TimelineSelectionEvent selEvent = new TimelineSelectionEvent( rowGeometry, clickTime, // must be valid ctrlKey, shiftKey, axis, details, stackFrames, left, right, up, down, eventIdx, eventStartTime, eventEndTime, requestCaliperRefresh, updateRowSelections); // make sure this stack is known by tl2DataFetcher if (details instanceof ExtendedEvent) { ExtendedEvent extEvent = (ExtendedEvent) details; tl2DataFetcher.ipcSetStackFuncArray(extEvent.getStack()); // IPC!! } return selEvent; } private void edt_processTimelineSelectionEvent(TimelineSelectionEvent selEvent) { edt_processTimelineSelectionEvent_internal(selEvent, false); } private void edt_processTimelineSelectionEvent_internal( TimelineSelectionEvent selEvent, boolean forceRows) { do { if (selEvent == null) { selEvent = new TimelineSelectionEvent(); } TL2DataSnapshot tl2DataSnapshot = event_drawer.getDataSnapshot(); if (selEvent.rowNum == -1) { // row number unknown if (selEvent.updateRowSelections || forceRows) { resetSelRowBlocks(); updateSelRowBlocks(tl2DataSnapshot, -1, false, false); } break; // go to notify } if (selEvent.updateRowSelections) { int tmpRowNum = limitRowRange(selEvent.rowNum); // is this needed? int blockNum = event_drawer.rowNum2EntityNum(tmpRowNum); // may be -1 updateSelRowBlocks(tl2DataSnapshot, blockNum, selEvent.ctrlKey, selEvent.shiftKey); } else { int ii = 0; // for breakpoint } // set global state // save definition of current row so we can find it after filter cursor_rowGeometry = selEvent.getRowGeometry(); // search for alternate cursor in case this one is filtered out cursor_rowGeometry_alt = getAdjacentRowGeo(selEvent.rowNum); } while (false); event_drawer.setSelection(selEvent); timelinePanel.repaint(); timelinePanel .requestFocus(); // YXXX steals focus from other applications, is there a better way? genericNotifyTimelineSelectionListeners(selEvent); } private void genericNotifyTimelineSelectionListeners(TimelineSelectionGenericEvent ev) { for (TimelineSelectionListener listener : selection_listeners) { listener.valueChanged(ev); } } // --- used by TL2ControlPanel public List<EntityDefinitions> getRowDefsByBlock() { TL2DataSnapshot tl2DataSnapshot = event_drawer.getDataSnapshot(); if (tl2DataSnapshot == null) { return null; } return tl2DataSnapshot.getEntityDefinitions(); } public List<Integer> getRowBlockSelectList() { // returns a sorted list of selected row blocks (i.e. threads,samples...). // The list consists of indices for use with getRowDefsByBlock() return new ArrayList<>(selected_row_blocks); } // utilities private int limitRowRange(int rowNum) { // dataAxisCalculator should be in sync with rowDefs int lastRow = dataAxisReader.getAbsRowEnd(); if (rowNum < 0) { return 0; } if (rowNum > lastRow) { return lastRow; } return rowNum; } private TimelineSelectionEvent ipcGetSelEvent( RowGeometry rowGeometry, long clickTime, // may be updated below final boolean ctrlKey, final boolean shiftKey, final TimelineSelectionEvent.CursorAxis axis, final long oldEventIdx, final long moveCount, final boolean requestCaliperUpdate, final boolean updateRowSelections) { if (rowGeometry == null) { return null; } RowDefinition rowDef = rowGeometry.rowData.rowDefinition; long eventIdx = oldEventIdx; if (eventIdx != TimelineSelectionEvent.EVT_IDX_INVALID) { long[] idx_and_time = ipcGetTLEventCenterTime(rowDef, oldEventIdx, moveCount); if (idx_and_time == null) { // event not found eventIdx = TimelineSelectionEvent.EVT_IDX_INVALID; // try again by time, below } else { // event found eventIdx = idx_and_time[0]; long event_ts = idx_and_time[1]; if (clickTime == TimelineDrawer.TIME_INVALID) { clickTime = event_ts; // update clickTime if not previously set } } } // note: eventIdx may be updated above if (eventIdx == TimelineSelectionEvent.EVT_IDX_INVALID && clickTime == TimelineDrawer.TIME_INVALID) { return null; // event cannot be found. } if (eventIdx == TimelineSelectionEvent.EVT_IDX_INVALID) { eventIdx = ipcGetTLEventIdxNearTime(rowDef, clickTime); } TimelineSelectionEvent selEvent = ipcNewSelectionEvent( rowGeometry, clickTime, ctrlKey, shiftKey, axis, eventIdx, requestCaliperUpdate, updateRowSelections); return selEvent; } // --- CursorEventQueue events (e.g. left/right/up/down) handled on worker thread private void cursorEventQueueInit() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { while (true) { cursorEventQueueTake(); } } }, "TL2CursorEventHandler"); } private void cursorEventQueueTake() { // NOT on awt thread! try { final CursorEvent genericEvent = cursorEventQ.take(); if (genericEvent instanceof CursorSetEvent) { CursorSetEvent head = (CursorSetEvent) genericEvent; not_edt_processCursorSetEvent(head); } else if (genericEvent instanceof CursorMoveEvent) { CursorMoveEvent head = (CursorMoveEvent) genericEvent; // look ahead to consolidate like-events int count = head.count; do { CursorMoveEvent anotherMove = null; synchronized (cursorEventQLock) { // synchronized with clear so that peek/take grab same value try { CursorEvent tmp = cursorEventQ.peek(); if (tmp instanceof CursorMoveEvent && ((CursorMoveEvent) tmp).axis == head.axis) { anotherMove = (CursorMoveEvent) cursorEventQ.take(); } else { break; } } catch (InterruptedException ex) { ; // do nothing } } count += anotherMove.count; } while (true); if (count != head.count) { head = new CursorMoveEvent(head.axis, count, head.ctrlKey, head.shiftKey); } not_edt_processCursorMoveEvent(head); } } catch (InterruptedException ex) { ; // do nothing } } private void not_edt_processCursorSetEvent(CursorSetEvent event) { // NOT awt thread // do ipc (calls below should not access globals) final TimelineSelectionEvent selEvent; final long eventIdx; if (event.directHit) { eventIdx = event.eventIdx; } else { eventIdx = TimelineSelectionEvent.EVT_IDX_INVALID; } selEvent = ipcGetSelEvent( event.rowGeometry, event.clickTime, event.ctrlKey, event.shiftKey, TimelineSelectionEvent.CursorAxis.NA, eventIdx, 0, event.requestRefreshCaliper, event.updateRowSelections); if (selEvent == null) { return; } // update swing components try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { edt_processTimelineSelectionEvent(selEvent); } }); } catch (Exception e) { ; // weird? // e.printStackTrace(); } } private void not_edt_processCursorMoveEvent(final CursorMoveEvent event) { // NOT awt thread final int n = event.count; if (n == 0) { return; } // compute new state on EDT class AWTStateCapture { public RowGeometry newRow; public long clickTime; public long oldEventIdx; public long moveCount; public boolean requestCaliperUpdate; public AWTStateCapture() { this.newRow = null; this.clickTime = TimelineDrawer.TIME_INVALID; this.oldEventIdx = TimelineSelectionEvent.EVT_IDX_INVALID; this.moveCount = 0; this.requestCaliperUpdate = false; } } ; final AWTStateCapture saved = new AWTStateCapture(); try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { // Calculate the next location on EDT // Set newRow=null if next location can't be calculated. TimelineSelectionEvent prevEvent = event_drawer.getSelection(); if (prevEvent == null || prevEvent.getRowGeometry() == null || prevEvent.rowNum == -1) { return; } if (event.axis == TimelineSelectionEvent.CursorAxis.LEFT_RIGHT) { if (prevEvent.eventIdx == TimelineSelectionEvent.EVT_IDX_INVALID) { return; } saved.newRow = prevEvent.getRowGeometry(); // will not be null, see above saved.clickTime = TimelineDrawer.TIME_INVALID; // will be determined later saved.oldEventIdx = prevEvent.eventIdx; saved.moveCount = n; saved.requestCaliperUpdate = true; return; } if (event.axis == TimelineSelectionEvent.CursorAxis.UP_DOWN) { final int n_abs = Math.abs(n); RowGeometry newRow = event_drawer.rowNum2RowGeometry(prevEvent.rowNum); if (newRow == null) { return; } for (int ii = 0; ii < n_abs; ii++) { final int nn; if (n < 0) { nn = newRow.rowNum - newRow.subrowNum - 1; } else { nn = newRow.rowNum - newRow.subrowNum + newRow.nSubrows; } RowGeometry nextRow = event_drawer.rowNum2RowGeometry(nn); if (nextRow == null) { break; } newRow = nextRow; } newRow = newRow.getMasterRow(); saved.newRow = newRow; saved.clickTime = prevEvent.clickTime; saved.oldEventIdx = TimelineSelectionEvent.EVT_IDX_INVALID; saved.moveCount = 0; // not used saved.requestCaliperUpdate = false; return; } } }); } catch (Exception e) { ; // weird? // e.printStackTrace(); } // do ipc (calls below should not access globals) final TimelineSelectionEvent selEvent; if (saved.newRow == null) { return; } selEvent = ipcGetSelEvent( saved.newRow, saved.clickTime, event.ctrlKey, event.shiftKey, event.axis, saved.oldEventIdx, saved.moveCount, saved.requestCaliperUpdate, true); if (selEvent == null) { return; } // update swing components try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { edt_processTimelineSelectionEvent(selEvent); } }); } catch (Exception e) { ; // weird? // e.printStackTrace(); } } private void cursorEventQueueClear() { synchronized (cursorEventQLock) { // synchronized to simplify peek cursorEventQ.clear(); } } private void cursorEventQueueAdd(CursorEvent event) { cursorEventQ.add(event); } private void cursorEventQueueSet(CursorEvent event) { // edt_processTimelineSelectionEvent(null);// clears queue, resets RHS cursorEventQueueClear(); cursorEventQueueAdd(event); } public void selectFirst() { int rowNum = dataAxisReader.getRowStart(); RowGeometry rowGeometry = event_drawer.rowNum2RowGeometry(rowNum); long time = timeAxisReader.getTimeStart(); cursorEventQueueSet(new CursorSetEvent(rowGeometry, time, false, false, true, true)); } @Override public void selectLeft() { selectLeft(false, false); } public void selectRight() { selectRight(false, false); } public void selectUp() { selectUp(false, false); } public void selectDown() { selectDown(false, false); } public void selectLeft(boolean ctrl, boolean shift) { cursorEventQueueAdd( new CursorMoveEvent(TimelineSelectionEvent.CursorAxis.LEFT_RIGHT, -1, ctrl, shift)); } public void selectRight(boolean ctrl, boolean shift) { cursorEventQueueAdd( new CursorMoveEvent(TimelineSelectionEvent.CursorAxis.LEFT_RIGHT, 1, ctrl, shift)); } public void selectUp(boolean ctrl, boolean shift) { cursorEventQueueAdd( new CursorMoveEvent(TimelineSelectionEvent.CursorAxis.UP_DOWN, -1, ctrl, shift)); } public void selectDown(boolean ctrl, boolean shift) { cursorEventQueueAdd( new CursorMoveEvent(TimelineSelectionEvent.CursorAxis.UP_DOWN, 1, ctrl, shift)); } public TimelineCaliper selectNearXY(int x, int y, boolean ctrl, boolean shift) { // System.out.println(event_drawer.dumpXY(event_drawer.findNearXY(x,y,false))); // DUMP // System.out.println(event_drawer.exportAsText(0)); // Returns time dimensions of event only if mouse directly over event. // Additionally, queues the selection event. TimelineDraw.FindNearXYResult result = event_drawer.findNearXY(x, y, true); if (result == null) { return null; } final CursorSetEvent event; if (result.event != null) { event = new CursorSetEvent( result.rowGeometry, result.clickTime, ctrl, shift, result.event.eventIdx, result.event.timeStart, result.event.timeEnd, result.directTimeHit, false, true); } else { event = new CursorSetEvent(result.rowGeometry, result.clickTime, ctrl, shift, false, true); } cursorEventQueueSet(event); if (!result.directTimeHit) { return null; } return new TimelineCaliper(result.event.timeStart, result.event.timeEnd); } public void notifyCaliperChange(TimelineCaliper caliper) { event_drawer.setCaliper(caliper); genericNotifyTimelineSelectionListeners( // Refactor? It may be bit odd doing this here // as the owner of calipers is TimelinePanel, not this class. new TimelineSelectionCaliperEvent(caliper)); timelinePanel.repaint(); } public void notifyZoomHistoryChange(TimelineSelectionHistoryEvent e) { genericNotifyTimelineSelectionListeners(e); } public void addSelectionListener(TimelineSelectionListener listener) { // AWT thread only selection_listeners.add(listener); } public boolean edt_fetchData(final boolean forceReload) { // AWT thread only! TL2DataSnapshot drawerSnapshot = event_drawer.getDataSnapshot(); // Note: event_drawer.getDataSnapshot() is only updated on the EDT; we know it won't change // while in this method if (drawerSnapshot != tl2DataFetcher.getTL2DataSnapshot()) { return false; // shortcut the process, the event_drawer is already obsolete } boolean refetchNeeded = false; if (forceReload) { // external entity (e.g. filter) is forcing refetch refetchNeeded = true; } // X: align according to bin size long tstart = timeAxisReader.getTimeStartAligned(); long binTime = timeAxisReader.getTimePerBin(); int binCount = timeAxisReader.getNumBins(); // Y int pstart = dataAxisReader.getRowStart(); int pend = dataAxisReader.getRowEnd(); // if(!initialImageReady){ // if(!initialImageReady){//TBR // // no image yet, we need to refetch // refetchNeeded = true; // }else{ { // check old data to see if we really need to refetch if (tstart != data_time_start || binTime != data_bin_time || binCount != data_time_nbins) { refetchNeeded = true; } if (pstart < data_row_start || pend > data_row_end) { refetchNeeded = true; } } if (!refetchNeeded && !forceReload) { return false; // not updated } final boolean loadingProcessed; if (event_drawer.getDataSnapshot() == null) { // no data to fetch, but still need to update the screen loadingProcessed = true; } else { RowGeometry rstart = event_drawer.rowNum2RowGeometry(pstart); RowGeometry rend = event_drawer.rowNum2RowGeometry(pend); if (null == rstart || null == rend) { loadingProcessed = false; // happens when null snapshot is pushed to clear screen } else { RowGeometry wide_rstart = event_drawer.rowNum2RowGeometry(0); RowGeometry wide_rend = event_drawer.rowNum2RowGeometry(dataAxisReader.getAbsRowEnd()); long overshoot = timeAxisReader.getTimeDuration(); // how much extra to buffer long estStart = timeAxisReader.getTimeStart() - overshoot; long wide_tstart = timeAxisReader.getTimeStartAligned(estStart); long estEnd = timeAxisReader.getTimeEnd() + overshoot; if (estEnd > event_drawer.getAbsoluteTimeEnd()) { estEnd = event_drawer.getAbsoluteTimeEnd(); } long duration = estEnd - wide_tstart; int wide_binCount = (int) (duration / binTime) + 1; RowDataRequestParams newReq = new RowDataRequestParams( drawerSnapshot, forceReload, binTime, wide_tstart, wide_binCount, // grab more width than requested wide_rstart.rowData.idx, wide_rend.rowData.idx, // ask for all rows timeAxisReader.getTimeStart(), timeAxisReader.getTimeEnd(), rstart.rowData.idx, rend.rowData.idx); loadingProcessed = tl2DataFetcher.edt_fetchTLRowDataInitiate(newReq); } } if (!loadingProcessed) { return false; // not updated (e.g. snapshot changed underneath us) } // initialImageReady = true; data_time_start = tstart; data_bin_time = binTime; data_time_nbins = binCount; data_row_start = pstart; data_row_end = pend; // if(forceReload){ // // for example, filter set // recenterVerticallyOnCursor(); // remapSelections(); // } return true; // updated } public boolean drawData(Graphics g) { // AWT thread only! final boolean painted; // if(initialImageReady){ if (event_drawer.getDataSnapshot() == tl2DataFetcher.getTL2DataSnapshot()) { event_drawer.drawIt(g); painted = true; } else { painted = false; } return painted; } private long ipcGetTLEventIdxNearTime(RowDefinition rowDef, long ts) { if (rowDef == null) { return TimelineSelectionEvent.EVT_IDX_INVALID; } int searchDirection = 0; // search forward and backwards for nearest event { Settings.TLData_type tlData_type = rowDef.getDataDescriptor().getTLDataType(); if (tlData_type.equals(Settings.TLData_type.TL_HEAPSZ)) { searchDirection = -1; // only search backwards in time } } long adjust = rowDef.getTimeOrigin(); long unadjusted_ts = ts + adjust; long eventIdx = tl2DataFetcher.ipcGetTLEventIdxNearTime( rowDef.getExpID(), rowDef.getDataDescriptor().getDataId(), rowDef.getEntity().getPropId(), rowDef.getEntity().getPropValue(), rowDef.getAux(), searchDirection, unadjusted_ts); return eventIdx; // SELECTION_IDX_INVALID if row has no events } private long[] ipcGetTLEventCenterTime(RowDefinition rowDef, long oldEventIdx, long moveCount) { if (rowDef == null) { return null; } IPCResult ipcResult = ipcStart_getTLEventCenterTime(rowDef, oldEventIdx, moveCount); return ipcFinish_getTLEventCenterTime(ipcResult, rowDef); } private IPCResult ipcStart_getTLEventCenterTime( RowDefinition rowDef, long oldEventIdx, long moveCount) { return tl2DataFetcher.ipcStart_getTLEventCenterTime( null, null, rowDef.getExpID(), rowDef.getDataDescriptor().getDataId(), rowDef.getEntity().getPropId(), rowDef.getEntity().getPropValue(), rowDef.getAux(), oldEventIdx, moveCount); } private long[] ipcFinish_getTLEventCenterTime(IPCResult ipcResult, RowDefinition rowDef) { if (ipcResult == null) { return null; } long[] idx_and_time = (long[]) ipcResult.getObject(); long ts = TimelineDrawer.TIME_INVALID; if (idx_and_time != null) { long unadjusted_ts = idx_and_time[1]; long adjust = rowDef.getTimeOrigin(); ts = unadjusted_ts - adjust; // should not be -1 if (ts < 0) { return null; // weird } idx_and_time[1] = ts; } return idx_and_time; // null if no such event } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/EventDetails.java����������������������������������������0000644�0001750�0001750�00000023635�15044710303�021057� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnInteger; import org.gprofng.mpmt.AnList; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline.events.EventDetail; import org.gprofng.mpmt.timeline.events.ExtendedEvent; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.util.ArrayList; import java.util.Vector; import javax.accessibility.AccessibleContext; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; // Initial version derived from timeline/TimelineDisp.java // YXXX Ideally, clean this up for TL2 public class EventDetails { private static final int NUM_EVT_SPC_LBL = 20; // YXXX yuck: max # of eventSpecLabels/Text // state private boolean extendedShowing; // show extended fields & stacks on RH tab private ExtendedEvent previousSelectedEvent; // previous user selection private String[] oldLabels; // previous selection's details // panel to hold details private JPanel tbPanel; private AnList anList; // container for event details // fixed fields private JTextField expTxt; private JTextField typeTxt; private JTextField functionTxt; private JTextField timeTxt; private JTextField lwpTxt; private JTextField thrTxt; private JTextField cpuTxt; // event-specific fields private JTextField[] eventSpecText; private JLabel[] eventSpecLabels; private ArrayList<JTextField> allFields; private ArrayList<JTextField> extendedFields; private ArrayList<JLabel> extendedLabels; // Constructor public EventDetails(final AnWindow awindow) { extendedShowing = true; doInit(); } // Initialize the event panel on right side public void doInit() { tbPanel = new JPanel(new BorderLayout()); // EventDetail Pane: Timeline selection allFields = new ArrayList<>(); extendedFields = new ArrayList<>(); extendedLabels = new ArrayList<>(); anList = new AnList(true); AccessibleContext context = anList.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Events")); context.setAccessibleDescription(AnLocale.getString("Events")); anList.setAlignmentY(); anList.setBorder(AnVariable.boxBorder); expTxt = createField(AnLocale.getString("Process:")); // , // AnLocale.getString('E', "MNEM_TIMELINE_EVENT_EXPERIMENT_NAME"), anList); typeTxt = createField(AnLocale.getString("Event Type:", "TIMELINE_EVENT_EVENT_TYPE")); // , // AnLocale.getString('p', "MNEM_TIMELINE_EVENT_EVENT_TYPE"), anList); functionTxt = createField(AnLocale.getString("Leaf Function:")); // , // AnLocale.getString('n', "MNEM_TIMELINE_EVENT_LEAF_FUNCTION"), anList); timeTxt = createField(AnLocale.getString("Timestamp (sec.):")); // , // AnLocale.getString('i', "MNEM_TIMELINE_EVENT_TIMESTAMP"), anList); lwpTxt = createField(AnLocale.getString("LWP:")); // , // AnLocale.getString('W', "MNEM_TIMELINE_EVENT_LWP"), anList); thrTxt = createField(AnLocale.getString("Thread:")); // , // AnLocale.getString('h', "MNEM_TIMELINE_EVENT_THREAD"), anList); cpuTxt = createField(AnLocale.getString("CPU:")); // , // AnLocale.getString('c', "MNEM_TIMELINE_EVENT_CPU"), anList); eventSpecLabels = new JLabel[NUM_EVT_SPC_LBL]; eventSpecText = new JTextField[NUM_EVT_SPC_LBL]; final String longest; { int len = 0, ind = 0, strlen; final int numNames = TimelineVariable.mstate_info.getNumNames(); for (int i = 0; i < numNames; i++) { String name = TimelineVariable.mstate_info.getNameByDisplayIdx(i); strlen = name.length(); if (strlen > len) { len = strlen; ind = i; } } longest = TimelineVariable.mstate_info.getNameByDisplayIdx( ind); // YXXX bogus, really depends on font } for (int i = 0; i < NUM_EVT_SPC_LBL; i++) { AnUtility.AnLabel label = new AnUtility.AnLabel( longest + " ", new ImageIcon(StackState.createIcon(Color.black)), JLabel.RIGHT, true); // label.setDisplayedMnemonic('z'); eventSpecLabels[i] = label; eventSpecText[i] = (JTextField) AnUtility.getText("", 0); eventSpecLabels[i].setVisible(false); eventSpecText[i].setVisible(false); eventSpecLabels[i].setLabelFor(eventSpecText[i]); anList.add(eventSpecLabels[i], eventSpecText[i]); allFields.add(eventSpecText[i]); } tbPanel.add(anList); } // Creates the label and textfield pairs for the event pane on right private JTextField createField(final String label) { // , final char mnemonic, // final AnList list) { final AnList list = anList; final JLabel lbl; final JTextField fld; lbl = (JLabel) AnUtility.getItem(label); fld = (JTextField) AnUtility.getText("", 0); // lbl.setDisplayedMnemonic(mnemonic); lbl.setLabelFor(fld); AccessibleContext context = lbl.getAccessibleContext(); context.setAccessibleName(label); context.setAccessibleDescription(label); context = fld.getAccessibleContext(); context.setAccessibleName(label); context.setAccessibleDescription(label); list.add(lbl, fld); allFields.add(fld); extendedFields.add(fld); extendedLabels.add(lbl); return fld; } private void clearTimeline() { oldLabels = null; for (int i = 0; i < NUM_EVT_SPC_LBL; i++) { eventSpecText[i].setVisible(false); eventSpecLabels[i].setVisible(false); } setExtendedFields(true); for (JTextField e : allFields) { e.setText(""); } } public JPanel setEvent(TimelineSelectionEvent evt) { EventDetail basicEvent = evt.eventDetail; RowDefinition rowDef = evt.getRowDefinition(); // may be null if (basicEvent == null) { oldLabels = null; for (int i = 0; i < NUM_EVT_SPC_LBL; i++) { eventSpecText[i].setVisible(false); eventSpecLabels[i].setVisible(false); } setExtendedFields(true); for (JTextField e : allFields) { e.setText(""); } return tbPanel; } final String[] labels, info; // final char[] mnemonics; final ImageIcon[] icons; labels = basicEvent.getEventSpecificLabels(); // mnemonics = basicEvent.getEventSpecificMnemonics(); icons = basicEvent.getEventSpecificIcons(); if (labels != oldLabels) { for (int i = 0; i < labels.length; i++) { eventSpecLabels[i].setText(labels[i]); // eventSpecLabels[i].setDisplayedMnemonic( // (i < mnemonics.length) ? mnemonics[i] : '\0'); if (i < icons.length) { eventSpecLabels[i].setIcon(icons[i]); eventSpecLabels[i].setHorizontalTextPosition(SwingConstants.LEADING); } else { eventSpecLabels[i].setIcon(null); } eventSpecLabels[i].setVisible(true); } for (int i = labels.length; i < NUM_EVT_SPC_LBL; i++) { eventSpecLabels[i].setVisible(false); } } oldLabels = labels; info = basicEvent.getEventSpecificInfo(); if (info == null) { return tbPanel; } for (int i = 0; i < info.length; i++) { eventSpecText[i].setText(info[i]); eventSpecText[i].setVisible(true); } for (int i = info.length; i < NUM_EVT_SPC_LBL; i++) { eventSpecText[i].setVisible(false); } if (!(basicEvent instanceof ExtendedEvent)) { if (extendedShowing) { setExtendedFields(false); } // YXXX update_event(evt); return tbPanel; } if (!extendedShowing) { setExtendedFields(true); } final ExtendedEvent event = (ExtendedEvent) basicEvent; if (event == previousSelectedEvent) { return tbPanel; } // Fill in text field values in the EventDetail pane based on the // current event selection final String fName; Vector<StackState> stackFrames = evt.getStackFrames(); if (stackFrames != null && !stackFrames.isEmpty()) { fName = stackFrames.get(0).getName(); } else { fName = ""; // weird } functionTxt.setText(fName); functionTxt.setCaretPosition(0); lwpTxt.setText(new AnInteger(event.getLWP()).toString()); thrTxt.setText(new AnInteger(event.getThread()).toString()); if (event.getCPU() == ExtendedEvent.NO_CPU_INFO) { cpuTxt.setText(AnLocale.getString("(unknown)")); } else { cpuTxt.setText(new AnInteger(event.getCPU()).toString()); } timeTxt.setText(TimelineVariable.strTimestamp(event.getTimestamp())); if (rowDef == null) { typeTxt.setText(""); expTxt.setText(""); } else { typeTxt.setText(rowDef.getDataDescUName()); String expName = rowDef.getExpName(); expTxt.setText(expName); } previousSelectedEvent = event; return tbPanel; } private void setExtendedFields(final boolean value) { for (JTextField e : extendedFields) { e.setVisible(value); } for (JLabel jl : extendedLabels) { jl.setVisible(value); } anList.setAlignmentX(); extendedShowing = value; } } ���������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TL2DataSnapshot.java�������������������������������������0000644�0001750�0001750�00000014074�15044710303�021400� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.settings.TimelineSetting; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; // The class represents storage for the timeline data for a particular // set of "entities" and enabled charts. It should have a rowDefinition for // every row, including those that might not be visible on the screen. // The time range supplied should be for maximum zoom-out across all rows. // // The same instance of a snapshot can be reused for all levels // of scroll, as well as display options such as stack height and orientation. // // A new instance of this class is needed when options change the actual rows // that can be displayed: Add/Drop experiment, Presentation Data Type // selections, and Filters. // // Portions of this class are immutable: // // The row definitions are stored in: // rowDefinitions/timeStart/TimeEnd // The array for storing results, rowResults, is allocated only once and // has a fixed size and a fixed set of RowData objects. // Note, however, that components within RowData // are modified as data gets populated from gp-display-text. public class TL2DataSnapshot { public static class EntityData { public final List<RowData> entityRows; public EntityData(List<RowData> entityRows) { this.entityRows = Collections.unmodifiableList(entityRows); } } public static class EntityDefinitions { public final List<RowDefinition> entityRows; public EntityDefinitions(List<RowDefinition> entityRows) { this.entityRows = Collections.unmodifiableList(entityRows); } } public static class ExperimentData { public final List<EntityData> experimentEntities; public ExperimentData(List<EntityData> experimentEntities) { this.experimentEntities = Collections.unmodifiableList(experimentEntities); } } public static class ExperimentDefinitions { public final List<EntityDefinitions> experimentEntities; public ExperimentDefinitions(List<EntityDefinitions> experimentEntities) { this.experimentEntities = Collections.unmodifiableList(experimentEntities); } } private final TimelineSetting.EntityProp entityProp; private final List<RowData> allRowData; // data organized by row private final List<EntityData> allEntityData; // data organized by entity private final List<EntityDefinitions> allEntityDefs; // defs organized by entity private final List<ExperimentData> experimentData; // data organized by experiment private final List<ExperimentDefinitions> experimentDefs; // defs organized by experiment private final long absoluteTimeStart, absoluteTimeEnd; private final Map<Integer, ExperimentDefinitions> experimentDefsByExpid; // RowDefinition data is expected to be immutable public TL2DataSnapshot( TimelineSetting.EntityProp entityProp, List<ExperimentDefinitions> expList, long absoluteTimeStart, long absoluteTimeEnd) { this.entityProp = entityProp; this.absoluteTimeStart = absoluteTimeStart; this.absoluteTimeEnd = absoluteTimeEnd; this.experimentDefs = Collections.unmodifiableList(expList); experimentDefsByExpid = new HashMap<>(); int ii = 0; ArrayList<ExperimentData> newExpDataList = new ArrayList<>(); ArrayList<RowData> newAllRowData = new ArrayList<>(); ArrayList<EntityData> newAllEntityData = new ArrayList<>(); ArrayList<EntityDefinitions> newAllEntityDefs = new ArrayList<>(); for (ExperimentDefinitions expDef : expList) { ArrayList<EntityData> newEntityDataList = new ArrayList<>(); for (EntityDefinitions entityDef : expDef.experimentEntities) { // process entity ArrayList<RowData> newEntityData = new ArrayList<>(); for (RowDefinition rowDef : entityDef.entityRows) { int expid = rowDef.getUserExpID(); ExperimentDefinitions tmp = experimentDefsByExpid.put(expid, expDef); if (tmp != null && tmp != expDef) { int jj = 1; // weird~ } RowData newRow = new RowData(rowDef, ii); newAllRowData.add(newRow); newEntityData.add(newRow); ii++; } EntityData newEntity = new EntityData(newEntityData); newEntityDataList.add(newEntity); newAllEntityData.add(newEntity); newAllEntityDefs.add(entityDef); } newExpDataList.add(new ExperimentData(newEntityDataList)); } allRowData = Collections.unmodifiableList(newAllRowData); allEntityData = Collections.unmodifiableList(newAllEntityData); allEntityDefs = Collections.unmodifiableList(newAllEntityDefs); experimentData = Collections.unmodifiableList(newExpDataList); } public TimelineSetting.EntityProp getEntityProp() { return entityProp; } public long getAbsoluteTimeEnd() { return absoluteTimeEnd; } public long getAbsoluteTimeStart() { return absoluteTimeStart; } public List<RowData> getRowData() { return allRowData; } public List<EntityData> getEntityData() { return allEntityData; } public List<EntityDefinitions> getEntityDefinitions() { return allEntityDefs; } public List<ExperimentData> getExperimentData() { return experimentData; } public List<ExperimentDefinitions> getExperimentDefinitions() { return experimentDefs; } public ExperimentDefinitions getExperimentDefinitions(int expid) { return experimentDefsByExpid.get(expid); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/RowDefinition.java���������������������������������������0000644�0001750�0001750�00000023560�14744453367�021271� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.experiment_props.*; import org.gprofng.mpmt.settings.Settings; import java.util.List; // This class is intended to be immutable so that it can be accessed from // the AWT thread without worry that inner details may change. // (Changeable data should go into RowData.java w/ appropriate synchronization) // // Each Entity may correspond to several rows on timeline (RowDefinitions). // The number of rows on the timeline is determined by the number of // DataDescriptors specified for the particular experiment. public final class RowDefinition { // experiment private final int exp_id; private final int user_exp_id; // data_id within experiment private final DataDescriptor data_descriptor; // immutable private final int aux; // HWC value // entity within data_id private final Entity entity; // immutable // specification for additional chart properties private final List<PropDescriptor> chartProps; private final String chartPropNames[]; // descriptive strings private final String exp_name; private final int exp_group_id; private final boolean compare_on; private final long data_start_hrt; // hr time at data start private final long data_end_hrt; // hr time at data end private final long time_origin_hrt; // hr time at "0" point of timeline private final String longDescription; private final String shortLabel; private final int cpuFreq; public RowDefinition( final ExperimentProperties experiment, Entity entity, final DataDescriptor d_descriptor, final int aux, final List<PropDescriptor> chartProps, final long time_adjust, final boolean compare_on) { this.compare_on = compare_on; this.exp_id = experiment.getID(); this.user_exp_id = experiment.getUserID(); this.data_descriptor = d_descriptor; this.aux = aux; if (entity == null) { entity = new Entity( Settings.PROP_NONE, // ent_prop_id (experiment-wide) "", // don't care 0, // ent_prop_value (0 is value for any undefined prop) d_descriptor.getLongUName(aux), null, null); } this.entity = entity; this.exp_name = experiment.getName(); this.exp_group_id = experiment.getGroupId(); this.data_start_hrt = experiment.getStartTime(); this.data_end_hrt = experiment.getEndTime(); this.time_origin_hrt = time_adjust; this.chartProps = chartProps; if (chartProps == null) { this.chartPropNames = null; } else { this.chartPropNames = new String[chartProps.size()]; int ii = 0; for (PropDescriptor prop : chartProps) { String propName = prop.getName(); this.chartPropNames[ii++] = propName; } } // other fields must be set before creating labels: this.longDescription = createLongDescription(); this.shortLabel = createShortLable(); this.cpuFreq = experiment.getCpuFreq(); } public DataDescriptor getDataDescriptor() { return data_descriptor; } public Entity getEntity() { return entity; } public String getExpName() { return exp_name; } public int getExpID() { return exp_id; } public int getUserExpID() { return user_exp_id; } public int getExpGroupId() { return exp_group_id; } public int getAux() { return aux; } public Settings.TLData_type getTLDataType() { return data_descriptor.getTLDataType(); } public String getDataDescUName() { return data_descriptor.getLongUName(aux); } public long getTimeOrigin() { // hr time at timeline origin (nanoseconds) return time_origin_hrt; } public long getDataTimeStart() { return data_start_hrt; } public long getDataTimeEnd() { return data_end_hrt; } public String getLongDescription() { return longDescription; } public boolean getComparisonOn() { return compare_on; } public int getChartCount() { if (chartProps == null) { return 0; } else { return chartProps.size(); } } public List<PropDescriptor> getChartProperties() { return chartProps; } public String[] getChartPropNames() { return chartPropNames; } public boolean matches(int thisChartPropIdx, RowDefinition thatRowDef, int thatChartPropIdx) { // check the basics if (user_exp_id != thatRowDef.user_exp_id) { return false; } else if (aux != thatRowDef.aux) { return false; } else if (entity.getPropId() != thatRowDef.entity.getPropId()) { return false; } else if (entity.getPropValue() != thatRowDef.entity.getPropValue()) { return false; } // check for data vs chart boolean thisIsData = (thisChartPropIdx == -1); boolean thatIsData = (thatChartPropIdx == -1); if (thisIsData != thatIsData) { return false; // only one is data } else if (thisIsData && thatIsData) { return true; // both are data } // were dealing with two charts if (chartProps == null || thisChartPropIdx >= chartProps.size()) { return false; // weird } else if (thatRowDef.getChartProperties() == null || thatChartPropIdx >= thatRowDef.getChartProperties().size()) { return false; // weird } PropDescriptor thisPropDescriptor = chartProps.get(thisChartPropIdx); PropDescriptor thatPropDescriptor = thatRowDef.getChartProperties().get(thatChartPropIdx); if (thisPropDescriptor.getPropId() != thatPropDescriptor.getPropId()) { return false; } return true; } private String createLongDescription() { RowDefinition rowDefinition = this; String desc = "<HTML>"; String moreInfo = ""; Settings.TLData_type tltype = data_descriptor.getTLDataType(); if (!tltype.equals(Settings.TLData_type.TL_SAMPLE) && !tltype.equals(Settings.TLData_type.TL_HEAPSZ) && // YXXX where to decide when to show stacks? !tltype.equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 moreInfo = AnLocale.getString(" Call Stacks"); } String experimentInfo = AnLocale.getString("<HR>Process: ") + "<B>" + user_exp_id + "</B>" + " (" + "<B>" + exp_name + "</B>" + ")"; if (Settings.PROP_NONE == rowDefinition.getEntity().getPropId()) desc += rowDefinition.getDataDescUName() + moreInfo + "<BR>" + experimentInfo; else { final String num, thr_name, thr_g_name, thr_p_name; final long entityNum; entityNum = rowDefinition.getEntity().getPropValue(); thr_name = rowDefinition.getEntity().getThreadName(); thr_g_name = rowDefinition.getEntity().getJThreadGroupName(); thr_p_name = rowDefinition.getEntity().getJThreadParentName(); // int tl_data_mode = rowDefinition.getEntity().getPropId(); String str; if (thr_g_name != null) { str = "<BR>" + AnLocale.getString("Thread name: ") + "<B>" + thr_name + "</B>" + "<BR>" + AnLocale.getString("Thread group: ") + "<B>" + thr_g_name + "</B>" + "<BR>" + AnLocale.getString("Thread parent: ") + "<B>" + thr_p_name + "</B>"; } else if (thr_name != null) { str = "<BR>" + AnLocale.getString("Thread name: ") // YXXX TBD + "<B>" + thr_name + "</B>"; } else { str = ""; } num = Long.toString(entityNum); String entMode = entity.getPropIdName(); desc += rowDefinition.getDataDescUName() + moreInfo + experimentInfo + "<BR>" + entMode + ": " + "<B>" + num + "</B>" + str; } if (this.compare_on) { final String group_name; if (exp_group_id <= 1) { group_name = "Baseline"; } else { group_name = "Comparison Group " + (exp_group_id - 1); } desc += "<BR>" + AnLocale.getString("Compare Group: ") + "<B>" + group_name + "</B>"; } return desc; } public String getShortLabel() { return shortLabel; } private String createShortLable() { RowDefinition rowDefinition = this; String userExpId = Integer.toString(rowDefinition.getUserExpID()); String rowLabel = new String(); long entityPropId = rowDefinition.getEntity().getPropId(); String entityPropName = rowDefinition.getEntity().getPropIdName(); rowLabel += userExpId; if (entityPropId != Settings.PROP_NONE) { // everything besides sample rows rowLabel += " " + entityPropName.toUpperCase().charAt(0) + ":" + Long.toString(rowDefinition.getEntity().getPropValue()); } else { if (compare_on) { if (exp_group_id <= 1) { rowLabel += " (Base)"; } else { // rowLabel += " (G" + (exp_group_id-1) + ")"; } } } return rowLabel; } public int getCpuFreq() { return cpuFreq; } } ������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/data/����������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�016614� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/data/SampleEvent.java������������������������������������0000644�0001750�0001750�00000001762�14744453367�021645� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.data; public class SampleEvent extends GenericEvent { public final long[] propValues; public SampleEvent( long eventId, int binStart, int binCount, long timeStart, long timeEnd, long[] propVals) { super(eventId, binStart, binCount, timeStart, timeEnd); this.propValues = propVals; } } ��������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/data/GenericEvent.java�����������������������������������0000644�0001750�0001750�00000003117�14744453367�021774� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.data; public class GenericEvent { public final long eventIdx; public final int binStart; public final int binCount; public final long timeStart, timeEnd; private final double NS_PER_SEC = 1000000000.0; public GenericEvent(long eventIdx, int binStart, int binCount, long timeStart, long timeEnd) { this.eventIdx = eventIdx; this.binStart = binStart; this.binCount = binCount; this.timeStart = timeStart; this.timeEnd = timeEnd; } @Override public String toString() { final GenericEvent event = this; StringBuilder buf = new StringBuilder(); // buf.append("eventIdx=" + event.eventIdx); // Not stable GUI testing? buf.append(" timeStart=" + event.timeStart / NS_PER_SEC); buf.append(" timeEnd=" + event.timeEnd / NS_PER_SEC); buf.append(" binStart=" + event.binStart); buf.append(" binCount=" + event.binCount); return buf.toString(); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/data/StackEvent.java�������������������������������������0000644�0001750�0001750�00000002615�14744453367�021467� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.data; public class StackEvent extends GenericEvent { public final long stackId; public final int mState; // OS state at time public StackEvent( long eventId, int binStart, int binCount, long timeStart, long timeEnd, long stackId, int mstate) { super(eventId, binStart, binCount, timeStart, timeEnd); this.stackId = stackId; this.mState = mstate; } @Override public String toString() { final StackEvent event = this; StringBuilder buf = new StringBuilder(); buf.append(super.toString()); // buf.append(" stackId=" + event.stackId); // Not stable GUI testing buf.append(" mState=" + event.mState); return buf.toString(); } } �������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/Entity.java����������������������������������������������0000644�0001750�0001750�00000004400�14744453367�017755� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; // This class is intended to be immutable. // // Entity is populated by DBE and describes how the TL rows are organized. // It specifies one of [LWP, THREAD, CPU], // // Each Entity may correspond to several rows on timeline (RowDefinition). // The number of rows on the timeline is determined by the number of // DataDescriptors specified for the particular experiment. public final class Entity { // data from ipcGetEntities() private final int entity_prop_id; // property used to segregate data private final String entity_prop_id_name; private final int entity_prop_value; // if "force_java_threads == true", set these: private final String name; // jthread entname private final String g_name; // jthread group name private final String p_name; // jthread parent name public Entity( final int entity_prop_id, final String entity_prop_id_name, final int entity_prop_value, final String name, final String g_name, final String p_name) { this.entity_prop_id = entity_prop_id; this.entity_prop_id_name = entity_prop_id_name; this.entity_prop_value = entity_prop_value; this.name = name; this.g_name = g_name; this.p_name = p_name; } public int getPropValue() { return entity_prop_value; } public int getPropId() { return entity_prop_id; } public String getPropIdName() { return entity_prop_id_name; } public String getThreadName() { return name; } public String getJThreadGroupName() { return g_name; } public String getJThreadParentName() { return p_name; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TL2ControlPanel.java�������������������������������������0000644�0001750�0001750�00000226165�15044710303�021415� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnEvent; import org.gprofng.mpmt.AnListener; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.control_panel.CPDetailsScrollPane; import org.gprofng.mpmt.control_panel.CPToolbar; import org.gprofng.mpmt.control_panel.CPToolbarHandler; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.filter.CustomFilterAction; import org.gprofng.mpmt.filter.FilterClause; import org.gprofng.mpmt.filter.RedoFilterAction; import org.gprofng.mpmt.filter.RemoveAllFilterAction; import org.gprofng.mpmt.filter.UndoFilterAction; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.TimelineSetting; import org.gprofng.mpmt.statecolors.AnColorChooser; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.statecolors.StackView; import org.gprofng.mpmt.statecolors.StackViewState; import org.gprofng.mpmt.statecolors.StateColorMap; import org.gprofng.mpmt.timeline.events.DetailsIPC; import org.gprofng.mpmt.timeline.events.ProfileEvent; import org.gprofng.mpmt.timeline2.TL2DataSnapshot.*; import org.gprofng.mpmt.timeline_common.TimelineCaliper; import org.gprofng.mpmt.timeline_common.TimelinePanel; import org.gprofng.mpmt.timeline_common.TimelineSelectionCaliperEvent; import org.gprofng.mpmt.timeline_common.TimelineSelectionGenericEvent; import org.gprofng.mpmt.timeline_common.TimelineSelectionHistoryEvent; import org.gprofng.mpmt.timeline_common.TimelineSelectionListener; import org.gprofng.mpmt.toolbar.ToolBarFiller; import org.gprofng.mpmt.toolbar.ToolBarSeparator; import org.gprofng.mpmt.util.gui.AnJPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.EventObject; import java.util.List; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSpinner; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; /** * The TL2ControlPanel provides the visual controls for the Chart as well as the code that allows * user interaction with the chart. * * <p>The Panel contains the details display, and a toolbar with color and navigation controls. * * <p>The top level code for zooming panning, selection, and detail display is in ChartControlPanel. */ public class TL2ControlPanel extends AnJPanel implements AnListener, MouseListener, ListSelectionListener, CPToolbarHandler, AnChangeListener { // provided by user private final AnWindow window; private final TimelinePanel timeline; private final AnColorChooser color_chooser; private final StateColorMap clmap; // components private final TL2Drawer tl2_drawer; private final JComponent customComponentsPanel; private final CPToolbar cpToolbar; private final JPanel detailsPanel; // Details Panel top private JPanel detailsTextPanel; private JPanel stackViewPane; // Details Panel private StackView stack_view; // Details Panel private final EventDetails eventDetails; // Details Panel text, layout private CaliperZoom caliperZoom; private SetFilterVisibleTimeRangeOnly setFilterVisibleTimeRangeOnly; private SetFilterSelectedTimeRangeOnly setFilterSelectedTimeRangeOnly; private SetFilterExcludeBefore setFilterExcludeBefore; private SetFilterExcludeAfter setFilterExcludeAfter; private SetFilterSelectedRowsOnly setFilterSelectedRowsOnly; private SetFilterUnselectedRowsOnly setFilterUnselectedRowsOnly; private SetFilterMicrostate setFilterMicrostate; private SetFilterNotMicrostate setFilterNotMicrostate; private RemoveAllFilterAction removeAllFilters; private CustomFilterAction customFilter; private UndoFilterAction undoFilter; private RedoFilterAction redoFilter; private UndoZoomAction undoZoomAction; private RedoZoomAction redoZoomAction; private SelectNextUp selectNextUpAction; private SelectNextDown selectNextDownAction; private SelectNextLeft selectNextLeftAction; private SelectNextRight selectNextRightAction; private SelectFind selectFindAction; private final JComboBox byComboBox; private final JSpinner spinner; // state private boolean stackViewEnabled; /** Creates a new instance of TL2ControlPanel */ public TL2ControlPanel( final AnWindow anWindow, final TimelinePanel timeline, final TL2Drawer tl2_drawer) { super(); cpToolbar = new CPToolbar(this, true, true, true); cpToolbar.add( new ToolBarSeparator(7, 6), null, 12); // FIXUP: hack to insert separator just before color chooser cpToolbar.add(AnWindow.getInstance().getSettingsAction().createActionButton()); // Group Data By drop-down; JLabel groupLabel = new JLabel(AnLocale.getString("Group Data by:")); groupLabel.setDisplayedMnemonic(AnLocale.getString('y', "MN_Timeline_GroupDataby")); groupLabel.setFont(groupLabel.getFont().deriveFont(Font.PLAIN)); groupLabel.setToolTipText(AnLocale.getString("Group data by...")); byComboBox = new JComboBox(); groupLabel.setLabelFor(byComboBox); byComboBox.setFont(byComboBox.getFont().deriveFont(Font.PLAIN)); TimelineSetting.EntityProp entProp; for (int ii = 0; null != (entProp = anWindow.getSettings().getTimelineSetting().getTl_entity_prop(ii)); ii++) { byComboBox.addItem(entProp.prop_uname); } byComboBox.setToolTipText(groupLabel.getToolTipText()); AnUtility.setAccessibleContext(byComboBox.getAccessibleContext(), byComboBox.getToolTipText()); byComboBox.setPreferredSize(new Dimension(byComboBox.getPreferredSize().width, 19)); byComboBox.setMaximumSize(byComboBox.getPreferredSize()); byComboBox.setSelectedIndex( anWindow.getSettings().getTimelineSetting().getTl_entity_selected_btn()); byComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { int index = byComboBox.getSelectedIndex(); window .getSettings() .getTimelineSetting() .setTLGroupDataBySelectedButtonIndex(TL2ControlPanel.this, index); } @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); cpToolbar.add(new ToolBarSeparator(8, 10)); cpToolbar.add(groupLabel); cpToolbar.add(new ToolBarFiller(2)); cpToolbar.add(byComboBox); // Stack Depth if (true) { // YXXXX TBR stuff spinner = null; } else { JLabel spinnerLabel = new JLabel(AnLocale.getString("Stack Depth:")); spinnerLabel.setFont(spinnerLabel.getFont().deriveFont(Font.PLAIN)); spinnerLabel.setToolTipText(AnLocale.getString("Maximum stack depth")); cpToolbar.add(new ToolBarFiller(7)); cpToolbar.add(spinnerLabel); spinner = new JSpinner(); spinner.setBorder(BorderFactory.createLineBorder(new Color(122, 138, 153))); spinner.setToolTipText(AnLocale.getString("Maximum stack depth")); spinner.setValue(anWindow.getSettings().getTimelineSetting().getTLStackDepth()); spinner.addChangeListener( new ChangeListener() { final TL2Drawer drawer = tl2_drawer; @Override public void stateChanged(ChangeEvent e) { Object value = spinner.getValue(); if (value instanceof Integer) { int sd = ((Integer) value).intValue(); if (sd >= 0) { window .getSettings() .getTimelineSetting() .setTLStackDepth(TL2ControlPanel.this, sd); } else { sd = window.getSettings().getTimelineSetting().getTLStackDepth(); spinner.setValue(sd); } } } }); JComponent editor = ((JSpinner.DefaultEditor) spinner.getEditor()); Dimension size = editor.getPreferredSize(); editor.setPreferredSize(new Dimension(20, size.height)); spinner.setPreferredSize(new Dimension(spinner.getPreferredSize().width, 19)); spinner.setMaximumSize(spinner.getPreferredSize()); cpToolbar.add(new ToolBarFiller(2)); cpToolbar.add(spinner); } // this.cpFilterPanel = null; this.timeline = timeline; this.tl2_drawer = tl2_drawer; this.color_chooser = anWindow.getColorChooser(); this.clmap = color_chooser.getColorMap(); this.window = anWindow; this.customComponentsPanel = initializeCustomComponents(); this.detailsPanel = initializeDetailComponents(); // overlaycursor = new Cursor(Cursor.HAND_CURSOR); initializeListeners(timeline); clmap.addAnListener(this); // YXXX leaks this in constructor eventDetails = new EventDetails(anWindow); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("TimelineView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADED_FAILED: case EXPERIMENTS_LOADED: case FILTER_CHANGED: case FILTER_CHANGING: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SETTING_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGING: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.TIMELINE) { // System.out.println("TL2ControlPanel getOriginalSource: " + // anSettingChangeEvent.getOriginalSource()); if (anSettingChangeEvent.getOriginalSource() == TL2ControlPanel.this) { break; } // System.out.println("TL2ControlPanel getOriginalSource: // doIt..............."); // Update states of Group Data and Stack Depth in control panel List new_tm = (List) anSettingChangeEvent.getNewValue(); int new_entity_button_num = ((Integer) new_tm.get(1)).intValue(); int new_stack_depth = ((Integer) new_tm.get(3)).intValue(); // int new_stack_frame_pixels = ((Integer) new_tm.get(10)).intValue(); updateDataGrouping(new_entity_button_num); updateStackDepth(new_stack_depth); // updateStackFramePixels(new_stack_frame_pixels); } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } private void debug() {} public void edt_resetAll() { resetStackView(); int sd = window.getSettings().getTimelineSetting().getTLStackDepth(); if (spinner != null) { spinner.setValue(sd); // 18294015 workaround; TBR } if (cpToolbar != null) { cpToolbar.setVNumberOfLevels(TimelineDraw.TIMELINE_MAX_VZOOM_LEVEL); cpToolbar.setVZoomLevel(sd); } } // --- allow CP layout to access components public void updateStackDepth(int value) { if (spinner != null) { if (((Integer) spinner.getValue()) != value) { ChangeListener ch = spinner.getChangeListeners()[0]; spinner.removeChangeListener(ch); spinner.setValue(value); spinner.addChangeListener(ch); } } if (cpToolbar != null) { cpToolbar.setVZoomLevel(value); } } public void updateDataGrouping(int index) { if (byComboBox != null) { if (byComboBox.getSelectedIndex() != index) { PopupMenuListener ch = byComboBox.getPopupMenuListeners()[0]; byComboBox.removePopupMenuListener(ch); byComboBox.setSelectedIndex(index); byComboBox.addPopupMenuListener(ch); } } } public JPopupMenu getFilterPopup() { return createPopupMenu(true); } public JComponent getToolbar() { return cpToolbar; } public JComponent getCustomPanel() { return customComponentsPanel; } public JComponent getDetailsPanel() { return detailsPanel; } public JComponent getDetailsTextPanel() { if (detailsTextPanel == null) { detailsTextPanel = new AnJPanel(); } return detailsTextPanel; } public JComponent getStackViewPane() { return stackViewPane; } /** Initialize visual components */ private void initializeListeners(final TimelinePanel timeline) { timeline.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { // YXXX overkill, nonspecific // book-keeping for zoom revert // cpToolbar.enableRevertButton(true); int tmp; tmp = timeline.getZoomTimeLevelMax(); cpToolbar.setNumberOfLevels(tmp); tmp = timeline.getZoomTimeLevel(); cpToolbar.setZoomLevel(tmp); tmp = TimelineDraw.TIMELINE_MAX_VZOOM_LEVEL; cpToolbar.setVNumberOfLevels(tmp); tmp = window.getSettings().getTimelineSetting().getTLStackDepth(); cpToolbar.setVZoomLevel(tmp); } }); tl2_drawer.addSelectionListener( new TimelineSelectionListener() { @Override public void valueChanged(TimelineSelectionGenericEvent ge) { if (ge instanceof TimelineSelectionHistoryEvent) { TimelineSelectionHistoryEvent e = (TimelineSelectionHistoryEvent) ge; cpToolbar.enableZoomUndoButton(!e.atMin); cpToolbar.enableZoomRedoButton(!e.atMax); undoZoomAction.enableMenuItem(!e.atMin); redoZoomAction.enableMenuItem(!e.atMax); } else if (ge instanceof TimelineSelectionEvent) { TimelineSelectionEvent e = (TimelineSelectionEvent) ge; cpToolbar.enableNavigationButtons(e.left, e.right, e.up, e.down, e.find); setFilterMicrostate.enableMenuItem(e); setFilterNotMicrostate.enableMenuItem(e); enableNavigationMenuItems(e.left, e.right, e.up, e.down, e.find); showStack(e); setDetailText(e); } else if (ge instanceof TimelineSelectionCaliperEvent) { TimelineSelectionCaliperEvent e = (TimelineSelectionCaliperEvent) ge; cpToolbar.enableZoomToCaliperButton(!e.caliper.isSingleEvent()); boolean enableRange = (e.caliper != null && !e.caliper.isSingleEvent()); setFilterSelectedTimeRangeOnly.enableMenuItem(e.caliper != null); setFilterExcludeBefore.enableMenuItem(enableRange); setFilterExcludeAfter.enableMenuItem(enableRange); caliperZoom.enableMenuItem(enableRange); } else if (ge instanceof TimelineSelectionRowEvent) { TimelineSelectionRowEvent event = (TimelineSelectionRowEvent) ge; setFilterSelectedRowsOnly.enableMenuItem(event.rowsSelected); setFilterUnselectedRowsOnly.enableMenuItem(event.rowsSelected); } } }); // mouse modes timeline.setRubberbandIs2D(false); // Init... initNavigationMenuItems(); initFilterMenuItems(); popupListener = new PopupListener(); stackViewPopupListener = stack_view.new StackViewPopupListener(window); timeline.addMouseListener(popupListener); } // --- CPToolbarHandler API --- @Override public void selectFind() { timeline.zoomCenterSelection(); } @Override public void selectFirst() { tl2_drawer.selectFirst(); } @Override public void selectLeft() { tl2_drawer.selectLeft(); } @Override public void selectRight() { tl2_drawer.selectRight(); } @Override public void selectDown() { tl2_drawer.selectDown(); } @Override public void selectUp() { tl2_drawer.selectUp(); } public void selectLeft(boolean ctrl, boolean shift) { tl2_drawer.selectLeft(ctrl, shift); } public void selectRight(boolean ctrl, boolean shift) { tl2_drawer.selectRight(ctrl, shift); } public void selectDown(boolean ctrl, boolean shift) { tl2_drawer.selectDown(ctrl, shift); } public void selectUp(boolean ctrl, boolean shift) { tl2_drawer.selectUp(ctrl, shift); } @Override public void toggleMouseMode() { if (timeline.getMouseMode() == TimelinePanel.MouseDragMode.MOUSE_RUBBERBANDING_MODE) { timeline.setMouseMode(TimelinePanel.MouseDragMode.MOUSE_GRABBING_MODE); } else { timeline.setMouseMode(TimelinePanel.MouseDragMode.MOUSE_RUBBERBANDING_MODE); } } @Override public void zoomToCaliper() { timeline.zoomToCaliper(); } @Override public void genericZoomToLevel(int n) { timeline.zoomTimeToLevel(n); } @Override public void genericZoomIn() { timeline.zoomTimeIn(); } @Override public void genericZoomOut() { timeline.zoomTimeOut(); } @Override public int getZoomLevelMax() { return 20; // YXXX prototype // return timeline.getZoomTimeLevelMax(); } @Override public void genericVZoomToLevel(int n) { // YXXX implement this? timeline.zoomHistoryAdd(); // needed because timeline isn't the owner of these settings window.getSettings().getTimelineSetting().setTLStackDepth(TL2ControlPanel.this, n); cpToolbar.setVZoomLevel(n); // YXXX fixup } @Override public void genericVZoomIn() { timeline.zoomHistoryAdd(); // needed because timeline isn't the owner of these settings int zl = window.getSettings().getTimelineSetting().getTLStackDepth(); zl++; window.getSettings().getTimelineSetting().setTLStackDepth(TL2ControlPanel.this, zl); cpToolbar.setVZoomLevel(zl); // YXXX fixup } @Override public void genericVZoomOut() { timeline.zoomHistoryAdd(); // needed because timeline isn't the owner of these settings int zl = window.getSettings().getTimelineSetting().getTLStackDepth(); zl--; if (zl < 0) { zl = 0; // YXXX fixup } window.getSettings().getTimelineSetting().setTLStackDepth(TL2ControlPanel.this, zl); cpToolbar.setVZoomLevel(zl); // YXXX fixup } @Override public void resetZoom() { timeline.resetZoom(); // updateZoomSliders(); //YXXX remove this let widget update do it } @Override public void undoZoom() { timeline.undoZoom(); } @Override public void redoZoom() { timeline.redoZoom(); } @Override public void chooseColors() { color_chooser.setVisible(true); } /** * Shows Context Menu (reaction on Shift-F10) * * @param ev */ @Override public void showContextMenu(ActionEvent ev) { int id = KeyEvent.VK_F10; long when = 0; // System.currentTimeMillis(); int modifiers = InputEvent.SHIFT_MASK; int x = 120; int y = 40; int clickCount = 1; boolean popupTrigger = true; int button = MouseEvent.BUTTON1; MouseEvent me = null; me = new MouseEvent(timeline, id, when, modifiers, x, y, clickCount, popupTrigger, button); try { popupListener.maybeShowPopup(me); } catch (java.awt.IllegalComponentStateException icse) { // System.out.println("showContextMenu(): " + icse); } } /** Opens "Set Data Presentation" dialog */ public void editProperties(String tabname) { window.getSettings().showDialog(window.getSettings().settingsTimelineIndex); } // --- used by menus --- // Changes timeline time zoom initiated by this class private void zoomTimeToLevel(int level) { timeline.zoomTimeToLevel(level); } // Change timeline process zoom initiated by this class private void zoomProcessToLevel(int level) { timeline.zoomProcessToLevel(level); } /** Initialize timeline specific components */ // called by parent's initializeComponents() private JComponent initializeCustomComponents() { // YXXX uh, supposed to ovverride parent or not? // the component we're going to return JPanel customBoxesPanel = new AnJPanel(); customBoxesPanel.setLayout(new BoxLayout(customBoxesPanel, BoxLayout.Y_AXIS)); // --- YXXX.... // customBoxesPanel.add(limiterPanel); // limiterPanel.revalidate(); customBoxesPanel.revalidate(); // return customBoxesPanel; return null; } /** Initialize component to show details */ private JPanel initializeDetailComponents() { // the component we're going to return: JPanel tmpDetailsPanel = new AnJPanel(); tmpDetailsPanel.setLayout(new BorderLayout()); // tmpDetailsPanel.setBorder( // new TitledBorder(AnLocale.getString("Details"))); // panel for text details detailsTextPanel = (JPanel) getDetailsTextPanel(); detailsTextPanel.registerKeyboardAction( new Analyzer.HelpAction(AnVariable.HELP_TabsSummary), "help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); detailsTextPanel.setLayout(new BoxLayout(detailsTextPanel, BoxLayout.Y_AXIS)); // horizontally-constrained scroll pane for detailsTextPanel CPDetailsScrollPane detailsScrollPane = new CPDetailsScrollPane(detailsTextPanel); detailsScrollPane.setBorder(BorderFactory.createEmptyBorder()); // tmpDetailsPanel.add(detailsScrollPane,BorderLayout.NORTH); // ---- call stack // panel for stack_view and stackEnableButton stackViewPane = new FocusPanel(); stackViewPane.setBackground(Color.WHITE); stackViewPane.setVisible(false); // stack component stack_view = new StackView(clmap); stack_view.addMouseListener(this); stack_view.addListSelectionListener(this); // XXXmpview, why is this needed? stackViewEnabled = false; // YXXX selState=null; stackViewPane.revalidate(); tmpDetailsPanel.add(stackViewPane, BorderLayout.CENTER); tmpDetailsPanel.revalidate(); return tmpDetailsPanel; } class FocusPanel extends JPanel { @Override public void requestFocus() { if (stack_view != null) { stack_view.requestFocus(); } } } /** Set the detail text */ void setDetailText(TimelineSelectionEvent evt) { JPanel tmpPanel; JLabel lbl; final String title; if (evt == null) { title = AnLocale.getString("Nothing Selected"); lbl = new JLabel(AnLocale.getString("Nothing selected")); tmpPanel = new AnJPanel(); tmpPanel.add(lbl); } else { title = AnLocale.getString("Timelinexx"); tmpPanel = eventDetails.setEvent(evt); } tmpPanel.revalidate(); detailsTextPanel.removeAll(); detailsTextPanel.add(tmpPanel); detailsTextPanel.revalidate(); detailsTextPanel.repaint(); } private void loadStacks() { // mpi_drawer.getProvider().loadStacks(); // FunctionDetail fdet = new FunctionDetail(selState); // long stackId=fdet.getStackId(); // YXXX showStack(stackId); } private void enableStackView() { // hide stackViewPane until data is ready stackViewPane.setVisible(false); stackViewPane.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(2, 2, 2, 2); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; stackViewPane.add(stack_view, gridBagConstraints); stackViewPane.revalidate(); stackViewPane.repaint(); stackViewEnabled = true; } private void showStack(TimelineSelectionEvent e) { final long stack_id = (e == null) ? DetailsIPC.INVALID_STACK_ID : e.stackId; if (stack_id == DetailsIPC.INVALID_STACK_ID) { // hide stackview panel stackViewPane.setVisible(false); } else if (e.eventDetail == null) { // hide stackview panel stackViewPane.setVisible(false); } else if (stack_id == 0) { // we would show stacks, but stack ID is not known if (!stackViewEnabled) { // show user button that loads stack data stackViewPane.setVisible(true); } else { // no stack for this function stackViewPane.setVisible(false); } } else { // valid stack_id if (!stackViewEnabled) { // some other tab must have loaded stacks for us enableStackView(); } updateStackView(e); stackViewPane.setVisible(true); } stackViewPane.revalidate(); } public void resetStackView() { if (stack_view != null) { stack_view.reset(); } } private static int desiredDistFromRoot = -1; private void updateStackView(final TimelineSelectionEvent e) { Vector<StackState> state_vec = (e == null) ? null : e.getStackFrames(); if (state_vec == null || state_vec.isEmpty()) { stack_view.reset(); return; } // stack_view(0) is leaf frame int prevSelIdx = stack_view.getLeadSelectionIndex(); if (stack_view.isSelectionEmpty()) { prevSelIdx = -1; } else { prevSelIdx = stack_view.getLeadSelectionIndex(); } final int prevMax = stack_view.getModel().getSize() - 1; // try to determine whether or not to change savedDistFromRoot if (prevSelIdx == -1) { // do nothing } else { int prevDistFromRoot = prevMax - prevSelIdx; if (prevDistFromRoot != desiredDistFromRoot) { // user probably made a selection if (prevSelIdx == 0) { desiredDistFromRoot = -1; // assume they want leaf to show } else { desiredDistFromRoot = prevDistFromRoot; // set new desired distance } } } // try to apply new desired to current stack final int selIndex; do { if (desiredDistFromRoot == -1) { selIndex = -1; // deselect and show leaf break; } final int newMax = state_vec.size() - 1; if (desiredDistFromRoot > newMax) { selIndex = -1; // deselect and show leaf break; } selIndex = newMax - desiredDistFromRoot; } while (false); clmap.addStates(state_vec); stack_view.setStates(state_vec, selIndex); // update stack in right-hand tab stack_view.setStackId(e.stackId); AnWindow.getInstance().setSubviewReadyToShow("timelineCallStackSubview", true); } // color change(s) @Override public void valueChanged(AnEvent e) { stack_view.repaint(); timeline.repaint(); } // Set selected function private void updateSummary(final StackState tmpstate) { final long sel_func; final long sel_pc; if (!(tmpstate instanceof StackViewState)) { System.err.println("XXXmpview timelistdisp: not StackViewState"); return; } StackViewState state = (StackViewState) tmpstate; sel_func = state.getNumber(); sel_pc = state.getPC(); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { long sel_obj = window.getSelectedObject().getObject(sel_func, sel_pc); // IPC! if (sel_obj != 0L) { window.getSelectedObject().setSelObj(sel_obj, AnDisplay.DSP_Timeline, 0); // window.getSelectionManager().updateSelection(sel_obj, // AnDisplay.DSP_TIMELINE, 0, 1); AnWindow.getInstance() .getViews() .getCurrentViewDisplay() .computeOnAWorkerThread(); // Update selection. FIXUP: Views that react on // selections should change selction on // SELECTION_CHANGED or SELECTED_OBJECT_CHANGED events // if not from own view } } }, "Timelinecontrol update summary"); } // The function selected has changed either by clicking inside the callstack // on the right or by clicking on an event in timeline // (MUST BE CALLED ON AWT THREAD) private void funcSelChanged(EventObject event) { final JList list; StackState state = null; // window.setSelectedInfoTab(eventPane); // TimelineDisp's eventPane if (event instanceof MouseEvent) { if (color_chooser.isVisible()) { color_chooser.setVisible(true); } if (((MouseEvent) event).getClickCount() > 1) { window.setSelectedView(AnDisplay.DSP_Source); } } else { if (color_chooser.isVisible()) { color_chooser.setVisible(true); } } // StackView or ChooserStateList if (event.getSource() instanceof StackView) { list = stack_view; state = (StackState) list.getSelectedValue(); } else { // XXXmpview, figure this out... // System.err.println("XXXmpview MPItimelistdisp: eventsource unknown"); return; } if (state == null) { return; } stack_view.setSelectedFunction(state.getNumber()); // XXXmpview may be redundant color_chooser.setSelectedFunction(state.getNumber()); updateSummary(state); } @Override public void mouseClicked(final MouseEvent event) { if (SwingUtilities.isLeftMouseButton(event)) { funcSelChanged(event); } if (SwingUtilities.isRightMouseButton(event)) { stackViewPopupListener.maybeShowPopup(event); } return; } @Override public void mouseEntered(final MouseEvent event) {} @Override public void mouseExited(final MouseEvent event) {} @Override public void mousePressed(final MouseEvent event) {} @Override public void mouseReleased(final MouseEvent event) {} @Override public void valueChanged(final ListSelectionEvent event) { // Handles selection changes to RHS Callstack made via keyboard funcSelChanged( event); // YXXX unfortunately also picks up new stack selections and causes selected object // to change } // ---------- Context menu ---------- // // private JPopupMenu popup; private JMenuItem menuItemZoomHD; private JMenuItem menuItemScrollHL, menuItemScrollHR, menuItemScrollHPL, menuItemScrollHPR; private JMenuItem menuItemScrollVU, menuItemScorllVD; private PopupListener popupListener; private StackView.StackViewPopupListener stackViewPopupListener; // ------- Private classes and methods to implement popup menu items ------- // private void enableNavigationMenuItems( boolean left, boolean right, boolean up, boolean down, boolean center) { selectNextLeftAction.enableMenuItem(left); selectNextRightAction.enableMenuItem(right); selectNextUpAction.enableMenuItem(up); selectNextDownAction.enableMenuItem(down); selectFindAction.enableMenuItem(center); } private void enableZoomMenuItems(boolean hasHZoom, boolean hasVZoom) { if (menuItemZoomHD == null) { return; } menuItemZoomHD.setEnabled(hasHZoom); menuItemScrollHL.setEnabled(hasHZoom); menuItemScrollHR.setEnabled(hasHZoom); menuItemScrollHPL.setEnabled(hasHZoom); menuItemScrollHPR.setEnabled(hasHZoom); menuItemScrollVU.setEnabled(hasVZoom); menuItemScorllVD.setEnabled(hasVZoom); } private class PopupListener extends MouseAdapter implements ActionListener, PopupMenuListener { PopupListener() {} @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } // public void mouseReleased(MouseEvent e) { // maybeShowPopup(e); // } /** * Shows context menu * * @param MouseEvent e */ private void maybeShowPopup(MouseEvent e) { // On Windows e.isPopupTrigger() returns false, so we have to apply a workaround if (e.isPopupTrigger() || ((System.getProperty("os.name").contains("Windows")) && (e.getButton() == 3))) { boolean hasHZoom = (tl2_drawer.getAbsoluteTimeDuration() != tl2_drawer.getTimeAxisReader().getTimeDuration()); boolean hasVZoom = (tl2_drawer.getAbsoluteRowCount() != tl2_drawer.getDataAxisReader().getRowCount()); enableZoomMenuItems(hasHZoom, hasVZoom); JPopupMenu popup = createPopupMenu(false); popup.show(e.getComponent(), e.getX(), e.getY()); } } @Override public void actionPerformed(ActionEvent ev) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuCanceled(PopupMenuEvent e) {} } /** * Creates popup menu Menu items: ---------------- Change Colors ---------------- Select Event -> * -> Select First -> Right -> Left -> Up -> Down -> Center Selection ---------------- Zoom -> -> * Increase -> Decrease -> Reset -> Previous (Back) ---------------- Scroll -> -> Center Selection * -> Right -> Left -> Up -> Down -> Page Right -> Page Left -> Previous (Back) ---------------- * Add Filter: Include only events from visible time range Add Filter: Include only events from * selected time to end Add Filter: Include only events from beginning to selected time Add * Filter: Include only selected rows Add Filter: Include only unselected rows Remove All Filters * Manage Filters... ---------------- Properties ---------------- * * <p>Returns PopupListener */ private final int menuModifier = 0; // was ActionEvent.ALT_MASK; private JMenu newEventSelectSubMenu() { JMenu submenu1; JMenuItem menuItem; { // Add Select Next submenu submenu1 = new JMenu(AnLocale.getString("Select Event")); menuItem = selectNextUpAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, menuModifier)); submenu1.add(menuItem); menuItem = selectNextDownAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, menuModifier)); submenu1.add(menuItem); menuItem = selectNextLeftAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, menuModifier)); submenu1.add(menuItem); menuItem = selectNextRightAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new SelectFirst()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, menuModifier)); submenu1.add(menuItem); } return submenu1; } private JMenu newZoomSubMenu() { JMenu submenu1; JMenuItem menuItem; { // Add Zoom submenu submenu1 = new JMenu(AnLocale.getString("Zoom")); // Add Horizontal Zoom submenu submenu1.add(caliperZoom.jmi); // enabled dynamically // Zoom Undo/Redo/Reset menuItem = undoZoomAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, menuModifier)); submenu1.add(menuItem); menuItem = redoZoomAction.jmi; menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, ActionEvent.SHIFT_MASK)); submenu1.add(menuItem); menuItem = new JMenuItem(new ResetHorizontalZoom()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_0, menuModifier)); submenu1.add(menuItem); // Zoom Increase/Descrease menuItem = new JMenuItem(new IncreaseHorizontalZoom()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, menuModifier)); submenu1.add(menuItem); menuItem = menuItemZoomHD = new JMenuItem(new DecreaseHorizontalZoom()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new IncreaseVerticalZoom()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, ActionEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemZoomHD = new JMenuItem(new DecreaseVerticalZoom()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, ActionEvent.CTRL_MASK)); submenu1.add(menuItem); } return submenu1; } private JMenu newFindSubMenu() { JMenu submenu1; JMenuItem menuItem; { // Add Scroll submenu submenu1 = new JMenu(AnLocale.getString("Find")); menuItem = selectFindAction.jmi; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new findTimeMarker()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.SHIFT_MASK)); submenu1.add(menuItem); } return submenu1; } private JMenu newScrollSubMenu() { JMenu submenu1; JMenuItem menuItem; { // Add Scroll submenu submenu1 = new JMenu(AnLocale.getString("Scroll")); menuItem = menuItemScrollVU = new JMenuItem(new ScrollVerticalUp()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemScorllVD = new JMenuItem(new ScrollVerticalDown()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemScrollHL = new JMenuItem(new ScrollHorizontalLeft()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemScrollHR = new JMenuItem(new ScrollHorizontalRight()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemScrollHPL = new JMenuItem(new ScrollHorizontalPageLeft()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK)); submenu1.add(menuItem); menuItem = menuItemScrollHPR = new JMenuItem(new ScrollHorizontalPageRight()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK)); submenu1.add(menuItem); } return submenu1; } private JMenu newTimeRangeSubMenu() { JMenu submenu1; JMenuItem menuItem; { // add select tiime range items submenu1 = new JMenu(AnLocale.getString("Select Time Range")); menuItem = new JMenuItem(new SetTimeMarker()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new MoveTimeMarkerLeft()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new MoveTimeMarkerRight()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, menuModifier)); submenu1.add(menuItem); menuItem = new JMenuItem(new MoveTimeMarkerRangeLeft()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.SHIFT_MASK)); submenu1.add(menuItem); menuItem = new JMenuItem(new MoveTimeMarkerRangeRight()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, InputEvent.SHIFT_MASK)); submenu1.add(menuItem); } return submenu1; } private JPopupMenu createPopupMenu(boolean filterOnly) { JMenu submenu1; JMenuItem menuItem; JPopupMenu popup = new JPopupMenu(); if (!filterOnly) { // popup.add(caliperZoom.jmi); // enabled dynamically popup.add(newZoomSubMenu()); popup.addSeparator(); } popup.add(setFilterSelectedTimeRangeOnly.jmi); popup.add(setFilterExcludeBefore.jmi); popup.add(setFilterExcludeAfter.jmi); popup.add(setFilterVisibleTimeRangeOnly.jmi); popup.add(setFilterSelectedRowsOnly.jmi); popup.add(setFilterUnselectedRowsOnly.jmi); submenu1 = new JMenu(AnLocale.getString("Additional Filters")); submenu1.add(setFilterMicrostate.jmi); submenu1.add(setFilterNotMicrostate.jmi); submenu1.add(customFilter.jmi); popup.add(submenu1); if (filterOnly) { popup.addSeparator(); } undoFilter.jmi.setEnabled(window.getFilters().canUndoLastFilter()); popup.add(undoFilter.jmi); redoFilter.jmi.setEnabled(window.getFilters().canRedoLastFilter()); popup.add(redoFilter.jmi); removeAllFilters.jmi.setEnabled(window.getFilters().canRemoveAllFilters()); popup.add(removeAllFilters.jmi); // Add "Remove Filter" action if (window.getFilters().anyFilters()) { popup.add(window.getFilters().removeFilterMenuItem()); } if (!filterOnly) { popup.addSeparator(); { menuItem = new JMenuItem(new ChangeColors()); menuItem.setAccelerator(KeyboardShortcuts.functionColorsActionShortcut); JMenuItem colorSubmenu = menuItem; popup.add(colorSubmenu); } popup.addSeparator(); popup.add(newFindSubMenu()); popup.add(newEventSelectSubMenu()); popup.add(newTimeRangeSubMenu()); popup.add(newScrollSubMenu()); popup.addSeparator(); // Add menu it em Properties menuItem = new JMenuItem(new ChangeDataPresentation()); menuItem.setAccelerator(KeyboardShortcuts.settingsActionShortcut); popup.add(menuItem); // popup.addSeparator(); } return popup; } private void initNavigationMenuItems() { JMenuItem menuItem; undoZoomAction = new UndoZoomAction(); menuItem = new JMenuItem(undoZoomAction); undoZoomAction.jmi = menuItem; menuItem.setEnabled(false); redoZoomAction = new RedoZoomAction(); menuItem = new JMenuItem(redoZoomAction); redoZoomAction.jmi = menuItem; menuItem.setEnabled(false); selectNextUpAction = new SelectNextUp(); menuItem = new JMenuItem(selectNextUpAction); selectNextUpAction.jmi = menuItem; menuItem.setEnabled(false); selectNextDownAction = new SelectNextDown(); menuItem = new JMenuItem(selectNextDownAction); selectNextDownAction.jmi = menuItem; menuItem.setEnabled(false); selectNextLeftAction = new SelectNextLeft(); menuItem = new JMenuItem(selectNextLeftAction); selectNextLeftAction.jmi = menuItem; menuItem.setEnabled(false); selectNextRightAction = new SelectNextRight(); menuItem = new JMenuItem(selectNextRightAction); selectNextRightAction.jmi = menuItem; menuItem.setEnabled(false); selectFindAction = new SelectFind(); menuItem = new JMenuItem(selectFindAction); selectFindAction.jmi = menuItem; menuItem.setEnabled(false); enableNavigationMenuItems(false, false, false, false, false); } private void initFilterMenuItems() { JMenuItem menuItem; TimelineCaliper caliper = timeline.getCaliperClone(); final boolean enableSelFilters = (caliper != null); caliperZoom = new CaliperZoom(); menuItem = new JMenuItem(caliperZoom); caliperZoom.jmi = menuItem; menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)); menuItem.setEnabled(enableSelFilters && !caliper.isSingleEvent()); setFilterVisibleTimeRangeOnly = new SetFilterVisibleTimeRangeOnly(); menuItem = new JMenuItem(setFilterVisibleTimeRangeOnly); setFilterVisibleTimeRangeOnly.jmi = menuItem; menuItem.setEnabled(true); setFilterSelectedTimeRangeOnly = new SetFilterSelectedTimeRangeOnly(); menuItem = new JMenuItem(setFilterSelectedTimeRangeOnly); setFilterSelectedTimeRangeOnly.jmi = menuItem; menuItem.setEnabled(enableSelFilters && !caliper.isSingleEvent()); setFilterExcludeAfter = new SetFilterExcludeAfter(); menuItem = new JMenuItem(setFilterExcludeAfter); setFilterExcludeAfter.jmi = menuItem; menuItem.setEnabled(enableSelFilters); setFilterExcludeBefore = new SetFilterExcludeBefore(); menuItem = new JMenuItem(setFilterExcludeBefore); setFilterExcludeBefore.jmi = menuItem; menuItem.setEnabled(enableSelFilters); final boolean hasRowSelections = (tl2_drawer.getRowBlockSelectList() != null && !tl2_drawer.getRowBlockSelectList().isEmpty()); setFilterSelectedRowsOnly = new SetFilterSelectedRowsOnly(); menuItem = new JMenuItem(setFilterSelectedRowsOnly); setFilterSelectedRowsOnly.jmi = menuItem; menuItem.setEnabled(hasRowSelections); setFilterUnselectedRowsOnly = new SetFilterUnselectedRowsOnly(); menuItem = new JMenuItem(setFilterUnselectedRowsOnly); setFilterUnselectedRowsOnly.jmi = menuItem; menuItem.setEnabled(hasRowSelections); setFilterMicrostate = new SetFilterMicrostate(); menuItem = new JMenuItem(setFilterMicrostate); setFilterMicrostate.jmi = menuItem; menuItem.setEnabled(false); setFilterNotMicrostate = new SetFilterNotMicrostate(); menuItem = new JMenuItem(setFilterNotMicrostate); setFilterNotMicrostate.jmi = menuItem; menuItem.setEnabled(false); customFilter = new CustomFilterAction("Advanced Custom Filter..."); menuItem = new JMenuItem(customFilter); customFilter.jmi = menuItem; menuItem.setEnabled(true); undoFilter = new UndoFilterAction(); menuItem = new JMenuItem(undoFilter); undoFilter.jmi = menuItem; menuItem.setEnabled(window.getFilters().canUndoLastFilter()); redoFilter = new RedoFilterAction(); menuItem = new JMenuItem(redoFilter); redoFilter.jmi = menuItem; menuItem.setEnabled(window.getFilters().canRedoLastFilter()); removeAllFilters = new RemoveAllFilterAction(); menuItem = new JMenuItem(removeAllFilters); removeAllFilters.jmi = menuItem; menuItem.setEnabled(window.getFilters().canRemoveAllFilters()); } class ContextMenuAction extends AbstractAction { final String name = AnLocale.getString("Context Menu"); int id = KeyEvent.VK_F10; long when = 0; // System.currentTimeMillis(); int modifiers = InputEvent.SHIFT_MASK; int x = 40; int y = 40; int clickCount = 1; boolean popupTrigger = true; int button = MouseEvent.BUTTON1; MouseEvent me = null; public ContextMenuAction() { super(AnLocale.getString("Context Menu"), null /* new ImageIcon("refresh.jpg") */); // A11YXXX : this is a hack, but I don't see a better way for now me = new MouseEvent(timeline, id, when, modifiers, x, y, clickCount, popupTrigger, button); } @Override public void actionPerformed(ActionEvent ev) { try { popupListener.maybeShowPopup(me); } catch (java.awt.IllegalComponentStateException icse) { // System.out.println("ContextMenuAction.ActionPerformed(): " + icse); } } } /** Implements menu item: Zoom -> -> Horizontal -> -> Increase */ class CaliperZoom extends AbstractAction { public JMenuItem jmi = null; public CaliperZoom() { super(AnLocale.getString("Zoom to Selected Time Range"), AnUtility.mtall_icon); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { zoomToCaliper(); } } class IncreaseHorizontalZoom extends AbstractAction { public IncreaseHorizontalZoom() { super(AnLocale.getString("Increase Time Zoom"), null); } @Override public void actionPerformed(ActionEvent ev) { genericZoomIn(); } } class DecreaseHorizontalZoom extends AbstractAction { public DecreaseHorizontalZoom() { super(AnLocale.getString("Decrease Time Zoom"), null); } @Override public void actionPerformed(ActionEvent ev) { genericZoomOut(); } } class IncreaseVerticalZoom extends AbstractAction { public IncreaseVerticalZoom() { super(AnLocale.getString("Increase Vertical Zoom"), null); } @Override public void actionPerformed(ActionEvent ev) { genericVZoomIn(); } } class DecreaseVerticalZoom extends AbstractAction { public DecreaseVerticalZoom() { super(AnLocale.getString("Decrease Vertical Zoom"), null); } @Override public void actionPerformed(ActionEvent ev) { genericVZoomOut(); } } /** Implements menu item: Zoom -> -> Horizontal -> -> Reset */ class ResetHorizontalZoom extends AbstractAction { public ResetHorizontalZoom() { super(AnLocale.getString("Reset Time Zoom"), null); } @Override public void actionPerformed(ActionEvent ev) { zoomTimeToLevel(0); } } /** Implements menu item: Zoom -> -> Previous (Back) */ class UndoZoomAction extends AbstractAction { public UndoZoomAction() { super(AnLocale.getString("Undo Zoom Action"), AnUtility.undo_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { undoZoom(); } } class RedoZoomAction extends AbstractAction { public RedoZoomAction() { super(AnLocale.getString("Redo Zoom Action"), AnUtility.redo_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { redoZoom(); } } // -------------- Change Colors ---------------- // /** Implements menu item: Change Colors */ class ChangeColors extends AbstractAction { public ChangeColors() { super(AnLocale.getString("Function Colors..."), AnUtility.colr_icon); } @Override public void actionPerformed(ActionEvent ev) { chooseColors(); } } // -------------- Properties ---------------- // /** Implements menu item: Properties */ class ChangeDataPresentation extends AbstractAction { public ChangeDataPresentation() { super(AnLocale.getString("Timeline Settings"), AnUtility.gear_icon); } @Override public void actionPerformed(ActionEvent ev) { editProperties(AnLocale.getString("Timeline")); } } private static final String ADD_FILTER = AnLocale.getString("Add Filter: "); private static final String VISIBLE_RANGE_SHORT_NAME = AnLocale.getString("Visible Range"); private static final String VISIBLE_RANGE_LONG_NAME = AnLocale.getString("Include only events intersecting visible time range"); private static final String SELECTED_RANGE_SHORT_NAME = AnLocale.getString("Intersecting Time Range"); private static final String SELECTED_RANGE_LONG_NAME = AnLocale.getString("Include only events intersecting selected time range"); private static final String EXCLUDE_BEFORE_SHORT_NAME = AnLocale.getString("Starting in Range"); private static final String EXCLUDE_BEFORE_LONG_NAME = AnLocale.getString("Include only events starting in selected time range"); private static final String EXCLUDE_AFTER_SHORT_NAME = AnLocale.getString("Ending in Range"); private static final String EXCLUDE_AFTER_LONG_NAME = AnLocale.getString("Include only events ending in selected time range"); private static final String SELECTED_ROWS_SHORT_NAME = AnLocale.getString("Selected Rows"); private static final String SELECTED_ROWS_LONG_NAME = AnLocale.getString("Include only selected rows"); private static final String UNSELECTED_ROWS_SHORT_NAME = AnLocale.getString("Unselected Rows"); private static final String UNSELECTED_ROWS_LONG_NAME = AnLocale.getString("Include only unselected rows"); private static final String WITH_MSTATE_SHORT_NAME = AnLocale.getString("Thread State"); private static final String WITH_MSTATE_LONG_NAME = AnLocale.getString("Include only events having the selected event's thread state"); private static final String NOT_MSTATE_SHORT_NAME = AnLocale.getString("Not Thread State"); private static final String NOT_MSTATE_LONG_NAME = AnLocale.getString("Include only events not having the selected event's thread state"); private String getSelectedViewDisplayName() { String ret = "Timeline"; // fallback if (window != null) { ret = window.getSelectedView().getDisplayName(); } return ret; } private void setClause(String shortName, String longName, String clause) { window .getFilters() .addClause( getSelectedViewDisplayName() + ": " + shortName, longName, clause, FilterClause.Kind.STANDARD); } // -------------- visible time range ---------------- // /** Implements menu item: Set Filter: visible time range */ class SetFilterVisibleTimeRangeOnly extends AbstractAction { public JMenuItem jmi = null; public SetFilterVisibleTimeRangeOnly() { super(ADD_FILTER + VISIBLE_RANGE_LONG_NAME /*, AnUtility.filtclause_icon*/); } @Override public void actionPerformed(ActionEvent ev) { long start = tl2_drawer.getTimeAxisReader().getTimeStart(); long end = tl2_drawer.getTimeAxisReader().getTimeEnd(); String clause = "!( (TSTAMP_HI < " + start + ") || (TSTAMP_LO > " + end + ") )"; // window.filter.showDialog(); // Show "Set Filter" dialog // window.filter.setSelectedTab(1); // Select advanced filter tab setClause( VISIBLE_RANGE_SHORT_NAME, VISIBLE_RANGE_LONG_NAME, clause); // Put the string in the text field } } /** Implements menu item: Set Filter: selected time range */ class SetFilterSelectedTimeRangeOnly extends AbstractAction { public JMenuItem jmi = null; public SetFilterSelectedTimeRangeOnly() { super(ADD_FILTER + SELECTED_RANGE_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { TimelineCaliper caliper = timeline.getCaliperClone(); if (caliper == null) { return; } final long start = caliper.getLowTime(); final long end = caliper.getHighTime(); String clause = "!( (TSTAMP_HI < " + start + ") || (TSTAMP_LO > " + end + ") )"; // window.filter.showDialog(); // Show "Set Filter" dialog // window.filter.setSelectedTab(1); // Select advanced filter tab setClause( SELECTED_RANGE_SHORT_NAME, SELECTED_RANGE_LONG_NAME, clause); // Put the string in the text field } } // -------------- exclude before ---------------- // /** Implements menu item: Set Filter: exclude before */ class SetFilterExcludeBefore extends AbstractAction { public JMenuItem jmi = null; public SetFilterExcludeBefore() { super(ADD_FILTER + EXCLUDE_BEFORE_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { TimelineCaliper caliper = timeline.getCaliperClone(); if (caliper == null) { return; } final long start = caliper.getLowTime(); final long end = caliper.getHighTime(); String clause = "( (TSTAMP_LO >= " + start + ") && (TSTAMP_LO <= " + end + ") )"; // window.filter.showDialog(); // Show "Set Filter" dialog // window.filter.setSelectedTab(1); // Select advanced filter tab setClause( EXCLUDE_BEFORE_SHORT_NAME, EXCLUDE_BEFORE_LONG_NAME, clause); // Put the string in the text field } } // -------------- exclude after ---------------- // /** Implements menu item: Set Filter: exclude after */ class SetFilterExcludeAfter extends AbstractAction { public JMenuItem jmi = null; public SetFilterExcludeAfter() { super(ADD_FILTER + EXCLUDE_AFTER_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { TimelineCaliper caliper = timeline.getCaliperClone(); if (caliper == null) { return; } final long start = caliper.getLowTime(); final long end = caliper.getHighTime(); String clause = "( (TSTAMP_HI >= " + start + ") && (TSTAMP_HI <= " + end + ") )"; // window.filter.showDialog(); // Show "Set Filter" dialog // window.filter.setSelectedTab(1); // Select advanced filter tab setClause( EXCLUDE_AFTER_SHORT_NAME, EXCLUDE_AFTER_LONG_NAME, clause); // Put the string in the text field } } // -------------- only selected rows ---------------- // /** Implements menu item: Set Filter: only selected rows */ class SetFilterSelectedRowsOnly extends AbstractAction { public JMenuItem jmi = null; public SetFilterSelectedRowsOnly() { super(ADD_FILTER + SELECTED_ROWS_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { String clause = getSelRowsFilterClause(false); if (clause.length() != 0) { setClause(SELECTED_ROWS_SHORT_NAME, SELECTED_ROWS_LONG_NAME, clause); } // Put the string in the text field } } // -------------- only unselected rows ---------------- // /** Implements menu item: Set Filter: only unselected rows */ class SetFilterUnselectedRowsOnly extends AbstractAction { public JMenuItem jmi = null; public SetFilterUnselectedRowsOnly() { super(ADD_FILTER + UNSELECTED_ROWS_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { String clause = getSelRowsFilterClause(true); if (clause.length() != 0) { setClause(UNSELECTED_ROWS_SHORT_NAME, UNSELECTED_ROWS_LONG_NAME, clause); } // Put the string in the text field } } private String getSelRowsFilterClause(boolean invert) { // Rules for generating row filter string: // if "group-by" is experiments // filter by expid // else if (experiment master row selected) // if (no subrows or all subrows selected) // filter by expid // else // filter by selected subrows // else // filter by selected subrows // // This has special implications for Java: // Example 1: // filter by experiment two's master row and all user-mode threads // Result: "EXPID==2" // Switching to Machine Mode will show User and JVM threads // // Example 2: // filter by experiment two's user-mode threads *without* master row // Result: "EXPID==2 && THRID IN (...)" // Switching to Machine Mode will show only User Mode threads // // // Note: this function does not look at EXPGRID // It also assumes that a given EXPID's blocks are contiguous // (rows from one EXPID won't be interleaved with rows from some other EXPID) // List<Integer> blockSelList = tl2_drawer.getRowBlockSelectList(); int nSelBlocks = blockSelList.size(); if (nSelBlocks == 0) { return ""; } List<EntityDefinitions> rowBlocks = tl2_drawer.getRowDefsByBlock(); if (rowBlocks == null) { return ""; // data is in transition } int prevUserExpId = -1; // invalid value final String clauseInit = "( "; String clause = clauseInit; boolean experimentMasterRowSelected = false; boolean entIsExpid = false; String entPropIdName = null; final List<Integer> entityIds = new ArrayList<>(); final List<Integer> expIdList = new ArrayList<>(); for (int jj = 0; jj <= nSelBlocks /*one extra!*/; jj++) { final RowDefinition rowDef0; final int userExpId; if (jj < nSelBlocks) { int blockNum = blockSelList.get(jj); if (blockNum < 0 || blockNum >= rowBlocks.size()) { return ""; // weird } EntityDefinitions rowDefs = rowBlocks.get(blockNum); rowDef0 = rowDefs.entityRows.get(0); userExpId = rowDef0.getUserExpID(); } else { rowDef0 = null; userExpId = -2; } if (jj == nSelBlocks || (jj > 0 && prevUserExpId != userExpId)) { // wrap up previous block boolean filterExclusivelyByExpid = false; if (entIsExpid) { // Group By Experiment filterExclusivelyByExpid = true; } else if (experimentMasterRowSelected) { if (entityIds.isEmpty()) { // Only Experiment master row selected filterExclusivelyByExpid = true; } else { ExperimentDefinitions tmp = tl2_drawer.event_drawer.getDataSnapshot().getExperimentDefinitions(prevUserExpId); if (tmp != null) { int numEntities = tmp.experimentEntities.size(); if (numEntities - 1 == entityIds.size()) { // Master and all subrows selected filterExclusivelyByExpid = true; } } else { int kk = -1; // weird } } } if (filterExclusivelyByExpid) { // Only Experiment master row selected: filter exclusively by EXPID expIdList.add(prevUserExpId); } else { // generate a filter for selected entities (e.g. THRID) if (!clause.equals(clauseInit)) { clause += " || "; } clause += "( EXPID==" + prevUserExpId + " && "; if (invert) { clause += "!"; expIdList.add(prevUserExpId); } boolean propListStarted = false; for (Integer entId : entityIds) { if (!propListStarted) { clause += "( " + entPropIdName + " IN ("; } else { clause += ","; } clause += entId; propListStarted = true; } clause += ") ) )"; } experimentMasterRowSelected = false; entIsExpid = false; entPropIdName = null; entityIds.clear(); } if (rowDef0 != null) { prevUserExpId = userExpId; Entity ent0 = rowDef0.getEntity(); String tmpEntPropIdName = ent0.getPropIdName(); if (tmpEntPropIdName.equalsIgnoreCase("EXPID")) { // no properties are needed for Experiment grouping entIsExpid = true; } else if (ent0.getPropId() == Settings.PROP_NONE) { // for rows that don't have an entity, like samples experimentMasterRowSelected = true; } else { int entId = ent0.getPropValue(); if (entPropIdName == null) { entPropIdName = tmpEntPropIdName; } else if (!entPropIdName.equalsIgnoreCase(tmpEntPropIdName)) { int kk = 0; // weird! } entityIds.add(entId); } } } if (!expIdList.isEmpty()) { // now generate the 'simple' EXPID filters if (!clause.equals(clauseInit)) { clause += " || "; } if (invert) { clause += " !"; } boolean firstTime = true; for (Integer tmpExpId : expIdList) { if (firstTime) { clause += "( EXPID in (" + tmpExpId; firstTime = false; } else { clause += "," + tmpExpId; } } clause += ") )"; } clause += " )"; return clause; } // -------------- from beginning to selected time ---------------- // /** Implements menu item: Set Filter: from beginning to selected time */ class SetFilterMicrostate extends AbstractAction { public JMenuItem jmi = null; private int stateValue = -1; public SetFilterMicrostate() { super(/*ADD_FILTER +*/ WITH_MSTATE_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(TimelineSelectionEvent selEvent) { boolean enabled; if (selEvent != null && selEvent.eventDetail != null && selEvent.eventDetail instanceof ProfileEvent) { enabled = true; ProfileEvent pEvent = (ProfileEvent) selEvent.eventDetail; stateValue = pEvent.getState(); } else { enabled = false; stateValue = -1; } if (null != jmi) { jmi.setEnabled(enabled); } } @Override public void actionPerformed(ActionEvent ev) { String clause = "(MSTATE == " + stateValue + ")"; setClause( WITH_MSTATE_SHORT_NAME, WITH_MSTATE_LONG_NAME, clause); // Put the string in the text field } } // -------------- from beginning to selected time ---------------- // /** Implements menu item: Set Filter: from beginning to selected time */ class SetFilterNotMicrostate extends AbstractAction { public JMenuItem jmi = null; private int stateValue = -1; public SetFilterNotMicrostate() { super(/*ADD_FILTER +*/ NOT_MSTATE_LONG_NAME /*, AnUtility.filtclause_icon*/); } public void enableMenuItem(TimelineSelectionEvent selEvent) { boolean enabled; if (selEvent != null && selEvent.eventDetail != null && selEvent.eventDetail instanceof ProfileEvent) { enabled = true; ProfileEvent pEvent = (ProfileEvent) selEvent.eventDetail; stateValue = pEvent.getState(); } else { enabled = false; stateValue = -1; } if (null != jmi) { jmi.setEnabled(enabled); } } @Override public void actionPerformed(ActionEvent ev) { String clause = "(MSTATE != " + stateValue + ")"; setClause( NOT_MSTATE_SHORT_NAME, NOT_MSTATE_LONG_NAME, clause); // Put the string in the text field } } // -------------- Select Event ---------------- // /** Implements menu item: -> Select First */ class SelectFirst extends AbstractAction { public SelectFirst() { super(AnLocale.getString("Select a Visible Event"), new ImageIcon("sf.jpg")); } @Override public void actionPerformed(ActionEvent ev) { selectFirst(); } } /** Implements menu item: -> Center Selection */ class SelectFind extends AbstractAction { public SelectFind() { super(AnLocale.getString("Find (Recenter) Event Selection")); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { selectFind(); } } /** Implements menu item: -> Right */ class SelectNextRight extends AbstractAction { public SelectNextRight() { super(AnLocale.getString("Right"), AnUtility.forw_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { selectRight(); } } /** Implements menu item: -> Left */ class SelectNextLeft extends AbstractAction { public SelectNextLeft() { super(AnLocale.getString("Left"), AnUtility.back_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { selectLeft(); } } /** Implements menu item: -> Up */ class SelectNextUp extends AbstractAction { public SelectNextUp() { super(AnLocale.getString("Up"), AnUtility.up_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { selectUp(); } } /** Implements menu item: -> Down */ class SelectNextDown extends AbstractAction { public SelectNextDown() { super(AnLocale.getString("Down"), AnUtility.down_icon); } public JMenuItem jmi = null; public void enableMenuItem(boolean val) { if (null != jmi) { jmi.setEnabled(val); } } @Override public void actionPerformed(ActionEvent ev) { selectDown(); } } // -------------- Scroll ---------------- // /** Implements menu item: Scroll -> -> Right */ class ScrollHorizontalRight extends AbstractAction { public ScrollHorizontalRight() { super(AnLocale.getString("Right"), new ImageIcon("shr.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.panRight(); } } /** Implements menu item: Scroll -> -> Left */ class ScrollHorizontalLeft extends AbstractAction { public ScrollHorizontalLeft() { super(AnLocale.getString("Left"), new ImageIcon("shl.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.panLeft(); } } /** Implements menu item: Scroll -> -> Page Right */ class ScrollHorizontalPageRight extends AbstractAction { public ScrollHorizontalPageRight() { super(AnLocale.getString("Page Right"), new ImageIcon("shpr.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.pageRight(); } } /** Implements menu item: Scroll -> -> Page Left */ class ScrollHorizontalPageLeft extends AbstractAction { public ScrollHorizontalPageLeft() { super(AnLocale.getString("Page Left"), new ImageIcon("shpl.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.pageLeft(); } } /** Implements menu item: Scroll -> -> Up */ class ScrollVerticalUp extends AbstractAction { public ScrollVerticalUp() { super(AnLocale.getString("Up"), new ImageIcon("svu.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.panUp(); } } /** Implements menu item: Scroll -> -> Down */ class ScrollVerticalDown extends AbstractAction { public ScrollVerticalDown() { super(AnLocale.getString("Down"), new ImageIcon("svd.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.panDown(); } } /** Implements menu item: Scroll -> -> Page Up */ class ScrollVerticalPageUp extends AbstractAction { public ScrollVerticalPageUp() { super(AnLocale.getString("Page Up"), new ImageIcon("svpu.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.pageUp(); } } /** Implements menu item: Scroll -> -> Page Down */ class ScrollVerticalPageDown extends AbstractAction { public ScrollVerticalPageDown() { super(AnLocale.getString("Page Down"), new ImageIcon("svpd.jpg")); } @Override public void actionPerformed(ActionEvent ev) { timeline.pageDown(); } } // -------------- Select Time Range ---------------- // class findTimeMarker extends AbstractAction { public findTimeMarker() { super(AnLocale.getString("Find Time Markers")); } @Override public void actionPerformed(ActionEvent ev) { timeline.findTimeMarker(); } } /** Implements menu item: Select Time Range -> -> Set Time Marker at Center */ class SetTimeMarker extends AbstractAction { public SetTimeMarker() { super(AnLocale.getString("Set Time Marker at Center")); } @Override public void actionPerformed(ActionEvent ev) { timeline.setTimeMarker(); } } /** Implements menu item: Select Time Range -> -> Move Time Marker Left */ class MoveTimeMarkerLeft extends AbstractAction { public MoveTimeMarkerLeft() { super(AnLocale.getString("Move Time Marker Left")); } @Override public void actionPerformed(ActionEvent ev) { timeline.moveTimeMarkerLeft(); } } /** Implements menu item: Select Time Range -> -> Move Time Marker Right */ class MoveTimeMarkerRight extends AbstractAction { public MoveTimeMarkerRight() { super(AnLocale.getString("Move Time Marker Right")); } @Override public void actionPerformed(ActionEvent ev) { timeline.moveTimeMarkerRight(); } } /** Implements menu item: Select Time Range -> -> Adjust Selection Range Left */ class MoveTimeMarkerRangeLeft extends AbstractAction { public MoveTimeMarkerRangeLeft() { super(AnLocale.getString("Adjust Time Range to the Left")); } @Override public void actionPerformed(ActionEvent ev) { timeline.moveTimeRangeToLeft(); } } /** Implements menu item: Select Time Range -> -> Adjust Selection Range Right */ class MoveTimeMarkerRangeRight extends AbstractAction { public MoveTimeMarkerRangeRight() { super(AnLocale.getString("Adjust Time Range to the Right")); } @Override public void actionPerformed(ActionEvent ev) { timeline.moveTimeRangeToRight(); } } class ShowDynamicHelpPageAction extends AbstractAction { public ShowDynamicHelpPageAction() { super(AnLocale.getString("More Info"), new ImageIcon("help.gif")); } @Override public void actionPerformed(ActionEvent ev) { ShowDynamicHelpPage(); } } private void ShowDynamicHelpPage() { // HelpManager.getDefault().showDynaHelp("MPITimeline"); } public TimelinePanel getTimelinePanel() { return timeline; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/cursorevent/���������������������������������������������0000755�0001750�0001750�00000000000�15044723234�020262� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/cursorevent/CursorSetEvent.java��������������������������0000644�0001750�0001750�00000005144�14744453367�024021� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.cursorevent; import org.gprofng.mpmt.timeline2.RowGeometry; import org.gprofng.mpmt.timeline2.TimelineSelectionEvent; public class CursorSetEvent extends CursorEvent { public final RowGeometry rowGeometry; public final long clickTime; public final boolean ctrlKey; public final boolean shiftKey; public final long eventIdx; // may be TimelineSelectionEvent.EVT_IDX_INVALID public final long eventTimeStart; // only set if eventIdx is valid public final long eventTimeEnd; // only set if eventIdx is valid public final boolean directHit; // click was on event public final boolean requestRefreshCaliper; // update of calipers requested public final boolean updateRowSelections; // update row selections public CursorSetEvent( RowGeometry row, long clickTime, boolean ctrlKey, boolean shiftKey, long eventIdx, long eventTimeStart, long eventTimeEnd, boolean directHit, boolean requestRefreshCaliper, boolean updateRowSelections) { this.rowGeometry = row; this.clickTime = clickTime; this.ctrlKey = ctrlKey; this.shiftKey = shiftKey; this.eventIdx = eventIdx; this.eventTimeStart = eventTimeStart; this.eventTimeEnd = eventTimeEnd; this.directHit = directHit; this.requestRefreshCaliper = requestRefreshCaliper; this.updateRowSelections = updateRowSelections; } public CursorSetEvent( RowGeometry row, long clickTime, boolean ctrlKey, boolean shiftKey, boolean requestRefreshCaliper, boolean updateRowSelections) { this.rowGeometry = row; this.clickTime = clickTime; this.ctrlKey = ctrlKey; this.shiftKey = shiftKey; this.eventIdx = TimelineSelectionEvent.EVT_IDX_INVALID; this.eventTimeStart = -1; this.eventTimeEnd = -1; this.directHit = false; this.requestRefreshCaliper = requestRefreshCaliper; this.updateRowSelections = updateRowSelections; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/cursorevent/CursorEvent.java�����������������������������0000644�0001750�0001750�00000001351�14744453367�023341� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.cursorevent; public class CursorEvent {} ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/cursorevent/CursorMoveEvent.java�������������������������0000644�0001750�0001750�00000002264�14744453367�024174� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2.cursorevent; import org.gprofng.mpmt.timeline2.TimelineSelectionEvent; public class CursorMoveEvent extends CursorEvent { public final TimelineSelectionEvent.CursorAxis axis; public final int count; public final boolean ctrlKey; public final boolean shiftKey; public CursorMoveEvent( TimelineSelectionEvent.CursorAxis axis, int count, boolean ctrlKey, boolean shiftKey) { this.axis = axis; this.count = count; this.ctrlKey = ctrlKey; this.shiftKey = shiftKey; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TimelineVariable.java������������������������������������0000644�0001750�0001750�00000022134�14744453367�021721� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.metrics.MetricColors; import java.awt.Color; import java.text.DecimalFormat; import java.text.NumberFormat; public final class TimelineVariable { public static final Color SELECT_COLOR = new Color(98, 98, 98); private static final double TIMESTAMP_MULT = .000000001; private static final NumberFormat TIMESTAMP_FMT; private static final Object syncFormat = new Object(); private static final Color unknownColor = Color.BLACK; static { TIMESTAMP_FMT = new DecimalFormat(); TIMESTAMP_FMT.setMaximumFractionDigits(6); TIMESTAMP_FMT.setMinimumFractionDigits(6); TIMESTAMP_FMT.setGroupingUsed(false); } public static String strTimestamp(final long time) { String t; synchronized (syncFormat) { // begin critical section: format is not thread safe t = TIMESTAMP_FMT.format(time * TIMESTAMP_MULT); } // end of critical section return t; } // ----- mapping states to colors and names ----- public static class StatesDisplayInfo { public final String statePropName; private final String[] displayNames; private final Color[] displayColors; private final int[] raw2displayIdxTable; public StatesDisplayInfo( String statePropName, String[] displayNames, Color[] displayColors, int[] raw2displayIdxTable) { this.statePropName = statePropName; this.displayNames = displayNames; this.displayColors = displayColors; this.raw2displayIdxTable = raw2displayIdxTable; } public final long[] raw2displayValues(final long[] rawValues) { if (raw2displayIdxTable == null) { return rawValues; } final long displayValues[] = new long[raw2displayIdxTable.length]; for (int i = 0; i < rawValues.length; i++) { int idx = getDisplayIdx(i); displayValues[idx] += rawValues[i]; } return displayValues; } public final int getDisplayIdx(int rawIdx) { if (raw2displayIdxTable == null) { return rawIdx; } if (rawIdx < 0 || rawIdx >= raw2displayIdxTable.length) { return raw2displayIdxTable.length - 1; // <unknown> bucket } return raw2displayIdxTable[rawIdx]; } public final String getNameByRawIdx(int rawIdx) { int idx = getDisplayIdx(rawIdx); if (displayNames == null || idx < 0 || idx >= displayNames.length) { return Integer.toString(rawIdx); } return displayNames[idx]; } public final String getNameByDisplayIdx(int dispIdx) { if (displayNames == null || dispIdx < 0 || dispIdx >= displayNames.length) { return Integer.toString(dispIdx) + "?"; // weird } return displayNames[dispIdx]; } public final Color getColorByRawIdx(int rawIdx) { int idx = getDisplayIdx(rawIdx); if (displayColors == null || idx < 0 || idx >= displayColors.length) { return unknownColor; } return displayColors[idx]; } public final Color getColorByDisplayIdx(int dispIdx) { if (displayColors == null || dispIdx < 0 || dispIdx >= displayColors.length) { return unknownColor; // weird } return displayColors[dispIdx]; } public final int getNumNames() { if (displayNames == null) { return 0; } return displayNames.length; } } // Remap the microstates to display categories and order. // Note: use same display order of LMS_* in: er.rc, TimelineVariable.java, // Ovw_data.h, BaseMetricTreeNode.cc and Experiment.cc metric registration public static final int NUM_SOLARIS_MSTATES = 10; // Solaris Microstates are 0-9 private static final int[ /*lms*/] MSTATE_TO_OVERVIEW_IDX = { // supply LMS value as index, returns display idx 0, // 0 LMS_USER 1, // 1 LMS_SYSTEM 2, // 2 LMS_TRAP 4, // 3 LMS_TFAULT 3, // 4 LMS_DFAULT 5, // 5 LMS_KFAULT 9, // 6 LMS_USER_LOCK 8, // 7 LMS_SLEEP 7, // 8 LMS_WAIT_CPU 6, // 9 LMS_STOPPED 10, // 10 LMS_LINUX_CPU 11, // 11 LMS_KERNEL_CPU 12, // 12 <unknown> }; // Names sorted by display order (not LMS_* order) private static final String[] MSTATE_DESC = { // YXXX should come from property names AnLocale.getString("User CPU"), AnLocale.getString("System CPU"), AnLocale.getString("Trap CPU"), AnLocale.getString("Data Page Fault"), AnLocale.getString("Text Page Fault"), AnLocale.getString("Kernel Page Fault"), AnLocale.getString("Stopped"), AnLocale.getString("Wait CPU"), AnLocale.getString("Sleep"), AnLocale.getString("User Lock"), AnLocale.getString("User+System CPU"), // NOT a Solaris microstate AnLocale.getString("Kernel CPU"), // NOT a Solaris microstate AnLocale.getString("<Unknown>"), // NOT a Solaris microstate }; // Colors sorted by display order (not LMS_* order) private static final Color[ /*ovw idx*/] MSTATE_COLORS = { MetricColors.getColor("user"), // 0: 0 LMS_USER MetricColors.getColor("system"), // 1: 1 LMS_SYSTEM MetricColors.getColor("trap"), // 2: 2 LMS_TRAP MetricColors.getColor("datapfault"), // 3: 4 LMS_DFAULT MetricColors.getColor("textpfault"), // 4: 3 LMS_TFAULT MetricColors.getColor("kernelpfault"), // 5: 5 LMS_KFAULT MetricColors.getColor("stop"), // 6: 9 LMS_STOPPED MetricColors.getColor("wait"), // 7: 8 LMS_WAIT_CPU MetricColors.getColor("sleep"), // 8: 7 LMS_SLEEP MetricColors.getColor("lock"), // 9: 6 LMS_USER_LOCK MetricColors.getColor("user"), // 10:10 LMS_LINUX_CPU MetricColors.getColor("user"), // 11:11 LMS_KERNEL_CPU Color.black, // 12:12 <unknown> }; public static final StatesDisplayInfo mstate_info = new StatesDisplayInfo("MSTATE", MSTATE_DESC, MSTATE_COLORS, MSTATE_TO_OVERVIEW_IDX); // YXXX maybe we should get these from properties private static final String[] TL_HEAP_HTYPE_DESCS = { AnLocale.getString("Allocation"), AnLocale.getString("Free"), AnLocale.getString("Reallocation"), AnLocale.getString("MemoryMap"), AnLocale.getString("MemoryUnmap"), }; private static final Color[] TL_HEAP_HTYPE_COLOR_TABLE = { MetricColors.BLUE_VIOLET, // malloc MetricColors.CYAN, // free MetricColors.ORANGE, // realloc MetricColors.RED, // mmap MetricColors.DARK_GREY, // munmap }; public static final StatesDisplayInfo htype_info = new StatesDisplayInfo("HTYPE", TL_HEAP_HTYPE_DESCS, TL_HEAP_HTYPE_COLOR_TABLE, null); // YXXX maybe we should get these from properties private static final String[] TL_IOTRACE_IOTYPE_DESCS = { AnLocale.getString("Read"), AnLocale.getString("Write"), AnLocale.getString("Open"), AnLocale.getString("Close"), AnLocale.getString("Other I/O"), AnLocale.getString("Read error"), AnLocale.getString("Write error"), AnLocale.getString("Open error"), AnLocale.getString("Close error"), AnLocale.getString("Other I/O error"), }; private static final Color[] TL_IOTRACE_IOTYPE_COLOR_TABLE = { // read, write, open, close, otherio, readerror, writeerror, openerror, closeerror, otherioerror MetricColors.RED, // read MetricColors.ORANGE, // write MetricColors.CYAN, // open MetricColors.DARK_GREY, // close MetricColors.BLUE_VIOLET, // otherio MetricColors.BLACK, // read error MetricColors.BLACK, // write error MetricColors.BLACK, // open error MetricColors.BLACK, // close error MetricColors.BLACK, // other io error }; public static final StatesDisplayInfo iotype_info = new StatesDisplayInfo("IOTYPE", TL_IOTRACE_IOTYPE_DESCS, TL_IOTRACE_IOTYPE_COLOR_TABLE, null); private static final Color[] TL_UNKNOWN_GENERIC_COLOR_TABLE = { MetricColors.BLUE_VIOLET, MetricColors.GOLDEN_YELLOW, MetricColors.COBALT, MetricColors.LIGHT_GREEN, MetricColors.FUSCHIA, MetricColors.GREEN, MetricColors.ORANGE, MetricColors.DARK_GREY, MetricColors.RED, MetricColors.CYAN, MetricColors.GRAY, MetricColors.BLUE, MetricColors.BLACK, }; private static final StatesDisplayInfo generic_info = new StatesDisplayInfo("", null, TL_UNKNOWN_GENERIC_COLOR_TABLE, null); private static final StatesDisplayInfo[] info_list = {mstate_info, htype_info, iotype_info}; public static final StatesDisplayInfo getStateInfo(final String propName) { for (int ii = 0; ii < info_list.length; ii++) { if (propName.equals(info_list[ii].statePropName)) { return info_list[ii]; } } return generic_info; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/RowDataRequestParams.java��������������������������������0000644�0001750�0001750�00000004221�14744453367�022560� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; public class RowDataRequestParams { // final public final TL2DataSnapshot snapshot; public final boolean forceLoad; public final long binTime; public final long alignedTimeStart; public final long timeEnd; public final int nbins; public final int rowStart; public final int rowEnd; public final long required_timeStart; public final long required_timeEnd; public final int required_rowStart; public final int required_rowEnd; // dynamic private boolean cancel; public RowDataRequestParams( final TL2DataSnapshot snapshot, final boolean forceLoad, final long bin_time, final long alignedStart, final int nbins, final int rowStart, final int rowEnd, final long required_timeStart, final long required_timeEnd, final int required_rowStart, final int required_rowEnd) { this.snapshot = snapshot; this.forceLoad = forceLoad; this.binTime = bin_time; this.alignedTimeStart = alignedStart; this.timeEnd = alignedStart + (nbins * bin_time - 1); this.nbins = nbins; this.rowStart = rowStart; this.rowEnd = rowEnd; this.cancel = false; this.required_timeStart = required_timeStart; this.required_timeEnd = required_timeEnd; this.required_rowStart = required_rowStart; this.required_rowEnd = required_rowEnd; } public synchronized void cancel() { cancel = true; } public synchronized boolean isCancelled() { return cancel; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TimelineSelectionRowEvent.java���������������������������0000644�0001750�0001750�00000002034�14744453367�023610� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.timeline_common.TimelineSelectionGenericEvent; /** Holds information about timeline row selections */ public class TimelineSelectionRowEvent extends TimelineSelectionGenericEvent { public final boolean rowsSelected; public TimelineSelectionRowEvent(boolean rowsSelected) { this.rowsSelected = rowsSelected; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TimelineDraw.java����������������������������������������0000644�0001750�0001750�00000256151�15044710303�021055� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.experiment_props.PropDescriptor; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.statecolors.StateColorMap; import org.gprofng.mpmt.timeline.events.*; import org.gprofng.mpmt.timeline2.TL2DataSnapshot.*; import org.gprofng.mpmt.timeline2.data.*; import org.gprofng.mpmt.timeline_common.CoordCalcDataMaster; import org.gprofng.mpmt.timeline_common.CoordCalcDataReader; import org.gprofng.mpmt.timeline_common.CoordCalcTimeReader; import org.gprofng.mpmt.timeline_common.TimelineCaliper; import java.awt.*; import java.util.ArrayList; import java.util.List; import java.util.TreeSet; import javax.swing.*; public final class TimelineDraw { public static final int STANDARD_WHITESPACE_PIXELS = 6; public static final int HMARGIN = STANDARD_WHITESPACE_PIXELS + 2; // +2 for border // set via constructor args private final TL2DataFetcher tl2DataFetcher; // for getStackFuncArray() private final IconRuler iconRuler; private final CoordCalcTimeReader timeAxisCalculator; private final CoordCalcDataReader dataAxisCalculator; private final CoordCalcDataMaster dataAxisMaster; private final StateColorMap colorMap; private StateColorMap.ColorMapSnapshot stateColorSnapshot; // settings private static final int FATTENED_EVENT_WIDTH = 5; // maximum pixel width for zero-duration events public static final int CLICK_PIXEL_TOLERANCE = FATTENED_EVENT_WIDTH / 2 + 4; private final int MIN_SAMPLE_3D_WIDTH = 3; // min width of sample before divider will show private final int DEFAULT_SAMPLE_HEIGHT = 20; private final int MAX_SAMPLE_HEIGHT = 50; private final int DEFAULT_HEAPSZ_HEIGHT = 60; private final int MAX_HEAPSZ_HEIGHT = 180; // vertical pixels for showing sample data private final int MIN_CHART_HEIGHT = 9; private final int MAX_CHART_HEIGHT = 9; // vertical pixels for showing chart data private final int EVENT_TICK_HEIGHT = 4; // pixel height of stack event tick marks public static final Color TICK_ONE_PIXEL_WIDE_COLOR = new Color(84, 83, 84); public static final Color TICK_WITH_STACK_COLOR = new Color(84, 83, 84); public static final Color TICK_STANDALONE_COLOR = new Color(87, 86, 87); private final int SAMPLE_BORDER_HEIGHT = 0; // 0 is allowed // height of border above/below samples public static final Color STANDARD_DIVIDER_COLOR = Color.LIGHT_GRAY; // entity dividers and subdividers public static final Color EXPERIMENT_DIVIDER_COLOR = STANDARD_DIVIDER_COLOR; // between experiments public static final Color COMPARE_GRP_DIVIDER_COLOR = EXPERIMENT_DIVIDER_COLOR; // between compare groups public static final Color GENERIC_SELECTION_COLOR = new Color(189, 207, 231); private final Color CROSSHAIR_COLOR = Color.DARK_GRAY; private final Color CROSSHAIR_FILL_BORDER_COLOR = Color.DARK_GRAY; public static final Color SELECTION_BACKGROUND_COLOR = new Color(209, 229, 255); // light GENERIC_SELECTION_COLOR private final Color CROSSHAIR_FILL_COLOR = SELECTION_BACKGROUND_COLOR; private final Color SAMPLE_BORDER_COLOR = Color.LIGHT_GRAY; private final Color SAMPLE_VDIVIDER_COLOR = Color.GRAY; private final Color CHART_BORDER_COLOR = Color.LIGHT_GRAY; private final Color CHART_BACKGROUND_COLOR = new Color(238, 238, 238); private final Color CHART_BACKGROUND_SEL_COLOR = GENERIC_SELECTION_COLOR; private final Color CHART_GRAPH_COLOR = Color.BLUE; private final Color CHART_GRAPH_COLOR_MAX = Color.RED; private final Color CHART_NUMERIC_TEXT_COLOR = new Color(0x33, 0x33, 0x33); private final double NS_PER_SEC = 1000000000.0; private class FontInfo { final int ascent; final int descent; final int height; final Font font; public FontInfo(Graphics g, Font font) { this.font = font; FontMetrics fm = g.getFontMetrics(font); if (fm != null) { ascent = fm.getAscent() - 1; // YXXX bogus adjust for looks descent = fm.getDescent() - 2; // YXXX bogus adjust for looks height = ascent + descent; } else { ascent = 0; descent = 0; height = 0; } } } private static final Font standard_font = (new JLabel()).getFont(); private FontInfo fontInfoSmallBold = null; private FontInfo fontInfoSmallNormal = null; // presentation options private Settings.TLStack_align stack_align; // stack settings private int vzoom_level; // stack settings private int stack_frame_pixels = 3; // stack settings private int stackRowHeight; private int nominalSampleHeight; private int nominalHeapszHeight; private static final int NUM_VZOOM_MACRO_LEVELS = 4; // vzoom_level = [0, NUM_VZOOM_MACRO_LEVELS] for zoom public static final int TIMELINE_MAX_VZOOM_LEVEL = 56 + NUM_VZOOM_MACRO_LEVELS; public static final int TIMELINE_DEFAULT_VZOOM_LEVEL = 8; private static final int MAX_STACK_PIXELS = 900; private final int VZOOM_BASE_PIXEL_STEP = 5; // initial pixel step for vzoom>NUM_VZOOM_MACRO_LEVELS // user options and events private boolean idle_color_set; // use a special color for idle cpu private Color idle_color; // color for idle cpu // selected item private TimelineCaliper caliper; private int caliper_x1, caliper_x2; private TimelineSelectionEvent selection_event = null; // if non-null, rowNum must be valid private TimelineSelectionEvent recent_selection = null; // if non-null, rowNum must be valid // selected item's boundaries (x,y,h,w) private int sel_x, sel_y, sel_w, sel_h; private boolean sel_set = false; // selected rows private TreeSet<Integer> multiselect_rows; private List<Integer> rowNumToEntityNum; // map from rowNum to entityNum // geometry private int usedHeight; // virtual vertical pixels that // would be required to draw all rows // row data snapshot private List<RowGeometry> rowGeometry; private List<List<RowGeometry>> rowGeometryByEntity; private TL2DataSnapshot recentDataSnapshot; private List<Integer> rowOffsets; // Notes: there is a 1-1 mapping between rowGeometry and subrows // visible on timeline. // "rowNum" is the typical name for an index into rowGeometry. // "rowNum" also is used by dataAxisCalculator. // // Do NOT use rowNum to index into rowData or rowDefinition arrays! // This is because a single rowDefinition defines both the event data row // and any charts rows generated for that event data. In other words, // a single rowDefinition may map to several rowGeometry elements. // screen state snapshot private int currRowFirst; // first visible row private int currRowLast; // first non-visible row private int currScrollY; private int currVisibleHeight; private boolean forceFullRepaint; // all rows must be redrawn private boolean forceRowGeometry; // row geometry has changed private final int INVALID_BIN = Integer.MIN_VALUE; public TimelineDraw( TL2DataFetcher tl2DataFetcher, StateColorMap colorMap, IconRuler iconRuler, CoordCalcTimeReader ccx, CoordCalcDataMaster ccy) { this.tl2DataFetcher = tl2DataFetcher; this.iconRuler = iconRuler; this.timeAxisCalculator = ccx; this.dataAxisCalculator = ccy; this.dataAxisMaster = ccy; this.colorMap = colorMap; stateColorSnapshot = null; rowGeometry = new ArrayList<>(); rowGeometryByEntity = new ArrayList<>(); multiselect_rows = new TreeSet<>(); rowNumToEntityNum = new ArrayList<>(); // options setVZoomLevel(13); // YXXX default, should be set somewhere else? this.stack_align = Settings.TLStack_align.TLSTACK_ALIGN_ROOT; // colors idle_color_set = false; idle_color = null; // screen info currRowFirst = currRowLast = 0; currScrollY = 0; currVisibleHeight = 0; forceFullRepaint = forceRowGeometry = false; // if x2 < x1, caliper is not visible: caliper_x1 = Integer.MAX_VALUE; caliper_x2 = Integer.MIN_VALUE; } private FontInfo getSmallFont(final Graphics g) { if (fontInfoSmallNormal != null) { return fontInfoSmallNormal; } if (g == null) { return null; // yuck } Font font = new Font("SansSerif", Font.PLAIN, standard_font.getSize() - 1); fontInfoSmallNormal = new FontInfo(g, font); return fontInfoSmallNormal; } private FontInfo getSmallBoldFont(final Graphics g) { if (fontInfoSmallBold != null) { return fontInfoSmallBold; } if (g == null) { return null; // yuck } Font font = new Font("SansSerif", Font.BOLD, standard_font.getSize() - 1); fontInfoSmallBold = new FontInfo(g, font); return fontInfoSmallBold; } public void setCPUIdleColor(final boolean set, final Color color) { if (idle_color_set != set || idle_color != color) { idle_color_set = set; idle_color = color; forceFullRepaint = true; } } public void setCaliper(TimelineCaliper newCaliper) { caliper = newCaliper; // this is a frozen snapshot } public void setSelection(TimelineSelectionEvent selEvent) { if (selEvent == null || selEvent.rowNum == -1 || selEvent.getRowGeometry() == null) { selection_event = null; } else { selection_event = selEvent; recent_selection = selEvent; } } public TimelineSelectionEvent getSelection() { return selection_event; } public void edt_resetAll() { // edt only recent_selection = null; // setSelection() & notification performed in other places } public TimelineSelectionEvent getRecentSelection() { if (selection_event != null) { return selection_event; } return recent_selection; } public void setSelectedRows(TreeSet<Integer> selected_entities) { multiselect_rows = new TreeSet<Integer>(); if (recentDataSnapshot == null) { // with current design shouldn't happen. If needed, we could save a copy of selected_entities return; // experiment load in progress } int numBlks = rowGeometryByEntity.size(); for (Integer blkIdx : selected_entities) { if (blkIdx < 0 || blkIdx >= numBlks) { continue; // weird } List<RowGeometry> entityGeos = rowGeometryByEntity.get(blkIdx); for (RowGeometry rowGeo : entityGeos) { multiselect_rows.add(rowGeo.rowNum); } } } public List<RowGeometry> getEntityRows(int entityNum) { if (entityNum < 0 || entityNum >= rowGeometryByEntity.size()) { return null; } return rowGeometryByEntity.get(entityNum); } public void setVZoomLevel(int new_vzoom_level) { if (new_vzoom_level < 0) { new_vzoom_level = 0; } else if (new_vzoom_level >= TIMELINE_MAX_VZOOM_LEVEL) { new_vzoom_level = TIMELINE_MAX_VZOOM_LEVEL; } if (this.vzoom_level != new_vzoom_level) { this.vzoom_level = new_vzoom_level; forceRowGeometry = true; } } public void setStackFramePixels(int stack_frame_pixels) { if (stack_frame_pixels < 1) { stack_frame_pixels = 1; // weird } else if (stack_frame_pixels > Settings.TIMELINE_MAX_STACK_FRAME_PIXELS) { stack_frame_pixels = Settings.TIMELINE_MAX_STACK_FRAME_PIXELS; // weird } if (this.stack_frame_pixels != stack_frame_pixels) { this.stack_frame_pixels = stack_frame_pixels; forceFullRepaint = true; } } public void setStackAlign(final Settings.TLStack_align stack_align) { if (this.stack_align != stack_align) { this.stack_align = stack_align; forceFullRepaint = true; } } public void edt_recalcRowOffsets() { // must be called from awt event thread edt_processDataSnapshot(recentDataSnapshot, true, null); } public TL2DataSnapshot getDataSnapshot() { return recentDataSnapshot; } // Main drawing routine for timeline public void drawIt(final Graphics g) { drawData(g); drawSelection(g); drawBorder(g); } private void drawData(final Graphics g) { TL2DataSnapshot dataSnapshot = recentDataSnapshot; boolean forceRedraw = false; if (fontInfoSmallBold == null || fontInfoSmallNormal == null) { // yuck getSmallFont(g); getSmallBoldFont(g); forceRedraw = true; } edt_processDataSnapshot(dataSnapshot, forceRedraw, g); final int visibleHeight = dataAxisCalculator.getCanvasPixels(); final int visibleWidth = timeAxisCalculator.getCanvasPixels(); // erase everything { Graphics2D g2 = (Graphics2D) g; Rectangle drawHere = g.getClipBounds(); g.setColor(Color.white); g.fillRect(drawHere.x, drawHere.y, drawHere.width, drawHere.height); } if (dataSnapshot == null || dataSnapshot.getRowData().isEmpty()) { final String message; if (dataSnapshot == null) { message = AnLocale.getString("Experiment load in progress..."); } else { message = AnLocale.getString("Data not available for this filter selection"); } drawCenteredMessage(g, message, visibleWidth / 2, visibleHeight / 2); rowGeometry = new ArrayList<>(); rowGeometryByEntity = new ArrayList<>(); rowNumToEntityNum = new ArrayList<>(); iconRuler.setRowGeometry(rowGeometry, 0, -1, -1, -1, multiselect_rows); return; } stateColorSnapshot = colorMap.checkForColorUpdates(stateColorSnapshot); final int scrollY = calcScrollY(); setScrollY(rowGeometry, scrollY, visibleHeight); // might be optimized... forceFullRepaint = false; // YXXX all rows updated for now, optimize later // in theory, could repaint only rows that have been updated or damaged // draw selection crosshair final long maxVisTime = timeAxisCalculator.getTimeEnd(); final long minVisTime = timeAxisCalculator.getTimeStart(); final int x1; final int x2; final long c_high, c_low; if (caliper != null && (c_high = caliper.getHighTime()) >= minVisTime && (c_low = caliper.getLowTime()) <= maxVisTime) { // caliper is visible if (c_low >= minVisTime) { int binStart = timeAxisCalculator.getBinAtTime(c_low); x1 = timeAxisCalculator.getLowCoordForBin(binStart); } else { x1 = Integer.MIN_VALUE; } if (c_high <= maxVisTime) { int binEnd = timeAxisCalculator.getBinAtTime(c_high); x2 = timeAxisCalculator.getLowCoordForBin(binEnd + 1) - 1; } else { x2 = Integer.MAX_VALUE; } } else { // caliper is not visible x1 = Integer.MAX_VALUE; x2 = Integer.MIN_VALUE; } caliper_x1 = x1; caliper_x2 = x2; drawCaliper(g, 0, visibleHeight - 1, CROSSHAIR_FILL_COLOR); // caliper fill drawVisibleDividers(g, rowGeometry, visibleWidth); drawVisibleRows(g, rowGeometry, visibleWidth); // sets stackColorMap drawCaliper(g, 0, visibleHeight - 1, null); // caliper border // YXXX could/should validate that event is still current int selectedRow = (selection_event == null) ? -1 : selection_event.rowNum; iconRuler.setRowGeometry( rowGeometry, scrollY, currRowFirst, currRowLast, selectedRow, multiselect_rows); // YXXX canvas.setRepainting(false); } // Selected object highlighting private GenericEvent getVisibleSelection() { if (selection_event == null || selection_event.eventIdx == -1) { return null; } if (selection_event.eventDetail == null) { return null; // weird? } // check if row is visible final int selection_row = selection_event.rowNum; if (selection_row < currRowFirst || selection_row >= currRowLast) { return null; } if (selection_row >= rowGeometry.size()) { return null; // typically, when rows are cleared pending new data } final EventDetail details = selection_event.eventDetail; long sel_time_start = details.getTimestamp(); long sel_time_end = sel_time_start; if (details instanceof DurationEvent) { DurationEvent devent = (DurationEvent) details; sel_time_start -= devent.getDuration(); } final GenericEvent evt; evt = eventDetail2GenericEvent(details, sel_time_start, sel_time_end, selection_event.eventIdx); return evt; } private GenericEvent eventDetail2GenericEvent( EventDetail details, long sel_time_start, long sel_time_end, long evtIdx) { final GenericEvent genEvent; final long delta = timeAxisCalculator.getTimeDuration(); final long timeWindowLow = timeAxisCalculator.getTimeStart() - delta; final long timeWindowHigh = timeAxisCalculator.getTimeEnd() + delta; // wider window used: the event highlight may be visible even if event is off screen if (sel_time_end < timeWindowLow || sel_time_start > timeWindowHigh) { // it's way off the screen return null; } long drawTimeStart = sel_time_start; long drawTimeEnd = sel_time_end; // limit draw range so that long calculations don't overflow: if (drawTimeStart < timeWindowLow) { drawTimeStart = timeWindowLow; } if (drawTimeEnd > timeWindowHigh) { drawTimeEnd = timeWindowHigh; } final int binStart = timeAxisCalculator.getBinAtTime(drawTimeStart); final int binEnd = timeAxisCalculator.getBinAtTime(drawTimeEnd); final int binCount = binEnd - binStart + 1; if (details instanceof ExtendedEvent) { int state = -1; if (details instanceof StateEvent) { state = ((StateEvent) details).getState(); } genEvent = new StackEvent( evtIdx, binStart, binCount, sel_time_start, sel_time_end, details.getStack(), state); } else if (details instanceof Sample) { Sample sample = (Sample) details; genEvent = new SampleEvent( evtIdx, binStart, binCount, sel_time_start, sel_time_end, sample.getMStates()); } else { genEvent = null; // weird } return genEvent; } private void setSelectionBounds(int x, int y, int w, int h) { sel_x = x; sel_y = y; sel_w = w; sel_h = h; sel_set = true; } private void drawSelection(Graphics g) { GenericEvent event = getVisibleSelection(); if (event == null) { return; } sel_set = false; // may be set to true by drawVisibleRows() if (selection_event == null) { return; } int selRowNum = selection_event.rowNum; if (selRowNum >= rowGeometry.size()) { return; // weird? } RowGeometry selRow = rowGeometry.get(selRowNum); drawSelection(g, selRow, event); if (!(event instanceof StackEvent)) { return; } // identify rows that display event's state RowGeometry statesRow = null; for (int ii = 0; ii < selRow.nSubrows; ii++) { int row_idx = ii - selRow.subrowNum; if (row_idx == 0) { continue; } row_idx += selRowNum; RowGeometry tmpRow = rowGeometry.get(row_idx); // YXXX there must be a better way to accurately determine if a row is for states final RowData dataCopy = tmpRow.rowData.grabEventData(); // row.rowData is volatile, get snapshot final Object vals = dataCopy.getChartData(tmpRow.chartPropIdx); if (vals instanceof SampleEvent[]) { statesRow = tmpRow; StackEvent stackEvt = (StackEvent) event; int state = stackEvt.mState; if (state < 0) { continue; // weird } long[] propVals = new long[state + 1]; propVals[state] = 1; SampleEvent sampleEvt = new SampleEvent( event.eventIdx, event.binStart, event.binCount, event.timeStart, event.timeEnd, propVals); drawSelection(g, statesRow, sampleEvt); } } } private void drawSelection(Graphics g, RowGeometry row, GenericEvent event) { GenericEvent[] events = new GenericEvent[1]; events[0] = event; drawRowEvents(g, row, events, 0, 0, true, false); if (!sel_set) { return; // off screen } drawHighlight(g, sel_x, sel_y, sel_w, sel_h); } private void drawHighlight(Graphics g, int x, int y, int w, int h) { Color c[] = {Color.YELLOW, Color.YELLOW, Color.RED}; for (int i = 0; i < c.length; i++) { g.setColor(c[i]); g.drawRect(x - i - 1, y - i - 1, w + 2 * i + 1, h + 2 * i + 1); } } private void drawBorder(final Graphics g) { final int surface_width = timeAxisCalculator.getCanvasPixels(); final int surface_height = dataAxisCalculator.getCanvasPixels(); final int xMargin = timeAxisCalculator.getMargin(); final int yMargin = dataAxisCalculator.getMargin(); final Graphics2D g2 = (Graphics2D) g; if (yMargin > 1 || xMargin > 1) { g2.setColor(STANDARD_DIVIDER_COLOR); g2.drawLine(0, 0, 0, surface_height - 1); // vertical, to right of ruler g2.setColor(Color.BLACK); g2.drawRect(-1, 0, surface_width + 1, surface_height - 1); } else { g2.setColor(Color.BLACK); g2.drawRect(0, 0, surface_width, surface_height - 1); } } private void drawRowVBorders( final Graphics g, final int rowStartY, final int rowEndY, final int dataStartY, final int dataEndY) { final int xMargin = timeAxisCalculator.getMargin(); if (xMargin <= 1) { return; } // erase vertical margins final int surface_width = timeAxisCalculator.getCanvasPixels(); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.WHITE); final int h = rowEndY - rowStartY + 1; g2.fillRect(0, rowStartY, xMargin, h); g2.fillRect(surface_width - xMargin, rowStartY, xMargin, h); if (dataEndY != -1) { // add vertical border g2.setColor(STANDARD_DIVIDER_COLOR); int xx = xMargin - 1; g2.drawLine(xx, dataStartY, xx, dataEndY); xx = surface_width - xMargin; g2.drawLine(xx, dataStartY, xx, dataEndY); } } private int calcScrollY() { double startPercent = dataAxisCalculator.getVisibleStart(); int scrollY = (int) (usedHeight * startPercent) - dataAxisCalculator.getMargin(); return scrollY; } private void drawCenteredMessage(Graphics g, String msg, int screenX, int screenY) { final FontMetrics fm = g.getFontMetrics(); g.setFont(standard_font); g.setColor(Color.LIGHT_GRAY); g.drawString(msg, screenX - fm.stringWidth(msg) / 2, screenY + fm.getHeight() / 2); } private void drawCaliper(final Graphics g, final int y1, final int y2, final Color doFill) { final int x1_orig = caliper_x1; final int x2_orig = caliper_x2; if (x2_orig < x1_orig || y2 < y1) { return; // not visible } final int visibleWidth = timeAxisCalculator.getCanvasPixels(); final int xMargin = timeAxisCalculator.getMargin(); final int x1 = x1_orig < xMargin ? xMargin : x1_orig; final int x2 = x2_orig > visibleWidth - xMargin ? visibleWidth - xMargin : x2_orig; final int w = x2 - x1; if (doFill != null) { if (w > 1) { g.setColor(doFill); g.fillRect(x1, y1, w, y2 - y1 + 1); } return; } if (w > 1) { g.setColor(CROSSHAIR_FILL_BORDER_COLOR); } else { g.setColor(CROSSHAIR_COLOR); } if (x1 == x1_orig) { g.drawLine(x1, y1, x1, y2); } if (x2 == x2_orig && x2 != x1) { g.drawLine(x2, y1, x2, y2); } // if (x1_orig == x2_orig) { // // fatten caliper if original was only 1 pixel wide // g.drawLine(x1 + 1, y1, x1 + 1, y2); // } } private int calcRowUpperPadding( Graphics g, final RowDefinition rowDef, final int chartIdx, final int subrowNum, final int numCharts) { Settings.TLData_type dataType = rowDef.getTLDataType(); if (chartIdx == -1 && (dataType.equals(Settings.TLData_type.TL_SAMPLE) || dataType.equals(Settings.TLData_type.TL_GCEVENT))) { // sample event data // GC event data return chart_padding(); } if (dataType.equals(Settings.TLData_type.TL_HEAPSZ)) { // heapsize event data and chart if (chartIdx == -1) { // event data int padding = chart_padding(); if (padding < STANDARD_WHITESPACE_PIXELS) { padding++; } return padding; } // chart data if (rowDef.getChartProperties().get(chartIdx).getName().equals("HTYPE")) { return 1; // state color chart } final FontInfo fi = getSmallBoldFont(g); // warning: see hack to init this at the top of drawData() if (fi != null) { return fi.height + chart_padding(); } return chart_padding(); } return 0; } private int calcRowLowerPadding( final Graphics g, final RowDefinition rowDef, final int chartIdx, final int subrowNum, final int numCharts) { Settings.TLData_type dataType = rowDef.getTLDataType(); if (chartIdx == -1 && dataType.equals(Settings.TLData_type.TL_HEAPSZ)) { // heapsz event data return 0; } if (chartIdx == -1 && !dataType.equals(Settings.TLData_type.TL_SAMPLE) && !dataType.equals(Settings.TLData_type.TL_GCEVENT)) { // callstack event data if (numCharts == 0) { // standalone event if (vzoom_level <= 2) { return 0; } if (vzoom_level <= 4) { return 1; } return 2; } else { // a chart follows int padding = chart_padding(); if (padding <= 1) { return padding; } if (subrowNum == numCharts) { // last row return 1; } return padding - 1; // -1 because stacks typically show "short" tick-marks } } // chart data return chart_padding(); } private int chart_padding() { // whitespace between charts if (vzoom_level <= 1) { return 0; } if (vzoom_level <= 4) { return 1; } { int pixels = 4 * stackRowHeight / STANDARD_WHITESPACE_PIXELS / 3; if (pixels < STANDARD_WHITESPACE_PIXELS) { return pixels; } } return STANDARD_WHITESPACE_PIXELS; } private int calcRowHeight( final Graphics g, final RowDefinition rowDef, final int chartIdx, final int subrowNum, final int nCharts) { final int stackBaseline = 18; Settings.TLData_type dataType = rowDef.getTLDataType(); if (chartIdx == -1 && dataType.equals(Settings.TLData_type.TL_SAMPLE)) { // sample event data if (vzoom_level <= NUM_VZOOM_MACRO_LEVELS) { int sz = DEFAULT_SAMPLE_HEIGHT * (vzoom_level + 1) / (NUM_VZOOM_MACRO_LEVELS + 2); return sz; } return nominalSampleHeight; } if (chartIdx == -1 && dataType.equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 // gc event data if (vzoom_level <= NUM_VZOOM_MACRO_LEVELS) { int sz = DEFAULT_SAMPLE_HEIGHT * (vzoom_level + 1) / (NUM_VZOOM_MACRO_LEVELS + 2); return sz; } return nominalSampleHeight; } if (dataType.equals(Settings.TLData_type.TL_HEAPSZ)) { // heapsize event data and chart if (chartIdx == -1) { // event data if (vzoom_level <= 1) { return 2; } return EVENT_TICK_HEIGHT; } // chart data if (rowDef.getChartProperties().get(chartIdx).getName().equals("HTYPE")) { return MIN_CHART_HEIGHT; } if (vzoom_level <= NUM_VZOOM_MACRO_LEVELS) { int sz = DEFAULT_HEAPSZ_HEIGHT * (vzoom_level + 1) / (NUM_VZOOM_MACRO_LEVELS + 2); return sz; } return nominalHeapszHeight; } if (chartIdx == -1) { // event data if (nCharts == 0) { // standalone event if (vzoom_level <= 0) { return 1; } if (vzoom_level <= 1) { return 2; } if (vzoom_level <= 2) { return 3; } if (vzoom_level <= 3) { return 4; } // if (vzoom_level<=4) { // return EVENT_TICK_HEIGHT; // } return stackRowHeight; } else { // charts follow this event row if (vzoom_level <= 1) { return 0; } if (vzoom_level <= 2) { return 2; } if (vzoom_level <= 3) { return 3; } // if (vzoom_level<=4) { // return EVENT_TICK_HEIGHT; // } return stackRowHeight; } } // chart data if (stackRowHeight > stackBaseline) { int chartHeight = MIN_CHART_HEIGHT; chartHeight += (stackRowHeight - stackBaseline) / 15; if (chartHeight > MAX_CHART_HEIGHT) { chartHeight = MAX_CHART_HEIGHT; } return chartHeight; } if (vzoom_level <= 0) { return 1; } if (vzoom_level <= 1) { return 2; } if (vzoom_level <= 2) { return 3; } if (vzoom_level <= 3) { return 5; } return MIN_CHART_HEIGHT; } public int rowNum2EntityNum(int rowNum) { if (rowNum < 0 || rowNum >= rowNumToEntityNum.size()) { return -1; // weird } int entityNum = rowNumToEntityNum.get(rowNum); return entityNum; } public RowGeometry rowNum2RowGeometry(int rowNum) { if (rowNum < 0 || rowNum >= rowGeometry.size()) { return null; // weird; } RowGeometry rowGeo = rowGeometry.get(rowNum); // YXXX sync rowGeometry? return rowGeo; } public List<RowGeometry> getRowGeometry() { return rowGeometry; } public void edt_processDataSnapshot( TL2DataSnapshot dataSnapshot, boolean forceRecalc, Graphics g /* may be null */) { if (!forceRecalc && recentDataSnapshot == dataSnapshot && !forceRowGeometry) { return; } recentDataSnapshot = dataSnapshot; rowGeometry = new ArrayList<>(); rowGeometryByEntity = new ArrayList<>(); rowNumToEntityNum = new ArrayList<>(); usedHeight = 0; // # of pixels used on virtual vertical axis { // set globals used in selecting spacing int zero_based_zoom = vzoom_level - NUM_VZOOM_MACRO_LEVELS; if (zero_based_zoom < 0) { zero_based_zoom = 0; } int stepFactor = MAX_STACK_PIXELS / (TIMELINE_MAX_VZOOM_LEVEL - NUM_VZOOM_MACRO_LEVELS) - VZOOM_BASE_PIXEL_STEP; double zoomPixelStep = VZOOM_BASE_PIXEL_STEP + (double) stepFactor * zero_based_zoom / (TIMELINE_MAX_VZOOM_LEVEL - NUM_VZOOM_MACRO_LEVELS); int pixelsForCallstacks = (int) (zoomPixelStep * zero_based_zoom); stackRowHeight = pixelsForCallstacks + EVENT_TICK_HEIGHT; nominalSampleHeight = DEFAULT_SAMPLE_HEIGHT + pixelsForCallstacks / 6; if (nominalSampleHeight > MAX_SAMPLE_HEIGHT) { nominalSampleHeight = MAX_SAMPLE_HEIGHT; } nominalHeapszHeight = DEFAULT_HEAPSZ_HEIGHT + pixelsForCallstacks / 2; if (nominalHeapszHeight > MAX_HEAPSZ_HEIGHT) { nominalHeapszHeight = MAX_HEAPSZ_HEIGHT; } } List<ExperimentData> expList; final int overallEntityCount; if (dataSnapshot == null) { expList = new ArrayList<>(); overallEntityCount = 0; } else { expList = dataSnapshot.getExperimentData(); overallEntityCount = dataSnapshot.getEntityData().size(); } int currentY = 1; // upper border is 1 pixel wide int rowGeometryNum = 0; // First scan rows to determine where dividers are needed: List<Boolean> entityNeedsSubDividers = new ArrayList<>(overallEntityCount); List<Boolean> entityNeedsDividers = new ArrayList<>(overallEntityCount); boolean someEntityHasSubDividers = false; boolean someEntityHasDividers = false; boolean someEntityIsSampleOrHeapsz = false; int maxEntities = 0; for (ExperimentData expData : expList) { final int numEntities = expData.experimentEntities.size(); if (maxEntities < numEntities) { maxEntities = numEntities; } for (int kk = 0; kk < numEntities; kk++) { EntityData entityData = expData.experimentEntities.get(kk); // determine if sub-divider lines are needed within this entity boolean needsSubDividers = false; boolean needsDivider = false; boolean hasSampleOrHeapsz = false; // see if we need subDividers: int numEntityDataTypes = entityData.entityRows.size(); for (RowData rowData : entityData.entityRows) { RowDefinition rowDef = rowData.rowDefinition; final int numCharts = rowDef.getChartCount(); Settings.TLData_type dataType = rowDef.getTLDataType(); if (dataType.equals(Settings.TLData_type.TL_HEAPSZ) || dataType.equals(Settings.TLData_type.TL_SAMPLE)) { hasSampleOrHeapsz = true; if (numEntityDataTypes > 1) { needsSubDividers = true; } } if (numCharts > 0 && numEntityDataTypes > 1) { // has multiple events and charts if (stackRowHeight > 8) { needsSubDividers = true; } if (vzoom_level >= 3) { needsSubDividers = true; } } } final boolean isExperimentEnd = (kk == numEntities - 1); // see if we need dividers: if (!isExperimentEnd) { if (needsSubDividers) { needsDivider = true; } if (vzoom_level >= 2) { needsDivider = true; } if (hasSampleOrHeapsz) { needsDivider = true; } } entityNeedsDividers.add(needsDivider); entityNeedsSubDividers.add(needsSubDividers); if (needsSubDividers) { someEntityHasSubDividers = true; } if (needsDivider) { someEntityHasDividers = true; } if (hasSampleOrHeapsz) { someEntityIsSampleOrHeapsz = true; } } } if (entityNeedsDividers.size() != overallEntityCount) { int xx = 1; // weird! } final boolean procDividersNeeded; if (someEntityHasSubDividers || someEntityHasDividers || someEntityIsSampleOrHeapsz || vzoom_level >= 3 || maxEntities > 1) { procDividersNeeded = true; } else { procDividersNeeded = false; } final int subDividerThickness = someEntityHasSubDividers ? 1 : 0; final int entityDividerThickness = someEntityHasDividers ? subDividerThickness + 1 : subDividerThickness; final int procDividerThickness = procDividersNeeded ? entityDividerThickness + 1 : 0; final int expGroupDividerThickness = 5; final int numExperiments = expList.size(); for (int kk = 0; kk < numExperiments; kk++) { ExperimentData expData = expList.get(kk); final int numEntities = expData.experimentEntities.size(); for (int jj = 0; jj < numEntities; jj++) { int overallEntityNum = rowGeometryByEntity.size(); EntityData entityData = expData.experimentEntities.get(jj); boolean isEntityStart = true; boolean isEntityEnd = false; int numEntityDataTypes = entityData.entityRows.size(); List<RowGeometry> entityGeos = new ArrayList<>(); boolean needsSubDividers = entityNeedsSubDividers.get(overallEntityNum); for (int ii = 0; ii < numEntityDataTypes; ii++) { // row within entity (entity's DATA* type) RowData rowData = entityData.entityRows.get(ii); // For each rowData element, there is one row of data events and N charts RowDefinition rowDef = rowData.rowDefinition; final int numCharts = rowDef.getChartCount(); int postRowDividerHeight = 0; RowGeometry masterRow = null; final int startSubrow = rowGeometryNum; for (int subrowNum = 0; subrowNum <= numCharts; subrowNum++) { final int chartIdx = subrowNum - 1; // -1 is for "events" final int startY = currentY; currentY += calcRowUpperPadding(g, rowDef, chartIdx, subrowNum, numCharts); final int dataStartY = currentY; currentY += calcRowHeight(g, rowDef, chartIdx, subrowNum, numCharts); final int dataEndY = currentY - 1; boolean isExperimentEnd = false; boolean isCompareGroupEnd = false; if (subrowNum == numCharts) { // last row for metric if (ii == numEntityDataTypes - 1) { // last row of entity isEntityEnd = true; isExperimentEnd = (jj == numEntities - 1); if (isExperimentEnd) { // determine if isCompareGroupEnd: if (kk == numExperiments - 1 && rowDef.getComparisonOn()) { isCompareGroupEnd = true; } else if (kk < numExperiments - 1) { ExperimentData nextExpData = expList.get(kk + 1); int nextGroupId = nextExpData .experimentEntities .get(0) .entityRows .get(0) .getRowDef() .getExpGroupId(); int groupId = rowDef.getExpGroupId(); if (groupId != nextGroupId) { isCompareGroupEnd = true; } } if (isCompareGroupEnd) { postRowDividerHeight = expGroupDividerThickness; } else { postRowDividerHeight = procDividerThickness; } } else if (entityNeedsDividers.get(overallEntityNum)) { postRowDividerHeight = entityDividerThickness; } } else { // not last row of entity if (needsSubDividers) { postRowDividerHeight = subDividerThickness; } } } currentY += calcRowLowerPadding(g, rowDef, chartIdx, subrowNum, numCharts); final int endY = currentY - 1; final String propName, propUName; if (chartIdx == -1) { propName = "MSTATE"; // YXXX actually, only needed for samples propUName = "Process Microstates"; } else { List<PropDescriptor> chartProps = rowDef.getChartProperties(); propName = chartProps.get(chartIdx).getName(); propUName = chartProps.get(chartIdx).getDescription(); } RowGeometry subRow = new RowGeometry( rowGeometryNum, rowGeometry, numCharts + 1, subrowNum, rowData, // note: rowData is not fully populated yet chartIdx, propName, propUName, startY, endY, dataStartY, dataEndY, isEntityStart, isEntityEnd, isExperimentEnd, isCompareGroupEnd, postRowDividerHeight); if (chartIdx == -1) { masterRow = subRow; } rowGeometryNum++; rowNumToEntityNum.add(overallEntityNum); rowGeometry.add(subRow); entityGeos.add(subRow); isEntityStart = false; } // numCharts int tmpRowNum = startSubrow; for (int subrowNum = 0; subrowNum <= numCharts; subrowNum++) { RowGeometry tmp = rowGeometry.get(tmpRowNum); tmp.setMasterRow(masterRow); tmpRowNum++; } currentY += postRowDividerHeight; } // data types rowGeometryByEntity.add(entityGeos); } // entities } // experiments usedHeight = currentY; if (rowGeometryByEntity.size() != overallEntityCount) { int xx = 1; // weird! } // used by coord calculator ArrayList<Integer> tmpOffsets = new ArrayList<>(); int ypos = 0; for (RowGeometry row : rowGeometry) { int delta = row.endY - ypos; tmpOffsets.add(delta); ypos = row.endY; } rowOffsets = tmpOffsets; forceRowGeometry = false; forceFullRepaint = true; dataAxisMaster.setAbsRowMinHeights(tmpOffsets); // YXXX check above call to see if it can cause feedback loop } private int getBinStartOffset(RowData dataCopy) { // Inputs: dataCopy is stable snapshot returned from RowData.grabEventData() // Returns: the # of bins from start of data in dataCopy to first bin visible on screen // or INVALID_BIN if no data is available for visible portion of screen. // Example: Suppose the TL view is 1000 pixels wide, and dataCopy has 2000 pixels // of valid data with 300 pixels off screen on the left and 700 off screen on the right. // The return value for this function would be 300, the first visible data bin. int offset = 0; if (!dataCopy.eventDataIsValid()) { return INVALID_BIN; } RowDataRequestParams params = dataCopy.getParams(); if (params == null) { return INVALID_BIN; // weird } long binTime = timeAxisCalculator.getTimePerBin(); if (binTime != params.binTime) { return INVALID_BIN; // zooming, data is stale } long fetchStart = params.alignedTimeStart; long visibleStart = timeAxisCalculator.getTimeStartAligned(); long delta = visibleStart - fetchStart; offset = (int) (delta / binTime); if (binTime * offset != delta) { return INVALID_BIN; // weird, not aligned } if (offset < 0) { // data is shifted so far right, there's a hole int ii = 0; // for breakpoint } return offset; } private void setScrollY(List<RowGeometry> rowGeometry, int scrollY, int visibleHeight) { if (currScrollY != scrollY || currVisibleHeight != visibleHeight) { currScrollY = scrollY; currVisibleHeight = visibleHeight; forceFullRepaint = true; } int rowCount = rowGeometry.size(); int newRowFirst = rowCount; int newRowLast = rowCount; for (int ii = 0; ii < rowCount; ii++) { // YXXX slow... RowGeometry row = rowGeometry.get(ii); int virtualY = row.endY - scrollY; if (newRowFirst == rowCount && virtualY > 0) { newRowFirst = ii; } virtualY = row.startY - scrollY; if (virtualY > visibleHeight) { newRowLast = ii; break; } } if (currRowFirst != newRowFirst || currRowLast != newRowLast) { currRowFirst = newRowFirst; currRowLast = newRowLast; forceFullRepaint = true; } } private void drawVisibleRows( final Graphics g, final List<RowGeometry> rowGeometry, final int visibleWidth) { for (int ii = currRowFirst; ii < currRowLast; ii++) { final RowGeometry row = rowGeometry.get(ii); final RowData dataCopy = row.rowData.grabEventData(); // row.rowData is volatile, get snapshot final int binStartOffset = getBinStartOffset(dataCopy); if (binStartOffset == INVALID_BIN) { // offset could not be determined int rowCenter = (row.dataEndY + row.dataStartY) / 2 - currScrollY; drawCenteredMessage(g, AnLocale.getString("Fetching Data..."), visibleWidth / 2, rowCenter); continue; } if (!row.isChartData()) { // specifies the events themselves GenericEvent[] events = dataCopy.getEvents(); drawRowEvents(g, row, events, binStartOffset, visibleWidth, false, true); continue; } // specifies a chart final Object vals = dataCopy.getChartData(row.chartPropIdx); if (vals instanceof long[]) { long longVals[] = (long[]) vals; Settings.TLData_type dataType = row.rowData.rowDefinition.getTLDataType(); final boolean preferZeroYOrigin = dataType.equals(Settings.TLData_type.TL_HEAPSZ) ? false : true; // final boolean preferZeroYOrigin = true; drawRowChartValues( g, row, dataCopy, longVals, binStartOffset, visibleWidth, preferZeroYOrigin); } else if (vals instanceof SampleEvent[]) { SampleEvent sampleEvents[] = (SampleEvent[]) vals; drawRowEvents(g, row, sampleEvents, binStartOffset, visibleWidth, false, false); } else { continue; // weird, vals is unexpected type } } } private void drawVisibleDividers( final Graphics g, final List<RowGeometry> rowGeometry, final int visibleWidth) { int x1 = 0; int x2 = visibleWidth; if (currScrollY == 0) { drawSolidDivider(g, STANDARD_DIVIDER_COLOR, x1, x2, 0, 1); } for (int ii = currRowFirst; ii < currRowLast; ii++) { RowGeometry row = rowGeometry.get(ii); if (row.rowDividerHeight > 0) { // divider below this row int y = row.endY - currScrollY + 1; if (row.isCompareGroupEnd) { drawDashedDivider(g, COMPARE_GRP_DIVIDER_COLOR, x1, x2, y, row.rowDividerHeight); } else if (row.isExperimentEnd) { drawSolidDivider(g, EXPERIMENT_DIVIDER_COLOR, x1, x2, y, row.rowDividerHeight); } else if (row.isEntityEnd) { drawSolidDivider(g, STANDARD_DIVIDER_COLOR, x1, x2, y, row.rowDividerHeight); } else { drawSolidDivider(g, STANDARD_DIVIDER_COLOR, x1, x2, y, row.rowDividerHeight); } } } } public static void drawSolidDivider( Graphics g, Color color, final int x1, final int x2, final int y, final int thickness) { g.setColor(color); for (int ii = 0; ii < thickness; ii++) { g.drawLine(x1, y + ii, x2, y + ii); } } public static void drawDashedDivider( Graphics g, Color color, final int x1, final int x2, int y, int thickness) { g.setColor(color); if (thickness > 2) { int ii = 0; g.drawLine(x1, y + ii, x2, y + ii); ii += thickness - 1; g.drawLine(x1, y + ii, x2, y + ii); thickness -= 2; y += 1; } for (int ii = 0; ii < thickness; ii++) { int x = x1 - (2 * ii); int step = 3; final int space = (thickness > 1) ? 6 : 2; while (x < x2) { if (step > x2 - x) { step = x2 - x; } g.drawLine(x, y + ii, x + step - 1, y + ii); x += step + space; } } } private void drawRowEvents( Graphics g, final RowGeometry row, final GenericEvent[] events, final int binStartOffset, final int visibleWidth, final boolean drawingSelectedItem, final boolean showDivisions) { if (events == null) { return; } if (events.length == 0) { return; } final int rowStartY = row.startY - currScrollY; final int rowEndY = row.endY - currScrollY; final int dataStartY = row.dataStartY - currScrollY; final int dataEndY = row.dataEndY - currScrollY; final TimelineVariable.StatesDisplayInfo stateInfo; if (events[0] instanceof SampleEvent) { // see TLExperiment.getChartProps() stateInfo = TimelineVariable.getStateInfo(row.propName); } else { stateInfo = null; } boolean forceToSingleBin = false; RowDefinition rowDef = row.rowData.rowDefinition; if (!row.isChartData() && rowDef.getTLDataType().equals(Settings.TLData_type.TL_CLOCK)) { // Hack to show clock profiling callstacks as a point in time // ... but show microstate bar for the full duration forceToSingleBin = true; } // repaint row int prev_event_x = 0; // remember where previous event ended int prev_event_x_tick = -2; // remember previous event tick end for (int ii = 0; ii < events.length; ii++) { final GenericEvent event = events[ii]; final int eventbinStart = event.binStart - binStartOffset; final int nbins = timeAxisCalculator.getNumBins(); final int binStart, binCount; if (forceToSingleBin && event.binCount > 1) { binStart = eventbinStart + event.binCount - 1; binCount = 1; } else { binStart = eventbinStart; binCount = event.binCount; } if (binStart > nbins + FATTENED_EVENT_WIDTH) { break; } if (binStart + binCount < 0) { continue; } if (binCount < 1) { continue; // happens when an event end overlaps with an event start, needs fix in DBE } int w; int x; int xLeftEdge, xRightEdge; { int binEnd = binStart + binCount - 1; int xStart = timeAxisCalculator.getLowCoordForBin(binStart); int xEnd = timeAxisCalculator.getLowCoordForBin(binEnd + 1) - 1; w = xEnd - xStart + 1; x = xStart; xLeftEdge = xStart; xRightEdge = xEnd; } boolean shortTick = true; boolean standaloneTick = true; if (w < FATTENED_EVENT_WIDTH && !row.rowData.rowDefinition.getTLDataType().equals(Settings.TLData_type.TL_GCEVENT)) { // attempt to fatten event int extension = (FATTENED_EVENT_WIDTH - w) / 2; // how much to add to each side // widen right side first int adjustedW; final int next_xStart; if (ii + 1 < events.length) { // check distance to event on right final GenericEvent nextEvent = events[ii + 1]; final int nextEventbinStart = nextEvent.binStart - binStartOffset; final int nextBinStart; if (forceToSingleBin && nextEvent.binCount > 1) { nextBinStart = nextEventbinStart + nextEvent.binCount - 1; } else { nextBinStart = nextEventbinStart; } next_xStart = timeAxisCalculator.getLowCoordForBin(nextBinStart); int avail = (next_xStart - (x + w)) / 2; if (avail < 0) { // overlapping events // note: intentinally not merged with next case adjustedW = w + avail; // shorten this event if (adjustedW < 1) { adjustedW = 1; // weird, not expected } } else if (avail < extension) { // not overlapping, but cramped adjustedW = w + avail; } else { // enough space for full expansion adjustedW = w + extension; } } else { adjustedW = w + extension; next_xStart = -1; } // now widen left side int adjustedX; if (prev_event_x < x - extension) { adjustedX = x - extension; } else { adjustedX = prev_event_x + 1; } adjustedW += x - adjustedX; // make tick marks of different heights (visual cue to zoom to see details) if (xLeftEdge == next_xStart - 1 && xLeftEdge == prev_event_x_tick + 1) { // touching both previous and next ticks // if(event.binNSamples>1){ // there are hidden events if ((xLeftEdge % 4) == 0) { // add special jagged edge // only use tall ticks for every third adjacent tick shortTick = false; // } } } if (xLeftEdge == next_xStart - 1 || xLeftEdge == prev_event_x_tick + 1) { standaloneTick = false; } w = adjustedW; x = adjustedX; } int x2 = x + w - 1; prev_event_x = x2; prev_event_x_tick = xRightEdge; if (event instanceof SampleEvent) { // YXXX how inefficient is this? SampleEvent sampleEvt = (SampleEvent) event; drawSampleEvent( g, sampleEvt.propValues, stateInfo, x, x2, dataStartY, dataEndY, drawingSelectedItem, showDivisions); } else if (event instanceof StackEvent) { StackEvent stackEvt = (StackEvent) event; drawStackEvent( g, stackEvt, x, x2, dataStartY, dataEndY, xLeftEdge, xRightEdge, drawingSelectedItem, shortTick, standaloneTick); } else if (event instanceof GenericEvent) { // CXXX Bug 20801848 - maybe add a function drawGCEvent() drawGenericEvent(g, x, x2, dataStartY, dataEndY, drawingSelectedItem, showDivisions); } else { int foo = 0; // weird } } if (!drawingSelectedItem) { drawRowVBorders(g, rowStartY, rowEndY, -1, -1); } } private int[] getRowVisibleBinMinMax(final RowData dataCopy) { // return minimum and maximum bin for valid data // if no valid data is visible, returns (Integer.MAX_VALUE, Integer.MIN_VALUE) final int[] minMaxNA = {Integer.MAX_VALUE, Integer.MIN_VALUE}; if (dataCopy == null || !dataCopy.eventDataIsValid()) { return minMaxNA; } int lowBinLimit = 0; int highBinLimit = timeAxisCalculator.getNumBins() - 1; { // limit chart to experiment's time boundaries final long timeOffset = dataCopy.rowDefinition.getTimeOrigin(); final long wallTimeStart = dataCopy.rowDefinition.getDataTimeStart() - timeOffset; final long wallTimeEnd = dataCopy.rowDefinition.getDataTimeEnd() - timeOffset; final long visibleStart = timeAxisCalculator.getTimeStart(); final long visibleEnd = timeAxisCalculator.getTimeEnd(); if (wallTimeStart > visibleStart) { if (wallTimeStart > visibleEnd) { return minMaxNA; } lowBinLimit = timeAxisCalculator.getBinAtTime(wallTimeStart); } if (wallTimeEnd < visibleEnd) { if (wallTimeEnd < visibleStart) { return minMaxNA; } highBinLimit = timeAxisCalculator.getBinAtTime(wallTimeEnd); } } int[] loHi = {lowBinLimit, highBinLimit}; return loHi; } private void drawRowChartValues( Graphics g, final RowGeometry row, final RowData dataCopy, final long longVals[], int binStartOffset, final int visibleWidth, final boolean preferZeroYOrigin) { final int rowStartY = row.startY - currScrollY; final int rowEndY = row.endY - currScrollY; final int dataStartY = row.dataStartY - currScrollY; final int dataEndY = row.dataEndY - currScrollY; final int rowHeight = dataEndY - dataStartY + 1; final int[] binMinMax = getRowVisibleBinMinMax(dataCopy); final int lowBinLimit = binMinMax[0]; final int highBinLimit = binMinMax[1] + 1; // +1 is fudge for missing pixel at some zooms int borderHeight = rowHeight < 6 ? 0 : 1; final int yOrigin = dataEndY - borderHeight; // -1 for bottom border final int lineThickness = rowHeight < 6 ? 1 : 2; final int dataHeight = rowHeight - 2 * borderHeight - (lineThickness - 1); // -1 for highlight // compute vertical scale long min_val = Long.MAX_VALUE; long max_val = Long.MIN_VALUE; int startBin = binStartOffset >= 0 ? binStartOffset : 0; for (int bin = startBin; bin < longVals.length; bin++) { final int visibleBin = bin - binStartOffset; if (visibleBin > highBinLimit) { break; } if (visibleBin < lowBinLimit) { continue; } // only consider visible time when computing y range long val = longVals[bin]; if (min_val > val) { min_val = val; } if (max_val < val) { max_val = val; } } if (min_val > 0 && preferZeroYOrigin) { min_val = 0; // zero Y origin unless minimum is negative } if (min_val == Long.MAX_VALUE) { min_val = 0; } if (max_val == Long.MIN_VALUE) { max_val = 0; } final long range = max_val - min_val; final double scale; if (range == 0) { scale = 0; } else { scale = (double) (dataHeight - lineThickness) / range; } // fill background { int xMargin = timeAxisCalculator.getMargin(); int x1 = xMargin; int x2 = visibleWidth - xMargin; drawHorizontalBand( g, x1, dataStartY, x2, dataEndY, CHART_BORDER_COLOR, CHART_BACKGROUND_COLOR); drawCaliper(g, dataStartY + 1, dataEndY - 1, CHART_BACKGROUND_SEL_COLOR); } // draw line g.setColor(CHART_GRAPH_COLOR); int peakStart = -1; int peakY = 0; int prevX = 0; int prevY = 0; long prevVal = 0; boolean firstTime = true; boolean lastTime = false; for (int bin = startBin; bin < longVals.length; bin++) { final int visibleBin = bin - binStartOffset; if (visibleBin == highBinLimit || bin == longVals.length - 1) { lastTime = true; } if (visibleBin > highBinLimit) { break; } if (visibleBin < lowBinLimit) { continue; } // calc vertical final Long curVal = longVals[bin] - min_val; final int h = (int) Math.round(scale * curVal); final int currY = yOrigin - h; // just above top of grey bar // calc horizonal final int x1 = timeAxisCalculator.getLowCoordForBin(visibleBin); final int x2 = timeAxisCalculator.getLowCoordForBin(visibleBin + 1) - 1; int centerX = (x1 + x2) / 2; if (firstTime) { prevY = currY; prevVal = curVal; prevX = x1; firstTime = false; } if (dataHeight > 3) { g.drawLine(prevX, prevY, centerX, currY); if (lineThickness != 1) { if (!(curVal == 0 && prevVal == 0)) { // only show non-baseline values thicker g.drawLine(prevX, prevY - 1, centerX, currY - 1); } } } else { if (!(curVal == 0 && prevVal == 0)) { // only show non-baseline values g.drawLine(prevX, prevY, centerX, currY); } } // highlight peaks boolean isPeak = (max_val == longVals[bin] && max_val != min_val); if (max_val == 1) { // don't highlight bins with just one event // note: won't work if values are based on HWC counts or time. isPeak = false; } if (isPeak) { if (peakStart == -1) { peakStart = centerX; } peakY = currY; } if (peakStart != -1 && (!isPeak || lastTime)) { // we know the end of the peak; let's draw the highlight int peakEnd = centerX; if (!isPeak) { peakEnd--; // we passed the peak } int delta = peakEnd - peakStart; final int min_peak_width = 4; if (delta < min_peak_width) { int fatten = (min_peak_width - delta + 1) / 2; peakEnd += fatten; peakStart -= fatten; } g.setColor(CHART_GRAPH_COLOR_MAX); int yOffset = peakY - lineThickness - borderHeight + 1; g.drawLine(peakStart, yOffset, peakEnd, yOffset); if (lineThickness != 1) { g.drawLine(peakStart, yOffset - 1, peakEnd, yOffset - 1); } g.setColor(CHART_GRAPH_COLOR); peakStart = -1; } prevY = currY; prevVal = curVal; prevX = centerX; } FontInfo title_font = getSmallFont(g); FontInfo value_font = getSmallBoldFont(g); if (title_font != null && value_font != null && value_font.height - 3 <= dataStartY - rowStartY) { // add Labels int xMargin = timeAxisCalculator.getMargin(); int xMax = timeAxisCalculator.getCanvasPixels() - xMargin; int xMin = xMargin; int textStartY = dataStartY - 1 - title_font.height + title_font.ascent; final String chartTitle = row.propUName; int chartTitleWidth = stringWidth(g, title_font.font, chartTitle); String yValue = getString(max_val); int yValueWidth = stringWidth(g, value_font.font, yValue); // Chart Title if (chartTitleWidth + yValueWidth < xMax - xMin - 10) { g.setColor(Color.BLACK); g.setFont(title_font.font); g.drawString(chartTitle, xMin + 1, textStartY); } // Y low and high values g.setColor(CHART_NUMERIC_TEXT_COLOR); g.setFont(value_font.font); if (yValueWidth < xMax - xMin) { g.drawString(yValue, xMax - yValueWidth - 1, textStartY); } if (value_font.height + 2 < dataHeight) { yValue = getString(min_val); yValueWidth = stringWidth(g, value_font.font, yValue); textStartY = yOrigin - value_font.height + value_font.ascent; g.drawString(yValue, xMax - yValueWidth - 1, textStartY); } } drawRowVBorders(g, rowStartY, rowEndY, dataStartY, dataEndY); } private void drawHorizontalBand( final Graphics g, final int x1, final int y1, final int x2, final int y2, final Color border, final Color fill) { g.setColor(fill); g.fillRect(x1, y1, x2 - x1, y2 - y1); g.setColor(border); g.drawLine(x1, y1, x2, y1); g.drawLine(x1, y2, x2, y2); g.setColor(Color.BLACK); } private String getString(long val) { return Long.toString(val); } private int stringWidth(final Graphics g, Font font, String stmp) { int strPixels = g.getFontMetrics(font).stringWidth(stmp); return strPixels; } private void drawStackEvent( Graphics g, final StackEvent thisEvent, final int startX, final int endX, final int startY, final int endY, final int xLeftEdge, final int xRightEdge, final boolean doSetSelected, boolean shortTick, boolean standaloneTick) { final int x = startX; final int wid = endX - startX + 1; final int height = endY - startY + 1; if (doSetSelected && height < 1) { setSelectionBounds(startX, startY, wid, height); return; } if (height < 1) { return; } final int nominalSegmentHeight = stack_frame_pixels; // check user's "cpu idle color" setting boolean useIdleColor = false; if (idle_color_set && thisEvent.mState > 1) { // YXXX yuck! if (idle_color == null) { return; } useIdleColor = true; } // determine stack alignment based on user settings final int numFrames; final int startFrame; final int frameInc; final int anchorY; final int tickY; final int topEdgeOfStack; final long[] stackFuncs = tl2DataFetcher.getStackFuncArray(thisEvent.stackId); final int tick_height = height >= EVENT_TICK_HEIGHT ? EVENT_TICK_HEIGHT : height; final int nominalHeight = tick_height + stack_frame_pixels * stackFuncs.length; final boolean truncated = nominalHeight > (endY - startY + 1); final int framesThatFit = (height - tick_height + stack_frame_pixels - 1) / stack_frame_pixels; if (stackFuncs.length > framesThatFit) { numFrames = framesThatFit; } else { numFrames = stackFuncs.length; } if (stack_align == Settings.TLStack_align.TLSTACK_ALIGN_ROOT) { startFrame = stackFuncs.length - 1; // main frameInc = -1; anchorY = 1 + endY - tick_height - nominalSegmentHeight; tickY = 1 + endY - tick_height; int _topEdgeOfStack = 1 + endY - tick_height - numFrames * nominalSegmentHeight; if (_topEdgeOfStack < startY) { topEdgeOfStack = startY; } else { topEdgeOfStack = _topEdgeOfStack; } } else { startFrame = 0; // leaf frameInc = 1; anchorY = startY + tick_height; tickY = startY; topEdgeOfStack = anchorY; } // draw stack boundary tick marks if (standaloneTick) { g.setColor(TICK_ONE_PIXEL_WIDE_COLOR); } else if (numFrames > 0) { g.setColor(TICK_WITH_STACK_COLOR); } else { g.setColor(TICK_STANDALONE_COLOR); } if (tick_height < 2) { // row is squashed to very few pixels, widen event to make it visible if (xLeftEdge != xRightEdge) { g.drawLine(xRightEdge - 1, tickY, xRightEdge, tickY); } g.drawLine(xLeftEdge - 1, tickY, xLeftEdge, tickY); } else { int tickYStart = tickY; int tickYEnd = tickY + tick_height - 1; if (shortTick && tick_height > 2) { tickYEnd -= 1; } if (xLeftEdge != xRightEdge) { g.drawLine(xRightEdge, tickYStart, xRightEdge, tickYEnd); } g.drawLine(xLeftEdge, tickYStart, xLeftEdge, tickYEnd); // if (thisEvent.binNSamples > 1) { // g.drawLine(xLeftEdge - 1, tickYStart, xLeftEdge - 1, tickYEnd); // } } // draw the stack Color color = idle_color; int stackHeight = 0; for (int ii = 0, frame = startFrame; ii < numFrames; ii++, frame += frameInc) { int segmentHeight = nominalSegmentHeight; if (!useIdleColor) { if (doSetSelected || stateColorSnapshot == null) { // selected objects are fetched later, color may not be in stateColorSnapshot color = colorMap.getFuncColor(stackFuncs[frame]); // slower, requires lock } else { color = stateColorSnapshot.getColorMap().get(stackFuncs[frame]); } if (color == null) { color = Color.LIGHT_GRAY; } } int yPos = anchorY + ii * segmentHeight * frameInc; if (yPos < startY) { segmentHeight -= (startY - yPos); yPos = startY; } int tmpEndY = yPos + segmentHeight - 1; if (tmpEndY > endY) { segmentHeight -= (tmpEndY - endY); } if (segmentHeight <= 0) { continue; // weird } stackHeight += segmentHeight; g.setColor(color); g.fillRect(x, yPos, wid, segmentHeight); if (ii == numFrames - 1 && truncated) { int y = (frameInc > 0) ? yPos + segmentHeight - 1 : yPos; Color darker = color.darker(); g.setColor(darker); g.drawLine(x, y, x + wid - 1, y); } } if (doSetSelected) { setSelectionBounds(x, topEdgeOfStack, wid, stackHeight); } } private void drawSampleEvent( final Graphics g, final long stateVals[], TimelineVariable.StatesDisplayInfo stateInfo, final int startX, final int endX, final int startY, final int endY, final boolean doSetSelected, boolean showDivisions) { final long propValues[] = stateInfo.raw2displayValues(stateVals); if (propValues == null || propValues.length == 0) { return; } final int event_w = endX - startX + 1; final int sampleHeight = endY - startY + 1; // calc total double total = 0; for (long val : propValues) { total += val; } if (total == 0) { return; } final int x = startX; final int w = event_w; // draw sample colors long sum_time = 0; int yPrev = startY + SAMPLE_BORDER_HEIGHT; int dataHeight = sampleHeight - SAMPLE_BORDER_HEIGHT * 2; for (int i = 0; i < propValues.length; i++) { sum_time += propValues[i]; double percent = sum_time / total; int height = (int) Math.round(percent * dataHeight); int yNew = startY + height + SAMPLE_BORDER_HEIGHT; if (yNew > yPrev) { final Color color = stateInfo.getColorByDisplayIdx(i); g.setColor(color); g.fillRect(x, yPrev, w, yNew - yPrev); } yPrev = yNew; } // vertical dividers if (showDivisions && w >= MIN_SAMPLE_3D_WIDTH) { final int y1 = startY + sampleHeight - 1 - SAMPLE_BORDER_HEIGHT; final int y2 = startY + SAMPLE_BORDER_HEIGHT; final int x1 = x; final int x2 = x + w - 1; // g.setColor(Color.LIGHT_GRAY); // g.drawLine(x1, y1, x1, y2); g.setColor(SAMPLE_VDIVIDER_COLOR); g.drawLine(x2, y1, x2, y2); } if (SAMPLE_BORDER_HEIGHT > 0 && SAMPLE_BORDER_COLOR != null) { final int y1 = startY + sampleHeight - 1; final int y2 = startY; final int x1 = x; final int x2 = x + w - 1; g.setColor(SAMPLE_BORDER_COLOR); g.drawLine(x1, y1, x2, y1); g.drawLine(x1, y2, x2, y2); } if (doSetSelected) { setSelectionBounds(x, startY, w, sampleHeight); } } // CXXX Bug 20801848 - maybe change to drawGCEvent() private void drawGenericEvent( final Graphics g, final int startX, final int endX, final int startY, final int endY, final boolean doSetSelected, boolean showDivisions) { final int event_w = endX - startX + 1; final int sampleHeight = endY - startY + 1; final int x = startX; final int w = event_w; int yPrev = startY + SAMPLE_BORDER_HEIGHT; int dataHeight = sampleHeight - SAMPLE_BORDER_HEIGHT * 2; g.setColor(Color.GRAY); int yNew = startY + dataHeight + SAMPLE_BORDER_HEIGHT; g.fillRect(x, yPrev, w, yNew - yPrev); // vertical dividers if (showDivisions && w >= MIN_SAMPLE_3D_WIDTH) { final int y1 = startY + sampleHeight - 1 - SAMPLE_BORDER_HEIGHT; final int y2 = startY + SAMPLE_BORDER_HEIGHT; final int x1 = x; final int x2 = x + w - 1; // g.setColor(Color.LIGHT_GRAY); // g.drawLine(x1, y1, x1, y2); g.setColor(SAMPLE_VDIVIDER_COLOR); g.drawLine(x2, y1, x2, y2); } if (SAMPLE_BORDER_HEIGHT > 0 && SAMPLE_BORDER_COLOR != null) { final int y1 = startY + sampleHeight - 1; final int y2 = startY; final int x1 = x; final int x2 = x + w - 1; g.setColor(SAMPLE_BORDER_COLOR); g.drawLine(x1, y1, x2, y1); g.drawLine(x1, y2, x2, y2); } if (doSetSelected) { setSelectionBounds(x, startY, w, sampleHeight); } } // private String getDescription(final MouseEvent evt) { //YXXX unused // final RowGeometry cachedRow; // cachedRow = screenY2RowGeometry(evt.getY()); // if ( cachedRow == null ){ // return null; // } // return cachedRow.rowData.rowDefinition.getLongDescription(); // } public int getVZoomLevel() { return vzoom_level; } public int getStackFramePixels() { return stack_frame_pixels; } public Settings.TLStack_align getStackAlign() { return stack_align; } public long getAbsoluteTimeStart() { if (recentDataSnapshot == null) { return 0; } return recentDataSnapshot.getAbsoluteTimeStart(); } public long getAbsoluteTimeEnd() { if (recentDataSnapshot == null) { return 0; } return recentDataSnapshot.getAbsoluteTimeEnd(); } public boolean selectionActive() { if (selection_event == null) { return false; } return true; } public long getSelectionTimeEnd() { if (selection_event == null) { return 0; } return selection_event.eventTimeEnd; } public long getSelectionTimeStart() { if (selection_event == null) { return 0; } return selection_event.eventTimeStart; } public double getSelectionYCenter() { if (selection_event == null) { return 0; } int ycoord = dataAxisCalculator.getCenterCoordForRow(selection_event.rowNum); double selection_ypct_center = dataAxisCalculator.getPercentNearCoord(ycoord); return selection_ypct_center; } public class FindNearXYResult { public final RowGeometry rowGeometry; public final long clickTime; public final GenericEvent event; public final Object chartData; // YXXX would prefer to use GenericEvent as type public final boolean directTimeHit; public final int x, y; public FindNearXYResult( int x, int y, RowGeometry rowGeometry, long clickTime, GenericEvent event, Object chartData, boolean directTimeHit) { this.x = x; this.y = y; this.rowGeometry = rowGeometry; this.clickTime = clickTime; this.event = event; this.chartData = chartData; this.directTimeHit = directTimeHit; } } public FindNearXYResult findNearXY( final int xx, final int yy, final boolean searchOnlyMasterRows) { // xx: either Integer.MIN_VALUE to use previous selection click time, or x coordinate final TimelineSelectionEvent recentSel = getRecentSelection(); final int y; final int rowNum; if (yy == Integer.MIN_VALUE) { if (recentSel != null) { rowNum = recentSel.rowNum; } else { rowNum = dataAxisCalculator.getRowStart(); } y = dataAxisCalculator.getCenterCoordForRow(rowNum); } else { y = yy; rowNum = dataAxisCalculator.getRowAtCoord(y); } RowGeometry rowGeometry = rowNum2RowGeometry(rowNum); if (rowGeometry == null) { return null; } final RowGeometry row; if (searchOnlyMasterRows) { // redirect any clicks on charts to master row row = rowGeometry.getMasterRow(); } else { row = rowGeometry; } final long clickTime; final int x; boolean inMargin = false; if (xx == Integer.MIN_VALUE) { if (recentSel != null) { clickTime = recentSel.clickTime; } else { clickTime = timeAxisCalculator.getTimeStart(); } x = timeAxisCalculator.getCoordAtTime(clickTime); } else { x = xx; int margin = timeAxisCalculator.getMargin(); int availWidth = timeAxisCalculator.getAvailPixels(); if (x < margin || x > availWidth + margin) { inMargin = true; } clickTime = timeAxisCalculator.getTimeNearCoord(x); } final RowData dataCopy = row.rowData.grabEventData(); // row.rowData is volatile, get snapshot Object chartData = null; if (row.isChartData()) { final Object vals = dataCopy.getChartData(row.chartPropIdx); do { // chart events are based on pixel-sized bins (not event time info) final int binStartOffset = getBinStartOffset(dataCopy); if (binStartOffset == INVALID_BIN) { break; // weird } final int clickBin = timeAxisCalculator.getBinAtTime(clickTime); if (vals instanceof SampleEvent[]) { // SampleEvent[]-style data is sparse; only bins with data are stored final SampleEvent[] events = (SampleEvent[]) vals; if (events.length == 0) { break; } final int virtualDataBin = clickBin + binStartOffset; final int srchIdx = searchEventsByBin(events, virtualDataBin); final SampleEvent event = events[srchIdx]; final int binEnd = event.binStart + event.binCount - 1; if (event.binStart > virtualDataBin || binEnd < virtualDataBin) { break; // not in data set } chartData = event; } else if (vals instanceof long[]) { // long[]-style data has a value for every bin final int[] binMinMax = getRowVisibleBinMinMax(dataCopy); final int lowBinLimit = binMinMax[0]; final int highBinLimit = binMinMax[1]; if (clickBin < lowBinLimit || clickBin > highBinLimit) { break; // click is outside of chart's valid data } final int dataBin = clickBin + binStartOffset; final long[] events = (long[]) vals; if (dataBin < 0 || dataBin >= events.length) { break; // weird } chartData = events[dataBin]; } else { int ii = 0; // weird, for breakpoint break; } } while (false); } GenericEvent[] events = dataCopy.getEvents(); if (!dataCopy.eventDataIsValid() || events == null || events.length == 0) { return new FindNearXYResult(x, y, row, clickTime, null, chartData, false); } // The events are ordered by timeEnd, but they might overlap // See Dbe.cc dbeGetTLEventIdxNearTime() for algorithm. // We'll do a binary search of visible (painted) events. // If searchEventsByTime() can't find an exact match, the result // will be after clickTime except if it is the last item. final int srchIdx = searchEventsByTime(events, clickTime); final long srchEndTime = events[srchIdx].timeEnd; int winner = -1; final long winnerDelta; do { if (clickTime == srchEndTime) { // exact winner = srchIdx; winnerDelta = 0; break; } final long srchTimeStart = events[srchIdx].timeStart; final long srchTimeDelta = distanceToEvent(clickTime, srchTimeStart, srchEndTime); if (srchEndTime < clickTime // hit rightmost max || srchIdx == 0) { // hit leftmost max winner = srchIdx; winnerDelta = srchTimeDelta; break; } // need to choose final int prevIdx = srchIdx - 1; final long prevTimeDelta = distanceToEvent(clickTime, events[prevIdx].timeStart, events[prevIdx].timeEnd); if (srchTimeDelta < prevTimeDelta) { winner = srchIdx; winnerDelta = srchTimeDelta; break; } else { winner = prevIdx; winnerDelta = prevTimeDelta; break; } } while (false); final GenericEvent event = events[winner]; final long timeTolerance = timeAxisCalculator.getTimePerBin() * CLICK_PIXEL_TOLERANCE; final boolean directTimeHit = !inMargin && (winnerDelta < timeTolerance); return new FindNearXYResult(x, y, row, clickTime, event, chartData, directTimeHit); } // binary search. If no exact match, the result's timeEnd // will be greater than clickTime unless the result is the last item. private int searchEventsByTime(GenericEvent[] events, long clickTime) { int lo = 0; int hi = events.length - 1; while (lo < hi) { int md = (hi + lo) / 2; if (clickTime > events[md].timeEnd) { lo = md + 1; } else { hi = md; } } return lo; } // binary search. If no exact match, the result's timeEnd // will be greater than clickTime unless the result is the last item. private int searchEventsByBin(GenericEvent[] events, int clickBin) { int lo = 0; int hi = events.length - 1; while (lo < hi) { int md = (hi + lo) / 2; int binEnd = events[md].binStart + events[md].binCount - 1; if (clickBin > binEnd) { lo = md + 1; } else { hi = md; } } return lo; } private long distanceToEvent(long refTime, long eventStart, long eventEnd) { if (refTime < eventStart) { return eventStart - refTime; } if (eventEnd < refTime) { return refTime - eventEnd; } return 0; } // ===== text dump of timeline data for debugging and automated GUI testing ===== public String dumpXY(final FindNearXYResult result) { if (result == null) { return "null"; } StringBuilder buf = new StringBuilder(); final RowGeometry row = result.rowGeometry; final RowDefinition rowDef = row.rowData.rowDefinition; buf.append("Timeline Data Near (x=" + result.x + ", y=" + result.y + "):"); buf.append(" rowNum=" + row.rowNum); buf.append(" clickTime=" + result.clickTime / NS_PER_SEC); buf.append(" directTimeHit=" + result.directTimeHit); buf.append("\n"); buf.append(" rowLabel=" + dumpRowInfo(row)); buf.append( " procTimeRange=[" + (rowDef.getDataTimeStart() - rowDef.getTimeOrigin()) / NS_PER_SEC); buf.append(", " + (rowDef.getDataTimeEnd() - rowDef.getTimeOrigin()) / NS_PER_SEC + "]"); buf.append("\n"); buf.append(" rowToolTip='" + rowDef.getLongDescription() + "'"); buf.append(dumpGenericEvent(result.event, row)); if (row.isChartData()) { buf.append("\n Chart='" + row.propUName + "'"); if (result.chartData != null) { if (result.chartData instanceof StackEvent) { buf.append("Unexected Chart Data"); } else if (result.chartData instanceof SampleEvent) { final SampleEvent event = (SampleEvent) result.chartData; buf.append(dumpSampleEvent(event, row.propName)); } else if (result.chartData instanceof Long) { final Long val = (Long) result.chartData; buf.append(" Value=" + val); } else { buf.append("UNKNOWN Chart Data!"); } } } buf.append("\n"); return buf.toString(); } private String dumpGenericEvent(GenericEvent evt, RowGeometry row) { if (evt != null) { StringBuilder buf = new StringBuilder(); buf.append("\n Event: "); buf.append(evt.toString()); if (evt instanceof SampleEvent) { buf.append("\n Sample:"); final SampleEvent event = (SampleEvent) evt; final String propName = row.getMasterRow().propName; buf.append(dumpSampleEvent(event, propName)); } return buf.toString(); } return ""; } private String dumpSampleEvent(final SampleEvent sampleEvent, final String propName) { if (sampleEvent == null) { return ""; } StringBuilder buf = new StringBuilder(); final TimelineVariable.StatesDisplayInfo stateInfo; stateInfo = TimelineVariable.getStateInfo(propName); if (stateInfo.statePropName.isEmpty()) { int ii = 0; // weird return ""; } final long stateVals[] = stateInfo.raw2displayValues(sampleEvent.propValues); long total = 0; for (int ii = 0; ii < stateVals.length; ii++) { total += stateVals[ii]; } final long binDuration = sampleEvent.timeEnd - sampleEvent.timeStart + 1; if (binDuration > 0) { final double nthreads = 1.0 * total / binDuration; buf.append(String.format(" nthreads=%.1f", nthreads)); } else { buf.append("<unknown sample duration>"); } buf.append(" (totalSampleTime=" + total / NS_PER_SEC + ")"); for (int ii = 0; ii < stateVals.length; ii++) { if (stateVals[ii] == 0) { continue; } final String state = stateInfo.getNameByDisplayIdx(ii); final double percent = 100.0 * stateVals[ii] / total; buf.append(String.format("\n %.2f%%", percent)); buf.append(" state='" + state + "'"); buf.append(" color=" + stateInfo.getColorByDisplayIdx(ii)); } return buf.toString(); } /** * @param limit limit in number of lines. 0 means all lines. * @return formatted text */ public String exportAsText(Integer limit) { TL2DataSnapshot dataSnapshot = recentDataSnapshot; if (dataSnapshot == null || dataSnapshot.getRowData().isEmpty()) { final String message; if (dataSnapshot == null) { message = AnLocale.getString("Experiment load in progress..."); } else { message = AnLocale.getString("Data not available for this filter selection"); } return message; } StringBuilder buf = new StringBuilder(); GenericEvent gevent = getVisibleSelection(); buf.append("\n============ TIMELINE DUMP ============"); buf.append("\n=== Selection ==="); if (gevent != null) { RowGeometry selRow = rowGeometry.get(selection_event.rowNum); buf.append("\n Timeline " + dumpRowInfo(selRow)); buf.append(dumpGenericEvent(gevent, selRow)); } else { buf.append("\n <no event selected>"); } if (caliper != null) { buf.append( "\n Time selection range: [" + caliper.getLowTime() + ", " + caliper.getHighTime() + "]"); } if (rowGeometry == null) { buf.append("\nWARNING: timeline panel has not been drawn yet"); return buf.toString(); } int nRows = rowGeometry.size(); if (currRowFirst > nRows || currRowLast > nRows) { buf.append("\nWARNING: timeline data row count is inconsistent"); return buf.toString(); } for (int ii = currRowFirst; ii < currRowLast; ii++) { final RowGeometry row = rowGeometry.get(ii); final RowData dataCopy = row.rowData.grabEventData(); // row.rowData is volatile, get snapshot final int binStartOffset = getBinStartOffset(dataCopy); buf.append("\n=== Timeline " + dumpRowInfo(row) + " ==="); if (binStartOffset == INVALID_BIN) { buf.append("\n Fetching Data..."); continue; } if (!row.isChartData()) { // specifies the events themselves GenericEvent[] events = dataCopy.getEvents(); buf.append(dumpRowEvents(row, events, binStartOffset)); continue; } // specifies a chart final Object vals = dataCopy.getChartData(row.chartPropIdx); if (vals instanceof long[]) { long longVals[] = (long[]) vals; buf.append(dumpRowChartValues(dataCopy, longVals, binStartOffset)); } else if (vals instanceof SampleEvent[]) { SampleEvent sampleEvents[] = (SampleEvent[]) vals; buf.append(dumpRowEvents(row, sampleEvents, binStartOffset)); } else { buf.append("\nERROR: unexpected data type"); continue; // weird, vals is unexpected type } } return buf.toString(); } private String dumpRowInfo(RowGeometry row) { final RowDefinition rowDef = row.rowData.rowDefinition; StringBuilder buf = new StringBuilder(); buf.append( "'" + rowDef.getShortLabel() + "'" // + " " + rowDef.getExpName() + " " + rowDef.getDataDescUName() + " "); if (row.subrowNum == 0) { buf.append("Events"); } else { buf.append(row.propUName); } return buf.toString(); } private String dumpRowEvents( final RowGeometry row, final GenericEvent[] events, final int binStartOffset) { StringBuilder buf = new StringBuilder(); ; if (events == null) { buf.append("\n <no data>"); return buf.toString(); } if (events.length == 0) { buf.append("\n <no events>"); return buf.toString(); } final TimelineVariable.StatesDisplayInfo stateInfo; if (events[0] instanceof SampleEvent) { // see TLExperiment.getChartProps() stateInfo = TimelineVariable.getStateInfo(row.propName); } else { stateInfo = null; } boolean forceToSingleBin = false; RowDefinition rowDef = row.rowData.rowDefinition; if (!row.isChartData() && rowDef.getTLDataType().equals(Settings.TLData_type.TL_CLOCK)) { // Hack to show clock profiling callstacks as a point in time // ... but show microstate bar for the full duration forceToSingleBin = true; } for (int ii = 0; ii < events.length; ii++) { final GenericEvent event = events[ii]; final int eventbinStart = event.binStart - binStartOffset; final int nbins = timeAxisCalculator.getNumBins(); final int binStart, binCount; if (forceToSingleBin && event.binCount > 1) { binStart = eventbinStart + event.binCount - 1; binCount = 1; } else { binStart = eventbinStart; binCount = event.binCount; } if (binStart > nbins + FATTENED_EVENT_WIDTH) { break; } if (binStart + binCount < 0) { continue; } { int binEnd = binStart + binCount - 1; int xStart = timeAxisCalculator.getLowCoordForBin(binStart); int xEnd = timeAxisCalculator.getLowCoordForBin(binEnd + 1) - 1; buf.append(dumpGenericEvent(event, row)); break; // only print the first visible event for now } } return buf.toString(); } private String dumpRowChartValues( final RowData dataCopy, final long longVals[], int binStartOffset) { StringBuilder buf = new StringBuilder(); ; final int[] binMinMax = getRowVisibleBinMinMax(dataCopy); final int lowBinLimit = binMinMax[0]; final int highBinLimit = binMinMax[1] + 1; // +1 is fudge for missing pixel at some zooms int startBin = binStartOffset >= 0 ? binStartOffset : 0; int maxPrintValues = 10; buf.append("\n Leftmost non-zero chart values: "); for (int bin = startBin; bin < longVals.length; bin++) { final int visibleBin = bin - binStartOffset; if (visibleBin > highBinLimit) { break; } if (visibleBin < lowBinLimit) { continue; } long val = longVals[bin]; if (val != 0) { if (maxPrintValues == 0) { break; } maxPrintValues--; buf.append(" " + val + "@" + bin); } } return buf.toString(); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/IconRuler.java�������������������������������������������0000644�0001750�0001750�00000034446�15044710303�020374� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.timeline_common.VerticalRowRuler; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.ruler.Ruler; import org.gprofng.mpmt.util.ruler.valuetypes.ValuesGeneric; import java.awt.*; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import java.util.TreeSet; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import javax.swing.ImageIcon; import javax.swing.JTable; public final class IconRuler extends VerticalRowRuler implements Ruler, Accessible { private final int ICON_WIDTH = 16; private final int ICON_HEIGHT = 16; private final int ICON_HPAD = 3; private final int CURSOR_HPAD = 7; private List<RowGeometry> rowGeometry; private int rowFirst; // first visible row private int rowLast; // first non-Visible row private int eventSelectionRow; // selected event's row private TreeSet<Integer> selectedRows; // highlighted rows private int scrollY; // font state private static Font TEXT_FONT; private int FONT_HEIGHT = 0; private int FONT_ASCENT = 0; private int FONT_DESCENT = 0; private int rulerWidth = 0; // drawer settings private ValuesGeneric valueType; private int paddingLow; private int paddingHigh; private final Color backColor = Color.WHITE; private final Color selectionBackColor = TimelineDraw.GENERIC_SELECTION_COLOR; private final Color selectionTextColor = Color.BLACK; private boolean comparisonEnabled; // preferred size private boolean lockPreferredSize = false; private Dimension preferredD = new Dimension(1, 1); // non-zero for layout mgr private int actualWidth; static { JTable jtable = new JTable(); Font org_font = jtable.getFont(); TEXT_FONT = new Font("SansSerif", org_font.getStyle(), org_font.getSize()); } public IconRuler(ValuesGeneric type) { // YXXX icon ruler shouldn't take value type? super(); this.valueType = type; // YXXX this should be a local copy this.paddingLow = 0; this.paddingHigh = 0; setToolTipText(""); reset(); AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Vertical Ruler")); } private void reset() { rowGeometry = new ArrayList<>(); rowFirst = -1; rowLast = -1; eventSelectionRow = -1; selectedRows = new TreeSet(); comparisonEnabled = false; } private boolean isFontInitialized() { if (FONT_HEIGHT != 0) { return true; } if (TEXT_FONT != null) { FontMetrics fm = this.getFontMetrics(TEXT_FONT); if (fm != null) { FONT_ASCENT = fm.getAscent() - 1; // YXXX bogus adjust for looks FONT_DESCENT = fm.getDescent() - 2; // YXXX bogus adjust for looks FONT_HEIGHT = FONT_ASCENT + FONT_DESCENT; return true; } } return false; } public void setRowGeometry( List<RowGeometry> geometry, int scrollY, int firstVisibleRow, int lastVisibleRow, int selectedRow, TreeSet<Integer> multiselect_rows) { this.rowGeometry = geometry; this.scrollY = scrollY; this.rowFirst = firstVisibleRow; this.rowLast = lastVisibleRow; this.eventSelectionRow = selectedRow; this.selectedRows = multiselect_rows; this.comparisonEnabled = false; if (geometry.size() > 1) { int grp0 = geometry.get(0).rowData.rowDefinition.getExpGroupId(); int grpLast = geometry.get(geometry.size() - 1).rowData.rowDefinition.getExpGroupId(); if (grpLast != grp0) { comparisonEnabled = true; } } repaint(); } /** * Set a spacing to align component padLo is at the "0" end of the graphics' coordinate system * padHi is at the opposite end */ public void setPadding(int padLo, int padHi) { if (paddingLow != padLo || paddingHigh != padHi) { paddingLow = padLo; paddingHigh = padHi; repaint(); // should we do this elsewhere, as well? } } /** set direction of ruler w.r.t. coordinate system */ public void setOrderReverse(boolean reverse) {} // if the LabelCoordinateCalculator stays the same, you can call this // WARNING: Modifies values in the global variable that was passed in! @Override public final void setRange(long lo, long hi) { // YXXX only used to determine repaints if (valueType.getLowValue() != lo || valueType.getHighValue() != hi) { valueType.setRange(lo, hi); repaint(); } } @Override public void lockRulerThickness(Graphics g, boolean lock) { /* * YXXX not sure if it ok to use g from another context, but * font size is needed to set preferred ruler size, and * I don't know how else to get font size without g. * Maybe we should never attempt to lock ruler thickness? * Unfortunately, changing thickness might unexpectedly change * data range that can be shown on center panel. * For now, workaround is to provide g. */ if (!lockPreferredSize && lock) { recomputePreferredSize(g); } lockPreferredSize = lock; } private int calcWidth(final Graphics g, String stmp) { if (!isFontInitialized()) { return 0; // YXXX or could return a guess } int strPixels = g.getFontMetrics(TEXT_FONT).stringWidth(stmp); return strPixels; } /** Recompute preferred size */ private boolean recomputePreferredSize(Graphics g) { if (!isFontInitialized()) { return false; } int textWidth = calcWidth(g, "99 (Base)"); // YXXX should use real labels? rulerWidth = textWidth + ICON_WIDTH + ICON_HPAD + CURSOR_HPAD; boolean changed = internalSetPreferredSize(rulerWidth, 0); return changed; } // override parent @Override public Dimension getPreferredSize() { return preferredD; } private boolean internalSetPreferredSize(int width, int height) { boolean changed = false; if (preferredD.width != width || preferredD.height != height) { preferredD.width = width; preferredD.height = height; changed = true; } return changed; } @Override protected void paintComponent(Graphics g) { if (!isFontInitialized()) { // should never happen since <g> should allow font to be set return; } if (!lockPreferredSize) { boolean changed = recomputePreferredSize(g); if (changed) { revalidate(); // YXXX not supposed to revalidate from paint } } myPaintComponent(g); } private int screenY(int virtualY) { return virtualY - scrollY; } // Paints the ruler private void myPaintComponent(final Graphics gr) { Graphics2D g = (Graphics2D) gr; Rectangle drawHere = g.getClipBounds(); actualWidth = drawHere.width; // erase entire ruler g.setColor(backColor); g.fillRect(drawHere.x, drawHere.y, drawHere.width, drawHere.height); if (rowGeometry.isEmpty()) { drawBorders(g, drawHere.height); return; } // Do the ruler labels in a small font that's black. g.setFont(TEXT_FONT); int lastVisibleRow = rowLast; // draw horizontal lines, selected rows' background for (int ii = rowFirst; ii < lastVisibleRow; ii++) { RowGeometry row = rowGeometry.get(ii); int groupId = row.rowData.rowDefinition.getExpGroupId(); if (selectedRows.contains(ii)) { g.setColor(selectionBackColor); } else if (comparisonEnabled) { g.setColor(AnMetric.getMetricBackground(groupId)); } else { g.setColor(backColor); } { int startY = screenY(row.startY); int height = screenY(row.endY) - startY + 1 + 1; // overshoot by 1 int width = drawHere.width; g.fillRect(drawHere.x, startY, width, height); } if (row.rowDividerHeight > 0) { // divider below this row int y = screenY(row.endY + 1); if (row.isCompareGroupEnd) { TimelineDraw.drawDashedDivider( g, TimelineDraw.COMPARE_GRP_DIVIDER_COLOR, 0, actualWidth, y, row.rowDividerHeight); } else if (row.isExperimentEnd) { TimelineDraw.drawSolidDivider( g, TimelineDraw.EXPERIMENT_DIVIDER_COLOR, 0, actualWidth, y, row.rowDividerHeight); } else if (row.isEntityEnd) { TimelineDraw.drawSolidDivider( g, TimelineDraw.STANDARD_DIVIDER_COLOR, 0, actualWidth, y, row.rowDividerHeight); } else { TimelineDraw.drawDashedDivider( g, TimelineDraw.STANDARD_DIVIDER_COLOR, 0, actualWidth, y, row.rowDividerHeight); } } if (screenY(row.startY) > drawHere.height) { lastVisibleRow = ii; break; } } // draw icons for (int ii = rowFirst; ii < lastVisibleRow; ) { RowGeometry masterRow = rowGeometry.get(ii).getMasterRow(); final int firstSubrow = masterRow.rowNum - masterRow.subrowNum; final int lastSubrow = firstSubrow + masterRow.nSubrows - 1; ii = lastSubrow + 1; ImageIcon icon = masterRow.rowData.rowDefinition.getTLDataType().getIcon(); if (icon == null) { continue; } int block_startY = rowGeometry.get(firstSubrow).startY; int block_endY = rowGeometry.get(lastSubrow).endY; int row_height = block_endY - block_startY + 1; if (ICON_HEIGHT > row_height) { continue; } { int centerY = screenY((block_endY + block_startY + 1) / 2); int startY = centerY - ICON_HEIGHT / 2; icon.paintIcon(this, g, actualWidth - ICON_WIDTH - ICON_HPAD - CURSOR_HPAD, startY); } } // draw text for (int ii = rowFirst; ii < lastVisibleRow; ii++) { RowGeometry row = rowGeometry.get(ii); if (ii == eventSelectionRow) { RowGeometry masterRow = rowGeometry.get(ii).getMasterRow(); final int firstSubrow = masterRow.rowNum - masterRow.subrowNum; final int lastSubrow = firstSubrow + masterRow.nSubrows - 1; int block_startY = rowGeometry.get(firstSubrow).startY; int block_endY = rowGeometry.get(lastSubrow).endY; if (block_endY - block_startY > 5) { block_endY--; block_startY++; } if (block_endY - block_startY > 7) { block_endY--; block_startY++; } drawHighlight(g, block_startY, block_endY); } if (!row.isEntityStart) { continue; } String str = row.rowData.rowDefinition.getShortLabel(); if (str == null) { continue; } // scan ahead for entity end to get height int entity_startY = row.startY; int entity_endY = row.endY; for (int jj = ii; jj < lastVisibleRow; jj++) { RowGeometry tmp_row = rowGeometry.get(jj); if (tmp_row.isEntityEnd) { entity_endY = tmp_row.endY; break; } } int row_height = entity_endY - entity_startY + 1; int fudge_factor = 2; if (FONT_HEIGHT - fudge_factor > row_height) { continue; } int textStartY = screenY(entity_startY); if (FONT_HEIGHT > row_height) { textStartY -= (FONT_HEIGHT - row_height + 3) / 2; } boolean is_selected = selectedRows.contains(ii); int groupId = row.rowData.rowDefinition.getExpGroupId(); // clear text background { Rectangle r = TEXT_FONT.getStringBounds(str, g.getFontRenderContext()).getBounds(); if (is_selected) { g.setColor(selectionBackColor); } else if (comparisonEnabled) { g.setColor(AnMetric.getMetricBackground(groupId)); } else { g.setColor(backColor); } g.fillRect(0, textStartY + 1, r.width, FONT_HEIGHT - 1); } if (is_selected) { g.setColor(selectionTextColor); } else { g.setColor(Color.black); } g.drawString(str, 0, textStartY + FONT_ASCENT); } drawBorders(g, drawHere.height); } private void drawHighlight(Graphics g, int dataStartY, int dataEndY) { Color c[] = {Color.YELLOW, Color.YELLOW, Color.RED}; final int borderSz = c.length; int startY = dataStartY + borderSz; int endY = dataEndY - borderSz; int y = screenY(startY); int h = endY - startY + 1; int x = actualWidth - CURSOR_HPAD + 3; int w = -1; for (int i = 0; i < c.length; i++) { g.setColor(c[i]); g.drawRect(x - i - 1, y - i - 1, w + 2 * i + 1, h + 2 * i + 1); } } private void drawBorders(Graphics g, int height) { g.setColor(Color.black); g.drawLine(0, 0, actualWidth, 0); g.drawLine(0, height - 1, actualWidth, height - 1); } private RowGeometry findRow(int screenY) { int virtualY = screenY + scrollY; for (int ii = rowFirst; ii < rowLast; ii++) { RowGeometry row = rowGeometry.get(ii); if (virtualY <= row.endY && virtualY >= row.startY) { return row; } } return null; } // The tooltip to be displayed for any icon inside the ruler, TimelineDraw // goes through the list of data to find what is being displayed at that "y" // location for the evt and sets the tooltip accordingly @Override public String getToolTipText(MouseEvent evt) { int screenY = evt.getY(); RowGeometry row = findRow(screenY); if (row != null) { String rc = row.rowData.rowDefinition.getLongDescription(); return rc; } return null; } @Override public AccessibleContext getAccessibleContext() { // variable accessibleContext is protected in superclass if (accessibleContext == null) { accessibleContext = new AccessibleIconRuler(); } return accessibleContext; } final class AccessibleIconRuler extends AccessibleJComponent { @Override public AccessibleRole getAccessibleRole() { return AccessibleRole.CANVAS; } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/RowGeometry.java�����������������������������������������0000644�0001750�0001750�00000005652�14744453367�020776� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import java.util.List; public class RowGeometry { public final int rowNum; // index into parent List public final List<RowGeometry> parent; // parent list public final int nSubrows; // total number of rows within data type public final int subrowNum; // row number within data type public final RowData rowData; public final int chartPropIdx; // -1 for event data, >=0 for data chart public final String propName; // internal name of PROP_* property public final String propUName; // user-visible name of PROP_* property public final int startY; public final int endY; public final int dataStartY; public final int dataEndY; public final boolean isEntityStart; public final boolean isEntityEnd; public final boolean isExperimentEnd; public final boolean isCompareGroupEnd; public final int rowDividerHeight; // height of divider below this row private RowGeometry masterRow; // points to row used for selection public RowGeometry( int rowNum, List<RowGeometry> parent, int nSubrows, int subrowNum, RowData rowData, int chartPropIdx, // -1 for event data, >=0 for data chart String propName, String propUName, int startY, int endY, int dataStartY, int dataEndY, boolean isEntityStart, boolean isEntityEnd, boolean isExperimentEnd, boolean isCompareGroupEnd, int rowDividerHeight) { this.rowNum = rowNum; this.parent = parent; this.nSubrows = nSubrows; this.subrowNum = subrowNum; this.rowData = rowData; // note: rowData will be updated asynchronously this.masterRow = this; this.chartPropIdx = chartPropIdx; this.propName = propName; this.propUName = propUName; this.startY = startY; this.endY = endY; this.dataStartY = dataStartY; this.dataEndY = dataEndY; this.isEntityStart = isEntityStart; this.isEntityEnd = isEntityEnd; this.isExperimentEnd = isExperimentEnd; this.isCompareGroupEnd = isCompareGroupEnd; this.rowDividerHeight = rowDividerHeight; } public void setMasterRow(RowGeometry row) { masterRow = row; } public RowGeometry getMasterRow() { return masterRow; } public boolean isChartData() { return (chartPropIdx != -1); } } ��������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TLExperiment.java����������������������������������������0000644�0001750�0001750�00000022165�15044710303�021045� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.experiment_props.*; import org.gprofng.mpmt.settings.Settings; import java.util.ArrayList; import java.util.List; public class TLExperiment { // YXXX refactor or rename. Sole remaining method is createRows() private final PropDescriptor PROP_EVT_COUNT = // used to get packet count new PropDescriptor( "EVT_COUNT", "Event Count", // Should be I18N'D YXXX Settings.PROP_NONE, null, null); private boolean descriptorIsEnabled( final String nameWithAux, final long tldata_hidden_mask, final List<String> tldata_cnames) { if (tldata_hidden_mask == 0 || tldata_cnames == null || tldata_cnames.isEmpty()) { return true; } for (int ii = 0; ii < tldata_cnames.size(); ii++) { long bit = tldata_hidden_mask & 1L << ii; if (bit != 0) { String hiddenName = tldata_cnames.get(ii); if (nameWithAux.equals(hiddenName)) { return false; } } } return true; } // routine to discover the Experiment's rows // returns: RowDefinitions grouped by entity) public List<TL2DataSnapshot.EntityDefinitions> createEntityRowDefinitions( final ExperimentProperties experimentProperties, final List<Entity> ents, final int entity_prop_id, final long tldata_hidden_mask, final List<String> tldata_cnames, final boolean show_states, final boolean show_charts, final long time_origin, // timestamp at left origin (nanoseconds) final boolean comparing) { List<TL2DataSnapshot.EntityDefinitions> entityList = new ArrayList<>(); if (ents == null || ents.isEmpty()) { return entityList; } // add rows that aren't associated with an entity List<DataDescriptor> data_descs_with_ent = new ArrayList<>(); List<DataDescriptor> data_descs_without_ent = new ArrayList<>(); final Entity ent0 = ents.get(0); final int ent_prop_id = ent0.getPropId(); final String ent_prop_id_name = ent0.getPropIdName(); final boolean prop_is_expid = ent_prop_id_name.equalsIgnoreCase("EXPID"); List<DataDescriptor> descriptors = experimentProperties.getTstampDataDescriptors(); for (DataDescriptor dataD : descriptors) { if (dataD.findProp("TSTAMP") == null) { // YXXX redundant?? continue; // only draw entities that have time } if (dataD.getTLDataType().equals(Settings.TLData_type.TL_HEAPSZ) || dataD.getTLDataType().equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 // YXXX see if we can avoid special case by adding property to DataDescriptor data_descs_without_ent.add(dataD); continue; } if (prop_is_expid) { data_descs_without_ent.add(dataD); continue; } if (dataD.findProp(ent_prop_id) != null) { data_descs_with_ent.add(dataD); } else { data_descs_without_ent.add(dataD); } } List<RowDefinition> entityRowDefs = newEntityRowDefs( experimentProperties, data_descs_without_ent, null, tldata_hidden_mask, tldata_cnames, show_states, show_charts, time_origin, comparing); entityList.add(new TL2DataSnapshot.EntityDefinitions(entityRowDefs)); // add rows for entities for (Entity ent : ents) { entityRowDefs = newEntityRowDefs( experimentProperties, data_descs_with_ent, ent, tldata_hidden_mask, tldata_cnames, show_states, show_charts, time_origin, comparing); entityList.add(new TL2DataSnapshot.EntityDefinitions(entityRowDefs)); } return entityList; } private boolean tryAdd( List<PropDescriptor> chartProps, final DataDescriptor dataD, final String propName) { PropDescriptor prop = dataD.findProp(propName); if (prop != null) { String[] stateNames = prop.getStateNames(); if (stateNames == null) { // value chart chartProps.add(prop); return true; } else { // state chart // ... do not chart items that have only one state int nStates = 0; int maxstates = prop.getStateNames().length; for (int ii = 0; ii < maxstates; ii++) { if (stateNames[ii] != null) { nStates++; } } if (nStates > 1) { chartProps.add(prop); return true; } } } return false; } // TBR? transfer this logic into event details classes? private List<PropDescriptor> getChartProps( final DataDescriptor dataD, final boolean show_states, final boolean show_charts) { List<PropDescriptor> chartProps = new ArrayList<>(); Settings.TLData_type tltype = dataD.getTLDataType(); if (tltype.equals(Settings.TLData_type.TL_SAMPLE)) { if (show_charts) { chartProps.add(PROP_EVT_COUNT); } } else if (tltype.equals(Settings.TLData_type.TL_CLOCK)) { if (show_states) { tryAdd(chartProps, dataD, "MSTATE"); // See MSTATE_COLORS_BY_OVERVIEW_IDX // tryAdd( chartProps, dataD, "OMPSTATE" );// See <TBD>TL_UNKNOWN_GENERIC_COLOR_TABLE // tryAdd( chartProps, dataD, "MPISTATE" );// See <TBD>TL_UNKNOWN_GENERIC_COLOR_TABLE } if (show_charts) { chartProps.add(PROP_EVT_COUNT); } } else if (tltype.equals(Settings.TLData_type.TL_SYNC)) { if (show_charts) { tryAdd(chartProps, dataD, "EVT_TIME"); } } else if (tltype.equals(Settings.TLData_type.TL_IOTRACE)) { if (show_states) { tryAdd(chartProps, dataD, "IOTYPE"); // See TL_IOTRACE_IOTYPE_COLOR_TABLE } if (show_charts) { tryAdd(chartProps, dataD, "EVT_TIME"); } } else if (tltype.equals(Settings.TLData_type.TL_HEAP)) { if (show_states) { tryAdd(chartProps, dataD, "HTYPE"); // See TL_HEAP_HTYPE_COLOR_TABLE } if (show_charts) { tryAdd(chartProps, dataD, "HSIZE"); } } else if (tltype.equals(Settings.TLData_type.TL_HEAPSZ)) { tryAdd(chartProps, dataD, "HCUR_ALLOCS"); tryAdd(chartProps, dataD, "HCUR_LEAKS"); // if(show_states){ // tryAdd( chartProps, dataD, "HTYPE" );// See TL_HEAP_HTYPE_COLOR_TABLE // } } else if (tltype.equals(Settings.TLData_type.TL_MPI)) { if (show_states) { // tryAdd( chartProps, dataD, "MPITYPE" );// See <TBD>TL_UNKNOWN_GENERIC_COLOR_TABLE } if (show_charts) { // tryAdd( chartProps, dataD, "MPISCOUNT" ); // tryAdd( chartProps, dataD, "MPIRCOUNT" ); // tryAdd( chartProps, dataD, "MPISBYTES" ); // tryAdd( chartProps, dataD, "MPIRBYTES" ); chartProps.add(PROP_EVT_COUNT); } } else if (tltype.equals(Settings.TLData_type.TL_RACES)) { if (show_states) { // tryAdd( chartProps, dataD, "RTYPE" );// See <TBD>TL_UNKNOWN_GENERIC_COLOR_TABLE } if (show_charts) { chartProps.add(PROP_EVT_COUNT); } } else if (tltype.equals(Settings.TLData_type.TL_GCEVENT)) { // CXXX Bug 20801848 if (show_charts) { chartProps.add(PROP_EVT_COUNT); } } else { if (show_charts) { chartProps.add(PROP_EVT_COUNT); } } return chartProps; } private List<RowDefinition> newEntityRowDefs( final ExperimentProperties experimentProperties, final List<DataDescriptor> dscrList, final Entity ent, final long tldata_hidden_mask, final List<String> tldata_cnames, final boolean show_states, final boolean show_charts, final long time_origin, final boolean comparing) { final List<RowDefinition> rawDataRows = new ArrayList<>(); for (DataDescriptor dataD : dscrList) { int auxmax = dataD.getAuxCount(); if (auxmax == 0) { // descriptor doesn't contain multiple types auxmax = 1; } for (int aux = 0; aux < auxmax; aux++) { String tldata_cmd = dataD.getErRcTLDataCmdName(aux); if (!descriptorIsEnabled(tldata_cmd, tldata_hidden_mask, tldata_cnames)) { continue; } List<PropDescriptor> chartProps = getChartProps(dataD, show_states, show_charts); RowDefinition row = new RowDefinition( experimentProperties, ent, dataD, aux, chartProps, time_origin, comparing); rawDataRows.add(row); } } return rawDataRows; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TL2CoordCalcData.java������������������������������������0000644�0001750�0001750�00000027150�15044710303�021431� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.timeline_common.CoordCalcDataMaster; import java.util.ArrayList; /** * Coordinate calculator for timeline rows * * <p>Coordinate systems used: * * <p>"vcoord": coordinate system to represent user rows on screen where Zero corresponds to upper * edge of first row. "canvas": coordinate system of canvas. Scrollbar and margins are added to * vcoord. * * <p>Note: A lot of the complexity in this class is related to vertical zoom, a feature which is * currently disabled. */ public class TL2CoordCalcData extends CoordCalcDataMaster { // --- total range of rows to be displayed private int abs_row_end = 0; // absolute end row (at full zoom out) private int abs_row_count = 0; // number of rows (at full zoom out) // --- canvas size private int canvasPixels = 0; // --- zoom range (value [0.0-1.0] corresponds to [0-vcoord_total_pixels]) private boolean use_rows_for_range = false; // rows or percent to set range? private double visible_start_pct = 0.0; // visible start (% of total) private double visible_end_pct = 1.0; // visible end (% of total) private int visible_start_row = 0; // visible start (row) private int visible_end_row = 0; // visible start (row) // --- state private boolean is_initialized = false; // edt_revalidate() has been called at least once private boolean needs_compute = false; private int vcoord_visible_top = 0; // vcoord offset to start of visible data // --- row layout (vcoord) private ArrayList<Integer> vcoord_row_tops; // row upper edge (unscaled) private ArrayList<Integer> vcoord_row_bottoms; // row lower edge (unscaled) private int vcoord_total_pixels = 1; // total size of all rows (unscaled) // preferences private final int canvasY_header = 0; // optional vertical offset private final int canvasY_margin; // space between TL and ruler public static final double HUNDRED_PERCENT_ROUNDUP = 0.999; public TL2CoordCalcData(int canvas_margin) { canvasY_margin = canvas_margin; } // --- canvas geometry /** Sets current canvas height */ @Override public void setCanvasPixels(int visiblePixels) { if (canvasPixels != visiblePixels) { canvasPixels = visiblePixels; needs_compute = true; } } /** Gets current canvas height */ public int getCanvasPixels() { return canvasPixels; } // --- row geometry settings @Override public void edt_revalidate() { // setAbsRowMinHeight*() must be called first if (needs_compute) { calculateRowSizes(); needs_compute = false; } is_initialized = true; } /** sets variables used to calculate row height */ private void calculateRowSizes() { // update vcoord_visible_top if (vcoord_row_tops == null) { vcoord_total_pixels = 1; vcoord_visible_top = 0; needs_compute = false; return; } double requested_pct = visible_end_pct - visible_start_pct; double avail_pct = (double) getAvailPixels() / vcoord_total_pixels; if (avail_pct > 1.0) { avail_pct = 1.0; } if (requested_pct < avail_pct) { // enough space to show more; expand range double center_pct = (visible_end_pct + visible_start_pct) / 2; visible_start_pct = center_pct - avail_pct / 2; visible_end_pct = center_pct + avail_pct / 2; } if (visible_start_pct < 0) { // shift range to start at 0 visible_end_pct += (0 - visible_start_pct); visible_start_pct = 0; } if (visible_end_pct > 1.0) { // shift range to end below %100 visible_start_pct -= (visible_end_pct - 1.0); visible_end_pct = 1.0; } if (visible_start_pct < 0) { visible_start_pct = 0; // weird, request was greater than %100 } visible_start_row = getRowNearPercent(visible_start_pct); visible_end_row = getRowNearPercent(visible_end_pct); vcoord_visible_top = (int) (vcoord_total_pixels * visible_start_pct); needs_compute = false; } /** margins allow states along edges to be visible and accessible */ public int getMargin() { return canvasY_margin; } public boolean isInitialized() { return is_initialized; } public boolean isValid() { return !needs_compute; } // --- row range private void setAbsRowCount(int rowCount) { int end = rowCount > 0 ? rowCount - 1 : 0; if (abs_row_count != rowCount || abs_row_end != end) { abs_row_count = rowCount; abs_row_end = end; needs_compute = true; } } public int getAbsRowEnd() { return abs_row_end; } public int getAbsRowCount() { return abs_row_count; } private void internalSetRowHeights(ArrayList<Integer> mins, int rowCount, int minPixels) { int absRowCount = (mins != null) ? mins.size() : rowCount; setAbsRowCount(absRowCount); int total_used = 0; if (absRowCount == 0) { vcoord_row_tops = vcoord_row_bottoms = null; needs_compute = true; } else { ArrayList<Integer> new_vcoord_row_tops = new ArrayList<>(absRowCount); ArrayList<Integer> new_vcoord_row_bottoms = new ArrayList<>(absRowCount); for (int ii = 0; ii < absRowCount; ii++) { new_vcoord_row_tops.add(total_used); final int rowHeight; if (mins != null) { rowHeight = mins.get(ii); } else { rowHeight = minPixels; } total_used += rowHeight; new_vcoord_row_bottoms.add(total_used); } for (int ii = 0; !needs_compute && ii < absRowCount; ii++) { if (new_vcoord_row_tops.get(ii) != vcoord_row_tops.get(ii) || new_vcoord_row_bottoms.get(ii) != vcoord_row_bottoms.get(ii)) { needs_compute = true; } } vcoord_row_tops = new_vcoord_row_tops; vcoord_row_bottoms = new_vcoord_row_bottoms; } // set unscaled row layout vcoord_total_pixels = total_used; if (vcoord_total_pixels < 1) { vcoord_total_pixels = 1; } edt_revalidate(); // visible_start_row = getRowNearPercent(visible_start_pct); // visible_end_row = getRowNearPercent(visible_end_pct); } public void setAbsRowMinHeights(int rowCount, int minPixels) { internalSetRowHeights(null, rowCount, minPixels); } public void setAbsRowMinHeights(ArrayList<Integer> mins) { internalSetRowHeights(mins, 0, 0); } public void setExpandToFill(boolean expands) {} public void setRowRange(int startrow, int endrow) { // snap to row not implemented at this time } public int getRowStart() { return visible_start_row; } public int getRowEnd() { return visible_end_row; } public int getRowCount() { return visible_end_row - visible_start_row + 1; } public void setVisibleRange(double start, double end) { if (use_rows_for_range != false || visible_start_pct != start || visible_end_pct != end) { use_rows_for_range = false; visible_start_pct = start; visible_end_pct = end; visible_start_row = getRowNearPercent(visible_start_pct); visible_end_row = getRowNearPercent(visible_end_pct); needs_compute = true; } } public double getVisibleStart() { return visible_start_pct; } public double getVisibleEnd() { return visible_end_pct; } public double getVisiblePercent() { return visible_end_pct - visible_start_pct; } // ---------- computed values ---------- private int vcoord2canvas(int vy) { int canvasY = vy - vcoord_visible_top + (canvasY_margin + canvasY_header); return canvasY; } private int canvas2vcoord(int canvasY) { int vy = canvasY + vcoord_visible_top - (canvasY_margin + canvasY_header); return vy; } public int getAvailPixels() { int availHeight = canvasPixels - canvasY_margin * 2; if (availHeight < 1) { availHeight = 1; } return availHeight; } public int getTotalPixels() { // YXXX unused return vcoord_total_pixels; } public int getMinPixelsForAllRows() { return vcoord_total_pixels; } public int getMinPixelsRequired(int row_lo, int row_hi) { // YXXX unused if (vcoord_row_tops == null) { return 0; } int top = vcoord_row_tops.get(row_lo); int bottom = vcoord_row_tops.get(row_hi); return bottom - top; } /** Get top coordinate for the ith row */ public int getLowCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vy = vcoord_row_tops.get(yrow); int y = vcoord2canvas(vy); return y; } /** Get center coordinate for the ith row */ public int getCenterCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vyt = vcoord_row_tops.get(yrow); int vyb = vcoord_row_bottoms.get(yrow); int vy = (vyt + vyb) / 2; int y = vcoord2canvas(vy); return y; } /** Get bottom coordinate for the ith row */ public int getHighCoordForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int vy = vcoord_row_bottoms.get(yrow); int y = vcoord2canvas(vy); return y; } // will return -1 if yy is between states public int getRowAtCoord(int canvasY) { // YXXX this might no longer be needed int idx = internalCoord2Row(canvasY); if (idx >= getAbsRowCount()) { return -1; } return idx; } // always returns a valid row num public int getRowNearCoord(int canvasY) { int idx = internalCoord2Row(canvasY); int nrows = getAbsRowCount(); if (idx < 0) { return 0; } else if (idx >= nrows) { return nrows - 1; } return idx; } // always returns a valid row num private int internalCoord2Row(int canvasY) { if (vcoord_row_tops == null) { return -1; } int vy = canvas2vcoord(canvasY); if (vy < 0) { return -1; } int nrows = getAbsRowCount(); for (int ii = 0; ii < nrows; ii++) { if (vy >= vcoord_row_tops.get(ii) && vy < vcoord_row_bottoms.get(ii)) { return ii; } } return nrows; } public double getPercentNearCoord(int canvasY) { if (vcoord_row_tops == null) { return 0; } int vy = canvas2vcoord(canvasY); double percent = (double) vy / vcoord_total_pixels; return percent; } public double getCenterPercentForRow(int yrow) { if (vcoord_row_tops == null) { return 0; } int uy = (vcoord_row_tops.get(yrow) + vcoord_row_bottoms.get(yrow)) / 2; double percent = (double) uy / vcoord_total_pixels; return percent; } public double getRowPercentOfTotal(int yrow) { if (vcoord_row_tops == null) { return 0; } int uy = vcoord_row_bottoms.get(yrow) - vcoord_row_tops.get(yrow); double percent = (double) uy / vcoord_total_pixels; return percent; } public int getRowNearPercent(double percent) { if (vcoord_row_tops == null) { return 0; } int uy = (int) (vcoord_total_pixels * percent); if (uy <= 0) { return 0; } int nrows = getAbsRowCount(); for (int ii = 0; ii < nrows - 1; ii++) { if (uy >= vcoord_row_tops.get(ii) && uy < vcoord_row_bottoms.get(ii)) { return ii; } } return nrows - 1; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/RowData.java���������������������������������������������0000644�0001750�0001750�00000005644�14744453367�020055� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.timeline2.data.*; // RowData contains per-row event data that must be synchronized between // a worker fetch thread and the AWT thread. // // In order to minimize MT risks, AWT-only data should not go into this class. public class RowData { // final public final RowDefinition rowDefinition; // immutable public final int idx; // location within RowData list (stable for life of snapshot) // dynamic data from gp-display-text private RowDataRequestParams params; private GenericEvent[] events; // primary row events private Object[] perPropChartData; // chart data private boolean dataValid = false; public RowData(RowDefinition rowDefinition, int idx) { this.rowDefinition = rowDefinition; this.idx = idx; } // --- the following should only be called from data fetcher public synchronized RowDataRequestParams getParams() { return params; } public synchronized void setEventData( RowDataRequestParams params, GenericEvent[] events, Object[] perPropData) { this.params = params; this.dataValid = true; this.events = events; this.perPropChartData = perPropData; } public synchronized RowData grabEventData() { RowData rowData = new RowData(rowDefinition, idx); rowData.params = this.params; rowData.dataValid = this.dataValid; rowData.events = this.events; rowData.perPropChartData = this.perPropChartData; return rowData; } public synchronized void invalidateEventData() { this.params = null; this.dataValid = false; this.events = null; this.perPropChartData = null; } public synchronized boolean eventDataIsValid() { // set to FALSE when data is invalid, set to TRUE after data is valid return dataValid; } // --- the following can be called by any thread (e.g. paint thread) public RowDefinition getRowDef() { // does not contain changing data; not synchronized return rowDefinition; } public synchronized GenericEvent[] getEvents() { return events; } public synchronized Object getChartData(int idx) { if (perPropChartData == null) { return null; } if (idx < 0 || idx >= perPropChartData.length) { return null; // weird } return perPropChartData[idx]; } } ��������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TimelineView.java����������������������������������������0000644�0001750�0001750�00000111626�15044710303�021067� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnEvent; import org.gprofng.mpmt.AnListener; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.TimelineSetting; import org.gprofng.mpmt.timeline_common.TimelinePanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSplitPane; import javax.swing.KeyStroke; /** * Derived from MPITimelineDisp.java * * <p>computed==true: -> use current TL2DataSnapshot, but always refetch rows updated==true: -> use * current TL2DataSnapshot and reuse row data if possible (repaint will handle fetching row data * from a TL2DataSnapshot) */ public final class TimelineView extends AnDisplay implements ExportSupport, AnChangeListener { // Created and owned by this class: private final MetaExperiment metaExperiment; // components private JPanel callStackPane; // right hand tab pane private JPanel detailsInfoTabComp; // details private TL2ControlPanel controlPanel; // control panel in rhTabPane private JPanel leftTabPanel; // left tab panel private TimelinePanel timelinePanel; // generic timeline framework private TL2Drawer drawer; // timeline data + drawer // private MPITLDrawer drawer; // timeline data + drawer // computing state private boolean fetchingNewExperiments = false; // Constructor public TimelineView() { super(AnWindow.getInstance(), AnDisplay.DSP_Timeline, AnVariable.HELP_TabsTimeline); // listen for color chooser changes window .getColorChooser() .getColorMap() .addAnListener( new AnListener() { @Override public void valueChanged(AnEvent e) { repaintTLDrawer(); } }); metaExperiment = new MetaExperiment(window, this); // YXXX potential race; leaks this in constructor instantiateTimelineDrawer(); // creates timelinePanel, drawer, etc. setAccessibility(AnLocale.getString("Timeline")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("TimelineView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: computed = false; fetchingNewExperiments = true; if (e.getType() == AnChangeEvent.Type.EXPERIMENTS_LOADING_NEW) { edt_resetAll(); // YXXX includes resetting anWindow.getColorChooser() colors } else { edt_resetExperiments(); } break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: edt_clearRows(); // clear previous row data, stops background IPC computed = false; break; case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGING: case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); switch (anSettingChangeEvent.getType()) { case VIEW_MODE: case LIBRARY_VISIBILITY: case FORMAT: if (e.getType() == AnChangeEvent.Type.SETTING_CHANGING) { edt_clearRows(); // clear previous row data, stops background IPC } computed = false; if (selected) { computeOnAWorkerThread(); } break; case TIMELINE: // stack height, group-by, which properties to show if (e.getType() == AnChangeEvent.Type.SETTING_CHANGING) { break; // these can happen quickly; just handle CHANGED event } List newSettings = (List) anSettingChangeEvent.getNewValue(); boolean[] ret = edt_settingsChanged(newSettings); boolean newExperimentFetchNeeded = ret[0]; boolean drawNeeded = ret[1]; if (newExperimentFetchNeeded) { computed = false; if (selected) { computeOnAWorkerThread(); } } else if (drawNeeded) { repaintTLDrawer(); } break; default: break; } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void requestFocus() { if (timelinePanel != null) { timelinePanel.requestFocus(); } } @Override public JPopupMenu getFilterPopup() { return controlPanel.getFilterPopup(); } protected void initComponentsXXXmpview() {} // Is current selected tab? @Override public void setSelected(final boolean set) { // called from AWT thread final JSplitPane splitPane; // YXXX RE_FACTOR super.setSelected(set); // enableAction(set); // Show right pane if we get selected // if (set) { // window.showRightPane(); // } } // tab to populate right-side info area public JComponent getStackInfoTabComp() { return callStackPane; } public JComponent getDetailsInfoTabComp() { return detailsInfoTabComp; } // name for tab in right-side info area public String getStackInfoTabName() { return AnLocale.getString("Call Stack - Timeline"); // YXXX javadoc } // name for tab in right-side info area public String getDetailsInfoTabName() { return AnLocale.getString("Selection Details"); // YXXX javadoc } class FocusPanel extends JPanel { @Override public void requestFocus() { if (controlPanel != null) { controlPanel.getStackViewPane().requestFocus(); } } } // Minimal initialize of GUI components. Should not do IPC. // NOTE: called by super() init; other class variables not initted yet(!) @Override protected void initComponents() { this.setLayout(new BorderLayout()); // right hand tab callStackPane = new FocusPanel(); callStackPane.setLayout(new BorderLayout()); detailsInfoTabComp = new JPanel(); detailsInfoTabComp.setLayout(new BorderLayout()); // main tab leftTabPanel = new JPanel(); leftTabPanel.setLayout(new BorderLayout()); // YXXX ally also set in AnWindow.java... String accessibleName = AnLocale.getString("Timeline"); leftTabPanel.getAccessibleContext().setAccessibleName(accessibleName); leftTabPanel.getAccessibleContext().setAccessibleDescription(accessibleName); leftTabPanel.setToolTipText(accessibleName); this.add(leftTabPanel, BorderLayout.CENTER); this.revalidate(); String ks_string; KeyStroke ks_def; ks_def = KeyboardShortcuts.contextMenuActionShortcut; this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_def); this.getActionMap() .put( ks_def, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.showContextMenu(ev); } } }); ks_string = "FIRST"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectFirst(); } } }); ks_string = "ENTER"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel.getTimelinePanel()) { controlPanel.getTimelinePanel().zoomToCaliper(); } } }); ks_string = "CENTERTIMESEL"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.findTimeMarker(); } } }); ks_string = "CENTEREVENTSEL"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_F, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectFind(); } } }); // --- plain arrows ks_string = "LEFT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectLeft(); } } }); ks_string = "RIGHT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectRight(); } } }); ks_string = "UP"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectUp(); } } }); ks_string = "DOWN"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectDown(); } } }); // --- shift ctrl arrows ks_string = "SHIFTCTRLLEFT"; ks_def = KeyStroke.getKeyStroke( KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.pageLeft(); } } }); ks_string = "SHIFTCTRLRIGHT"; ks_def = KeyStroke.getKeyStroke( KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.pageRight(); } } }); ks_string = "SHIFTCTRLUP"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.pageUp(); } } }); ks_string = "SHIFTCTRLDOWN"; ks_def = KeyStroke.getKeyStroke( KeyEvent.VK_DOWN, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.pageDown(); } } }); // --- shift arrows ks_string = "SHIFTLEFT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectLeft(false, true); } } }); ks_string = "SHIFTRIGHT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectRight(false, true); } } }); ks_string = "SHIFTUP"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectUp(false, true); } } }); ks_string = "SHIFTDOWN"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.selectDown(false, true); } } }); // --- ctrl arrows ks_string = "CTRLLEFT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.stepLeft(); } } }); ks_string = "CTRLRIGHT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.stepRight(); } } }); ks_string = "CTRLUP"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.stepUp(); } } }); ks_string = "CTRLDOWN"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.stepDown(); } } }); // --- zoom ks_string = "ZOOMIN"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.genericZoomIn(); } } }); ks_string = "ZOOMINE"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.genericZoomIn(); } } }); ks_string = "ZOOMOUT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.genericZoomOut(); } } }); if (true) { // Thomas' race condition needs to be sorted out first // --- height ks_string = "VZOOMIN"; ks_def = KeyStroke.getKeyStroke( KeyEvent.VK_EQUALS, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { int sd = window.getSettings().getTimelineSetting().getTLStackDepth() + 1; window.getSettings().getTimelineSetting().setTLStackDepth(TimelineView.this, sd); } }); ks_string = "VZOOMINE"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { int sd = window.getSettings().getTimelineSetting().getTLStackDepth() + 1; window.getSettings().getTimelineSetting().setTLStackDepth(TimelineView.this, sd); } }); ks_string = "VZOOMOUT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { int sd = window.getSettings().getTimelineSetting().getTLStackDepth() - 1; if (sd >= 0) { window .getSettings() .getTimelineSetting() .setTLStackDepth(TimelineView.this, sd); } } }); } ks_string = "ZOOMRESET"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_0, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.resetZoom(); } } }); ks_string = "ZOOMUNDO"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.undoZoom(); } } }); ks_string = "ZOOMREDO"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != controlPanel) { controlPanel.redoZoom(); } } }); ks_string = "CENTERTIMEMARKER"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.setTimeMarker(); } } }); ks_string = "MOVETIMEMARKERLEFT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.moveTimeMarkerLeft(); } } }); ks_string = "MOVETIMEMARKERRIGHT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, 0, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.moveTimeMarkerRight(); } } }); ks_string = "ADJUSTSELECTIONRANGELEFT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.moveTimeRangeToLeft(); } } }); ks_string = "ADJUSTSELECTIONRANGERIGHT"; ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_CLOSE_BRACKET, InputEvent.SHIFT_MASK, false); this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, ks_string); this.getActionMap() .put( ks_string, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { if (null != timelinePanel) { timelinePanel.moveTimeRangeToRight(); } } }); // ks_string = "COLORCHOOSER"; // ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_C, 0, false); // this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, // ks_string); // this.getActionMap().put(ks_string, new AbstractAction() { // @Override // public void actionPerformed(ActionEvent ev) { // window.getColorChooser().setVisible(true); // } // }); // // ks_string = "TIMELINESETTINGS"; // ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_S, 0, false); // this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, // ks_string); // this.getActionMap().put(ks_string, new AbstractAction() { // @Override // public void actionPerformed(ActionEvent ev) { // window.getSettings().showDialog(window.getSettings().settingsTimelineIndex); // } // }); } /** * Initialize the TimelinePanel and TL2ControlPanel objects and add them to the eventPane. Called * only from edt_threadDoCompute() */ private void instantiateTimelineDrawer() { // called from AWT thread drawer = new TL2Drawer(metaExperiment.getDataFetcher()); drawer .getDataAxisMaster() .setAbsRowMinHeights(drawer.getAbsoluteRowCount(), 100); // just some value to init calc timelinePanel = new TimelinePanel( drawer, TimelinePanel.MouseDragMode.MOUSE_GRABBING_MODE, TimelinePanel.MouseDragMode.MOUSE_SELECTION_MODE, TimelinePanel.MouseDragMode.MOUSE_GRABBING_MODE); drawer.setParent(timelinePanel); // YXXX yuck controlPanel = new TL2ControlPanel(window, timelinePanel, drawer); detailsInfoTabComp.add(controlPanel.getDetailsTextPanel()); callStackPane.add(controlPanel.getDetailsPanel(), BorderLayout.CENTER); callStackPane.revalidate(); JPanel toolbarPanel = new JPanel(new GridBagLayout()); toolbarPanel.setMinimumSize(new Dimension(10, 10)); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.weightx = 1.0; toolbarPanel.add(controlPanel.getToolbar(), gridBagConstraints); leftTabPanel.add(toolbarPanel, BorderLayout.NORTH); if (GUITesting.getInstance().isRunningUnderGUITesting()) { // Use a fixed size panel for GUI testing Dimension dim = new Dimension(820, 750); timelinePanel.setPreferredSize(dim); timelinePanel.setMinimumSize(dim); timelinePanel.setMaximumSize(dim); timelinePanel.setSize(dim); JPanel tmpPanel = new JPanel(); tmpPanel.add(timelinePanel); timelinePanel.setBorder(BorderFactory.createLineBorder(Color.darkGray, 1)); leftTabPanel.add(tmpPanel, BorderLayout.CENTER); } else { leftTabPanel.add(timelinePanel, BorderLayout.CENTER); } leftTabPanel.revalidate(); } @Override public void doCompute() { // called by "Display_thread" AnUtility.checkIfOnAWTThread(false); if (!selected) { return; } if (!computed) { metaExperiment.ipcUpdateRows(); // IPC! } timelinePanel.repaint(); computed = true; } // presentation settings delivered via AnSettingChangeEvent.Type.TIMELINE //can be AWT thread public boolean[] edt_settingsChanged(List new_tm) { // presentation:timeline settings were changed final String new_entity_prop_name; final int new_entity_button_num; final Settings.TLStack_align new_stack_align; final int new_vzoom_level; final int new_stack_frame_pixels; final long new_tldata_hidden_mask; // unchecked tldata boxes final List<String> new_tldata_cnames; // (samples, ...) final List<String> new_tldata_unames; // (samples, ...) final int new_tldata_names_version; final boolean tldata_show_states, tldata_show_charts; // final ArrayList new_tm;// populated by Presentation.java // new_tm = (ArrayList) event.getAux(); new_entity_prop_name = (String) new_tm.get(0); new_entity_button_num = ((Integer) new_tm.get(1)).intValue(); new_stack_align = (Settings.TLStack_align) new_tm.get(2); new_vzoom_level = ((Integer) new_tm.get(3)).intValue(); new_tldata_hidden_mask = ((Long) new_tm.get(4)).longValue(); new_tldata_cnames = (List<String>) new_tm.get(5); new_tldata_unames = (List<String>) new_tm.get(6); new_tldata_names_version = ((Integer) new_tm.get(7)).intValue(); tldata_show_states = ((Boolean) new_tm.get(8)).booleanValue(); tldata_show_charts = ((Boolean) new_tm.get(9)).booleanValue(); new_stack_frame_pixels = ((Integer) new_tm.get(10)).intValue(); TimelineSetting.EntityProp entityProp = AnWindow.getInstance() .getSettings() .getTimelineSetting() .getTl_entity_prop(new_entity_button_num); if (entityProp == null) { return new boolean[] {false, false}; // weird } // set up next snapshot boolean drawNeeded = edt_updatePresentationDrawingOptions( new_stack_align, new_vzoom_level, new_stack_frame_pixels); boolean fetchNeeded = metaExperiment.edt_updatePresentationFetchOptions( entityProp, new_tldata_hidden_mask, tldata_show_states, tldata_show_charts, new_tldata_cnames, new_tldata_unames, new_tldata_names_version); return new boolean[] {fetchNeeded, drawNeeded}; } private boolean edt_updatePresentationDrawingOptions( // AWT only! final Settings.TLStack_align new_stack_align, final int new_vzoom_level, final int new_stack_frame_pixels) { boolean updated = false; if (drawer.event_drawer.getStackAlign() != new_stack_align) { drawer.event_drawer.setStackAlign(new_stack_align); updated = true; } if (drawer.event_drawer.getVZoomLevel() != new_vzoom_level) { drawer.event_drawer.setVZoomLevel(new_vzoom_level); drawer.event_drawer.edt_recalcRowOffsets(); if (timelinePanel != null) { timelinePanel.edt_revalidateAll(false); } updated = true; } if (drawer.event_drawer.getStackFramePixels() != new_stack_frame_pixels) { drawer.event_drawer.setStackFramePixels(new_stack_frame_pixels); updated = true; } return updated; } // YXXX not @Override? public void setCPUIdleColor(final boolean set, final Color color) { // YXXX this is retarded drawer.event_drawer.setCPUIdleColor(set, color); repaintTLDrawer(); } public void repaintTLDrawer() { // Called from data fetcher worker thread if (selected) { timelinePanel.repaint(); } } // Reset row data, stops background IPC for row fetching (force a new data snapshot, recheck // experiments) private void edt_clearRows() { // e.g. filters, user/expert/machine mode, TL presentation // create a new TL2DataSnapshot because row definitions may have changed metaExperiment.resetCurrentActivity(); // triggers repaint } // Clear display private void edt_resetExperiments() { // e.g. add/drop experiments controlPanel.resetStackView(); // FIXUP: RE_ARCH metaExperiment.resetCurrentActivity(); // triggers repaint timelinePanel.edt_resetExperiments(); } private void edt_resetAll() { // e.g. Open Experiment controlPanel.edt_resetAll(); metaExperiment.edt_resetAll(); // resets TL2DataSnapshot. Also triggers repaint drawer.edt_resetAll(); timelinePanel.edt_resetAll(); // may depend on TL2DataSnapshot being reset } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { if (GUITesting.getInstance().isRunningUnderGUITesting()) { System.out.println("timelinePanel dimensions: " + timelinePanel.getSize()); } StringBuilder buf = new StringBuilder(); // buf.append(controlPanel.exportAsText(limit)); // buf.append(timelinePanel.exportAsText(limit)); buf.append(drawer.event_drawer.exportAsText(limit)); return buf.toString(); } @Override public java.util.List<ExportFormat> getSupportedExportFormats() { java.util.List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubviewTimeLine()); list.add(window.getTimelineCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubviewTimeLine()); list.add(window.getTimelineCallStackSubview()); return list; } } ����������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/TimelineSelectionEvent.java������������������������������0000644�0001750�0001750�00000011133�14744453367�023120� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.timeline.events.DetailsIPC; import org.gprofng.mpmt.timeline.events.EventDetail; import org.gprofng.mpmt.timeline_common.TimelineSelectionGenericEvent; import java.util.Vector; /** * Holds information about the selected timeline event. * * <p>Code is based on old timeline events and MPITL event selection. */ public class TimelineSelectionEvent extends TimelineSelectionGenericEvent { public static final long EVT_IDX_INVALID = -1; // note: value used in IPC public enum CursorAxis { UP_DOWN, LEFT_RIGHT, NA }; public final EventDetail eventDetail; // null for unknown public final int rowNum; // if -1, equivelant to "unselect" private final RowGeometry rowGeometry; // identifies row information, may be null private final RowDefinition rowDefinition; // identifies row information, may be null public final long stackId; // DetailsIPC.INVALID_STACK_ID for unknown private final Vector<StackState> stackFrames; // null for unknown // cursor movements that can be applied w.r.t. this selection public final boolean left; public final boolean right; public final boolean up; public final boolean down; public final boolean find; public final long eventIdx; // EVT_IDX_INVALID if no event under cursor; not valid after filter public final long clickTime; // time-location of mouse click, must be valid public final long eventTimeStart; public final long eventTimeEnd; public final boolean ctrlKey; public final boolean shiftKey; public final CursorAxis moveAxis; public final boolean requestCaliperUpdate; public final boolean updateRowSelections; public TimelineSelectionEvent() { // the "unselect" event this.rowNum = -1; // flags this as an unselect event this.rowGeometry = null; this.rowDefinition = null; this.eventDetail = null; this.stackId = DetailsIPC.INVALID_STACK_ID; this.stackFrames = null; left = right = up = down = find = false; this.eventIdx = EVT_IDX_INVALID; this.clickTime = 0; this.eventTimeStart = clickTime; this.eventTimeEnd = clickTime; this.ctrlKey = false; this.shiftKey = false; this.moveAxis = CursorAxis.NA; this.requestCaliperUpdate = false; this.updateRowSelections = false; } public TimelineSelectionEvent( RowGeometry rowGeometry, long clickTime, boolean ctrlKey, boolean shiftKey, CursorAxis axis, EventDetail evt, Vector<StackState> stackFrames, boolean left, boolean right, boolean up, boolean down, long eventIdx, long eventStartTime, long eventEndTime, boolean requestCaliperUpdate, boolean updateRowSelections) { this.rowGeometry = rowGeometry; if (rowGeometry == null) { this.rowNum = -1; this.rowDefinition = null; } else { this.rowNum = rowGeometry.rowNum; this.rowDefinition = rowGeometry.rowData.rowDefinition; } this.eventDetail = evt; if (evt == null) { this.stackId = DetailsIPC.INVALID_STACK_ID; } else { this.stackId = evt.getStack(); } this.stackFrames = stackFrames; this.left = left; this.right = right; this.up = up; this.down = down; this.eventIdx = eventIdx; this.find = (eventIdx != EVT_IDX_INVALID); this.clickTime = clickTime; this.eventTimeStart = eventStartTime; this.eventTimeEnd = eventEndTime; this.ctrlKey = ctrlKey; this.shiftKey = shiftKey; this.moveAxis = axis; this.requestCaliperUpdate = requestCaliperUpdate; this.updateRowSelections = updateRowSelections; } public RowGeometry getRowGeometry() { return rowGeometry; // may be null } public RowDefinition getRowDefinition() { return rowDefinition; // may be null } public Vector<StackState> getStackFrames() { Vector<StackState> vec = (Vector<StackState>) stackFrames.clone(); return vec; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/timeline2/MetaExperiment.java��������������������������������������0000644�0001750�0001750�00000054513�15044710303�021416� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.timeline2; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.experiment_props.ExperimentProperties; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.TimelineSetting; import org.gprofng.mpmt.timeline2.TL2DataSnapshot.EntityDefinitions; import org.gprofng.mpmt.timeline2.TL2DataSnapshot.ExperimentDefinitions; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; // MetaExperiment is a container for holding multiple Experiments. // NOTE: Synchronization on this object is required because calls may come from // more than one thread. public final class MetaExperiment { // set by constructor parameters private final AnWindow w_IPC; // created and owned by this class: private final TL2DataFetcher tl2DataFetcher; private final TLExperiment tlExperiment; // timeline fetch settings private TimelineSetting.EntityProp entity_prop = null; // Row mode: CPU, THREAD, etc. private long tldata_hidden_mask; private boolean tldata_show_states; private boolean tldata_show_charts; private List<String> tldata_cnames; private List<String> tldata_unames; private int tldata_unames_version; // Constructor public MetaExperiment( final AnWindow awindow, final TimelineView timelineView) { // TimelineView only for doRepaint() this.w_IPC = awindow; this.tl2DataFetcher = new TL2DataFetcher(timelineView, awindow); this.tlExperiment = new TLExperiment(); init_tldata_settings(); } private void init_tldata_settings() { entity_prop = null; // Row mode: CPU, THREAD, etc. tldata_hidden_mask = 0; tldata_show_states = false; tldata_show_charts = false; tldata_cnames = new ArrayList<>(); tldata_unames = new ArrayList<>(); tldata_unames_version = -1; } public TL2DataFetcher getDataFetcher() { return tl2DataFetcher; } // --- public experiment interface ---- // clear(): old data is invalid so stop fetching and wait for *Update*() call public synchronized void resetCurrentActivity() { // action that precedes Update actions resetTimeData(); tl2DataFetcher.resetSnapshot(); } public synchronized void edt_resetAll() { // a fresh start e.g. "open experiment" // experiments.resetAll(); resetTimeData(); tl2DataFetcher.resetAll(); // YXXX: refactor: also clears color chooser colors init_tldata_settings(); } // Presentation row settings changed public synchronized boolean edt_updatePresentationFetchOptions( final TimelineSetting.EntityProp entity_prop, final long _tldata_hidden_mask, final boolean show_states, final boolean show_charts, final List<String> new_tldata_cnames, final List<String> new_tldata_unames, final int new_tldata_names_version) { boolean changed = false; if (this.entity_prop == null || this.entity_prop.prop_id != entity_prop.prop_id) { this.entity_prop = entity_prop; changed = true; } if (this.tldata_hidden_mask != _tldata_hidden_mask) { this.tldata_hidden_mask = _tldata_hidden_mask; changed = true; } if (this.tldata_show_states != show_states) { this.tldata_show_states = show_states; changed = true; } if (this.tldata_show_charts != show_charts) { this.tldata_show_charts = show_charts; changed = true; } if (this.tldata_unames_version != new_tldata_names_version) { this.tldata_unames_version = new_tldata_names_version; this.tldata_cnames = new ArrayList<>(new_tldata_cnames); this.tldata_unames = new ArrayList<>(new_tldata_unames); changed = true; } return changed; } public synchronized void ipcUpdateRows() { // generates a new TL2DataSnapshot //IPC! resetTimeData(); if (entity_prop == null) { tl2DataFetcher.setTL2DataSnapshot(null); return; } final int prop_id = entity_prop.prop_id; final calcExperimentTimeOriginsRC origins = calcExperimentTimeOrigins(false, true, true); List<ExperimentDefinitions> experimentList = new ArrayList<>(); final boolean comparing = w_IPC.getSettings().getCompareModeSetting().comparingExperiments(); // does not perform IPC List<ExperimentProperties> exps = w_IPC.getExperimentProperties().getAllExperimentProperties(); final int[] expIds = new int[exps.size()]; for (int ii = 0; ii < exps.size(); ii++) { expIds[ii] = exps.get(ii).getID(); } List<List<Entity>> entsList = ipcGetEntitiesV2(expIds, prop_id); for (int ii = 0; ii < entsList.size(); ii++) { ExperimentProperties expProps = exps.get(ii); List<Entity> ents = entsList.get(ii); int exp_id = expProps.getID(); List<EntityDefinitions> entityList = tlExperiment.createEntityRowDefinitions( expProps, ents, prop_id, tldata_hidden_mask, tldata_cnames, tldata_show_states, tldata_show_charts, origins.timeOrigins.get(exp_id), comparing); experimentList.add(new ExperimentDefinitions(entityList)); } experimentList = ipcPruneEmptyRows(experimentList); // IPC! TL2DataSnapshot tl2DataSnapshot; tl2DataSnapshot = new TL2DataSnapshot(entity_prop, experimentList, 0, origins.maxDuration); tl2DataFetcher.setTL2DataSnapshot(tl2DataSnapshot); } // --- internal stuff ---- private void resetTimeData() {} private List<ExperimentDefinitions> ipcPruneEmptyRows( // IPC! List<ExperimentDefinitions> experimentList) { List<ExperimentDefinitions> pruned = Collections.unmodifiableList(new ArrayList<>()); if (experimentList == null) { return pruned; } int sz = 0; for (ExperimentDefinitions expDef : experimentList) { for (EntityDefinitions entityDef : expDef.experimentEntities) { sz += entityDef.entityRows.size(); } } if (sz == 0) { return pruned; } int exp_ids[] = new int[sz]; int data_ids[] = new int[sz]; int entity_prop_ids[] = new int[sz]; int entity_prop_vals[] = new int[sz]; int hwctags[] = new int[sz]; int ii = 0; for (ExperimentDefinitions expDef : experimentList) { for (EntityDefinitions entityDef : expDef.experimentEntities) { for (RowDefinition row : entityDef.entityRows) { exp_ids[ii] = row.getExpID(); data_ids[ii] = row.getDataDescriptor().getDataId(); entity_prop_ids[ii] = row.getEntity().getPropId(); entity_prop_vals[ii] = row.getEntity().getPropValue(); hwctags[ii] = row.getAux(); ii++; } } } boolean[] hasData = ipcHasTLData( exp_ids, data_ids, // IPC! entity_prop_ids, entity_prop_vals, hwctags); if (hasData == null || hasData.length != sz) { return pruned; // weird } // only add rows for Entities that have data // note: each rowBlock corresponds to an entity ii = 0; ArrayList<ExperimentDefinitions> newExpList = new ArrayList<>(); for (ExperimentDefinitions expDef : experimentList) { ArrayList<EntityDefinitions> newEntityList = new ArrayList<>(); for (EntityDefinitions entityDef : expDef.experimentEntities) { boolean entityHasData = false; for (RowDefinition row : entityDef.entityRows) { if (hasData[ii]) { entityHasData = true; // break; can't break here because we have to increment ii } ii++; } if (entityHasData) { newEntityList.add(entityDef); } } if (!newEntityList.isEmpty()) { newExpList.add(new ExperimentDefinitions(newEntityList)); } } pruned = Collections.unmodifiableList(newExpList); return pruned; } // --- internal stuff ---- public static final long NANOSEC = 1000000000L; private class TimeConversion { // timestamps relating wall time to HRT nanoseconds: private final long ref_hrt_ns; // reference hrt snapshot // Time distance from reference to global (and recent) point in time private final long global_offset_ns; // nanosecond distance from ref to global point public TimeConversion(long ref_hrt_ns, long global_offset_ns) { this.ref_hrt_ns = ref_hrt_ns; this.global_offset_ns = global_offset_ns; } public long hrtToNormalizedWallNanoSec(long hrt) { final long hrt_delta = hrt - ref_hrt_ns; final long normalized_wall_ns = global_offset_ns + hrt_delta; return normalized_wall_ns; } public long normalizedWallNanoSecToHrt(long normalized_wall_ns) { final long hrt_delta = normalized_wall_ns - global_offset_ns; return hrt_delta + ref_hrt_ns; } } private class calcExperimentTimeOriginsRC { final Long maxDuration; final Map<Integer, Long> timeOrigins; // expId, computed timestamp @ origin calcExperimentTimeOriginsRC(Long maxDuration, Map<Integer, Long> timeOrigins) { this.maxDuration = maxDuration; this.timeOrigins = timeOrigins; } } private calcExperimentTimeOriginsRC calcExperimentTimeOrigins( final boolean forceAllLeft, // force founders and descendents left final boolean forceFoundersLeft, // force founders but not descedents left final boolean forceNonConcurrentLeft // force standalone founders left // final Map<Integer, Long> customOffsets ) { List<ExperimentProperties> expProps = w_IPC.getExperimentProperties().getAllExperimentProperties(); final Map<Integer, Long> rcTimeOrigins = new HashMap<>(); // key: expId, value: hrt of origin long rcMaxDuration = 0L; if (expProps == null || expProps.isEmpty()) { return new calcExperimentTimeOriginsRC(rcMaxDuration, rcTimeOrigins); } // loop thru all exps, save subexperiment-to-founder offsets if (forceFoundersLeft || forceAllLeft) { final Map<Integer, Long> offsets = new HashMap<>(); long minOffset = 0; for (ExperimentProperties exp : expProps) { final int expId = exp.getID(); long offset; if (forceAllLeft) { offset = 0; // start at experiment's origin } else { offset = exp.getTimeOffset(); // founder start } // if (customOffsets != null) { // final Long customOffset = customOffsets.get(expId); // if (customOffset != null) { // offset += customOffset; // } // } offsets.put(expId, offset); if (minOffset > offset) { // find the most negative offset minOffset = offset; } } // if(forceFoundersLeft || forceAllLeft){ // save per-experiment origin timestamp, as well as longest duration for (ExperimentProperties exp : expProps) { final int expId = exp.getID(); // normalize to minOffset so that leftmost start is at origin final long offset = offsets.get(expId) - minOffset; final long expOrigin = exp.getStartTime() - offset; final long expDuration = exp.getEndTime() - expOrigin; rcTimeOrigins.put(expId, expOrigin); rcMaxDuration = Math.max(expDuration, rcMaxDuration); } return new calcExperimentTimeOriginsRC(rcMaxDuration, rcTimeOrigins); } // Scan for founder experiments that are concurrent in time // We will left-align any founders that are not concurrent with others. // The following holds wall-to-hrtime reference values. // For a given host "epoch" (e.g. between reboots), // there should be only one pair of references used. // This is because the HRT and time of day ticks may not be synchronized class HostnameTimeRef { public final String hostname; private long wall_seconds; private long hrt; HostnameTimeRef(String hostname, long wall_seconds, long hrt) { this.hostname = hostname; this.wall_seconds = wall_seconds; this.hrt = hrt; } public boolean sameEpoch(HostnameTimeRef other) { if (!hostname.equals(other.hostname)) { return false; } final long wall_delta = (wall_seconds - other.wall_seconds) * NANOSEC; final long hrt_delta = hrt - other.hrt; final long delta = wall_delta - hrt_delta; if (Math.abs(delta) > 2 * NANOSEC) { return false; } return true; } public boolean isBetterRef(HostnameTimeRef other) { if (!sameEpoch(other)) { return false; } if (wall_seconds < other.wall_seconds) { return false; } if (hrt < other.hrt) { return false; } return true; } public void update(HostnameTimeRef other) { wall_seconds = other.wall_seconds; hrt = other.hrt; } } // Represents a blob of experiments that overlap in time: class ConcurrentExperiments { private final Map<Integer, ExperimentProperties> subexps; // expId key private final Map<Integer, HostnameTimeRef> hostInfo; // expId key private final Map<Integer, TimeConversion> timeInfo; // expId key private long start; private long end; private final long wallNormalizeSeconds; public ConcurrentExperiments(long wallNormalizeSeconds) { subexps = new HashMap<>(); hostInfo = new HashMap<>(); timeInfo = new HashMap<>(); start = Long.MAX_VALUE; end = Long.MIN_VALUE; this.wallNormalizeSeconds = wallNormalizeSeconds; } public boolean overlaps(ConcurrentExperiments other) { if (other == null) { return false; } if (start == Long.MAX_VALUE || end == Long.MIN_VALUE) { // anything overlaps with new object return true; // weird } if (other.start > end) { return false; } if (other.end < start) { return false; } return true; } private void updateRange(long start, long end) { if (this.start > start) { this.start = start; } if (this.end < end) { this.end = end; } } public void add(ExperimentProperties exp, HostnameTimeRef ref) { int expId = exp.getID(); long globalOffset = (ref.wall_seconds - wallNormalizeSeconds) * NANOSEC; // globalOffset += nanoSecCorrection; TimeConversion timeConv = new TimeConversion(ref.hrt, globalOffset); final long tmpStart = exp.getStartTime(); final long tmpEnd = exp.getEndTime(); final long localRefToStart = timeConv.hrtToNormalizedWallNanoSec(tmpStart); final long localRefToEnd = timeConv.hrtToNormalizedWallNanoSec(tmpEnd); updateRange(localRefToStart, localRefToEnd); subexps.put(expId, exp); hostInfo.put(expId, ref); timeInfo.put(expId, timeConv); } public void add(ConcurrentExperiments other) { if (other == null) { return; } updateRange(other.start, other.end); subexps.putAll(other.subexps); hostInfo.putAll(other.hostInfo); timeInfo.putAll(other.timeInfo); } public long getDuration() { if (start == Long.MAX_VALUE || end == Long.MIN_VALUE) { return 0; // weird } return end - start; } public long getExpHrtAtConcurrentStart(int expId) { if (start == Long.MAX_VALUE || end == Long.MIN_VALUE) { return 0; // weird } TimeConversion timeConv = timeInfo.get(expId); final long origin = timeConv.normalizedWallNanoSecToHrt(start); return origin; } } // create hostMap; maps experiments to canonical host wall-to-hrt reference values: long min_wall = Long.MAX_VALUE; long max_wall = Long.MIN_VALUE; Map<String, List<HostnameTimeRef>> hostMap = new HashMap<>(); // key hostname Map<Integer, HostnameTimeRef> expTimeRef = new HashMap<>(); // key expId for (ExperimentProperties exp : expProps) { String hostname = exp.getHostname(); if (min_wall > exp.getStartWallSeconds()) { min_wall = exp.getStartWallSeconds(); } if (max_wall < exp.getStartWallSeconds()) { max_wall = exp.getStartWallSeconds(); } HostnameTimeRef tmpRef = new HostnameTimeRef(hostname, exp.getStartWallSeconds(), exp.getStartTime()); List<HostnameTimeRef> timeRefs = hostMap.get(hostname); boolean found = false; if (timeRefs == null) { timeRefs = new ArrayList<>(); hostMap.put(hostname, timeRefs); } else { for (HostnameTimeRef hostRef : timeRefs) { if (hostRef.sameEpoch(tmpRef)) { if (hostRef.isBetterRef(tmpRef)) { hostRef.update(tmpRef); } tmpRef = hostRef; found = true; break; } } } if (!found) { timeRefs.add(tmpRef); } expTimeRef.put(exp.getID(), tmpRef); } if (max_wall - min_wall > Integer.MAX_VALUE) { int ii = 1; // weird! Will overflow when converted to nanoseconds } final long wallNormalizeSeconds = min_wall; // first, store all descendents as concurrent final Map<Integer, ConcurrentExperiments> founders = new HashMap<>(); // founderExpId key for (ExperimentProperties exp : expProps) { final int expId = exp.getID(); final Integer founderId = exp.getFounderID(); // update founder ConcurrentExperiments ConcurrentExperiments timeInfo = founders.get(founderId); if (timeInfo == null) { timeInfo = new ConcurrentExperiments(wallNormalizeSeconds); founders.put(founderId, timeInfo); } timeInfo.add(exp, expTimeRef.get(expId)); } // next, any founders that are concurrent get merged List<ConcurrentExperiments> blobs = new ArrayList<>(founders.values()); for (int ii = 0; ii < blobs.size(); ii++) { ConcurrentExperiments base = blobs.get(ii); if (base == null) { continue; } for (int jj = ii + 1; jj < blobs.size(); jj++) { ConcurrentExperiments cmp = blobs.get(jj); if (base.overlaps(cmp)) { base.add(cmp); blobs.set(jj, null); // mark assimilated items as null } } } // next, prune assimilated items List<ConcurrentExperiments> liveBlobs = new ArrayList<>(); for (ConcurrentExperiments blob : blobs) { if (blob == null) { continue; } liveBlobs.add(blob); } // scan for leftmost founders, durations for (ConcurrentExperiments blob : liveBlobs) { final long blob_offset = forceNonConcurrentLeft ? 0 : blob.start; Long duration = blob.getDuration() + blob_offset; if (rcMaxDuration < duration) { rcMaxDuration = duration; } for (Map.Entry<Integer, ExperimentProperties> entry : blob.subexps.entrySet()) { final ExperimentProperties exp = entry.getValue(); final int expId = exp.getID(); long origin = blob.getExpHrtAtConcurrentStart(expId) - blob_offset; // final long debug = exp.getStartTime() - origin; rcTimeOrigins.put(expId, origin); } } return new calcExperimentTimeOriginsRC(rcMaxDuration, rcTimeOrigins); } // ---IPC--- (Native methods from liber_dbe.so) private boolean[] ipcHasTLData( int exp_ids[], int data_ids[], int entity_prop_ids[], int entity_prop_vals[], int hwctags[]) { synchronized (IPC.lock) { w_IPC.IPC().send("hasTLData"); w_IPC.IPC().send(0); w_IPC.IPC().send(exp_ids); w_IPC.IPC().send(data_ids); w_IPC.IPC().send(entity_prop_ids); w_IPC.IPC().send(entity_prop_vals); w_IPC.IPC().send(hwctags); return (boolean[]) w_IPC.IPC().recvObject(); } } private List<Entity> processGetEntities(final Object[] objs, final int entity_prop_id) { if (entity_prop_id == Settings.PROP_NONE) { return null; } if (objs == null) { return null; } ArrayList<Entity> ents = new ArrayList<>(); if (objs.length == 0) { return ents; } final int prop_vals[] = (int[]) objs[0]; final String names[] = (String[]) objs[1]; final String g_names[] = (String[]) objs[2]; final String p_names[] = (String[]) objs[3]; final String propNameV[] = (String[]) objs[4]; // only 1 element expected final int[] ent_values; final int size = prop_vals.length; final String entity_prop_id_name = propNameV[0]; for (int i = 0; i < size; i++) { int prop_val = prop_vals[i]; String name = names[i]; String g_name = g_names[i]; String p_name = p_names[i]; Entity newEnt = new Entity(entity_prop_id, entity_prop_id_name, prop_val, name, g_name, p_name); ents.add(newEnt); } return ents; } private List<List<Entity>> ipcGetEntitiesV2(final int[] expIds, final int entity_prop_id) { List<List<Entity>> entsList = new ArrayList<>(); if (expIds.length == 0) { return entsList; } final Object[] expEntities = ipcRawGetEntitiesV2(expIds, entity_prop_id); if (expEntities == null) { return entsList; // weird; } for (int ii = 0; ii < expEntities.length; ii++) { final Object[] objs = (Object[]) expEntities[ii]; List<Entity> entities = processGetEntities(objs, entity_prop_id); entsList.add(entities); } return entsList; } private Object[] ipcRawGetEntitiesV2(final int[] expIds, final int ekind) { synchronized (IPC.lock) { w_IPC.IPC().send("getEntitiesV2"); w_IPC.IPC().send(0); w_IPC.IPC().send(expIds); w_IPC.IPC().send(ekind); return (Object[]) w_IPC.IPC().recvObject(); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnString.java������������������������������������������������������0000644�0001750�0001750�00000002612�15044710303�016315� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; // Analyzer String object public final class AnString extends AnObject implements Comparable<AnString> { private String obj; // Constructor public AnString(String value) { obj = value; } // Analyzer String printing format public String toString() { return obj; } // As String.compareTo public int compareTo(AnString o) { return obj.compareTo(o.toString()); } // Never used // // Convert String[] to AnString[] // public static AnString[] toArray(String[] list) { // int length = list.length; // AnString[] new_list = new AnString[length]; // // for (int i = 0; i < length; i++) // new_list[i] = new AnString(list[i]); // // return new_list; // } } ����������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SourceDisassemblyView.java�����������������������������������������0000644�0001750�0001750�00000027436�15044710303�021076� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JViewport; /** Dual Source / Disassembly tab */ public final class SourceDisassemblyView extends AnDisplay implements ExportSupport, AnChangeListener { private JScrollPane errorPane = null; private SourceDisp upperSourcePanel; private DisasmDisp lowerSourcePanel; private JSplitPane splitPane; private boolean inCompute = false; private boolean initialized; private int focusedPart; /** Creates a new instance of SrcDisamDisp */ public SourceDisassemblyView() { super(AnWindow.getInstance(), AnDisplay.DSP_SourceDisassembly, AnVariable.HELP_TabsSrcDisassm); focusedPart = 1; initialized = false; setAccessibility(AnLocale.getString("Source/Disassembly")); AnEventManager.getInstance().addListener(this); } @Override public void requestFocus() { if (upperSourcePanel != null) { upperSourcePanel.requestFocus(); } } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("SourceDisassemblyView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: setComputed(false); clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: if (selected) { filterChanged(); } setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case SOURCE_FINDING_CHANGED: setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SRC_DIS || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SEARCH_PATH || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.PATH_MAP || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { setComputed(false); if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void setComputed(boolean set) { super.setComputed(set); upperSourcePanel.setComputed(set); lowerSourcePanel.setComputed(set); } @Override public JPopupMenu getFilterPopup() { return upperSourcePanel.getFilterPopup(); } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text; text = upperSourcePanel.exportAsText(limit, format, delimiter); text = text + lowerSourcePanel.exportAsText(limit, format, delimiter); return text; } @Override protected void initComponents() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); upperSourcePanel = new SourceDisp( window, AnDisplay.DSP_Source, null, AnDisplay.DSP_SourceDisassembly); // AnVariable.HELP_TabsSource); lowerSourcePanel = new DisasmDisp( window, AnDisplay.DSP_Disassembly, null, AnDisplay.DSP_SourceDisassembly); // AnVariable.HELP_TabsDisassembly); lowerSourcePanel.table.setWrapMetricNames(false); // make the both parts to be 0ed Dimension minDim = new Dimension(0, 0); upperSourcePanel.setMinimumSize(minDim); lowerSourcePanel.setMinimumSize(minDim); splitPane = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, upperSourcePanel, lowerSourcePanel); // the both parts are equals splitPane.setResizeWeight(0.5); // put the split bar in the middle splitPane.setDividerLocation(0.5); // // splitPane.setOneTouchExpandable(true); add(splitPane); } @Override public synchronized void doCompute() { AnUtility.checkIfOnAWTThread(false); if (!selected) { return; // Not selected } if (window .getSettings() .getCompareModeSetting() .comparingExperiments()) { // XXXX show error when compare is on, needs simplified, but the // situation is different for different views reset(); JLabel error_label = new JLabel(); error_label.setHorizontalAlignment(JLabel.CENTER); error_label.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); error_label .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Error message")); JViewport error_view = new JViewport(); error_view.setView(error_label); String msg = AnLocale.getString("Not available when comparing experiments"); error_label.setText(msg); if (errorPane == null) { errorPane = new AnJScrollPane(); add(errorPane, BorderLayout.CENTER); } errorPane.setViewportView(error_view); errorPane.setVisible(true); if (splitPane != null) { splitPane.setVisible(false); } return; } if (errorPane != null) { errorPane.setVisible(false); } if (splitPane != null) { splitPane.setVisible(true); } if (inCompute) { return; // Weak synchronization } inCompute = true; if (!initialized) { initialized = true; splitPane.setDividerLocation(0.5); } if (true) // cur_pc_2 != parent.getSelPC(2) ) { // System.err.println("Update low"); lowerSourcePanel.setSelected(true); lowerSourcePanel.doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } if (true) // cur_pc_1 != parent.getSelPC(1) ) { upperSourcePanel.setSelected(true); upperSourcePanel.doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } computed = true; inCompute = false; } private static JPanel toolbarPanel = null; // Fixup: pass it to SourceDisp instead of being static!!!! public static JPanel getToolbarPanelInternal() { if (toolbarPanel == null) { toolbarPanel = new JPanel(); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); toolbarPanel.setLayout(new BorderLayout()); } return toolbarPanel; } @Override public JPanel getToolbarPanel() { return getToolbarPanelInternal(); } // Update view specific tool bar public void updateToolBar() { if (focusedPart == 1 && upperSourcePanel != null) { upperSourcePanel.updateToolBar(); } else if (focusedPart == 2 && lowerSourcePanel != null) { lowerSourcePanel.updateToolBar(); } } /** Remember which part is active (has focus) to continue search */ public void focusInHalf(int stype) { if (stype == AnTable.AT_SRC) { focusedPart = 1; } if (stype == AnTable.AT_DIS) { focusedPart = 2; } } public void syncHalf(int stype) { if (focusedPart == 2 && stype == AnTable.AT_SRC) { upperSourcePanel.computeOnAWorkerThread(); } if (focusedPart == 1 && stype == AnTable.AT_DIS) { lowerSourcePanel.computeOnAWorkerThread(); } } // @Override public void filterChanged() { // System.out.println("SourceDisassemblyView:filterChanged: " + this); if (upperSourcePanel == null || lowerSourcePanel == null) { return; } upperSourcePanel.filterChanged(); lowerSourcePanel.filterChanged(); } @Override public void clearHistory() { if (upperSourcePanel == null || lowerSourcePanel == null) { return; } upperSourcePanel.clearHistory(); lowerSourcePanel.clearHistory(); } @Override protected boolean supportsFindText() { return true; } /** Find */ @Override public int find(final String str, final boolean next, boolean caseSensitive) { int value = -1; if (focusedPart == 1) { value = upperSourcePanel.find(str, next, caseSensitive); } else if (focusedPart == 2) { value = lowerSourcePanel.find(str, next, caseSensitive); } return value; } @Override public java.util.List<ExportFormat> getSupportedExportFormats() { java.util.List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); formats.add(ExportFormat.TEXT); return formats; } @Override public boolean exportLimitSupported() { return false; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getTimelineCallStackSubview()); list.add(window.getIoCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnDialog.java������������������������������������������������������0000644�0001750�0001750�00000022357�14744453367�016302� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.util.gui.AnJScrollPane; import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.accessibility.AccessibleContext; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.border.EmptyBorder; public abstract class AnDialog extends JDialog implements ActionListener { protected int win_id; protected AnWindow window; protected final AnDialog dialog; protected boolean close_on_enter; private final Frame frame; private JPanel work_area; private JPanel response; protected ResponseAction ok, apply, close; private ResponseAction help; public ResponseAction[] aux_actions; private final String help_id; private boolean locationSet = false; public final AnWindow getWindow() { return window; } // Constructor public AnDialog( final AnWindow awindow, final Frame frame, final String title, final boolean has_scroll, final String[] aux, final char[] mnemonic, final String help_id) { super(frame, title); this.win_id = 0; this.frame = frame; window = awindow; dialog = this; close_on_enter = true; this.help_id = help_id; // Initialize GUI components & center it in frame initComponents(has_scroll, aux, mnemonic); final AccessibleContext context = dialog.getAccessibleContext(); context.setAccessibleName(title); context.setAccessibleDescription(title); } // Constructor with modal setting public AnDialog( final AnWindow awindow, final Frame frame, final String title, final boolean has_scroll, final String[] aux, final char[] mnemonic, final String help_id, final boolean modal) { super(frame, title, modal); this.win_id = 0; this.frame = frame; window = awindow; dialog = this; close_on_enter = true; this.help_id = help_id; // Initialize GUI components & center it in frame initComponents(has_scroll, aux, mnemonic); final AccessibleContext context = dialog.getAccessibleContext(); context.setAccessibleName(title); context.setAccessibleDescription(title); } // Initialize GUI components private void initComponents(final boolean has_scroll, final String[] aux, final char[] mnemonic) { final Container cnt; JPanel panel; final int nb; cnt = getContentPane(); cnt.setLayout(new BorderLayout()); // work area work_area = new JPanel(new BorderLayout(4, 4)); work_area.setOpaque(false); work_area.setBorder(new EmptyBorder(12, 12, 0, 12)); panel = new JPanel(new GridLayout(1, 1)); panel.setOpaque(false); // panel.setBorder(new BevelBorder(BevelBorder.LOWERED)); panel.add(has_scroll ? (JComponent) new AnJScrollPane(work_area) : (JComponent) work_area); cnt.add(panel, BorderLayout.CENTER); // response area GridBagConstraints gridBagConstraints; response = new JPanel(new GridBagLayout()); response.setOpaque(false); // response.setBackground(AnEnvironment.DEFAULT_DIALOG_BACKGROUND); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; // gridBagConstraints.weightx = 1.0; // Filler gridBagConstraints.insets = new java.awt.Insets(8, 8, 12, 0); response.add(new JLabel(), gridBagConstraints); gridBagConstraints.insets = new java.awt.Insets(8, 4, 12, 0); // Add online help if (aux == null) { aux_actions = null; } else { nb = aux.length; aux_actions = new ResponseAction[nb]; for (int i = 0; i < nb; i++) { response.add(aux_actions[i] = new ResponseAction(aux[i], mnemonic[i]), gridBagConstraints); } } gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; response.add(new JLabel(""), gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(8, 0, 12, 4); response.add(ok = new ResponseAction(AnLocale.getString("OK")), gridBagConstraints); response.add( apply = new ResponseAction( AnLocale.getString("Apply"), AnLocale.getString('A', "MNEM_DIALOG_APPLY")), gridBagConstraints); response.add( close = new ResponseAction(AnLocale.getString("Close", "DIALOG_CLOSE"), ' '), gridBagConstraints); if (help_id != null) { final String command = AnLocale.getString("Help", "DIALOG_HELP"); response.add( help = new ResponseAction(command, AnLocale.getString('H', "MNEM_DIALOG_HELP")), gridBagConstraints); help.setEnabled(false); // ((JComponent) cnt).registerKeyboardAction(help, command, // KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); // ((JComponent) cnt).registerKeyboardAction(help, command, // KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_FOCUSED); ((JComponent) cnt) .registerKeyboardAction( help, command, KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_IN_FOCUSED_WINDOW); } // Filler gridBagConstraints.insets = new java.awt.Insets(4, 0, 12, 8); response.add(new JLabel(), gridBagConstraints); getRootPane().setDefaultButton(ok); ((JComponent) cnt) .registerKeyboardAction( ok, AnLocale.getString("OK"), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ((JComponent) cnt) .registerKeyboardAction( close, AnLocale.getString("Close", "DIALOG_CLOSE"), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); panel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel.add(response); cnt.add(response, BorderLayout.SOUTH); } public final void setWin(final AnWindow awin) { window = awin; win_id = 0; } // Get win_id public final int getID() { return win_id; } public final JPanel getWorkArea() { return work_area; } /** * Gets default buttons * * @return */ public JButton[] getDefaultButtons() { JButton[] buttons = new JButton[3]; buttons[0] = (JButton) ok; buttons[1] = (JButton) apply; buttons[2] = (JButton) close; return buttons; } // Set visible @Override public void setVisible(final boolean aFlag) { if (aFlag) { if (!locationSet) { setLocationRelativeTo(frame); locationSet = true; } } super.setVisible(aFlag); if (aFlag) { work_area.requestFocus(); } } // Add component in work area protected final void setAccessory(final JComponent work) { work_area.add(work, BorderLayout.CENTER); pack(); } protected boolean vetoClose() { return false; } protected final class ResponseAction extends JButton implements ActionListener { public ResponseAction(final String text) { super(text); final AccessibleContext context = this.getAccessibleContext(); context.setAccessibleName(text); context.setAccessibleDescription(text); addActionListener(this); } public ResponseAction(final String text, final char mnemonic) { this(text); if (mnemonic != ' ') { setMnemonic(mnemonic); } } @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("OK"))) { dialog.actionPerformed(event); if (!vetoClose() && (close_on_enter || (event.getSource() != getContentPane()))) { dialog.setVisible(false); } } else if (cmd.equals(AnLocale.getString("Apply"))) { dialog.actionPerformed(event); } else if (cmd.equals(AnLocale.getString("Close", "DIALOG_CLOSE"))) { if (close_on_enter || (event.getSource() != getContentPane())) { dialog.setVisible(false); } } else if (cmd.equals(AnLocale.getString("Help", "DIALOG_HELP"))) { Analyzer.showHelp(help_id); } else { dialog.actionPerformed(event); } } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SourceDisp.java����������������������������������������������������0000644�0001750�0001750�00000217104�15044710303�016654� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnTable.SelObjInfo; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.Shape; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextPane; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter; import javax.swing.text.Highlighter; import javax.swing.text.JTextComponent; import javax.swing.text.LayeredHighlighter; import javax.swing.text.Position; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import javax.swing.text.View; public class SourceDisp extends FuncListDisp { private int[] src_type; // private boolean can_comp; private int prevScroll = -1; private boolean inCompute = false; private int my_src_type = AnTable.AT_SRC; private int my_src_type_only = AnTable.AT_SRC_ONLY; /** Keeps last warning to avoid showing the same warning message many times */ private String lastWarning = null; protected SelObjInfo lastFilterSelection = null; protected long lastSelSrc = -1; protected long lastSelFunc = -1; // Constructor public SourceDisp(final AnWindow window, final int type, final String help_id) { super(window, type, 0, help_id); } // Constructor public SourceDisp(final AnWindow window, final int type, final String help_id, final int ptype) { super(window, type, 0, help_id); parent_type = ptype; } // Constructor public SourceDisp( final AnWindow window, final int type, final int subtype, final String help_id, final int ptype) { super(window, type, subtype, help_id); parent_type = ptype; } // Initialize GUI components protected void initComponents() { setLayout(new BorderLayout()); String acName = null; String acDesc = null; JLabel acLabel = null; acName = AnLocale.getString("Source"); acDesc = AnLocale.getString("Show source for selected function"); if (acName != null) { acLabel = new JLabel(acName, JLabel.RIGHT); } table = new AnTable(type, true, true, can_sort, false, true, true, true, acName, acDesc, acLabel); table.setParent(this); if (acLabel != null) { acLabel.setVisible(false); acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); } table.addAnListener(new TableHandler()); add(table, BorderLayout.CENTER); HotGapPanel hotGapPanel = new HotGapPanel(this); table.setHotGapPanel(hotGapPanel); add(hotGapPanel, BorderLayout.EAST); warningPane = new JPanel(); warningPane.setVisible(false); // warningPane.setBorder(AnVariable.textBorder); warningPane.setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR)); add(warningPane, BorderLayout.SOUTH); } // Clear display @Override public void clear() { if (table != null) { table.removeAll(); } } @Override public void clearHistory() { if (table != null) { table.clearHistory(); } } public int getParentType() { return this.parent_type; } // Compute & update function list table @Override public void doCompute() { final long sel_obj; int new_ind; final int sort_ind; final Object[] raw_data; final String pwarnstr; final MetricLabel[] label; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (inCompute) { // NM TEMPORARY should be synchronized return; } else { inCompute = true; } if (lastFilterSelection != null) { window.getSelectedObject().setSelObjV2(lastFilterSelection.id); } if (!forceCompute && parent_type != AnDisplay.DSP_SourceDisassembly && table.srcRenderer.functionIdToRow != null) { long src_obj = window.getSelectedObject().getSelObj(DSP_SourceSelectedObject, 0); long funcId = window.getSelectedObject().getSelObjV2("FUNCTION"); Integer targetRow = table.srcRenderer.functionIdToRow.get(funcId); if (targetRow != null && src_obj == sel_src && src_obj != 0) { int targetFuncRow = (targetRow - 1 >= 0) ? (targetRow - 1) : 0; long cur_sel_obj = window.getSelectedObject().getSelObj(type, subtype); int sel_ind = window.getSelectedObject().getSelIndex(cur_sel_obj, type, subtype); if (sel_ind != -1) { window.getSelectedObject().setSelObj(sel_ind, type, subtype); targetFuncRow = sel_ind; boolean recordHistory = table.getNavigationHistoryPool().getHistory().enabled; if (recordHistory) { table.getNavigationHistoryPool().getHistory().enabled = false; } table.setSelectedRow(targetFuncRow); if (recordHistory) { table.getNavigationHistoryPool().getHistory().enabled = true; } table.fireAnEvent(new AnEvent(table, AnEvent.EVT_SELECT, targetFuncRow, null)); table.srcRenderer.tryAddNewObj(); table.getAnParent().updateToolBar(); inCompute = false; computed = true; window .getCalledByCallsSourceView() .doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) lastSelFunc = table.srcRenderer.getFunctionBaseRowWhenCompare(targetFuncRow); if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } return; } } } if (forceCompute) { forceCompute = false; } sel_obj = window.getSelectedObject().getSelObj(type, subtype); // sel_func = window.getSelObj(DSP_FUNCTION, 0); // if (-1 == sel_func) { sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // } if (!computed) { // need re-compute reset(); Object[] res = setFuncData(sel_func, type, subtype); new_ind = (int) ((long[]) (res[0]))[0]; String errstr = ((String[]) (res[1]))[0]; long sf_id = ((long[]) (res[0]))[1]; String sf_name = ((String[]) (res[1]))[1]; // Update table if (errstr == null) { updateWarningPanel(); table.setViewport(); Object[][] table_data; raw_data = getFuncList(type, subtype); Object[] raw_marks = getHotMarks(type); Object[] raw_marks_inc = getHotMarksInc(type); int[][] marks = new int[2][]; marks[0] = (int[]) raw_marks[0]; marks[1] = (int[]) raw_marks[1]; int[][] marks_inc = new int[2][]; marks_inc[0] = (int[]) raw_marks_inc[0]; marks_inc[1] = (int[]) raw_marks_inc[1]; final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); table_data = localProcessData(mlist, raw_data); // first index is for column, second index is for rows src_type = (int[]) raw_data[raw_data.length - 1]; // AT_SRC, DIS, QUOTE, etc. String[] hdrContent = getNames(type, 0); // name column table header contents (?) label = getSettings().getMetricsSetting().getLabel(table_data, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); new_ind = (new_ind == -1) ? 0 : new_ind; int sel_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); if (sel_ind == -1) { // XXX we should not call setSelObj when we go to the Source tab window .getSelectedObject() .setSelObj(new_ind, type, subtype); // set SelObj DSP_SRC_FILE before renderSrc() sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } table.setData(label, table_data, hdrContent, src_type, new_ind, name_col, sort_ind, marks, marks_inc); if (sel_func == 0) { // XXX we should not call setSelObj when we go to the Source tab window.getSelectedObject().setSelObj(new_ind, type, subtype); } } else { window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); if (sf_name == null || sf_name.startsWith("(")) { // FIXUP: need better API table.showMessage(errstr); } else { table.showMessage(new CannotFindFilePanel(errstr, sf_name, sf_id)); } // table.showMessage(errstr, sf_name, sf_id); computed = true; inCompute = false; return; } } // Update selected row new_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); if (new_ind == -1) { new_ind = table.getSelectedRow(); if (new_ind == -1) { new_ind = 0; } table.showSelectedRow(); // if (-1 == sel_func) { // Do we need sel_func? sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // } } else { table.setSelectedRow(new_ind); } // XXX we should not call setSelObj when we go to the Source tab window.getSelectedObject().setSelObj(new_ind, type, subtype); // scroll to previous location after re-sort if (prevScroll > 0) { table.setScroll(prevScroll); prevScroll = -1; } updateGap(); // Update summary display if (parent_type != AnDisplay.DSP_SourceDisassembly) { updateSummary(new_ind); } computed = true; // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } if (lastFilterSelection != null) { if (lastSelSrc == sel_src && lastFilterSelection.lineno != -1) { table.setSelectedRow(lastFilterSelection.lineno); // XXX we should not call setSelObj when we go to the Source tab window.getSelectedObject().setSelObj(lastFilterSelection.lineno, type, subtype); } lastFilterSelection = null; lastSelSrc = -1; } // Set toolbar and select subviews updateToolBar(); window .getCalledByCallsSourceView() .doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) lastSelFunc = table.srcRenderer.getFunctionBaseRowWhenCompare(new_ind); if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } inCompute = false; } protected BackForwardControls getBackForwardControls() { if (backForwardControls == null) { backForwardControls = new BackForwardControls(); } backForwardControls.updateToolBarStatus(); return backForwardControls; } @Override public void updateToolBar() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (backForwardControls == null) { backForwardControls = new BackForwardControls(); } backForwardControls.updateToolBarStatus(); if (parent_type == AnDisplay.DSP_SourceDisassembly) { if (type == AnDisplay.DSP_Disassembly) { SourceDisassemblyView.getToolbarPanelInternal().removeAll(); SourceDisassemblyView.getToolbarPanelInternal() .add(backForwardControls, BorderLayout.CENTER); SourceDisassemblyView.getToolbarPanelInternal().repaint(); } } else if (parent_type == AnDisplay.DSP_DualSource) { DualSourceView.getToolbarPanelInternal().removeAll(); DualSourceView.getToolbarPanelInternal() .add(backForwardControls, BorderLayout.CENTER); DualSourceView.getToolbarPanelInternal().repaint(); } else { AnCompDisp.getToolbarPanelInternal().removeAll(); AnCompDisp.getToolbarPanelInternal().add(backForwardControls, BorderLayout.CENTER); AnCompDisp.getToolbarPanelInternal().repaint(); } } }); } @Override public void syncSrcDisWin() { if (parent_type == DSP_SourceDisassembly) { if (type == DSP_Source) { window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); window.getSourceDisassemblyView().syncHalf(AnTable.AT_DIS); } else if (type == DSP_Disassembly) { window.getSourceDisassemblyView().focusInHalf(AnTable.AT_DIS); window.getSourceDisassemblyView().syncHalf(AnTable.AT_SRC); } } } // Set current func/load-object in 'selected func' & summary display private void updateSummary(final int new_ind) { int[] rows = table.getSelectedRows(); if (null != rows) { if (rows.length > 1) { // Special case for multiselection: pass only lines with my_src_type int len = 0; for (int i = 0; i < rows.length; i++) { int k = rows[i]; if (k < src_type.length) { int stype = src_type[k]; if (stype < 0) { stype = -stype; } if ((stype == my_src_type) || (stype == my_src_type_only)) { len++; } } } if ((len > 0) && (len != rows.length)) { long[] filtered_rows = new long[len]; for (int i = 0, m = 0; i < rows.length; i++) { int k = rows[i]; int stype = src_type[k]; if (stype < 0) { stype = -stype; } if ((stype == my_src_type) || (stype == my_src_type_only)) { filtered_rows[m] = rows[i]; m++; } } window.getSelectionManager().updateSelection(filtered_rows, type, subtype, 1); return; } } window.getSelectionManager().updateSelection(rows, type, subtype, 1); // } else { // no source } } @Override public void goToLine(final AnTable tbl, final int row) { AnDisplay anDisplay = null; if (tbl.getNavigationHistoryPool() != null) { if (type == DSP_Source) { tbl.getNavigationHistoryPool().getHistory().goToSrcNew(row); anDisplay = window.getCalledByCallsSourceView(); } else if (type == DSP_Disassembly) { tbl.getNavigationHistoryPool().getHistory().goToDisNew(row); anDisplay = window.getCalledByCallsDisassemblyView(); } updateToolBar(); } tbl.setSelectedRow(row); window.getSelectedObject().setSelObj(row, type, subtype); long curSelFunc = window.getSelectedObject().getSelObjV2("FUNCTION"); if (curSelFunc != lastSelFunc || curSelFunc == 0) { lastSelFunc = curSelFunc; anDisplay.setComputed(false); anDisplay.computeOnAWorkerThread(); } updateSummary(row); syncSrcDisWin(); } // Listener for updating table private final class TableHandler implements AnListener { public void valueChanged(final AnEvent event) { final int from; final int to; int stype = 0; final boolean can_nav; switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting from = event.getValue(); if (can_sort) { can_nav = true; } else { stype = src_type[from]; if (stype < 0) { stype = -stype; } can_nav = (stype == AnTable.AT_SRC) || (stype == AnTable.AT_SRC_ONLY) || (stype == AnTable.AT_FUNC) || (stype == AnTable.AT_DIS) || (stype == AnTable.AT_QUOTE); } if ((type == DSP_Source)) { deselectRaceStack(subtype); // FIXUP: REARCH window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } if ((type == DSP_SourceDisassembly) || (type == DSP_Disassembly)) { if (stype == AnTable.AT_DIS) { window.getSourceDisassemblyView().focusInHalf(AnTable.AT_DIS); } else { // SOURCE window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } } // Set selected object & Update summary display if (can_nav) { window.getSelectedObject().setSelObj(from, type, subtype); long curSelFunc = window.getSelectedObject().getSelObjV2("FUNCTION"); if (curSelFunc != lastSelFunc || curSelFunc == 0) { lastSelFunc = curSelFunc; window.getCalledByCallsSourceView().setComputed(false); window.getCalledByCallsSourceView().computeOnAWorkerThread(); } updateSummary(from); if (parent_type == DSP_SourceDisassembly) { window.getSourceDisassemblyView().syncHalf(AnTable.AT_DIS); } // if ((type == DSP_SOURCE) || (type == DSP_DISASM)) { // // fixme, xxxx to make MARTY and RDT people happy, Do not // pop Summary Tab to top for Source or Disasm // } else { // window.showSummary(); // } } else // in other cases (eg. AnTable.AT_SRC_ONLY), just update summary { long curSelFunc = window.getSelectedObject().getSelObjV2("FUNCTION"); if (curSelFunc != lastSelFunc || curSelFunc == 0) { lastSelFunc = curSelFunc; window.getCalledByCallsSourceView().setComputed(false); window.getCalledByCallsSourceView().computeOnAWorkerThread(); } updateSummary(from); } // if (parent_type == DSP_SOURCE_DISASM) { // XXXX don't update toolbar // for src in src&dis view // updateToolBar(); // } break; case AnEvent.EVT_SORT: // Sorting // save current scroll location prevScroll = table.getScroll(); int functionsColumn = getFuncSortColumn(((Integer) event.getAux()).intValue()); getSettings() .getMetricsSetting() .setSortMetricByDType(this, functionsColumn, AnDisplay.DSP_Functions); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } from = event.getValue(); to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; } } } protected int getFuncSortColumn(int srcdis_sort_ind) { int ret = -1; AnMetric[] func_mlist = getSettings().getMetricsSetting().getMetricListByMType(MetricsSetting.MET_NORMAL); AnMetric[] srcdis_mlist = getSettings().getMetricsSetting().getMetricListByMType(MetricsSetting.MET_SRCDIS); if (srcdis_sort_ind < 0 || srcdis_sort_ind >= srcdis_mlist.length) { return -1; } for (int ind = 0; ind < func_mlist.length; ind++) { if (srcdis_mlist[srcdis_sort_ind].getUserName().equals(func_mlist[ind].getUserName())) { ret = ind; break; } } if (ret == -1) { ret = getSettings().getMetricsSetting().getSortColumnByDType(AnDisplay.DSP_Functions); } return ret; } // Is current selected tab? @Override public void setSelected(final boolean set) { selected = set; window.getCalledByCallsSourceView().setSelected(set); } // @Override // public String exportAsText(Integer limit, ExportSupport.ExportFormat format, Character // delimiter) { // // Update Total value // AnObject[] totals = getTotals(type, subtype); // IPC call // if (totals != null) { // if (MaximumValues == null) { // MaximumValues = new Object[2][totals.length]; // MaximumValues[1] = totals; // } // MaximumValues[0] = totals; // } // // Call super.exportAsText // String text = super.exportAsText(limit, format, delimiter); // return text; // } public void filterChanged() { long id = window.getSelectedObject().getSelObjV2("FUNCTION"); int cur_line = table.getSelectedRow(); lastFilterSelection = new SelObjInfo(id, cur_line, ""); lastSelSrc = sel_src; forceCompute = true; } /* * Class to render source code for simple syntax highlighting */ static class SrcRenderer { // Fortran keywords (see CR 7206640) private final String[] FORTRAN95_KEYWORDS = { "assign", "backspace", "block", "data", "call", "close", "common", "continue", "data", "dimension", "do", "else", "if", "end", "endfile", "endif", "entry", "equivalence", "external", "format", "function", "goto", "implicit", "inquire", "intrinsic", "open", "parameter", "pause", "print", "program", "read", "return", "rewind", "rewrite", "save", "stop", "subroutine", "then", "write", "allocate", "allocatable", "case", "contains", "cycle", "deallocate", "elsewhere", "exit", "include", "interface", "intent", "module", "namelist", "nullify", "only", "operator", "optional", "pointer", "private", "procedure", "public", "result", "recursive", "select", "sequence", "target", "use", "while", "where", "elemental", "forall", "pure", "integer", "real", "complex", "logical", "character", "double", "precision", "type", "kind", "in", "out", "inout", "blockdata", "doubleprecision", "elseif", "elsewhere", "endblockdata", "enddo", "endforall", "endfunction", "endinterface", "endmodule", "endprogram", "endselect", "endsubroutine", "endtype", "endwhere", "selectcase", "selecttype" }; private final String[] JAVA_KEYWORDS = { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "true", "transient", "try", "void", "volatile", "while" }; private final String[] C_KEYWORDS = { "auto", "_Bool", "break", "case", "char", "_Complex", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "_Imaginary", "inline", "int", "long", "register", "restrict", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while" }; private final String[] CPP_KEYWORDS = { "alignas", "alignof", "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "char16_t", "char32_t", "class", "compl", "const", "constexpr", "const_cast", "continue", "decltype", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr ", "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast", "return", "short", "signed", "sizeof", "static", "static_assert", "static_cast", "struct", "switch", "template", "this", "thread_local", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq" }; private final String SPLIT_PATTERN = "[@$~!%&();,#<>*/= +-?:.|\\[\\]{}^]"; protected final HashMap<String, Boolean> fortran95KeywordMap; protected final HashMap<String, Boolean> javaKeywordMap; protected final HashMap<String, Boolean> cKeywordMap; protected final HashMap<String, Boolean> cppKeywordMap; protected int caretLinePosition = -1; protected AnTable fl_table; public SrcRenderer(AnTable table) { fl_table = table; fortran95KeywordMap = new HashMap<String, Boolean>(); javaKeywordMap = new HashMap<String, Boolean>(); cKeywordMap = new HashMap<String, Boolean>(); cppKeywordMap = new HashMap<String, Boolean>(); for (int i = 0; i < FORTRAN95_KEYWORDS.length; i++) { fortran95KeywordMap.put(FORTRAN95_KEYWORDS[i], Boolean.TRUE); } for (int i = 0; i < JAVA_KEYWORDS.length; i++) { javaKeywordMap.put(JAVA_KEYWORDS[i], Boolean.TRUE); } for (int i = 0; i < C_KEYWORDS.length; i++) { cKeywordMap.put(C_KEYWORDS[i], Boolean.TRUE); } for (int i = 0; i < CPP_KEYWORDS.length; i++) { cppKeywordMap.put(CPP_KEYWORDS[i], Boolean.TRUE); } } protected String srcType = "c"; protected Object[][] tableData = null; protected int[] srcTypeData = null; protected boolean srcInComment = false; protected HashMap<Integer, SrcTextMarker> srcRendered = null; // stores cached SrcTextMarker of each line protected HashMap<Integer, SrcTextPane> srcPaneCreated = null; // stores cached SrcTextPane of each line protected HashMap<Long, HashMap<Integer, SrcTextMarker>> srcRenderedMap = new HashMap< Long, HashMap< Integer, SrcTextMarker>>(); // stores cached srcRendered of each selected object that has // been shown in Source View before protected HashMap<Long, HashMap<Integer, SrcTextPane>> srcPaneCreatedMap = new HashMap< Long, HashMap< Integer, SrcTextPane>>(); // stores cached srcPaneCreated of each selected object that has // been shown in Source View before protected int maxSrcCachedNumber = 15; // XXXX cacheing asumes the content will always be the same for the same DSP_SRC_FILE // object protected HashMap<Long, HashMap<Integer, String>> functionRenderedMap = new HashMap<Long, HashMap<Integer, String>>(); protected HashMap<Integer, String> functionRendered = null; // a map from row to function name protected HashMap<Long, HashMap<Integer, Boolean>> functionCallerCalleeAddedMap = new HashMap<Long, HashMap<Integer, Boolean>>(); protected HashMap<Integer, Boolean> functionCallerCalleeAdded = null; // a map from row to whether it's been added caller-callee info protected HashMap<Long, HashMap<Long, ArrayList<SelObjInfo>>> callerInfoMap = new HashMap<Long, HashMap<Long, ArrayList<SelObjInfo>>>(); protected HashMap<Long, ArrayList<SelObjInfo>> callerInfo = null; // a map from function id to its callers' ids protected HashMap<Long, HashMap<Integer, ArrayList<SelObjInfo>>> calleeInfoMap = new HashMap<Long, HashMap<Integer, ArrayList<SelObjInfo>>>(); protected HashMap<Integer, ArrayList<SelObjInfo>> calleeInfo = null; // a map from call site row to callees' ids protected HashMap<Long, ArrayList<Long>> functionIdMap = new HashMap<Long, ArrayList<Long>>(); protected ArrayList<Long> functionId = null; // a vector of function id of each row or null protected HashMap<Long, HashMap<Long, Integer>> functionIdToRowMap = new HashMap<Long, HashMap<Long, Integer>>(); protected HashMap<Long, Integer> functionIdToRow = null; // a map from function id to row protected HashMap<Long, HashMap<Integer, Integer>> lineNoToRowMap = new HashMap<Long, HashMap<Integer, Integer>>(); protected HashMap<Integer, Integer> lineNoToRow = null; // a map from line number to row protected HashMap<Long, HashMap<Integer, Integer>> newRowToOldRowMap = new HashMap<Long, HashMap<Integer, Integer>>(); protected HashMap<Integer, Integer> newRowToOldRow = null; // a map from new row to old row protected ArrayList<Integer> rowToFuncBaseRow = null; protected int old_viewmode = -1; protected Object[] getFuncCalleeInfo(final int type, final int[] rows, final int groupId) { synchronized (IPC.lock) { fl_table.getAnParent().window.IPC().send("getFuncCalleeInfo"); fl_table.getAnParent().window.IPC().send(0); fl_table.getAnParent().window.IPC().send(type); fl_table.getAnParent().window.IPC().send(rows); fl_table.getAnParent().window.IPC().send(groupId); return (Object[]) fl_table.getAnParent().window.IPC().recvObject(); } } protected Object[] getFuncCallerInfo(final int type, final int[] rows, final int groupId) { synchronized (IPC.lock) { fl_table.getAnParent().window.IPC().send("getFuncCallerInfo"); fl_table.getAnParent().window.IPC().send(0); fl_table.getAnParent().window.IPC().send(type); fl_table.getAnParent().window.IPC().send(rows); fl_table.getAnParent().window.IPC().send(groupId); return (Object[]) fl_table.getAnParent().window.IPC().recvObject(); } } protected long[] getFuncId(final int type, final int begin, final int length) { synchronized (IPC.lock) { fl_table.getAnParent().window.IPC().send("getFuncId"); fl_table.getAnParent().window.IPC().send(0); fl_table.getAnParent().window.IPC().send(type); fl_table.getAnParent().window.IPC().send(begin); fl_table.getAnParent().window.IPC().send(length); return (long[]) fl_table.getAnParent().window.IPC().recvObject(); } } public int mapRow(int newRow) { return newRowToOldRow.get(newRow) == null ? -1 : newRowToOldRow.get(newRow); } // Process the raw data from mixed Primary/Object to pure Object array. // Creates and updates MaximumValues. public Object[][] localProcessData(final Object[] raw_data) { // raw_data has one vector for each column of metric values. // In addition, it has a vector of dbe row identifiers (HistItem->obj->id) int i; if (raw_data == null) { return null; } final int nc = raw_data.length - 1; // number of metric columns if (nc < 0) { return null; } final Object[][] data = new Object[nc][]; for (i = 0; i < nc; i++) { if (raw_data[i] instanceof double[]) { data[i] = AnDouble.toArray((double[]) raw_data[i]); } else if (raw_data[i] instanceof int[]) { data[i] = AnInteger.toArray((int[]) raw_data[i]); } else if (raw_data[i] instanceof long[]) { if ((((long[]) raw_data[i]).length == 0) || !AnAddress.isAddress(((long[]) raw_data[i])[0])) { data[i] = AnLong.toArray((long[]) raw_data[i]); } else { data[i] = AnAddress.toArray((long[]) raw_data[i]); } } else { data[i] = (Object[]) raw_data[i]; } } return data; } protected void releaseMap(HashMap map, int count) { Set keys = map.keySet(); int i = 0; for (Object key : keys) { map.put(key, null); i++; if (i >= count) { break; } } } protected void renderSrc( final String[] hdrContent, final Object[][] table_data, final int[] src_type, final long sel_src, final int view_mode) { tableData = table_data; srcTypeData = src_type; if (hdrContent.length <= 0) { return; } // set src type for source view if (hdrContent[0].startsWith("Source File")) { int dotPos = hdrContent[0].lastIndexOf('.'); if (dotPos != -1) { srcType = hdrContent[0].substring(dotPos + 1); if (srcType.matches("[0-9]*\\)?")) { int dotPos2 = hdrContent[0].lastIndexOf('.', dotPos - 1); if (dotPos2 != -1) { srcType = hdrContent[0].substring(dotPos2 + 1, dotPos); } } srcType = srcType.replaceFirst("\\)", ""); srcType = srcType.replaceFirst("_[a-zA-Z0-9\\-]*", ""); int dummyPos = srcType.indexOf(" (not found"); if (dummyPos != -1) { srcType = srcType.substring(0, dummyPos); } } } // initialize or store new cached data for the selected object if (srcRenderedMap.size() >= maxSrcCachedNumber || old_viewmode != view_mode) { // clear data cache before it gets too large releaseMap(srcRenderedMap, maxSrcCachedNumber / 3); releaseMap(srcPaneCreatedMap, maxSrcCachedNumber / 3); releaseMap(functionRenderedMap, maxSrcCachedNumber / 3); releaseMap(functionIdMap, maxSrcCachedNumber / 3); releaseMap(functionIdToRowMap, maxSrcCachedNumber / 3); releaseMap(lineNoToRowMap, maxSrcCachedNumber / 3); releaseMap(newRowToOldRowMap, maxSrcCachedNumber / 3); releaseMap(callerInfoMap, maxSrcCachedNumber / 3); releaseMap(calleeInfoMap, maxSrcCachedNumber / 3); } if (old_viewmode != view_mode) { old_viewmode = view_mode; } srcRendered = srcRenderedMap.get(sel_src); functionRendered = functionRenderedMap.get(sel_src); functionCallerCalleeAdded = functionCallerCalleeAddedMap.get(sel_src); srcPaneCreated = srcPaneCreatedMap.get(sel_src); functionId = functionIdMap.get(sel_src); functionIdToRow = functionIdToRowMap.get(sel_src); lineNoToRow = lineNoToRowMap.get(sel_src); newRowToOldRow = newRowToOldRowMap.get(sel_src); callerInfo = callerInfoMap.get(sel_src); calleeInfo = calleeInfoMap.get(sel_src); boolean isRenew = false; if (srcRendered == null || lineNoToRow == null || newRowToOldRow == null || sel_src == 0) { isRenew = true; } if (srcRendered == null) { srcRendered = new HashMap<Integer, SrcTextMarker>(); } if (functionRendered == null) { functionRendered = new HashMap<Integer, String>(); } if (functionCallerCalleeAdded == null) { functionCallerCalleeAdded = new HashMap<Integer, Boolean>(); } if (functionId == null) { functionId = new ArrayList<>(); } if (functionIdToRow == null) { functionIdToRow = new HashMap<Long, Integer>(); } if (lineNoToRow == null) { lineNoToRow = new HashMap<Integer, Integer>(); } if (newRowToOldRow == null) { newRowToOldRow = new HashMap<Integer, Integer>(); } if (callerInfo == null) { callerInfo = new HashMap<Long, ArrayList<SelObjInfo>>(); } if (calleeInfo == null) { calleeInfo = new HashMap<Integer, ArrayList<SelObjInfo>>(); } if (isRenew) { srcRendered.clear(); lineNoToRow.clear(); newRowToOldRow.clear(); for (int i = 0; i < table_data[fl_table.getNameCol()].length; i++) { Object value = table_data[fl_table.getNameCol()][i]; int type = src_type[i] < 0 ? (-src_type[i]) : src_type[i]; if (value instanceof String && (type == AnTable.AT_SRC || type == AnTable.AT_SRC_ONLY)) { SrcTextMarker sm = new SrcTextMarker(i, ((String) value)); srcRendered.put(i, sm); newRowToOldRow.put(i, i); } } srcRenderedMap.put(sel_src, srcRendered); lineNoToRowMap.put(sel_src, lineNoToRow); newRowToOldRowMap.put(sel_src, newRowToOldRow); } if (srcPaneCreated == null || sel_src == 0) { if (srcPaneCreated == null) { srcPaneCreated = new HashMap<Integer, SrcTextPane>(); } srcPaneCreated.clear(); srcPaneCreatedMap.put(sel_src, srcPaneCreated); } // add function ids and caller callee info functionRendered.clear(); functionCallerCalleeAdded.clear(); functionId.clear(); functionIdToRow.clear(); callerInfo.clear(); calleeInfo.clear(); AnUtility.checkIPCOnWrongThread(false); long[] rawData = getFuncId(fl_table.getAnParent().type, 0, src_type.length); AnUtility.checkIPCOnWrongThread(true); long lastFuncId = 0; if (rawData != null) { for (int i = 0; i < rawData.length; i++) { long id = rawData[i]; if (id == 0) { int start = i; int end = i + 4; boolean found = false; for (int k = start; k < end && k < rawData.length; k++) { int type = src_type[k] < 0 ? (-src_type[k]) : src_type[k]; if (type == AnTable.AT_FUNC) { found = true; break; } } id = found ? 0 : lastFuncId; } functionId.add(id); int type = src_type[i] < 0 ? (-src_type[i]) : src_type[i]; if (type == AnTable.AT_FUNC) { functionIdToRow.put(rawData[i], i); lastFuncId = rawData[i]; } } } rowToFuncBaseRow = new ArrayList<>(); int baseRow = 0; for (int i = 0; i < table_data[fl_table.getNameCol()].length; i++) { Object value = table_data[fl_table.getNameCol()][i]; int type = src_type[i] < 0 ? (-src_type[i]) : src_type[i]; if (type == AnTable.AT_FUNC) { functionRendered.put(i, (String) value); baseRow = i; } rowToFuncBaseRow.add(baseRow); } functionRenderedMap.put(sel_src, functionRendered); functionCallerCalleeAddedMap.put(sel_src, functionCallerCalleeAdded); functionIdMap.put(sel_src, functionId); functionIdToRowMap.put(sel_src, functionIdToRow); callerInfoMap.put(sel_src, callerInfo); calleeInfoMap.put(sel_src, calleeInfo); tryAddNewObj(); } public void tryAddNewObj() { // add new obj to history if it's different from current if (fl_table.getNavigationHistoryPool().getHistory().enabled && (fl_table.getType() == AnDisplay.DSP_Source || fl_table.getType() == AnDisplay.DSP_SourceV2)) { int row = fl_table.getSelectedRow(); SrcTextMarker sm = srcRendered.get(mapRow(row)); if (sm != null) { int lineNo = sm.lineNo; long fun_id = -1; if (functionId != null && row >= 0 && row < functionId.size()) { fun_id = functionId.get(row); } if (fun_id == 0) { fun_id = fl_table.getAnParent().window.getSelectedObject().getSelObjV2("FUNCTION"); } SelObjInfo cur_so = fl_table.getNavigationHistoryPool().getHistory().getCurrent(); if (cur_so == null || cur_so.id != fun_id || cur_so.lineno != lineNo) { SelObjInfo new_so = new SelObjInfo(fun_id, lineNo, ""); fl_table.getNavigationHistoryPool().getHistory().goToNew(new_so); } else { fl_table.getNavigationHistoryPool().getHistory().newAdded = false; } } } } public void addFunctionByRow(int row) { if (row < 0 || row >= srcTypeData.length) { return; } int type = srcTypeData[row] < 0 ? (-srcTypeData[row]) : srcTypeData[row]; if (type != AnTable.AT_FUNC) { return; } int[] funcIds = new int[1]; funcIds[0] = row; String functionName = (tableData == null) ? null : (String) tableData[fl_table.getNameCol()][row]; functionCallerCalleeAdded.put(row, true); AnUtility.checkIPCOnWrongThread(false); Object[] calleeData = getFuncCalleeInfo(fl_table.getType(), funcIds, fl_table.getGroupId()); Object[] callerData = getFuncCallerInfo(fl_table.getType(), funcIds, fl_table.getGroupId()); AnUtility.checkIPCOnWrongThread(true); if (calleeData != null && callerData != null && tableData != null && calleeData.length > 0 && callerData.length > 0) { addFunction(row, functionName, (Object[]) calleeData[0], (Object[]) callerData[0]); } } public void addFunction(int row, String function, Object[] calleeData, Object[] callerData) { if (calleeData == null) { return; } String[] names = (String[]) calleeData[calleeData.length - 1]; Object[][] return_data = localProcessData(calleeData); if (return_data.length != 2) { return; // error happens here } for (int i = 0; i < return_data[0].length; i++) { Integer callsite = ((AnInteger) return_data[0][i]).toInteger(); if (callsite == null) { continue; } Long calleeId = ((AnLong) return_data[1][i]).toLong(); String funcName = names[i]; SelObjInfo fi = new SelObjInfo(calleeId, -1, funcName); ArrayList<SelObjInfo> callees = calleeInfo.get(callsite); if (callees == null) { callees = new ArrayList<>(); callees.add(fi); calleeInfo.put(callsite, callees); if (fl_table.getType() == AnDisplay.DSP_Source || fl_table.getType() == AnDisplay.DSP_SourceV2) { SrcTextMarker sm = srcRendered.get(mapRow(callsite)); if (sm != null) { sm.isCallSite = true; } } } else { callees.add(fi); } } if (callerData == null) { return; } names = (String[]) callerData[callerData.length - 1]; return_data = localProcessData(callerData); if (return_data.length != 2) { return; // error happens here } if (functionId == null || row < 0 || row >= functionId.size()) { return; } Long funcId = functionId.get(row); for (int i = 0; i < return_data[0].length; i++) { Long callerId = ((AnLong) return_data[0][i]).toLong(); Integer lineNo = ((AnInteger) return_data[1][i]).toInteger(); if (callerId == null) { continue; } String funcName = names[i]; SelObjInfo fi = new SelObjInfo(callerId, lineNo, funcName); ArrayList<SelObjInfo> callers = callerInfo.get(funcId); if (callers == null) { callers = new ArrayList<>(); callers.add(fi); callerInfo.put(funcId, callers); } else { callers.add(fi); } } } protected String getFunctionWhenCompare(int row) { int funcRow; if (rowToFuncBaseRow == null) { funcRow = -1; } else if (rowToFuncBaseRow.get(row) == null) { funcRow = -1; } else { funcRow = rowToFuncBaseRow.get(row); } return functionRendered.get(funcRow); } protected int getFunctionBaseRowWhenCompare(int row) { if (rowToFuncBaseRow == null) { return 0; } try { if (rowToFuncBaseRow.get(row) == null) { // return 0; } return rowToFuncBaseRow.get(row); } catch (ArrayIndexOutOfBoundsException e) { // This can be a bug or a race condition return 0; } } public String getFunction(int row) { if (fl_table .getAnParent() .window .getSettings() .getCompareModeSetting() .comparingExperiments()) { return getFunctionWhenCompare(row); } if (functionId == null || row < 0 || row >= functionId.size()) { return null; } int funcRow = -1; Long id = functionId.get(row); if (id != null) { Integer funcR = functionIdToRow.get(id); if (funcR != null) { funcRow = funcR.intValue(); } } return functionRendered.get(funcRow); } public int getFunctionBaseRow(int row) { if (fl_table .getAnParent() .window .getSettings() .getCompareModeSetting() .comparingExperiments()) { return getFunctionBaseRowWhenCompare(row); } if (functionId == null || row < 0 || row >= functionId.size()) { return 0; } int funcRow = 0; Long id = functionId.get(row); if (id != null) { Integer funcR = functionIdToRow.get(id); if (funcR != null) { funcRow = funcR.intValue(); } } return funcRow; } public int getNextCallsite(int row) { int callsite = -1; if (calleeInfo == null) { return callsite; } for (int i = 0; i < calleeInfo.size(); i++) { if (calleeInfo.get(row + i) != null) { callsite = row + i; break; } } return callsite; } public int getRowByLineNo(int lineNo) { Integer result = lineNoToRow.get(lineNo); int ret = -1; if (result != null) { ret = result.intValue(); } return ret; } public SrcTextPane getSrcTextPane(final String content, final JComponent cmp, final int row) { if (functionCallerCalleeAdded.get(getFunctionBaseRow(row)) == null) { addFunctionByRow(getFunctionBaseRow(row)); } int lineBegin = content.indexOf('.'); int lineNo = -1; if (lineBegin != -1) { lineNo = Integer.parseInt(content.substring(0, lineBegin).trim()); } Integer oldRowObj = lineNoToRow == null ? null : lineNoToRow.get( lineNo); // lineNoToRow is the one to one mapping between line number and the // index in srcRendered & srcPaneCreated int oldRow = oldRowObj == null ? 0 : oldRowObj; SrcTextMarker sm = srcRendered.get(oldRow); SrcTextPane st = srcPaneCreated.get(oldRow); boolean oldIsCallSite = false; if (oldRow != row) { newRowToOldRow.put(row, oldRow); if (calleeInfo != null && calleeInfo.get(row) == null && sm != null) { oldIsCallSite = sm.isCallSite; sm.isCallSite = false; } } if (st == null || !st.getText() .equalsIgnoreCase(content)) { // only create JTextPanel when it needs to be shown st = new SrcTextPane(content, cmp, sm); srcPaneCreated.put(oldRow, st); } else { if (oldRow != row && sm != null && oldIsCallSite && !sm.isCallSite) { st.unSetCallSiteStyle(); } } return st; } // A JTextPane for src/dis table cell protected final class SrcTextPane extends JTextPane { private String text; private SrcTextMarker textMarker = null; private UnderlineHighlighter highlighter = new UnderlineHighlighter(Color.black); private Highlighter.HighlightPainter painter = highlighter.new UnderlineHighlightPainter(Color.black); public SrcTextPane(final String content, final JComponent cmp, final SrcTextMarker tm) { text = content; textMarker = tm; setFont(cmp.getFont()); setBorder(AnVariable.labelBorder); setForeground(cmp.getForeground()); setBackground(cmp.getBackground()); setHighlighter(highlighter); Style style1 = addStyle("keyword", null); StyleConstants.setForeground(style1, AnVariable.KEYWORD_COLOR); Style style2 = addStyle("comment", null); StyleConstants.setForeground(style2, AnVariable.COMMENT_COLOR); Style style3 = addStyle("directive", null); StyleConstants.setForeground(style3, AnVariable.DIRECTIVE_COLOR); Style style4 = addStyle("string", null); StyleConstants.setForeground(style4, AnVariable.STRING_COLOR); Style style5 = addStyle("lineno", null); StyleConstants.setForeground(style5, AnVariable.LINENO_COLOR); Style style6 = addStyle("lineno_bold", null); StyleConstants.setForeground(style6, AnVariable.LINENO_COLOR_BOLD); StyleConstants.setBold(style6, true); StyledDocument doc = getStyledDocument(); try { doc.insertString(0, content, null); if (textMarker == null) { return; } for (int i = 0; i < textMarker.marker.size(); i++) { int from = textMarker.marker.get(i).from; int length = textMarker.marker.get(i).length; String style = textMarker.marker.get(i).style; doc.setCharacterAttributes(from, length, getStyle(style), true); } if (textMarker.isCallSite) { highlighter.addHighlight(textMarker.codeBegin, textMarker.codeEnd, painter); for (int i = 0; i < textMarker.marker.size(); i++) { int from = textMarker.marker.get(i).from; int length = textMarker.marker.get(i).length; String style = textMarker.marker.get(i).style; if (style.equals("lineno")) { doc.setCharacterAttributes(from, length, getStyle("lineno_bold"), true); break; } } } } catch (BadLocationException e) { // System.err.println("BadLocationException: " + e); // e.printStackTrace(); } final MouseMotionListener[] ls = getMouseMotionListeners(); for (final MouseMotionListener l : ls) { removeMouseMotionListener(l); } SrcTextPaneMouseAdapter ma = new SrcTextPaneMouseAdapter(cmp, this); SrcTextPaneMouseMotionAdapter mam = new SrcTextPaneMouseMotionAdapter(cmp, this); SrcTextPaneMouseWheelAdapter maw = new SrcTextPaneMouseWheelAdapter(cmp, this); SrcTextPaneKeyAdapter ka = new SrcTextPaneKeyAdapter(cmp); this.addMouseListener(ma); this.addMouseMotionListener(mam); this.addMouseWheelListener(maw); addKeyListener(ka); this.setDragEnabled(false); this.setFont(cmp.getFont()); this.setBorder(AnVariable.labelBorder); this.setForeground(cmp.getForeground()); this.setBackground(cmp.getBackground()); this.setOpaque(false); setEditable(false); } public void unSetCallSiteStyle() { StyledDocument doc = getStyledDocument(); if (textMarker == null) { return; } Highlighter.Highlight[] hilites = highlighter.getHighlights(); for (int i = 0; i < hilites.length; i++) { if (hilites[i].getPainter() instanceof UnderlineHighlighter.UnderlineHighlightPainter) { highlighter.removeHighlight(hilites[i]); } } for (int i = 0; i < textMarker.marker.size(); i++) { int from = textMarker.marker.get(i).from; int length = textMarker.marker.get(i).length; String style = textMarker.marker.get(i).style; if (style.equals("lineno_bold")) { doc.setCharacterAttributes(from, length, getStyle("lineno"), true); break; } } } public String getText() { return text; } } protected void propagateToTable( MouseEvent e, boolean changeSource, final Component parentComponent) { if (JTextPane.class.isAssignableFrom(e.getSource().getClass())) { int oldX = e.getX(); int oldY = e.getY(); Point p = e.getPoint(); SwingUtilities.convertPointToScreen(p, e.getComponent()); e.translatePoint(-oldX, -oldY); SwingUtilities.convertPointFromScreen(p, parentComponent); e.translatePoint(p.x, p.y); if (changeSource) { e.setSource(parentComponent); } parentComponent.dispatchEvent(e); } } protected final class SrcTextPaneKeyAdapter extends KeyAdapter { private Component parentComponent; public SrcTextPaneKeyAdapter(JComponent cmp) { parentComponent = cmp; } public void propagateToTable(KeyEvent e) { e.setSource(parentComponent); parentComponent.dispatchEvent(e); } @Override public void keyTyped(KeyEvent e) { propagateToTable(e); } @Override public void keyPressed(KeyEvent e) { propagateToTable(e); } @Override public void keyReleased(KeyEvent e) { propagateToTable(e); } } protected final class SrcTextPaneMouseMotionAdapter extends MouseMotionAdapter { private Component parentComponent; private JTextPane pane; public SrcTextPaneMouseMotionAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseMoved(MouseEvent e) {} } protected final class SrcTextPaneMouseWheelAdapter implements MouseWheelListener { private Component parentComponent; private JTextPane pane; public SrcTextPaneMouseWheelAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseWheelMoved(MouseWheelEvent e) { propagateToTable(e, true, parentComponent); } } protected final class SrcTextPaneMouseAdapter extends MouseAdapter { private Component parentComponent; private JTextPane pane; public SrcTextPaneMouseAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseClicked(MouseEvent e) { propagateToTable(e, true, parentComponent); } public void mousePressed(MouseEvent e) { caretLinePosition = pane.getCaretPosition(); } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} } // A marker of the style for JTextPane for src/dis table cell protected final class SrcTextMarker { protected final class Highlighter { public int from; public int length; public String style; public Highlighter(int f, int l, String s) { from = f; length = l; style = s; } } public ArrayList<Highlighter> marker = new ArrayList<>(); private String text = ""; private String type = ""; private int curRow = -1; public int lineNo = -1; public int codeBegin = 0; public int codeEnd = 0; public boolean isCallSite = false; public SrcTextMarker(int row, final String content) { curRow = row; if (srcType.equalsIgnoreCase("f") || srcType.equalsIgnoreCase("for")) { type = "fortranfixed"; } else if (srcType.equalsIgnoreCase("f90") || srcType.equalsIgnoreCase("f95")) { type = "fortranfree"; } else if (srcType.equalsIgnoreCase("java")) { type = "java"; } else if (srcType.equalsIgnoreCase("cpp") || srcType.equalsIgnoreCase("cc") || srcType.equalsIgnoreCase("cxx") || srcType.equalsIgnoreCase("hpp") || srcType.equalsIgnoreCase("hh") || srcType.equalsIgnoreCase("hxx")) { type = "cpp"; } else if (srcType.equalsIgnoreCase("c") || srcType.equalsIgnoreCase("h") || srcType.equalsIgnoreCase("inc")) { type = "c"; } text = content; renderCode(); } public void renderDirective(int startPos, int endPos) { if (endPos <= startPos) { return; } int directiveEnd = endPos; int isSpace = 0; boolean nonSpaceSeen = false; for (int i = startPos; i < endPos; i++) { if (text.charAt(i) != ' ' && text.charAt(i) != '\t' && text.charAt(i) != '#') { nonSpaceSeen = true; } if (nonSpaceSeen && (text.charAt(i) == ' ' || text.charAt(i) == '\t' || text.charAt(i) == '"' || text.charAt(i) == '<')) { directiveEnd = i; isSpace = (text.charAt(i) == ' ' || text.charAt(i) == '\t') ? 1 : 0; break; } } marker.add(new Highlighter(startPos, directiveEnd - startPos, "directive")); if (text.substring(startPos, directiveEnd).equals("#include")) { marker.add(new Highlighter(directiveEnd + isSpace, endPos, "string")); } } public void renderComment(int startPos, int endPos) { if (endPos <= startPos) { return; } marker.add(new Highlighter(startPos, endPos - startPos, "comment")); } public void renderQuote(int startPos, int endPos) { if (endPos <= startPos) { return; } marker.add(new Highlighter(startPos, endPos - startPos, "string")); } // render code that is not multiline comment in /**/ public void renderNonMLComment(int startPos, int endPos) { if (endPos <= startPos) { return; } boolean seenQuote = false; int start = -1; int end = 0; for (int i = startPos; i < endPos; i++) { if (text.charAt(i) == '"') { boolean isQuote = true; int k = i - 1; int slashNum = 0; while (k >= 0 && text.charAt(k) == '\\') { slashNum++; k--; } if (slashNum % 2 != 0) { isQuote = false; } if (isQuote) { if (seenQuote) { end = i + 1; renderQuote(start, end); } else { start = i; renderNonQuoteComment(end, start); } seenQuote = !seenQuote; } } } if (seenQuote) { renderQuote(start, endPos); } else { renderNonQuoteComment(end, endPos); } } // render non comment conde that is not inside "" public void renderNonQuoteComment(int startPos, int endPos) { if (endPos <= startPos) { return; } int startDirective = startPos; boolean foundDirective = false; if (type.equals("c") || type.equals("cpp")) { while (startDirective < endPos) { if (text.charAt(startDirective) == '#') { foundDirective = true; break; } startDirective++; } } if (foundDirective && text.charAt(startDirective) == '#') { renderDirective(startDirective, endPos); } else { String code = text.substring(startPos, endPos); String[] words = code.split(SPLIT_PATTERN); int curPos = startPos; for (int i = 0; i < words.length; i++) { if (words[i].length() == 0) { } else { if (type.equals("c")) { if (cKeywordMap.get(words[i]) != null) { marker.add(new Highlighter(curPos, words[i].length(), "keyword")); } } else if (type.equals("cpp")) { if (cppKeywordMap.get(words[i]) != null) { marker.add(new Highlighter(curPos, words[i].length(), "keyword")); } } else if (type.equals("java")) { if (javaKeywordMap.get(words[i]) != null) { marker.add(new Highlighter(curPos, words[i].length(), "keyword")); } } else if (type.equals("fortranfixed") || type.equals("fortranfree")) { if (fortran95KeywordMap.get(words[i].toLowerCase()) != null) { marker.add(new Highlighter(curPos, words[i].length(), "keyword")); } } } if (i < words.length - 1) { curPos += words[i].length() + 1; } } } } // render code before which /* is not seen public void renderCode(int start, int end) { if (start >= end) { return; } codeBegin = start; codeEnd = end; while (codeBegin != end) { if (text.charAt(codeBegin) != ' ') { break; } codeBegin++; } if (type.equals("fortranfixed")) { if ((text.charAt(start) == 'c' || text.charAt(start) == 'C' || text.charAt(start) == '*') && start + 1 < end && text.charAt(start + 1) != '$') { renderComment(start, end); return; } } boolean seenQuote = false; boolean seenCommentStart = false; int startPos = -1; int endPos = start; int tail = 1; if (type.equals("fortranfixed") || type.equals("fortranfree")) { tail = 0; } for (int i = start; i < end - tail; i++) { if (text.charAt(i) == '"') { boolean isQuote = true; int k = i - 1; int slashNum = 0; while (k >= 0 && text.charAt(k) == '\\') { slashNum++; k--; } if (slashNum % 2 != 0) { isQuote = false; } if (isQuote && !seenCommentStart) { seenQuote = !seenQuote; } } if (type.equals("fortranfixed") || type.equals("fortranfree")) { if (text.charAt(i) == '!' && i + 1 < end && text.charAt(i + 1) != '$') { if (!seenQuote && !seenCommentStart) { renderNonMLComment(endPos, i); renderComment(i, end); return; } } } else if (type.equals("c") || type.equals("cpp") || type.equals("java")) { if (text.charAt(i) == '/' && text.charAt(i + 1) == '*') { if (!seenQuote && !seenCommentStart) { seenCommentStart = true; startPos = i; renderNonMLComment(endPos, startPos); i++; continue; } } if (text.charAt(i) == '*' && text.charAt(i + 1) == '/' && (i == 0 || text.charAt(i - 1) != '/')) { if (!seenQuote && seenCommentStart) { seenCommentStart = false; endPos = i + 2; renderComment(startPos, endPos); i++; continue; } } if (text.charAt(i) == '/' && text.charAt(i + 1) == '/') { if (!seenQuote && !seenCommentStart) { renderNonMLComment(endPos, i); renderComment(i, end); return; } } } } if (seenCommentStart) { renderComment(startPos, end); srcInComment = true; } else { renderNonMLComment(endPos, end); } } public void renderCode() { int lineBegin = text.indexOf('.'); if (lineBegin == -1) { lineBegin = 0; } else { lineNo = Integer.parseInt(text.substring(0, lineBegin).trim()); lineNoToRow.put(lineNo, curRow); lineBegin += 2; } marker.add(new Highlighter(0, lineBegin, "lineno")); if (type.equals("fortranfixed") || type.equals("fortranfree")) { // assume fortran has no comment inside /**/ renderCode(lineBegin, text.length()); return; } // detect comments inside /**/ or after // if (srcInComment) { String[] nonQuote = text.split("\""); int commentEndPos = 0; boolean foundEnd = false; for (int i = 0; i < nonQuote.length; i += 2) { // only look at "*/" outside pairs of "\"" if (i > 0) { commentEndPos += nonQuote[i - 2].length() + nonQuote[i - 1].length() + 2; } int idx = nonQuote[i].indexOf("*/"); if (idx != -1) { commentEndPos += idx + 2; foundEnd = true; break; } } if (foundEnd) { renderComment(lineBegin, commentEndPos); srcInComment = false; renderCode(commentEndPos, text.length()); } else { renderComment(lineBegin, text.length()); } return; } renderCode(lineBegin, text.length()); } } protected class UnderlineHighlighter extends DefaultHighlighter { // Painter used for this highlighter protected Highlighter.HighlightPainter painter; public UnderlineHighlighter(Color c) { painter = new UnderlineHighlightPainter(c); } // Convenience method to add a highlight with // the default painter. public Object addHighlight(int p0, int p1) throws BadLocationException { return addHighlight(p0, p1, painter); } public void setDrawsLayeredHighlights(boolean newValue) { // Illegal if false - we only support layered highlights if (newValue == false) { throw new IllegalArgumentException("UnderlineHighlighter only draws layered highlights"); } super.setDrawsLayeredHighlights(true); } // Painter for underlined highlights public class UnderlineHighlightPainter extends LayeredHighlighter.LayerPainter { public UnderlineHighlightPainter(Color c) { color = c; } public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) { // Do nothing: this method will never be called } public Shape paintLayer( Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c, View view) { g.setColor(color == null ? c.getSelectionColor() : color); Rectangle alloc = null; if (offs0 == view.getStartOffset() && offs1 == view.getEndOffset()) { if (bounds instanceof Rectangle) { alloc = (Rectangle) bounds; } else { alloc = bounds.getBounds(); } } else { try { Shape shape = view.modelToView( offs0, Position.Bias.Forward, offs1, Position.Bias.Backward, bounds); alloc = (shape instanceof Rectangle) ? (Rectangle) shape : shape.getBounds(); } catch (BadLocationException e) { // System.err.println("BadLocationException: " + e); // e.printStackTrace(); return null; } } FontMetrics fm = c.getFontMetrics(c.getFont()); int baseline = alloc.y + alloc.height - fm.getDescent(); int lowShift = 1; g.drawLine(alloc.x, baseline + lowShift, alloc.x + alloc.width, baseline + lowShift); return alloc; } protected Color color; // The color for the underline } } protected void goToCallee(int row, MouseEvent e) { if (calleeInfo == null || calleeInfo.get(row) == null) { return; } SrcTextPane dt = srcPaneCreated.get(mapRow(row)); if (dt != null) { if (caretLinePosition >= dt.textMarker.codeBegin && caretLinePosition < dt.textMarker.codeEnd) { ArrayList<SelObjInfo> callees = calleeInfo.get(row); if (callees.size() > 1) { // pop up context menu JPopupMenu popup = fl_table.getMenuListener().initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); boolean pressDown = false; for (int i = 0; i < 3; i++) { // XXXX ugly assumption that the "show callee source" is the 3rd item if (!popup.getComponent(i).isEnabled()) { continue; } popup.dispatchEvent( new KeyEvent(popup, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_DOWN, '\0')); pressDown = true; } if (pressDown) { popup.dispatchEvent( new KeyEvent(popup, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_RIGHT, '\0')); } } } else if (callees.size() == 1) { long funcId = callees.get(0).id; Integer targetRow = functionIdToRow.get(funcId); Object progressBarHandle = fl_table .getAnParent() .window .getSystemProgressPanel() .progressBarStart(AnLocale.getString("Callee")); // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToSrcNew(row); // change selected object fl_table.getAnParent().window.getSelectedObject().setSelObjV2(funcId); if (targetRow != null) { int targetFuncRow = (targetRow - 1 >= 0) ? (targetRow - 1) : 0; fl_table.getNavigationHistoryPool().getHistory().enabled = false; fl_table.setSelectedRow(targetFuncRow); fl_table.getNavigationHistoryPool().getHistory().enabled = true; fl_table.fireAnEvent(new AnEvent(fl_table, AnEvent.EVT_SELECT, targetFuncRow, null)); tryAddNewObj(); fl_table.getAnParent().updateToolBar(); } else { fl_table.getAnParent().setComputed(false); fl_table.getAnParent().computeOnAWorkerThread(); } fl_table.updateAnTable(AnTable.STR_ACTION_SHOW_CALLEE_SOURCE); fl_table .getAnParent() .window .getSystemProgressPanel() .progressBarStop(progressBarHandle); } } } } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SourceView.java����������������������������������������������������0000644�0001750�0001750�00000011073�14744453367�016710� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; public final class SourceView extends AnCompDisp implements AnChangeListener { public SourceView() { super(AnWindow.getInstance(), AnDisplay.DSP_Source, AnVariable.HELP_TabsSource); setAccessibility(AnLocale.getString("Source")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("SourceView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: setComputed(false); clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: addExperiment(); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: if (selected) { filterChanged(); } setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case SOURCE_FINDING_CHANGED: setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SETTING_CHANGING: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SRC_DIS || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.SEARCH_PATH || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.PATH_MAP || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { setComputed(false); if (oneDispPanel != null) { oneDispPanel.forceCompute = true; // ?????? } if (selected) { computeOnAWorkerThread(); } } break; case SELECTED_OBJECT_CHANGED: if (selected) { computeOnAWorkerThread(); } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void setComputed(boolean set) { super.setComputed(set); AnWindow.getInstance().getCalledByCallsSourceView().setComputed(set); } @Override protected void setAvailable(boolean set) { super.setAvailable(set); AnWindow.getInstance().getCalledByCallsSourceView().setAvailable(set); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/IPC.java�����������������������������������������������������������0000644�0001750�0001750�00000013211�14744453367�015224� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.ipc.IPCCancelledException; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.ipc.IPCErrorReader; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCReader; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.util.gui.AnUtility; import java.io.InputStream; import java.io.OutputStream; public final class IPC { public static final Object lock; public static String host; public static int port; protected InputStream processOutput, processError; protected OutputStream processInput; private IPCProcess thisProcess; private Process delegate; private Analyzer parent_Analyzer; private String cmd; // gp-display-text path + option private IPCHandle ipcHandle = null; private IPCResult ipcResult = null; private IPCReader ipcReader; private IPCErrorReader ipcErrorReader; static { lock = new Object(); } IPC(Analyzer parent) { parent_Analyzer = parent; } public InputStream getInputStream() { return processOutput; } public OutputStream getOutputStream() { return processInput; } public InputStream getErrorStream() { return processError; } public IPCReader getIPCReader() { return ipcReader; } public IPCErrorReader getIPCErrorReader() { return ipcErrorReader; } /** * @return trimmed gp-display-text command path plus IPC argument */ public String getCmd() { return cmd.trim(); } public void init(final String cmd, boolean run) throws Exception { this.cmd = cmd; final Runtime rt = Runtime.getRuntime(); delegate = rt.exec(cmd); processOutput = delegate.getInputStream(); processInput = delegate.getOutputStream(); processError = delegate.getErrorStream(); thisProcess = new IPCProcess(parent_Analyzer, delegate, processInput, processOutput, processError); if (thisProcess.monitor != null) { thisProcess.monitor.interrupt(); thisProcess.monitor = null; } thisProcess.setExitListener(); // NM Temporary solution for remote analyzer: pass flag "run" to IPCReader ipcReader = new IPCReader(this, run); ipcErrorReader = new IPCErrorReader(this, true); } public void destroyIPCProc() { if (thisProcess != null) { thisProcess.removeExitListener(); parent_Analyzer.IPC_started = false; thisProcess.destroy(); if (ipcReader != null) { ipcReader.stopThread(); } if (ipcErrorReader != null) { ipcErrorReader.stopThread(); } } } public int recvInt() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvInt cancelled..."); throw new IPCCancelledException(); } return ipcResult.getInt(); } public String recvString() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvString cancelled..."); throw new IPCCancelledException(); } return ipcResult.getString(); } public long recvLong() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvLong cancelled..."); throw new IPCCancelledException(); } return ipcResult.getLong(); } public boolean recvBoolean() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvBoolean cancelled..."); throw new IPCCancelledException(); } return ipcResult.getBoolean(); } public Object recvObject() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvObject cancelled..."); throw new IPCCancelledException(); } return ipcResult.getObject(); } public void recvVoid() { sendIPCRequest(); if (ipcResult.getCC() != IPCResult.CC.SUCCESS) { System.out.append("\nrecvVoid cancelled..."); throw new IPCCancelledException(); } ipcResult.getVoid(); // <=== FIXUP: is this needed???? } private IPCHandle getIPCHandle() { if (ipcHandle == null) { ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, IPCContext.getCurrentContext()); } return ipcHandle; } private void sendIPCRequest() { if (ipcHandle != null) { AnUtility.checkIfOnAWTThread(false); ipcResult = ipcHandle.sendRequest(); } else { System.err.println("********************ERROR: IPC: ipcRequest==null"); assert false; } ipcHandle = null; } public void send(final int i) { getIPCHandle().append(i); } public void send(final long l) { getIPCHandle().append(l); } public void send(final boolean b) { getIPCHandle().append(b); } public void send(final String s) { getIPCHandle().append(s); } public void send(final Object object) { getIPCHandle().append(object); } public static final class AnIPCException extends RuntimeException { public AnIPCException() { super(); } public AnIPCException(final Throwable thr) { super(thr); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnObject.java������������������������������������������������������0000644�0001750�0001750�00000013173�14744453367�016305� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; // Analyzer object public abstract class AnObject { public static final String quote_space = " "; public static final String zero_decimal = new DecimalFormat("0. ").format(0.); public static final String zero_sdecimal = new DecimalFormat("+0. ").format(0.); public static final String zero_percent = new DecimalFormat("0. ").format(0.); public static final DecimalFormat format_decimal = new DecimalFormat("0.000"); public static final DecimalFormat format_sdecimal = new DecimalFormat("+0.000;-0.000"); public static final DecimalFormat format_percent = new DecimalFormat("0.00"); public static final DecimalFormat format_group_decimal; public static final DecimalFormat format_group_sdecimal; public static final DecimalFormat format_group_integer; public static final DecimalFormat format_group_sinteger; static { DecimalFormatSymbols df_sym; df_sym = new DecimalFormatSymbols(); df_sym.setGroupingSeparator('@'); format_group_decimal = new DecimalFormat("#,##0.000", df_sym); format_group_sdecimal = new DecimalFormat("#,##0.000", df_sym); format_group_integer = new DecimalFormat("#,##0", df_sym); format_group_sinteger = new DecimalFormat("#,##0", df_sym); format_group_sinteger.setPositivePrefix("+"); format_group_sdecimal.setPositivePrefix("+"); } protected boolean showZero = true; protected boolean sign = false; protected String xtimes = ""; protected String get_zero_decimal() { // if (sign) { // Why do we want +0. ?? // return zero_sdecimal; // } return zero_decimal; } // Analyzer double value public double doubleValue() { return 0.0; } // Analyzer printing format public abstract String toString(); // Analyzer formatted printing format public String toFormString() { return toString(); } // Time printing public String toTime(final double clock) { if (xtimes.compareTo("") != 0) { // for ratio comparison, don't rescale by clock return toString(); } else { // is this code path ever reached? what is it for? return ""; } } // Time formatted printing format public String toFormTime(final double clock) { return toTime(clock); } // Percent printing public String toPercent(final double total) { return ""; } // Percent printing public final String percentToString(final double val) { if (val == 0.0) { return (showZero) ? zero_percent : quote_space; } return format_percent.format(val); } // Percent printing with quote public final String toPercentQuote(final double percent) { String s = toString(); if (percent == 0.0) { if (showZero) { return String.format("%s (%6s%%)", toString(), zero_percent); } return toQuoteSpace(); } return String.format("%s (%6.2f%%)", toString(), percent); } // Don't show percentage public final String toQuoteSpace() { String s = toString(); return s + " "; } // To show or not to show zero public final void showZero(boolean show) { showZero = show; } public final void showSign(boolean show) { sign = show; } public final void showXtimes(boolean show) { if (show) { xtimes = "x"; } else { xtimes = ""; } } /* * Updates Total and Max values. * Note: Total is not used, so only Maximum is updated. */ public static Object[][] updateMaxValues(final Object[][] data, Object[][] maxValues) { if (maxValues == null) { maxValues = new Object[2][data.length]; } if (maxValues[1].length != data.length) { maxValues = new Object[2][data.length]; } String strTotal = "<Total>"; String strLocalizedTotal = AnLocale.getString("<Total>"); int totalColumn = -1; for (int i = 0; i < data.length; i++) { int maxlen = 0; Object obj = maxValues[1][i]; if (obj != null) { maxlen = obj.toString().length(); } Object[] d = data[i]; for (int j = 0; j < d.length; j++) { int len = d[j].toString().length(); if (maxlen < len) { maxlen = len; obj = d[j]; } } maxValues[1][i] = obj; if (data[i] instanceof String[]) { String snames[] = (String[]) data[i]; for (int j = 0; j < snames.length; j++) { if ((snames[j].equals(strLocalizedTotal)) || (snames[j].equals(strTotal))) { totalColumn = j; break; } } } } if ((totalColumn != -1)) { for (int i = 0; i < data.length; i++) { Object[] d = data[i]; maxValues[0][i] = d[totalColumn]; } } // make sure there are no null elements in maxValues for (int i = 0; i < data.length; i++) { if (maxValues[0][i] == null) { maxValues[0][i] = new AnDouble(0.0); } if (maxValues[1][i] == null) { maxValues[1][i] = ""; } } return maxValues; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ViewDisplayPanel.java����������������������������������������������0000644�0001750�0001750�00000006021�14744453367�020032� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.settings.ViewsSetting; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.KeyStroke; public class ViewDisplayPanel extends JPanel { private ViewsSetting.View currentView = null; public ViewDisplayPanel() { setOpaque(false); setBorder(null); setLayout(new BorderLayout()); // Focus final KeyStroke viewsFocusShortCut = KeyboardShortcuts.viewsFocusShortCut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(viewsFocusShortCut, viewsFocusShortCut); getActionMap() .put( viewsFocusShortCut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().getNavigationPanel().getViewsPanel().requestFocus(); } }); // Focus KeyStroke mainViewFocusShortcut = KeyboardShortcuts.mainViewFocusShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(mainViewFocusShortcut, mainViewFocusShortcut); getActionMap() .put( mainViewFocusShortcut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { getCurrentViewDisplay().requestFocus(); } }); } public AnDisplay getCurrentViewDisplay() { AnDisplay ad = null; if (currentView != null) { ad = currentView.getAnDispTab().getTComp(); } return ad; } public String getCurrentViewName() { String ad = null; if (currentView != null) { ad = currentView.getAnDispTab().getTCmd(); } return ad; } public boolean viewComponent(String cmd) { if (cmd == null) { return false; } if (currentView != null && currentView.getAnDispTab().getTCmd().equals(cmd)) { return false; } ViewsSetting.View view = AnWindow.getInstance().getSettings().getViewsSetting().findView(cmd); if (view == null) { return false; } removeAll(); add(view.getAnDispTab().getTComp(), BorderLayout.CENTER); currentView = view; view.getAnDispTab() .getTComp() .repaint(); // Necessary, otherwise views don't paint correctly if changing views // rapitly.... return true; } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015633� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/BorderPanel.form������������������������������������������0000644�0001750�0001750�00000003746�14744453367�020663� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Form> ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/SubviewAreaPanel.java�������������������������������������0000644�0001750�0001750�00000016350�14744453367�021634� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.mainview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.CalledByCallsDisp; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.MainViewPanel.SubviewArea; import org.gprofng.mpmt.util.gui.AnTabbedPane; import java.awt.Component; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.KeyStroke; public class SubviewAreaPanel extends BorderPanel { private final SubviewArea subviewArea; private final AnTabbedPane tabbedPane; protected SubviewAreaPanel(SubviewArea subviewArea) { this.subviewArea = subviewArea; tabbedPane = new AnTabbedPane(); tabbedPane.setBorder(null); add(tabbedPane); setBackground(AnEnvironment.SUBVIEW_PANEL_BACKGROUND); // Focus keyboard shortcuts if (subviewArea == SubviewArea.SUBVIEW_AREA_1) { KeyStroke keyStroke = KeyboardShortcuts.subviewArea1FocusShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap().put(keyStroke, new FocusDefaultAction()); } else if (subviewArea == SubviewArea.SUBVIEW_AREA_2) { // Special case caller/callee tables KeyStroke keyStroke = KeyboardShortcuts.subviewArea2CallerFocusShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap().put(keyStroke, new FocusCallerAction()); keyStroke = KeyboardShortcuts.subviewArea2CalleeFocusShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap().put(keyStroke, new FocusCalleeAction()); } else if (subviewArea == SubviewArea.SUBVIEW_AREA_3) { KeyStroke keyStroke = KeyboardShortcuts.subviewArea3FocusShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap().put(keyStroke, new FocusDefaultAction()); } } static class FocusDefaultAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { SubviewAreaPanel subviewAreaPanel = (SubviewAreaPanel) e.getSource(); AnTabbedPane tabbedPane = subviewAreaPanel.getTabbedPane(); if (tabbedPane != null) { tabbedPane.requestFocus(); } } } static class FocusCallerAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { SubviewAreaPanel subviewAreaPanel = (SubviewAreaPanel) e.getSource(); AnTabbedPane tabbedPane = subviewAreaPanel.getTabbedPane(); if (tabbedPane != null && tabbedPane.getTabCount() > 0) { Subview subview = (Subview) tabbedPane.getComponentAt(0); Component component = subview.getComponent(); if (component instanceof CalledByCallsDisp) { CalledByCallsDisp calledByCallsDisp = (CalledByCallsDisp) component; if (calledByCallsDisp.getCallerTable().getSelectedRow() < 0) { calledByCallsDisp.getCallerTable().setSelectedRow(0); } calledByCallsDisp.getCallerTable().requestFocus(); } } } } static class FocusCalleeAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { SubviewAreaPanel subviewAreaPanel = (SubviewAreaPanel) e.getSource(); AnTabbedPane tabbedPane = subviewAreaPanel.getTabbedPane(); if (tabbedPane != null && tabbedPane.getTabCount() > 0) { Subview subview = (Subview) tabbedPane.getComponentAt(0); Component component = subview.getComponent(); if (component instanceof CalledByCallsDisp) { CalledByCallsDisp calledByCallsDisp = (CalledByCallsDisp) component; if (calledByCallsDisp.getCalleeTable().getSelectedRow() < 0) { calledByCallsDisp.getCalleeTable().setSelectedRow(0); } calledByCallsDisp.getCalleeTable().requestFocus(); } } } } protected AnTabbedPane getTabbedPane() { return tabbedPane; } protected void addSubview(Subview subview) { getTabbedPane().addTab(subview.getDisplayName(), subview); } protected void setHidden(Subview subview, boolean hidden) { int index = getTabbedPane().indexOfComponent(subview); if (hidden && index >= 0) { getTabbedPane().remove(subview); } if (!hidden && index < 0) { addSubview(subview); } } protected void remove(Subview subview) { getTabbedPane().remove(subview); } protected void setSelected(Subview subview) { int index = getTabbedPane().indexOfComponent(subview); if (index >= 0) { getTabbedPane().setSelectedComponent(subview); } } protected boolean isSelected(Subview subview) { Subview selectedSubview = (Subview) getTabbedPane().getSelectedComponent(); return selectedSubview == subview; } protected int getTabCount() { return getTabbedPane().getTabCount(); } /** Dump contents of subviews. Used in unit tests. */ public String dumpSubviews() { StringBuilder buf = new StringBuilder(); buf.append("\n"); buf.append(subviewArea); buf.append("\n"); buf.append("\n"); Component selectedComponent = tabbedPane.getSelectedComponent(); for (Component outerComponent : tabbedPane.getComponents()) { if (outerComponent instanceof Subview) { buf.append(((Subview) outerComponent).getDisplayName()); buf.append("\n"); buf.append("\n"); if (outerComponent == selectedComponent) { Component innerComponent = ((Subview) outerComponent).getComponent(); if (innerComponent instanceof ExportSupport && ((ExportSupport) innerComponent) .getSupportedExportFormats() .contains(ExportSupport.ExportFormat.TEXT)) { buf.append( ((ExportSupport) innerComponent) .exportAsText(0, ExportSupport.ExportFormat.TEXT, null)); } else { buf.append(((Subview) outerComponent).exportAsText()); } } } } return buf.toString(); } /** Dump views structure. Used in unit tests. */ public String dumpSubviewsVisibility() { StringBuilder buf = new StringBuilder(); buf.append(subviewArea); buf.append("\n"); Component selectedComponent = tabbedPane.getSelectedComponent(); for (Component component : tabbedPane.getComponents()) { if (component instanceof Subview) { if (component == selectedComponent) { buf.append(" *"); } else { buf.append(" "); } buf.append(((Subview) component).dumpName()); } } return buf.toString(); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/MainViewPanel.form����������������������������������������0000644�0001750�0001750�00000003747�14744453367�021166� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-108"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> �������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/Subview.java����������������������������������������������0000644�0001750�0001750�00000012256�14744453367�020064� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.mainview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.mainview.MainViewPanel.SubviewArea; import org.gprofng.mpmt.util.gui.AnJScrollPane; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.KeyStroke; public class Subview extends AnJScrollPane { private final String viewName; private final String displayName; private final SubviewArea subviewArea; private boolean readyToShow = true; private Component component; private final JPanel internalPanel; public Subview( String viewName, String displayName, final Component component, SubviewArea subviewArea) { this.viewName = viewName; this.displayName = displayName; this.subviewArea = subviewArea; setBackground(AnEnvironment.SUBVIEW_PANEL_BACKGROUND); setBorder(null); internalPanel = new JPanel(); internalPanel.setLayout(new BorderLayout()); internalPanel.setBackground(AnEnvironment.SUBVIEW_PANEL_BACKGROUND); setComponent(component); setViewportView(internalPanel); getMainViewPanel().addSubview(this); getVerticalScrollBar().setUnitIncrement(6); registerKeyboardAction( new SubviewHelpAction(), "help", KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } public static final class SubviewHelpAction implements ActionListener { @Override public void actionPerformed(final ActionEvent event) { // Delegate help to current view. AnWindow.getInstance().getViews().getCurrentViewDisplay().showHelp(); } } public String exportAsText() { StringBuilder buf = new StringBuilder(); // buf.append(displayName); // buf.append("\n"); exportAsText(buf, this); return buf.toString(); } private void exportAsText(StringBuilder buf, Component component) { if (component instanceof JLabel) { buf.append("Label:" + ((JLabel) component).getText()); buf.append("\n"); } if (component instanceof JTextField) { buf.append("TextField:" + ((JTextField) component).getText()); buf.append("\n"); } if (component instanceof JTextArea) { buf.append("JTextArea:" + ((JTextArea) component).getText()); buf.append("\n"); } if (component instanceof JList) { JList list = (JList) component; for (int i = 0; i < list.getModel().getSize(); i++) { buf.append(list.getModel().getElementAt(i).toString()); buf.append("\n"); } } if (component instanceof Container) { Component[] components = ((Container) component).getComponents(); for (Component c : components) { exportAsText(buf, c); } } } public String getViewName() { return viewName; } public String getDisplayName() { return displayName; } public void setComponent(Component component) { internalPanel.removeAll(); if (component != null) { internalPanel.add(component, BorderLayout.CENTER); } this.component = component; } public void removeComponent() { remove(component); this.component = null; } public Component getComponent() { return component; } public SubviewArea getSubviewArea() { return subviewArea; } public void setHidden(boolean hidden) { getMainViewPanel().setHidden(subviewArea, this, hidden); } public void setSelected() { getMainViewPanel().setSelected(subviewArea, this); } public boolean isSelected() { return getMainViewPanel().isSelected(subviewArea, this); } private MainViewPanel getMainViewPanel() { return AnWindow.getInstance().getMainViewPanel(); } /** * @return the readyToShow */ public boolean isReadyToShow() { return readyToShow; } /** * @param readyToShow the readyToShow to set */ public void setReadyToShow(boolean readyToShow) { this.readyToShow = readyToShow; } public void showSubview(boolean show) { boolean toShow = isReadyToShow() && show; setHidden(!toShow); } /** Dump views structure. Used in unit tests. */ public String dumpName() { StringBuilder buf = new StringBuilder(); buf.append(getViewName()); buf.append("\n"); return buf.toString(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/BorderPanel.java������������������������������������������0000644�0001750�0001750�00000003212�14744453367�020625� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.mainview; import org.gprofng.analyzer.AnEnvironment; import java.awt.BorderLayout; import javax.swing.BorderFactory; public class BorderPanel extends javax.swing.JPanel { public BorderPanel() { initComponents(); setBorder(BorderFactory.createLineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR, 1)); setBackground(AnEnvironment.TABBED_PANE_BACKGROUND_COLOR); setLayout(new BorderLayout()); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.BorderLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/Panel.java������������������������������������������������0000644�0001750�0001750�00000001726�14744453367�017477� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.mainview; import org.gprofng.analyzer.AnEnvironment; import java.awt.BorderLayout; import javax.swing.JPanel; public class Panel extends JPanel { public Panel() { setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); setBorder(null); setLayout(new BorderLayout()); } } ������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/mainview/MainViewPanel.java����������������������������������������0000644�0001750�0001750�00000021752�15044710303�021114� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.mainview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnSplitPaneFixedRightSize; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.JPanel; import javax.swing.JSplitPane; // +----------+-------------------------------------------------+---------------+ // | N | M | S1 | // | | | | // | | | | // | | | | // | | D1 | // | | | | // | | | | // | | | | // | | +-D3------------+ // | | | S3 | // | | | | // | | | | // | | | | // | | | | // | | | | // | +-D2----------------------------------------------+ | // | | S2 | | // | | | | // +----------+-------------------------------------------------+---------------+ // // MainViewPanel manages the M+S1+S2+S3 area // public class MainViewPanel extends javax.swing.JPanel { public enum SubviewArea { SUBVIEW_AREA_1(0), SUBVIEW_AREA_2(1), SUBVIEW_AREA_3(2); private final int index; SubviewArea(int index) { this.index = index; } public int index() { return index; } }; // Areas private final BorderPanel mainviewArea = new BorderPanel(); private final SubviewAreaPanel subviewArea1 = new SubviewAreaPanel(SubviewArea.SUBVIEW_AREA_1); private final SubviewAreaPanel subviewArea2 = new SubviewAreaPanel(SubviewArea.SUBVIEW_AREA_2); private final SubviewAreaPanel subviewArea3 = new SubviewAreaPanel(SubviewArea.SUBVIEW_AREA_3); private final List<SubviewAreaPanel> subviewAreas = new ArrayList<>(Arrays.asList(subviewArea1, subviewArea2, subviewArea3)); // List of all added subviews (including custom subviews) private final List<Subview> subviews = new ArrayList<>(); private final AnSplitPaneFixedRightSize splitPane1; private final AnSplitPaneFixedRightSize splitPane2; private final AnSplitPaneFixedRightSize splitPane3; public MainViewPanel() { initComponents(); setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); setBorder(null); setLayout(new GridBagLayout()); splitPane3 = new AnSplitPaneFixedRightSize( JSplitPane.VERTICAL_SPLIT, subviewArea1, subviewArea3, UserPref.getInstance().getSplitPane3().getSize(), UserPref.getInstance().getSplitPane3().getDefaultSize()); splitPane2 = new AnSplitPaneFixedRightSize( JSplitPane.VERTICAL_SPLIT, mainviewArea, subviewArea2, UserPref.getInstance().getSplitPane2().getSize(), UserPref.getInstance().getSplitPane2().getDefaultSize()); splitPane1 = new AnSplitPaneFixedRightSize( JSplitPane.HORIZONTAL_SPLIT, splitPane2, splitPane3, UserPref.getInstance().getSplitPane1().getSize(), UserPref.getInstance().getSplitPane1().getDefaultSize()); splitPane1.setHidden(true); splitPane2.setHidden(true); splitPane3.setHidden(true); GridBagConstraints gridBagConstraints = new GridBagConstraints(); // gridBagConstraints.insets = new Insets(5, 0, 5, 4); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(splitPane1, gridBagConstraints); } /** * @return the mainviewArea */ public JPanel getMainview() { return mainviewArea; } /** * @return the splitPane1 */ public AnSplitPaneFixedRightSize getSplitPane1() { return splitPane1; } /** * @return the splitPane2 */ public AnSplitPaneFixedRightSize getSplitPane2() { return splitPane2; } /** * @return the splitPane3 */ public AnSplitPaneFixedRightSize getSplitPane3() { return splitPane3; } public final void addSubview(Subview subview) { subviewAreas.get(subview.getSubviewArea().index()).addSubview(subview); subviews.add(subview); } public final Subview findSubview(String viewName) { Subview subview = null; for (Subview sv : subviews) { if (sv.getViewName().equals(viewName)) { subview = sv; break; } } return subview; } public final Subview findSubview(Component component) { Subview subview = null; for (Subview sv : subviews) { if (sv.getComponent() == component) { subview = sv; break; } } return subview; } public void hideAllSubviews() { for (Subview subview : subviews) { subview.setHidden(true); } } /** Show/hide subviews area depending on any tabs are visible */ public void showHideSubviewAreas() { // For now deal only with subviewArea2.... getSplitPane1().setHidden(subviewArea1.getTabCount() == 0); getSplitPane2().setHidden(subviewArea2.getTabCount() == 0); getSplitPane3().setHidden(subviewArea3.getTabCount() == 0); } public void setHidden(SubviewArea subviewArea, Subview subview, boolean hidden) { subviewAreas.get(subviewArea.index()).setHidden(subview, hidden); } public void setSelected(SubviewArea subviewArea, Subview subview) { subviewAreas.get(subviewArea.index()).setSelected(subview); } public boolean isSelected(SubviewArea subviewArea, Subview subview) { return subviewAreas.get(subviewArea.index()).isSelected(subview); } /** Dump views structure. Used in unit tests. */ public String dumpMainviewAreaVisibility() { StringBuilder buf = new StringBuilder(); buf.append("MAINVIEW_AREA\n"); buf.append(" "); buf.append(AnWindow.getInstance().getViews().getCurrentViewDisplay().getAnDispTab().getTCmd()); buf.append("\n"); return buf.toString(); } /** Dump contents of subviews. Used in unit tests. */ public String dumpSubviews() { StringBuilder buf = new StringBuilder(); if (!getSplitPane1().isHidden()) { buf.append(subviewArea1.dumpSubviews()); if (!getSplitPane3().isHidden()) { buf.append(subviewArea3.dumpSubviews()); } } if (!getSplitPane2().isHidden()) { buf.append(subviewArea2.dumpSubviews()); } return buf.toString(); } /** Dump views structure. Used in unit tests. */ public String dumpSubviewAreasVisibility() { StringBuilder buf = new StringBuilder(); if (!getSplitPane1().isHidden()) { buf.append(subviewArea1.dumpSubviewsVisibility()); if (!getSplitPane3().isHidden()) { buf.append(subviewArea3.dumpSubviewsVisibility()); } } if (!getSplitPane2().isHidden()) { buf.append(subviewArea2.dumpSubviewsVisibility()); } return buf.toString(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ����������������������gprofng-gui-2.1/org/gprofng/mpmt/ResolveFilePathPanel.form������������������������������������������0000644�0001750�0001750�00000022044�14744453367�020653� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,2,102"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="infoLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="unResolvedLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="unResolvedTextField"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="text" type="java.lang.String" value="222"/> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="resolvedLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="resolvedTextField"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="text" type="java.lang.String" value="111"/> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="pathTextField"> <Properties> <Property name="columns" type="int" value="50"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="5" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="browseButton"> <Properties> <Property name="text" type="java.lang.String" value="..."/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="browseButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="archiveCheckBox"> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="archiveCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="6" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JCheckBox" name="thisFileOnlyCheckBox"> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="thisFileOnlyCheckBoxActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="7" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="17" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="errorLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="9" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnMemoryManager.java�����������������������������������������������0000644�0001750�0001750�00000014220�14744453367�017634� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.statuspanel.StatusHandleFactory; import org.gprofng.mpmt.statuspanel.StatusLabelValueHandle; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.SwingUtilities; /** * @author tpreisle */ public class AnMemoryManager { private static final long MB = 1024 * 1024; private static AnMemoryManager instance = null; private static StatusLabelValueHandle memoryStatusHandle = null; private static long max = 0; private static long total = 0; private static long free = 0; private static long leftThreshold = 0; private static long visibleThreshold = 0; private static long used = 0; private static long left = 0; private static boolean warned = false; public AnMemoryManager() {} public static AnMemoryManager getInstance() { if (instance == null) { instance = new AnMemoryManager(); } if (memoryStatusHandle == null && AnWindow.getInstance() != null && AnWindow.getInstance().getStatusPanel() != null) { memoryStatusHandle = StatusHandleFactory.createStatusLabelValue( AnWindow.getInstance(), null, null, AnLocale.getString("Available Memory"), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.err.println("---------------Memory Usage"); System.err.println(statusText()); } }); memoryStatusHandle.setVisible(false); } return instance; } public boolean checkMemoryThreshold() { max = Runtime.getRuntime().maxMemory(); total = Runtime.getRuntime().totalMemory(); free = Runtime.getRuntime().freeMemory(); leftThreshold = Math.max(max / 8, 20 * MB); visibleThreshold = max / 2; used = total - free; left = max - used; if (left < visibleThreshold) { return true; } return false; } public void checkMemoryUsage() { max = Runtime.getRuntime().maxMemory(); total = Runtime.getRuntime().totalMemory(); free = Runtime.getRuntime().freeMemory(); leftThreshold = Math.max(max / 8, 20 * MB); visibleThreshold = max / 2; used = total - free; left = max - used; if (left < leftThreshold && !warned) { warning(); warned = true; } if (!(left < leftThreshold)) { warned = false; } if (memoryStatusHandle != null) { if ((used / MB) > visibleThreshold) { memoryStatusHandle.setVisible(true); } if (memoryStatusHandle.isVisible()) { final String labelValueText = (used / MB + "/" + max / MB + " MB"); // System.err.println(labelValueText); final String labelToolTip = statusTT(); final StatusLabelValueHandle.Mode mode = left < leftThreshold ? StatusLabelValueHandle.Mode.ERROR : StatusLabelValueHandle.Mode.DEFAULT; final ImageIcon icon = left < leftThreshold ? AnUtility.warningIcon : null; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { memoryStatusHandle.update(labelValueText, mode); memoryStatusHandle.updateToolTip(labelToolTip); memoryStatusHandle.update(icon); } }); } } } private void warning() { String warning = "============================> LOW MEMORY WARNING"; String status = statusText(); StringBuilder stacktrace = new StringBuilder(); StackTraceElement[] se = new Exception().getStackTrace(); stacktrace.append(Thread.currentThread().getName()); stacktrace.append("\n"); for (StackTraceElement se1 : se) { stacktrace.append(se1.toString()); stacktrace.append("\n"); } AnLog.log(warning); AnLog.log(status); AnLog.log(stacktrace.toString()); System.err.println(warning); // FIXUP: should be removed System.err.println(status); // FIXUP: should be removed } private static String statusTT() { StringBuilder buf = new StringBuilder(); buf.append("<html>"); buf.append("<b>Memory Usage</b> (used/available): " + used / MB + "/" + max / MB + " MB"); buf.append("<br>"); buf.append("<b>max</b>: " + max / MB + " MB"); buf.append("<br>"); buf.append("<b>total</b>: " + total / MB + " MB"); buf.append("<br>"); buf.append("<b>free</b>: " + free / MB + " MB"); buf.append("<br>"); buf.append("<b>used</b>: " + used / MB + " MB"); buf.append("<br>"); buf.append("<b>leftThreshold</b>: " + leftThreshold / MB + " MB"); buf.append("<br>"); buf.append("<b>visibleThreshold</b>: " + visibleThreshold / MB + " MB"); buf.append("<br>"); buf.append("<b>left</b>: " + left / MB + " MB"); buf.append("<br>"); buf.append("</html>"); return buf.toString(); } private static String statusText() { StringBuilder buf = new StringBuilder(); buf.append("max: " + max / MB + " MB"); buf.append("\n"); buf.append("total: " + total / MB + " MB"); buf.append("\n"); buf.append("free: " + free / MB + " MB"); buf.append("\n"); buf.append("used: " + used / MB + " MB"); buf.append("\n"); buf.append("leftThreshold: " + leftThreshold / MB + " MB"); buf.append("\n"); buf.append("left: " + left / MB + " B"); return buf.toString(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/FunctionsView.java�������������������������������������������������0000644�0001750�0001750�00000011162�14744453367�017417� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnUtility; public final class FunctionsView extends FuncListDisp implements AnChangeListener { public FunctionsView() { super(AnWindow.getInstance(), AnDisplay.DSP_Functions, 0, AnVariable.HELP_TabsFunctions); setAccessibility(AnLocale.getString("Functions")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("FunctionsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: setComputed(false); clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: setComputed(false); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTION_CHANGING: case SELECTION_CHANGED: // Nothing break; case SELECTION_UPDATE: ignoreSelected = true; computeOnAWorkerThread(); // This will recompute if necessary and fire a SELECTION_CHANGED // event. break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { setComputed(false); if (selected) { computeOnAWorkerThread(); } } break; case SELECTED_OBJECT_CHANGED: if (selected) { computeOnAWorkerThread(); } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void setComputed(boolean set) { super.setComputed(set); AnWindow.getInstance().getCalledByCallsFunctionsView().setComputed(set); } @Override protected void setAvailable(boolean set) { super.setAvailable(set); AnWindow.getInstance().getCalledByCallsFunctionsView().setAvailable(set); } /** * Ensure Functions View has been computed (even if not selected) Note: must directly or * indirectly be called from another view's doCompute */ public void computeIfNeeded() { AnUtility.checkIfOnAWTThread(false); ignoreSelected = true; updateSummary = false; boolean savedComputed = computed; doCompute(); computed = savedComputed; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/PsParser.java������������������������������������������������������0000644�0001750�0001750�00000056507�15044710303�016343� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import java.util.regex.Pattern; /** * A service for accessing 'ps'. * * <pre> * Typical usage: * * PsParser psParser = PsParser.getDefault("Solaris"); // or "Linux" * psParser.setPsOutput(psOutput); // String psOutput is 'ps -ef' output * Vector<String> th = psParser.getData(true).header(); * java.util.regex.Pattern re = java.util.regex.Pattern.compile("."); * Vector<Vector<String>> tp = psParser.getData(true).processes(re); * (javax.swing.table.DefaultTableModel)jTable.getModel().setDataVector(tp, th); * * </pre> */ public abstract class PsParser { private static final Logger logger = Logger.getLogger(PsParser.class.getName()); public final class PsData { private List<List<String>> processes = new ArrayList<>(); private List<String> header = null; /** Translated header names in the table */ public List<String> header() { return header; } void setHeader(List<String> header) { this.header = header; } public int commandColumnIdx() { return commandColumnIndex(); } public int pidColumnIdx() { return pidColumnIndex(); } // public FileMapper getFileMapper() { // return PsProvider.this.getFileMapper(); // } /** filter lines and convert to columns */ public List<List<String>> processes(Pattern re) { List<List<String>> res = new ArrayList<>(); // Do filtering outer: for (List<String> proc : processes) { for (String field : proc) { if (re.matcher(field).find()) { res.add(proc); continue outer; } } } return res; } void addProcess(String line) { int offset = 0; List<String> columns = new ArrayList<>(headerStr().length - 3); for (int cx = 0; cx < headerStr().length; cx++) { String s = null; if (cx == 7) { s = line.substring(offset + fields[cx][0]); } else // extra check for UID if (headerStr()[cx].contains("UID")) { assert offset == 0; int end = fields[cx][1]; while (line.charAt(end + 1) != ' ') { end++; } s = line.substring(fields[cx][0], end + 1); offset = end - fields[cx][1]; } else { s = line.substring(offset + fields[cx][0], offset + fields[cx][1] + 1); } if (cx != 3 && cx != 5 /* && cx != 6 */) { // No "C", "TTY" and /* "TIME" */columns columns.add(s.trim()); } } processes.add(columns); } private void updateCommand(String pid, String command) { for (List<String> proc : processes) { if (pid.equals(proc.get(pidColumnIdx()))) { proc.set(commandColumnIdx(), command); } } } } // can't be static, for format of ps output is different from host to host private List<String> parsedHeader = null; protected static final String zero = "0"; private String uid = null; private int fields[][] = new int[8][2]; /** Specialization of PsParser for Solaris */ static class SolarisPsParser extends PsParser { private static final String header_str_solaris[] = { "UID", "PID", "PPID", "C", // skipped "STIME", "TTY ", // skipped " TIME", // skipped "CMD", }; public SolarisPsParser(/* NM Host host */ ) { super(/* NM host */ ); } @Override public int commandColumnIndex() { return 4; } @Override public int pidColumnIndex() { return 1; } @Override public String[] headerStr() { return header_str_solaris; } /* * for executor, not used now, * in the future if we want to get uid from remote host * this is will be used. */ // protected String[] uidCommand1() { // String [] args = new String[2]; // args[0] = "/usr/xpg4/bin/id"; // args[1] = "-u"; // return args; // } @Override protected String uidCommand() { return "/usr/xpg4/bin/id -u"; } /* OLD protected String[] psCommand1(String uid) { if (Log.Ps.null_uid) uid = null; if ( (uid == null) || (uid.equals(zero)) ) { // uid=0 => root; use ps -ef // OLD return "LANG=C /bin/ps -www -o pid,tty,time,cmd"; String [] args = new String[2]; args[0] = "/usr/bin/ps"; args[1] = "-ef" ; return args; // return "LANG=C /usr/bin/ps -ef"; } else { String [] args = new String[3]; args[0] = "/usr/bin/ps"; args[1] = "-fu"; args[2] = uid; return args; // return "LANG=C /usr/bin/ps -fu " + uid; } } */ @Override protected String psCommand(String uid) { // SHOULD set LC_ALL=C here since we're depending // on column widths to get to the individual ps items! // (moved to getData) // if (Log.Ps.null_uid) // uid = null; if ((uid == null) || (uid.equals(zero))) { // uid=0 => root; use ps -ef return "/usr/bin/ps -ef"; } else { return "/usr/bin/ps -fu " + uid; } } @Override public PsData getData(boolean allProcesses) { PsData res = super.getData(allProcesses); // pargs call if needed // if (res != null && !DISABLE_PARGS && !res.processes.isEmpty()) { // NativeProcessBuilder pargsBuilder = // NativeProcessBuilder.newProcessBuilder(exEnv); // pargsBuilder.setExecutable("/usr/bin/pargs").redirectError(); // pargsBuilder.getEnvironment().put("LC_ALL", "C"); // String[] pargs_args = new String[res.processes.size()+1]; // pargs_args[0] = "-Fl"; // int idx = 1; // for (Vector<String> proc : res.processes) { // pargs_args[idx++] = proc.get(pidColumnIndex()); // } // pargsBuilder.setArguments(pargs_args); // // try { // List<String> pargsOutput = // ProcessUtils.readProcessOutput(pargsBuilder.call()); // updatePargsData(res, pargs_args, pargsOutput); // } catch (IOException ex) { // Exceptions.printStackTrace(ex); // } // } return res; } } // static void updatePargsData(PsData res, String[] pargs_args, List<String> pargsOutput) { // int idx = 1; // for (String procArgs : pargsOutput) { // if (procArgs.isEmpty() || // procArgs.startsWith("pargs: Warning") || // procArgs.startsWith("pargs: Couldn't determine locale of target process") || // procArgs.startsWith("pargs: Some strings may not be displayed properly")) { // continue; // } // if (!procArgs.startsWith("pargs:")) { // res.updateCommand(pargs_args[idx], procArgs); // } // idx++; // } // if ( (idx-1) != res.processes.size()) { // we should check if the operation has been // applied to all processes // throw new AssertionError("Process list:" + res.processes.toString() + "\npargs // output:" + pargsOutput.toString()); // } // } /** Specialization of PsParser for Linux */ static class LinuxPsParser extends PsParser { private static final String header_str_linux[] = { "UID ", "PID", "PPID", "C", // skipped "STIME", "TTY ", // skipped " TIME", // skipped "CMD", }; public LinuxPsParser(/*NM Host host */ ) { super(/*NM host */ ); } @Override public int commandColumnIndex() { return 4; } @Override public int pidColumnIndex() { return 1; } @Override public String[] headerStr() { return header_str_linux; } /* * for executor, not used, * in the future if we want to get uid from remote host * this is will be used. */ // protected String [] uidCommand1() { // String [] args = new String[2]; // args[0] = "/usr/bin/id"; // args[1] = "-u"; // return args; // } @Override protected String uidCommand() { return "/usr/bin/id -u"; } /* OLD protected String[] psCommand1(String uid) { if (Log.Ps.null_uid) uid = null; if ( (uid == null) || (uid.equals(zero)) ) { // uid=0 => root; use ps -ef // OLD return "LANG=C /bin/ps -www -o pid,tty,time,cmd"; String [] args = new String[2]; args[0] = "/bin/ps"; args[1] = "-ef"; return args; } else { String [] args = new String[3]; args[0] = "/bin/ps"; args[1] = "-fu"; args[2] = uid; return args; } } */ @Override protected String psCommand(String uid) { // SHOULD set LC_ALL=C here since we're depending // on column widths to get to the individual ps items! // (moved to getData) // if (Log.Ps.null_uid) // uid = null; if ((uid == null) || (uid.equals(zero))) { // uid=0 => root; use ps -ef // OLD return "LANG=C /bin/ps -www -o pid,tty,time,cmd"; return "/bin/ps -ef"; } else { return "/bin/ps -fu " + uid + " --width 1024"; } } } // static class MacOSPsProvider extends LinuxPsProvider { // private final static String header_str_mac[] = { // " UID", // " PID", // " PPID", // " C", // skipped // "STIME", // "TTY ", // skipped // " TIME", // skipped // "CMD", // }; // // @Override // public String[] headerStr() { // return header_str_mac; // } // // public MacOSPsProvider(Host host) { // super(host); // } // // @Override // protected String psCommand(String uid) { // if ( (uid == null) || (uid.equals(zero)) ) { // return "/bin/ps -ef"; // } else { // return "/bin/ps -fu " + uid; // } // } // } /** Specialization of PsProvider for Windows */ // static class WindowsPsProvider extends PsProvider { // private FileMapper fileMapper = FileMapper.getDefault(); // // private final static String header_str_windows[] = { // "PID", // "PPID", // "PGID", // "WINPID", // "TTY", // skipped // "UID", // "STIME", // "COMMAND", // }; // // public WindowsPsProvider(Host host) { // super(host); // } // // public int commandColumnIndex() { // return 4; // } // // // see IZ 193741 - skip status column // @Override // protected int firstPosition() { // return 1; // } // // public int pidColumnIndex() { // return 0; // } // // public String[] headerStr() { // return header_str_windows; // } // // protected String uidCommand() { // return getUtilityPath("id") + " -u"; // } // // protected String psCommand(String uid) { // // SHOULD set LC_ALL=C here since we're depending // // on column widths to get to the individual ps items! // // (moved to getData) // // if (Log.Ps.null_uid) // uid = null; // // // Always show all processes on Windows (-W option), see IZ 193743 // if ( (uid == null) || (uid.equals(zero)) ) { // // uid=0 => root; use ps -ef // return getUtilityPath("ps") + " -W"; // } else { // return getUtilityPath("ps") + " -u " + uid + " -W"; // } // } // // private String getUtilityPath(String util) { // File file = new File(CompilerSetUtils.getCygwinBase() + "/bin", util + ".exe"); // if (file.exists()) { // fileMapper = FileMapper.getByType(FileMapper.Type.CYGWIN); // } else { // fileMapper = FileMapper.getByType(FileMapper.Type.MSYS); // file = new File(CompilerSetUtils.getCommandFolder(null), util + ".exe"); // } // if (file.exists()) { // return file.getAbsolutePath(); // } // return util; // } // // @Override // public FileMapper getFileMapper() { // return fileMapper; // } // } // public static synchronized PsProvider getDefault(Host host) { // PsProvider psProvider = host.getResource(PsProvider.class); // if (psProvider == null) { // ExecutionEnvironment exEnv = host.executionEnvironment(); // if (!ConnectionManager.getInstance().connect(exEnv)) { // return null; // } // try { // HostInfo hostInfo = HostInfoUtils.getHostInfo(exEnv); // switch (hostInfo.getOSFamily()) { // case LINUX: // psProvider = new LinuxPsProvider(host); // break; // case WINDOWS: // psProvider = new WindowsPsProvider(host); // break; // case MACOSX: // psProvider = new MacOSPsProvider(host); // break; // default: // psProvider = new SolarisPsProvider(host); // } // } catch (CancellationException e) { // // user cancelled connection attempt // } catch (Exception e) { // Exceptions.printStackTrace(e); // } // host.putResource(PsProvider.class, psProvider); // } // return psProvider; // } public static synchronized PsParser getDefault(String OSFamily) { PsParser psParser = null; if ("Linux".equals(OSFamily)) { psParser = new LinuxPsParser(); } if ("Solaris".equals(OSFamily)) { psParser = new SolarisPsParser(); } return psParser; } /** Return index of the CMD column. */ protected abstract int commandColumnIndex(); protected abstract int pidColumnIndex(); protected abstract String[] headerStr(); // protected abstract String[] uidCommand1(); // for executor, not used protected abstract String psCommand(String root); // OLD protected abstract String[] psCommand1(String root); // for executor protected abstract String uidCommand(); // for Runtime.exe protected int firstPosition() { return 0; } // return file mapper (important only on Windows) // public FileMapper getFileMapper() { // return FileMapper.getDefault(); // } // // protected final ExecutionEnvironment exEnv; // // private PsProvider(Host host) { // exEnv = host.executionEnvironment(); // } // "host" for getUid is usually "localhost" private String getUid() { // if (uid == null) { // try { // NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(exEnv); // npb.setCommandLine(uidCommand()); // NativeProcess process; // try { // process = npb.call(); // } catch (Exception e) { // logger.log(Level.WARNING, "Failed to exec id command", e); // return exEnv.getUser(); // } // // String res = ProcessUtils.readProcessOutputLine(process); // // int exitCode = process.waitFor(); // if (exitCode != 0) { // String msg = "id command failed with " + exitCode; // logger.log(Level.WARNING, msg); // return exEnv.getUser(); // } // if (!res.isEmpty()) { // uid = res; // } else { // uid = exEnv.getUser(); // } // } catch (Exception e) { // ErrorManager.getDefault().annotate(e, "Failed to parse OutputStream of uid // command"); // ErrorManager.getDefault().notify(e); // } // } return uid; } /** Debugging method for printing column boundaries as discovered by parseHeader(). */ private void printFields(String str) { System.out.printf("------------------------------------------------\n"); System.out.printf("%s\n", str); for (int sx = 0; sx < str.length(); sx++) { boolean found = false; for (int cx = 0; cx < headerStr().length; cx++) { if (fields[cx][0] == sx) { System.out.printf("%d", cx); found = true; } else if (fields[cx][1] == sx) { System.out.printf("%d", cx); found = true; } } if (!found) { System.out.printf(" "); } } System.out.printf("\n"); System.out.printf("------------------------------------------------\n"); } /** * Return a Vector of headers based on the first line emitted by 'ps' and populate 'fields' as a * side-effect. * * <p>First lines look like this on solaris: * * <p>| UID PID PPID C STIME TTY TIME CMD | ivan 1501 1483 0 Nov 26 console 0:07 xterm -name * edit-left * * <p>and like this on linux: * * <p>|UID PID PPID C STIME TTY TIME CMD |ivan 11585 11583 0 12:39 pts/2 00:00:00 -csh * * <p>Field justifications are as follows: * * <p>field solaris linux ------------------------------ UID right left PID right right PPID right * right C 1 character 1 STIME right left TTY left left TIME right right CMD left left * * <p>The current column boundary determination is as follows: for solaris * |------------------------------------------------ | UID PID PPID C STIME TTY TIME CMD |0 01 12 * 23 34 45 56 67 7 |------------------------------------------------ ... and linux ...: * |------------------------------------------------ |UID PID PPID C STIME TTY TIME CMD |0 01 12 * 23 34 45 56 67 7 |------------------------------------------------ * * <p>The left side of left-aligned columns is one column too much to the left (STIME, C, TTY and * CMD). This is no problem as long as the left edge of this columns is next to a right-aligned * column. It should just be a space and get eaten up by 'trim'. TTY on linux is the only one * which doesn't abide by this. But I'm going to wing it for now and postpone making this column * discovery even more involved. */ List<String> parseHeader(String str) { /* OLD // parsedHeader is static so we only do this once if (parsedHeader != null) return parsedHeader; */ // if (Log.Ps.debug) // System.out.printf("parseHeader: '%s'\n", str); parsedHeader = new ArrayList<>(headerStr().length - 3); for (int cx = 0; cx < headerStr().length; cx++) { String s = null; int i; i = str.indexOf(headerStr()[cx]); // fields[cx][0] the begining of this column // fields[cx][1] the end of this column if (i >= 0) { // found if (cx == 0) // first column { fields[cx][0] = firstPosition(); } fields[cx][1] = i + headerStr()[cx].length() - 1; } if (cx == 7) { // last one s = str.substring(fields[cx][0]); } else { s = str.substring(fields[cx][0], fields[cx][1] + 1); fields[cx + 1][0] = i + headerStr()[cx].length(); } // if (Log.Ps.debug) // System.out.println("fields : " + fields[cx][0] + " " + fields[cx][1]); if (cx != 3 && cx != 5 /* && cx != 6 */) // No "C", "TTY" and /* "TIME" */ columns { parsedHeader.add(s.trim()); } } // if (Log.Ps.debug) // printFields(str); // translate header for (int hx = 0; hx < parsedHeader.size(); hx++) { String h = parsedHeader.get(hx); // NM parsedHeader.set(hx, Catalog.get("PS_HDR_" + h)); parsedHeader.set(hx, h); } return parsedHeader; } /** * Execute a ps command and return the data. * * <p>Executes a ps command, captures the output, remembers the first line as the 'parsedHeader', * stuffs the rest of the lines into 'PsData.lines'. PsData will columnize lines later. */ public PsData getData(boolean allProcesses) { PsData psData = new PsData(); String luid = allProcesses ? null : getUid(); // try { // //FIXME // NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(exEnv); // npb.setCommandLine(psCommand(luid)); // npb.getEnvironment().put("LANG", "C"); // // NativeProcess process; // try { // process = npb.call(); // } catch (Exception e) { // logger.log(Level.WARNING, "Failed to exec ps command", e); // return null; // } int lineNo = 0; // NM for (String line : ProcessUtils.readProcessOutput(process)) { for (String line : getPsOutput()) { // if (Log.Ps.debug) // System.out.printf("PsOutput: '%s'\n", line); if (line.indexOf("UID", 0) != -1) { // first line psData.setHeader(parseHeader(line)); lineNo++; } else if (lineNo++ > 0) { psData.addProcess(line); } } // int exitCode = process.waitFor(); // if (exitCode != 0) { // String msg = "ps command failed with " + exitCode; // logger.log(Level.WARNING, msg); // return null; // } // // } catch (Exception e) { // ErrorManager.getDefault().annotate(e, "Failed to parse OutputStream of ps command"); // ErrorManager.getDefault().notify(e); // } // // if (psData.processes.isEmpty()) { // ErrorManager.getDefault().log(ErrorManager.EXCEPTION, // "No lines from "); // } return psData; } // TEMPORARY private String psOutput = null; public void setPsOutput(String s) { psOutput = s; } String[] getPsOutput() { String[] s = {""}; // TEMPORARY List<String> v = new ArrayList<>(); if (null != psOutput) { for (int n = 0; n < psOutput.length(); ) { int k = psOutput.indexOf('\n', n); if (k < n) { break; // ignore incomplete line } String line = psOutput.substring(n, k); v.add(line); n = k + 1; } } int len = v.size(); if (len > 0) { s = new String[len]; for (int i = 0; i < len; i++) { s[i] = v.get(i); } } return s; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015635� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/StringPickListElement.java��������������������������������0000644�0001750�0001750�00000002175�14744453367�022665� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; public class StringPickListElement implements PickListElement { private String elem; public StringPickListElement(String elem) { this.elem = elem; } public String getString() { return elem; } /** Compares two PicklistElement for equality. Returns true if equal, otherwise false. */ @Override public boolean equals(PickListElement elem) { return ((StringPickListElement) elem).getString().equals(this.elem); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/PickListEvent.java����������������������������������������0000644�0001750�0001750�00000002774�14744453367�021173� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; import java.util.EventObject; /** Defines an event that encapsulates changes to a Picklist. */ public class PickListEvent extends EventObject { /** Identifies one or more changes in the lists contents. */ public static final int CONTENTS_CHANGED = 0; /** * The type of this event; */ private int type; /** * Constructs a PicklistDataEvent object. * * @param source the source Object (typically <code>this</code>) * @param type an int specifying {@link #CONTENTS_CHANGED} */ public PickListEvent(Object source, int type) { super(source); this.type = type; } /** * Returns the event type. The possible values are: * * <ul> * <li>{@link #CONTENTS_CHANGED} * </ul> * * @return an int representing the type value */ public int getType() { return type; } } ����gprofng-gui-2.1/org/gprofng/mpmt/picklist/PickListListener.java�������������������������������������0000644�0001750�0001750�00000001737�14744453367�021675� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; import java.util.EventListener; public interface PickListListener extends EventListener { /** * Sent when the contents of the list has changed. * * @param e a <code>PicklistDataEvent</code> encapsulating the event information */ void contentsChanged(PickListEvent e); } ���������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/PickList.java���������������������������������������������0000644�0001750�0001750�00000020621�15044710303�020134� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; import java.util.ArrayList; import java.util.List; import javax.swing.event.EventListenerList; public class PickList { /** Default max size of Picklist */ private int maxSize = 8; /** Increase size of Picklist, if variable sized */ private static int increaseSize = 8; /** The list itself and it's current size */ private PickListElement[] picklist = null; private int picklistSize = 0; /** Holds list of event listeners */ protected EventListenerList listenerList = null; /** Creates a new variable sized Picklist */ public PickList() { initialize(0); } /** Creates a new Picklist with maximux 'max' elements. 'max' <= 0 means variable sized list. */ public PickList(int max) { initialize(max); } private EventListenerList getListenerList() { if (listenerList == null) { listenerList = new EventListenerList(); } return listenerList; } /** Initializing data */ private void initialize(int max) { if (max <= 0) { maxSize = 0; // Open-ended ... picklist = new PickListElement[increaseSize]; } else { maxSize = max; // Fixed sized picklist = new PickListElement[increaseSize]; } } /** * Adds the specified component to the beginning of this list, increasing its size by one. * * @param elem the component to be added. */ public void addElement(PickListElement elem) { addElement(elem, true); // notify listener of a change fireContentsChanged(this); } public void addElements(List<PickListElement> list) { for (PickListElement elem : list) { addElement(elem, true); } // notify listener of a change fireContentsChanged(this); } /** * Adds the specified component to the beginning of this list, increasing its size by one. * * @param elem the component to be added. */ private synchronized void addElement(PickListElement elem, boolean check) { // Is this the only method that needs to synchronized??? FIXUP // first check if element already in the list int foundAt = contains(elem); int shiftDownFrom = 0; if (check && foundAt >= 0) { shiftDownFrom = foundAt; picklistSize--; } else { // Open-ended list if (picklistSize == picklist.length) { // Need to increate the size of picklist PickListElement[] picklist2 = new PickListElement[picklist.length + increaseSize]; for (int i = 0; i < picklist.length; i++) { picklist2[i] = picklist[i]; } picklist = picklist2; } shiftDownFrom = picklistSize; } // Shift down elements for (int i = shiftDownFrom; i > 0; i--) { picklist[i] = picklist[i - 1]; } // insert at top and increase size picklist[0] = elem; picklistSize++; // if fixed-sizes list, check size and possile delete last element if (maxSize > 0 && picklistSize >= maxSize) { picklistSize--; } } /** * Tests if the specified element is a component in this list. * * @param elem an object. * @return index of the specified element in the list if it exists as determined by the * <tt>equals</tt> method; <code>-1</code> otherwise. */ public int contains(PickListElement elem) { int foundAt = -1; if (elem != null) { for (int i = 0; i < picklistSize; i++) { if (picklist[i].equals(elem)) { foundAt = i; break; } } } return foundAt; } /** * Returns the value at the specified index. * * @param index the requested index * @return the value at <code>index</code> */ public PickListElement getElementAt(int index) { if (index >= 0 && index < picklistSize) { return picklist[index]; } else { return null; } } public List<PickListElement> getElements() { List<PickListElement> ret = new ArrayList<>(); for (PickListElement picklistElement : picklist) { if (picklistElement != null) { ret.add(picklistElement); } } return ret; } /** * Returns the max length of the list, 0 being variable sized. * * @return the max length of the list, 0 being variable sized */ public int getMaxSize() { return maxSize; } /** * Returns the top-most element in the list if not empty, otherwise null. * * @return the top-most element in the list */ public PickListElement getMostRecentUsedElement() { if (picklistSize > 0) { return picklist[0]; } else { return null; } } /** * Returns the length of the list. * * @return the length of the list */ public int getSize() { return picklistSize; } /** Removes all elements from this list and sets its size to zero. */ public void removeAllElements() { for (int i = 0; i < picklist.length; i++) { picklist[i] = null; } picklistSize = 0; // notify listener of a change fireContentsChanged(this); } /** * Removes the first (lowest-indexed) occurrence of the argument from this list. * * @param elem the element to be removed. * @return the element removed if found, null otherwise. */ public PickListElement removeElement(PickListElement elem) { return removeElementAt(contains(elem)); } /** * Removes the element at the specified index from the list. Each element in this list with an * index greater or equal to the specified <code>index</code> is shifted downward to have an index * one smaller than the value it had previously. The size of this list is decreased by <tt>1</tt>. * * <p>The index must be a value greater than or equal to <code>0</code> and less than the current * size of the list. * * <p> * * @param index the index of the object to remove. * @return the element removed if index valid, null otherwise. */ public PickListElement removeElementAt(int index) { PickListElement toBeRemoved = null; if (index < 0 || index >= picklistSize) { return toBeRemoved; } toBeRemoved = picklist[index]; for (int i = index; i < picklistSize - 1; i++) { picklist[i] = picklist[i + 1]; } picklistSize--; // notify listener of a change fireContentsChanged(this); return toBeRemoved; } /** * Replaces the element at the specified index with the one specified. * * @param index the index of the object to remove. * @return the element replaced if index valid, null otherwise. */ public PickListElement replaceElementAt(PickListElement elem, int index) { PickListElement toBeReplaced = null; if (index < 0 || index >= picklistSize) { return toBeReplaced; } toBeReplaced = picklist[index]; picklist[index] = elem; // notify listener of a change fireContentsChanged(this); return toBeReplaced; } /** * Adds a listener to the list that's notified each time a change to the data model occurs. * * @param l the <code>PicklistDataListener</code> to be added */ public void addPicklistListener(PickListListener l) { getListenerList().add(PickListListener.class, l); } /** * Removes a listener from the list that's notified each time a change to the data model occurs. * * @param l the <code>PicklistDataListener</code> to be removed */ public void removePicklistListener(PickListListener l) { getListenerList().remove(PickListListener.class, l); } private void fireContentsChanged(Object source) { Object[] listeners = getListenerList().getListenerList(); PickListEvent e = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == PickListListener.class) { if (e == null) { e = new PickListEvent(source, PickListEvent.CONTENTS_CHANGED); } ((PickListListener) listeners[i + 1]).contentsChanged(e); } } } } ���������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/PickListElement.java��������������������������������������0000644�0001750�0001750�00000001561�14744453367�021474� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; public interface PickListElement { /** Compares two PicklistElement for equality. Returns true if equal, otherwise false. */ public boolean equals(PickListElement elem); } �����������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/picklist/StringPickList.java���������������������������������������0000644�0001750�0001750�00000002670�15044710303�021327� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.picklist; import java.util.ArrayList; import java.util.List; public class StringPickList extends PickList { /** Creates a new variable sized Picklist */ public StringPickList() { super(); } /** Creates a new Picklist with maximux 'max' elements. 'max' <= 0 means variable sized list. */ public StringPickList(int max) { super(max); } public void addElement(String elem) { super.addElement(new StringPickListElement(elem)); } public List<StringPickListElement> getStringElements() { List<StringPickListElement> list = new ArrayList<>(); List<PickListElement> mostRecentExperiments = getElements(); for (PickListElement ple : mostRecentExperiments) { list.add((StringPickListElement) ple); } return list; } } ������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnVariable.java����������������������������������������������������0000644�0001750�0001750�00000024164�14744453367�016626� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.awt.Color; import java.awt.Dimension; import java.awt.Insets; import java.awt.Toolkit; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; public final class AnVariable { public static final Object mainFlowLock = new Object(); // Runtime environment public static final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize(); // Preferred color public static final Color LABEL_COLOR = Color.black; // regular label public static final Color CCOMP_COLOR = new Color(46, 146, 199); // comp-comm public static final Color DISRC_COLOR = new Color(117, 117, 117); // src for dis public static final Color QUOTE_COLOR = new Color(199, 0, 0); // quote public static final Color HILIT_COLOR = Color.ORANGE; // flagged public static final Color HILIT_INC_COLOR = new Color(255, 245, 0); // flagged public static final Color HOTLINE_COLOR = new Color(255, 165, 0); // flagged public static final Color WARMLINE_COLOR = new Color(215, 215, 225); // flagged public static final Color COMENTARY_COLOR = new Color(233, 239, 248); // background color for commentary public static final Color SRCDIS_COLOR = new Color(245, 245, 245); // background color for source in disasm view public static final Color KEYWORD_COLOR = new Color(0, 0, 230); // syntax highlighting public static final Color COMMENT_COLOR = new Color(155, 155, 155); // syntax highlighting public static final Color DIRECTIVE_COLOR = new Color(0, 155, 0); // syntax highlighting public static final Color STRING_COLOR = new Color(206, 123, 0); // syntax highlighting public static final Color LINENO_COLOR = new Color(155, 155, 183); // syntax highlighting public static final Color LINENO_COLOR_BOLD = new Color(95, 95, 123); // syntax highlighting public static final Color OPCODE_COLOR = new Color(0, 155, 0); // syntax highlighting public static final Color OPRANDREG_COLOR = new Color(46, 146, 199); // syntax highlighting public static final Color OPRANDVALUE_COLOR = new Color(153, 51, 204); // syntax highlighting public static final Color REGSEL_COLOR = new Color(135, 206, 250); // background color for selected reg public static final Color WARNINGPANEL_COLOR = new Color(255, 255, 199); // background color for warning panel public static final Color JMPOTHER_COLOR = new Color(0, 185, 0); // forground color for jump forward address public static final Color JMPBACK_COLOR = new Color(243, 143, 0); // forground color for jump back address public static final Color JMPOUTSIDE_COLOR = Color.RED; // forground color for jump outside function address // Preferred windows size public static final int WIN_WIDTH, WIN_HEIGHT; private static final int INFO_PRF_WIDTH, INFO_MIN_WIDTH; private static final int FVIEW_WIDTH, FVIEW_HEIGHT; public static final Dimension WIN_SIZE; public static final Dimension INFO_PRF_SIZE; public static final Dimension INFO_MIN_SIZE; public static final Dimension FVIEW_SIZE; static { WIN_WIDTH = 850; INFO_PRF_WIDTH = 370; WIN_HEIGHT = 450; INFO_MIN_WIDTH = 200; FVIEW_WIDTH = 650; FVIEW_HEIGHT = 400; WIN_SIZE = new Dimension(WIN_WIDTH, WIN_HEIGHT); INFO_PRF_SIZE = new Dimension(INFO_PRF_WIDTH, WIN_HEIGHT); INFO_MIN_SIZE = new Dimension(INFO_MIN_WIDTH, WIN_HEIGHT); FVIEW_SIZE = new Dimension(FVIEW_WIDTH, FVIEW_HEIGHT); } private static final int HELP_WIDTH = 600; private static final int HELP_HEIGHT = 700; public static final Dimension HELP_SIZE = new Dimension(HELP_WIDTH, HELP_HEIGHT); // Label with left/right margin space private static final int sizeLabel = 4; public static final int sizeIcon = 1; public static final Border labelBorder = new EmptyBorder(0, sizeLabel, 0, sizeLabel); public static final Border fieldBorder = new EmptyBorder(sizeLabel, 0, sizeLabel, 0); public static final Border iconBorder = new EmptyBorder(0, sizeIcon, 0, sizeIcon); public static final Border boxBorder = new EmptyBorder(sizeLabel, sizeLabel, sizeLabel, sizeLabel); public static final Border textBorder = UIManager.getBorder("TextField.border"); public static final Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); public static final Border listFocusBorder = UIManager.getBorder("List.focusCellHighlightBorder"); public static final Border tableFocusBorder = UIManager.getBorder("Table.focusCellHighlightBorder"); public static final Border treeFocusBorder = new LineBorder(UIManager.getColor("Tree.selectionBorderColor")); // Button margin public static final Insets buttonMargin = new Insets(1, 1, 1, 1); // All chars public static final String all_chars = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "1234567890-=\\`[];',./" + "!@#$%^&*()_+|~{}:\"<>?"; // Help mapIDs public static final String HELP_WelcomeAnalyzer = "Welcome_Analyzer"; public static final String HELP_InformationMap = "Information"; public static final String HELP_NewFeatures = "Welcome_WhatsNew"; public static final String HELP_QuickReference = "Navigate_QuickRef"; public static final String HELP_KeyboardShortcuts = "Navigate_Keyboard"; public static final String HELP_HelpShortcuts = "Navigate_KbdNavHelp"; public static final String HELP_Troubleshooting = "Trouble_Trouble"; public static final String HELP_Welcome = "WelcomeView"; // "Tabs_Welcome"; public static final String HELP_Export = null; // "Tabs_Welcome"; public static final String HELP_Overview = "Tabs_Overview"; public static final String HELP_TabsFunctions = "Tabs_Functions"; public static final String HELP_TabsCallersCallees = "Tabs_CallersCallees"; public static final String HELP_CallFlameChart = "CallFlameChart"; public static final String HELP_TabsCallTree = "Tabs_CallTree"; public static final String HELP_TabsSource = "Tabs_Source"; public static final String HELP_TabsLines = "Tabs_Lines"; public static final String HELP_TabsDisassembly = "Tabs_Disassembly"; public static final String HELP_TabsPCs = "Tabs_PCs"; public static final String HELP_TabsDataLayout = "Tabs_DataLayout"; public static final String HELP_TabsDataObjects = "Tabs_DataObjects"; public static final String HELP_TabsTimeline = "Tabs_Timeline"; public static final String HELP_TabsStatistics = "Tabs_Statistics"; public static final String HELP_TabsExperiments = "Tabs_Experiments"; public static final String HELP_TabsExperimentIDs = "Tabs_ExperimentIDs"; public static final String HELP_TabsLeaklist = "Tabs_Leaklist"; public static final String HELP_TabsHeap = "Tabs_Heap"; public static final String HELP_TabsMemObj = "Tabs_MemObj"; public static final String HELP_TabsIndxObj = "Tabs_IndxObj"; public static final String HELP_TabsIFreq = "Tabs_IFreq"; public static final String HELP_TabsSummary = "Tabs_Summary"; public static final String HELP_TabsEvent = "Tabs_Event"; public static final String HELP_TabsLegend = "Tabs_Legend"; public static final String HELP_TabsLeak = "Tabs_Leak"; public static final String HELP_TabsProcesses = "Tabs_Processes"; public static final String HELP_TabsRaceList = "Tabs_RaceList"; public static final String HELP_TabsRaceDetails = "Tabs_RaceDetails"; public static final String HELP_TabsRaceDualSrc = "DualSource"; public static final String HELP_TabsSrcDisassm = "Tabs_SrcDisassm"; public static final String HELP_TabsThreads = "Threads"; public static final String HELP_TabsCPUs = "CPUs"; public static final String HELP_TabsSamples = "Samples"; public static final String HELP_TabsSeconds = "Seconds"; public static final String HELP_TabsThreadsChart = "Threads"; public static final String HELP_TabsDeadlockDetails = "Tabs_DeadlockDetails"; public static final String HELP_TabsDeadlocksList = "Tabs_DeadlocksList"; public static final String HELP_TabsIOActivity = "Tabs_IOActivity"; public static final String HELP_TabsMPITimeline = "MPITimeline"; public static final String HELP_TabsMPIChart = "MPIChart"; public static final String HELP_TabsOMPParallelRegions = "Tabs_OMPParallelRegions"; // new tag????? public static final String HELP_TabsOpenMPTasks = "Tabs_OpenMPTasks"; public static final String HELP_Settings = "Data_SetPref"; public static final String HELP_Filter = "CustomFilters"; public static final String HELP_ShowHideFunctions = "Data_ShowHide"; public static final String HELP_CollectDialog = "CollectAnalyzer"; public static final String HELP_CollectRunningDialog = "CollectRunning"; public static final String HELP_CollectKernelDialog = "ProfileKernel"; public static final String HELP_MachModel = "LoadMachModel"; public static final String HELP_MachineModelBrowser = "BrowseMachModel"; public static final String HELP_CustomMemTab = "AddCustomMemTab"; public static final String HELP_CustomIndxTab = "AddCustomIndxTab"; public static final String HELP_DataSize = "Tabs_DataSize"; public static final String HELP_Duration = "Tabs_Duration"; public static final String HELP_Compare = "Compare"; public static final String HELP_Aggregate = "Aggregate"; // public final static String HELP_RemoteAnalyzer = "RemoteAnalyzer"; public static final String HELP_ConnectRemoteHost = "ConnectToRemoteHost"; public static final String HELP_ConnectAuthentication = "Managing_Auth"; public static final String HELP_ExportSettings = "ExportSettings"; // FIXUP public static final String HELP_ResolveSourceFile = "ResolveSourceFile"; // FIXUP } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnHotGap.java������������������������������������������������������0000644�0001750�0001750�00000054075�15044710303�016243� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Rectangle2D; import java.util.Vector; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.ToolTipManager; import javax.swing.event.PopupMenuEvent; /** * A component that lets the user navigate between hot lines clicking on an appropriate colored * rect. due to rfe #4487681 () */ public final class AnHotGap extends JPanel implements MouseListener, MouseMotionListener { // Hot Rect constants private AnMenuListener menuListener; private AnTable table; private final double box_height = 2.; // height of rect public static final int HOTGAP_WIDTH = 18; private final double box_width = HOTGAP_WIDTH - 6; // width of rect private final double height_adjustment = 16; // height of the scrollbare arrow private final double handle_adjustment = 8; // half height of the handle private final double x_left = (HOTGAP_WIDTH - box_width) / 2 - 1; // left rect indentation private Vector<RectData> vect; // list of hot rects private Vector<Integer> hots; // list of hot lines private Vector<Integer> warm_lines; // list of warm lines (a metric value > 0) private int warm_lines_count = 0; // count of warm lines private boolean show_warm_lines = true; private FuncListDisp disp = null; // SRC or DIS display private int hots_count = 0; // Count of hot lines private int row_count; // count of the table lines private int curr_line = 0; // Current line private boolean isHotRect = false; // indicates hot rect private String text = null; // Tooltip text for hot rect private Rectangle2D.Double rect, rect_shadow; private Rectangle r; private ToolTipManager tm; // Tooltip manager private AnTable.FListTableModel model; // table model private final BasicStroke stroke = new BasicStroke(BasicStroke.JOIN_ROUND); private static final String prefix_msg = AnLocale.getString("Non-Zero-Metric item at: "); private final String updateView = AnLocale.getString("Updating the view"); // Menu actions public static final String STR_ACTION_NEXT_HOT_LINE = AnLocale.getString("Next Hot Line"); public static final String STR_ACTION_NEXT_NZ_LINE = AnLocale.getString("Next Non-zero Metric Line"); public static final String STR_ACTION_PREV_HOT_LINE = AnLocale.getString("Previous Hot Line"); public static final String STR_ACTION_PREV_NZ_LINE = AnLocale.getString("Previous Non-zero Metric Line"); public static final String STR_ACTION_SHOW_NZ_LINE = AnLocale.getString("Show Non-zero Metric Line"); public static final String STR_ACTION_HIDE_NZ_LINE = AnLocale.getString("Hide Non-zero Metric Line"); /** Creates hot rects panel */ public AnHotGap(FuncListDisp disp, int headerHeight) { init(disp, disp.table, headerHeight); } public AnHotGap(final FuncListDisp disp, final AnTable table, int headerHeight) { init(disp, table, headerHeight); } private void init(final FuncListDisp disp, AnTable table, int headerHeight) { this.disp = disp; this.table = table; table.gap = this; model = table.getTableModel(); setLayout(new java.awt.GridLayout()); java.awt.Dimension dim = new java.awt.Dimension(HOTGAP_WIDTH, table.getPreferredSize().height - headerHeight); setPreferredSize(dim); dim = new java.awt.Dimension(HOTGAP_WIDTH, table.getMaximumSize().height - headerHeight); setMaximumSize(dim); dim = new java.awt.Dimension(HOTGAP_WIDTH, table.getMinimumSize().height - headerHeight); setMinimumSize(dim); addMouseMotionListener(this); addMouseListener(this); tm = ToolTipManager.sharedInstance(); tm.registerComponent(this); // Popup menu menuListener = new AnMenuListener(); this.addMouseListener(menuListener); } /** Updates hot rects panel and sets required flags and variables */ public void update() { synchronized (updateView) { row_count = model.getRowCount(); if (row_count == 0) { hots_count = 0; repaint(); return; } if (show_warm_lines) { warm_lines = new Vector<Integer>(); for (int i = 0; i < row_count; i++) { int mcc = model.getColumnCount(); int j, k = model.getNameCol(); String s; for (j = 0; j < mcc; j++) { if (j == k) { continue; } s = model.getValueAt(i, j).toString(); if (s.matches(".*[1-9].*")) { warm_lines.add(i); break; } } } warm_lines_count = warm_lines.size(); } else { warm_lines_count = 0; } hots = new Vector<Integer>(); for (int i = 0; i < row_count; i++) { int j; if ((j = model.getSrcType(i)) < 0) { hots.add(i); } } hots_count = hots.size(); repaint(); } } /** Paints this component. */ @Override protected void paintComponent(final Graphics g) { update(g); } /** * Updates this component. * * @param g the specified context to use for updating * @see #paint * @see #repaint() */ @Override public void update(final Graphics g) { synchronized (updateView) { double y; int line; int line_height = 0; final Graphics2D g2 = (Graphics2D) g; // Clean old markers java.awt.Dimension dim = getSize(); r = new Rectangle(0, 0, dim.height, dim.height); g2.setPaint(java.awt.Color.WHITE /* AnVariable.BG_COLOR */); g2.fill(r); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); if ((hots_count == 0) && (warm_lines_count == 0)) { return; } double gap_height = table.getVerticalScrollBar().getSize().height - 2 * height_adjustment - handle_adjustment; double inc = (gap_height / row_count); double rowHeight = table.getRowHeight(); if (inc > rowHeight) { gap_height = gap_height * rowHeight / inc; inc = rowHeight; } // Calculate minimum line height if (row_count > 0) { line_height = (dim.height / row_count); } vect = new Vector<RectData>(hots_count + warm_lines_count); int addRow = 0; Rectangle2D.Double cur_rect_warm = null; int current_line = table.getSelectedRow(); for (int i = 0; i < warm_lines_count; i++) { line = warm_lines.get(i); y = addRow + height_adjustment + inc * line; rect = new java.awt.geom.Rectangle2D.Double(x_left, y, box_width, box_height); g2.setPaint(AnVariable.WARMLINE_COLOR); g2.setStroke(stroke); g2.draw(rect); g2.fill(rect); r = rect.getBounds(); r = new Rectangle(r.x, r.y, r.width + 2, r.height + 1); vect.add(new RectData(r, line)); // Highlight current line if (line == current_line) { // rect = new java.awt.geom.Rectangle2D.Double(x_left-4, y, box_width/2+4, box_height+2); rect_shadow = new java.awt.geom.Rectangle2D.Double( x_left - 1, y - 1, box_width + 2, box_height + 2); cur_rect_warm = rect; } } Rectangle2D.Double cur_rect_hot = null; for (int i = 0; i < hots_count; i++) { line = hots.get(i); y = addRow + height_adjustment + inc * line; rect = new java.awt.geom.Rectangle2D.Double(x_left, y, box_width, box_height); g2.setPaint(AnVariable.HOTLINE_COLOR); g2.setStroke(stroke); g2.draw(rect); g2.fill(rect); r = rect.getBounds(); r = new Rectangle(r.x, r.y, r.width + 2, r.height + 1); vect.add(new RectData(r, line)); // , model.getSrcLine(line))); // Highlight current line if (line == current_line) { // rect = new java.awt.geom.Rectangle2D.Double(x_left-4, y, box_width/2+4, box_height+2); rect_shadow = new java.awt.geom.Rectangle2D.Double( x_left - 1, y - 1, box_width + 2, box_height + 2); cur_rect_hot = rect; } } if (cur_rect_warm != null) { g2.setPaint(Color.BLACK); g2.draw(rect_shadow); g2.fill(rect_shadow); g2.setPaint(AnVariable.WARMLINE_COLOR); g2.setStroke(stroke); g2.draw(cur_rect_warm); g2.fill(cur_rect_warm); } if (cur_rect_hot != null) { g2.setPaint(Color.BLACK); g2.draw(rect_shadow); g2.fill(rect_shadow); g2.setPaint(AnVariable.HOTLINE_COLOR); g2.setStroke(stroke); g2.draw(cur_rect_hot); g2.fill(cur_rect_hot); } } } private void goToLine(int line) { disp.goToLine(table, line); update(); } /** * Returns hot line for the current hot rect * * @return current hot line */ private int getLine() { return curr_line; } /** * Checks selected point if that is from hot rect and sets approproiate flags and vars * * @param p point being checked * @return <code>true</code> if point belongs hot rect */ private boolean checkRect(final Point p) { isHotRect = false; curr_line = 0; final int size = vect.size(); if (size == 0) { return false; } RectData data; Vector<Integer> candidates = new Vector<Integer>(); for (int i = 0; i < size; i++) { data = vect.get(i); if (data.getRect().contains(p)) { candidates.add(i); } } for (int i = 0; i < candidates.size(); i++) { data = vect.get(candidates.get(i)); for (int j = 0; j < hots_count; j++) { int line = hots.get(j); if (line == data.getLine()) { setText(data.getHint()); isHotRect = true; curr_line = data.getLine(); return true; } } } for (int i = 0; i < candidates.size(); i++) { data = vect.get(candidates.get(i)); setText(data.getHint()); isHotRect = true; curr_line = data.getLine(); return true; } return false; } /** * Sets tooltip text for hot rects * * @param str tooltip text */ private void setText(final String str) { text = str; } /** * Returns tooltip text for hot rect (overrides method in <code>javax.swing.JComponent</code>) * * @param event Mouse event */ @Override public String getToolTipText(final MouseEvent event) { return text; } /** * Returns tooltip location for hot rect (overrides method in <code>javax.swing.JComponent</code>) * * @param event Mouse event */ @Override public Point getToolTipLocation(final MouseEvent event) { final Point p = event.getPoint(); if (getSize().getHeight() - p.getY() <= 25) { p.setLocation(0, p.y - (20 + box_height)); } else { p.setLocation(0, p.y + 15); } return p; } // This methods are required by MouseMotionListener. public void mouseMoved(final MouseEvent e) { synchronized (updateView) { final Point mp = e.getPoint(); if (vect == null) { return; } if (checkRect(mp)) { tm.setEnabled(true); this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { tm.setEnabled(false); this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } } public void mouseDragged(final MouseEvent e) {} // This methods are required by MouseListener. public void mouseClicked(final MouseEvent e) { if (!isHotRect) { return; } goToLine(getLine()); } public void mouseExited(final MouseEvent e) { tm.setEnabled(true); } public void mouseEntered(final MouseEvent e) {} public void mousePressed(final MouseEvent e) {} public void mouseReleased(final MouseEvent e) {} /** Inner class to represent hot rect data */ private final class RectData { private final Rectangle r; private final int line; /** * Constructor of hot rect data * * @param r hot rectangle * @param line hot line */ public RectData(final Rectangle r, final int line /*, final String hint*/) { this.r = r; this.line = line; } public Rectangle getRect() { return r; } public String getHint() { return prefix_msg + model.getSrcLine(line); } public int getLine() { return line; } } /** * Navigate in Hot Gap Possible actions: Next Hot Line - go to next Hot Line Next Non-zero Metric * Line - go to next Non-zero Metric Line Previous Hot Line - go to Previous Hot Line Previous * Non-zero Metric Line - got to Previous Non-zero Metric Line */ private void HG_Action(String actionName, ActionEvent ev) { if (actionName.equals(STR_ACTION_NEXT_HOT_LINE)) { HG_Next_Hot_Line(); } if (actionName.equals(STR_ACTION_NEXT_NZ_LINE)) { HG_Next_NZ_Line(); } if (actionName.equals(STR_ACTION_PREV_HOT_LINE)) { HG_Prev_Hot_Line(); } if (actionName.equals(STR_ACTION_PREV_NZ_LINE)) { HG_Prev_NZ_Line(); } if (actionName.equals(STR_ACTION_SHOW_NZ_LINE)) { show_warm_lines = true; update(); } if (actionName.equals(STR_ACTION_HIDE_NZ_LINE)) { show_warm_lines = false; update(); } } /** Navigate to Next Hot Line */ public void HG_Next_Hot_Line() { int current_line = table.getSelectedRow(); for (int i = 0; i < hots_count; i++) { int line = hots.get(i); if (current_line >= line) { continue; } goToLine(line); repaint(); break; } } /** Navigate to Previous Hot Line */ public void HG_Prev_Hot_Line() { int current_line = table.getSelectedRow(); for (int i = hots_count - 1; i >= 0; i--) { int line = hots.get(i); if (current_line <= line) { continue; } goToLine(line); repaint(); break; } } /** Navigate to Next Non-Zero Metric Line */ public void HG_Next_NZ_Line() { int next_hot_line = -1; int next_nz_line = -1; int current_line = table.getSelectedRow(); for (int i = 0; i < hots_count; i++) { int line = hots.get(i); if (current_line >= line) { continue; } next_hot_line = line; break; } for (int i = 0; i < warm_lines_count; i++) { int line = warm_lines.get(i); if (current_line >= line) { continue; } next_nz_line = line; break; } if ((next_hot_line < 0) && (next_nz_line < 0)) { return; } if (next_hot_line < 0) { next_hot_line = next_nz_line; } if (next_nz_line < 0) { next_nz_line = next_hot_line; } if (next_hot_line < next_nz_line) { next_nz_line = next_hot_line; } goToLine(next_nz_line); repaint(); } /** Navigate to Previous Non-Zero Metric Line */ public void HG_Prev_NZ_Line() { int next_hot_line = -1; int next_nz_line = -1; int current_line = table.getSelectedRow(); for (int i = hots_count - 1; i >= 0; i--) { int line = hots.get(i); if (current_line <= line) { continue; } next_hot_line = line; break; } for (int i = warm_lines_count - 1; i >= 0; i--) { int line = warm_lines.get(i); if (current_line <= line) { continue; } next_nz_line = line; break; } if ((next_hot_line < 0) && (next_nz_line < 0)) { return; } if (next_hot_line < 0) { next_hot_line = next_nz_line; } if (next_nz_line < 0) { next_nz_line = next_hot_line; } if (next_hot_line > next_nz_line) { next_nz_line = next_hot_line; } goToLine(next_nz_line); repaint(); } /** Is navigation to Next Hot Metric Line available? */ public boolean HG_Is_Next_Hot_Line() { int current_line = table.getSelectedRow(); for (int i = 0; i < hots_count; i++) { int line = hots.get(i); if (current_line >= line) { continue; } return true; } return false; } /** Is navigation to Previous Hot Metric Line available? */ public boolean HG_Is_Prev_Hot_Line() { int current_line = table.getSelectedRow(); for (int i = hots_count - 1; i >= 0; i--) { int line = hots.get(i); if (current_line <= line) { continue; } return true; } return false; } /** Is navigation to Next Non-Zero Metric Line available? */ public boolean HG_Is_Next_NZ_Line() { int next_hot_line = -1; int next_nz_line = -1; if (!show_warm_lines) { return false; } int current_line = table.getSelectedRow(); for (int i = 0; i < hots_count; i++) { int line = hots.get(i); if (current_line >= line) { continue; } next_hot_line = line; break; } for (int i = 0; i < warm_lines_count; i++) { int line = warm_lines.get(i); if (current_line >= line) { continue; } next_nz_line = line; break; } if ((next_hot_line < 0) && (next_nz_line < 0)) { return false; } return true; } /** Is navigation to Previous Non-Zero Metric Line available? */ public boolean HG_Is_Prev_NZ_Line() { int next_hot_line = -1; int next_nz_line = -1; if (!show_warm_lines) { return false; } int current_line = table.getSelectedRow(); for (int i = hots_count - 1; i >= 0; i--) { int line = hots.get(i); if (current_line <= line) { continue; } next_hot_line = line; break; } for (int i = warm_lines_count - 1; i >= 0; i--) { int line = warm_lines.get(i); if (current_line <= line) { continue; } next_nz_line = line; break; } if ((next_hot_line < 0) && (next_nz_line < 0)) { return false; } return true; } // ------- Private classes to implement popup menu items ------- // private class AnMenuListener extends MouseAdapter { private boolean debug; AnMenuListener() { debug = false; } public JPopupMenu initPopup(MouseEvent event) { return init_popup(); } public JPopupMenu init_popup() { AccessibleContext ac; JMenuItem mi; JPopupMenu popup = new JPopupMenu(); String txt; // Add "Previous Hot Line" action txt = STR_ACTION_PREV_HOT_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(HG_Is_Prev_Hot_Line()); popup.add(mi); // Add "Next Hot Line" action txt = STR_ACTION_NEXT_HOT_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(HG_Is_Next_Hot_Line()); popup.add(mi); // Add separator popup.addSeparator(); // Add "Previous Non-zero Metric Line" action txt = STR_ACTION_PREV_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(HG_Is_Prev_NZ_Line()); popup.add(mi); // Add "Next Non-zero Metric Line" action txt = STR_ACTION_NEXT_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(HG_Is_Next_NZ_Line()); popup.add(mi); // Add separator popup.addSeparator(); // Add "Show Non-zero Metric Line" action txt = STR_ACTION_SHOW_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(!show_warm_lines); popup.add(mi); // Add "Hide Non-zero Metric Line" action txt = STR_ACTION_HIDE_NZ_LINE; mi = new JMenuItem(new UpdateAction(txt)); ac = mi.getAccessibleContext(); ac.setAccessibleDescription(txt); mi.setEnabled(show_warm_lines); popup.add(mi); return popup; } public void mousePressed(MouseEvent e) { maybeShowPopup(e); } public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } /** Generic action for context menu items. Action name is passed as String. */ class UpdateAction extends AbstractAction { String actionName = null; public UpdateAction(String txt) { super(txt); actionName = txt; } @Override public void actionPerformed(ActionEvent ev) { HG_Action(actionName, ev); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/HeapView.java������������������������������������������������������0000644�0001750�0001750�00000112610�15044710303�016300� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.AnDisplay.DSP_Heap; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.statecolors.StackView; import org.gprofng.mpmt.statecolors.StackViewState; import org.gprofng.mpmt.statecolors.StateColorMap; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.EventObject; import java.util.List; import java.util.Vector; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JViewport; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public final class HeapView extends FuncListDisp implements AnListener, MouseListener, AdjustmentListener, ListSelectionListener, AnChangeListener { private boolean inCompute = false; // protected AnTable table; // Don't use your own local copy. Use the 'table' from // FuncListDisp. private JScrollPane errorPane = null; private Object[][] tableDataCalStk; private long[] dataCalStkIds = null; private JPanel statPanel; private AnJScrollPane statScrollPane; private String[][] statisticsData; private JComponent eventPane; private JComponent stackViewPane; private StackView stack_view; // Right-hand Tab's Event Stack Display private final StateColorMap clmap; private int stackRowId; private final int HEAPSIZE = 0; private final int ALLOC = 1; private final int LEAK = 2; private boolean updateIfNotSort; private StackView.StackViewPopupListener stackViewPopupListener; /** Keeps last warning to avoid showing the same warning message many times */ // Constructor public HeapView() { super(AnWindow.getInstance(), AnDisplay.DSP_Heap, 0, AnVariable.HELP_TabsHeap); clmap = window.getColorChooser().getColorMap(); clmap.addAnListener(this); initTab(); stackViewPopupListener = stack_view.new StackViewPopupListener(window); setAccessibility(AnLocale.getString("Heap")); AnEventManager.getInstance().addListener(this); updateIfNotSort = true; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } private void initTab() { // Event Pane eventPane = new FocusPanel(); eventPane.setLayout(new BorderLayout()); TitledBorder titledBorder = new TitledBorder(AnLocale.getString("Heap Activity")); titledBorder.setBorder(new LineBorder(eventPane.getBackground())); // Event Pane: Call Stack stack_view = new StackView(clmap); stack_view.addMouseListener(this); stack_view.addListSelectionListener(this); stackViewPane = new JPanel(); stackViewPane.setBackground(Color.WHITE); stackViewPane.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(2, 2, 2, 2); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; stackViewPane.add(stack_view, gridBagConstraints); stackViewPane.setVisible(false); stackViewPane.revalidate(); stackViewPane.repaint(); eventPane.add(stackViewPane, BorderLayout.CENTER); eventPane.revalidate(); } class FocusPanel extends JPanel { @Override public void requestFocus() { if (stack_view != null) { stack_view.requestFocus(); } } } @Override public JPopupMenu getFilterPopup() { return table.initPopup(true); } // tab to populate right-side info area public JComponent getStackInfoTabComp() { return eventPane; } // name for tab in right-side info area public String getStackInfoTabName() { return AnLocale.getString("Call Stack - Heap"); } public JComponent getStackViewPane() { return stackViewPane; } @Override public void setSelected(final boolean set) { super.setSelected(set); // Show right pane if we get selected // if (set) { // window.showRightPane(); // } } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); String acName = null; String acDesc = null; JLabel acLabel = null; acName = AnLocale.getString("HeapActivity"); acDesc = AnLocale.getString("Show heap activity for selected application"); if (acName != null) { acLabel = new JLabel(acName, JLabel.RIGHT); } table = new AnTable(type, true, true, can_sort, false, true, true, true, acName, acDesc, acLabel); table.setParent(this); if (acLabel != null) { acLabel.setVisible(false); // acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); } table.addAnListener(new TableHandler()); statPanel = new JPanel(); statPanel.setLayout(new GridBagLayout()); statPanel.setBackground(Color.white); statScrollPane = new AnJScrollPane(statPanel); statScrollPane.setPreferredSize(new Dimension(100, 100)); JSplitPane sp = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, table, statScrollPane); sp.setResizeWeight(.75); add(sp, BorderLayout.CENTER); } // Compute & update function list table @Override public void doCompute() { AnUtility.checkIfOnAWTThread(false); MetricLabel[] label; final String pwarnstr; // Not selected if (!selected) { return; } // XXXX show error when compare is on, needs simplified, // but the situation is different for different views if (window.getSettings().getCompareModeSetting().comparingExperiments()) { JLabel error_label = new JLabel(); error_label.setHorizontalAlignment(JLabel.CENTER); error_label.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); error_label .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Error message")); JViewport error_view = new JViewport(); error_view.setView(error_label); String msg = AnLocale.getString("Not available when comparing experiments"); error_label.setText(msg); if (errorPane == null) { errorPane = new AnJScrollPane(); add(errorPane, BorderLayout.CENTER); } errorPane.setViewportView(error_view); errorPane.setVisible(true); statScrollPane.setVisible(false); return; } if (errorPane != null) { errorPane.setVisible(false); } statScrollPane.setVisible(true); if (inCompute) { return; } else { inCompute = true; } int typeForPresentation = type; if (!computed) { // need re-compute reset(); tableDataCalStk = null; dataCalStkIds = null; stack_view.reset(); table.setViewport(); final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); Object[] raw_data_with_ids = window.getTableDataV2("MET_HEAP", "ALL", "HEAPCALLSTACK", "" + subtype, null); tableDataCalStk = localProcessData(mlist, raw_data_with_ids); dataCalStkIds = current_ids; if (updateIfNotSort) { statisticsData = getHeapStatistics(); AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { statPanel.removeAll(); displayStatisticsData(statisticsData); } }); } updateIfNotSort = true; names = getNames(type, 0); // IPC call, don't do on AWT AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { MetricLabel[] label = getSettings().getMetricsSetting().getLabel(tableDataCalStk, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); int sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); table.setData(label, tableDataCalStk, names, null, 0, name_col, sort_ind); table.setSelectedRow(stackRowId); table.showSelectedRow(); window.showSubview(window.getHeapCallStackSubview(), true); if (table.getTable().getColumnCount() == 1) { table.showMessage(new NoMetricsSelectedPanel(type)); inCompute = false; return; } } }); } // else if (!isUpdated()) { // Object[] gtm = getTotalMax(); // label = getSettings().getMetricsSetting().getLabel(table.getTableData(), gtm, // typeForPresentation, table); // // if (label != null) { // table.setLabel(label); // } // } AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { if (stackRowId >= dataCalStkIds.length) { stackRowId = dataCalStkIds.length - 1; } long id = dataCalStkIds[stackRowId]; int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_Heap); window.getSelectionManager().updateSelection(ids, DSP_Heap, subtype, 1); } updateStackView(id); } }); computed = true; // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } inCompute = false; } public int getDisplayMode() { return DSP_Heap; } public long[] getSelectedIds(int selectedIndices[], int displayMode) { // FIXUP: REARCH long[] ids = null; if (selectedIndices.length >= 1) { ids = new long[selectedIndices.length]; for (int i = 0; i < selectedIndices.length; i++) { ids[i] = dataCalStkIds[selectedIndices[i]]; } } return ids; } private String exportStatisticsData(final String[][] raw_data) { if (raw_data == null) { return null; } StringBuilder strBuild = new StringBuilder(); strBuild.append("\n"); if (!AnWindow.getInstance().getFilters().anyFilters()) { strBuild.append(AnLocale.getString("Heap Data Statistics For <Total>")); strBuild.append("\n\n"); } else { strBuild.append(AnLocale.getString("Heap Data Statistics For <Total> (filters on)")); strBuild.append("\n\n"); } if (raw_data[HEAPSIZE].length > 1) { strBuild.append(raw_data[HEAPSIZE][0]); strBuild.append("\n"); for (int i = 1; i < raw_data[HEAPSIZE].length; i++) { strBuild.append(raw_data[HEAPSIZE][i]); strBuild.append("\t\t\t"); i++; strBuild.append(raw_data[HEAPSIZE][i]); strBuild.append("\n"); } strBuild.append("\n"); } if (raw_data[ALLOC].length > 1) { strBuild.append(raw_data[ALLOC][0]); strBuild.append("\n"); strBuild.append(AnLocale.getString("Allocation Size Range")); strBuild.append("\t\t"); strBuild.append(AnLocale.getString("Allocations")); strBuild.append("\n"); for (int i = 1; i < raw_data[ALLOC].length; i++) { if (raw_data[ALLOC][i].trim().indexOf('-') > 0) { strBuild.append(" "); } strBuild.append(raw_data[ALLOC][i]); if (raw_data[ALLOC][i].trim().indexOf('-') > 0) { strBuild.append("\t\t\t"); } else { strBuild.append("\t"); } i++; strBuild.append(raw_data[ALLOC][i]); strBuild.append("\n"); } strBuild.append("\n"); } if (raw_data[LEAK].length > 1) { strBuild.append(raw_data[LEAK][0]); strBuild.append("\n"); strBuild.append(AnLocale.getString("Leak Size Range")); strBuild.append("\t\t\t"); strBuild.append(AnLocale.getString("Leaks")); strBuild.append("\n"); for (int i = 1; i < raw_data[LEAK].length; i++) { if (raw_data[LEAK][i].trim().indexOf('-') > 0) { strBuild.append(" "); } strBuild.append(raw_data[LEAK][i]); if (raw_data[LEAK][i].trim().indexOf('-') > 0) { strBuild.append("\t\t\t"); } else { strBuild.append("\t\t"); } i++; strBuild.append(raw_data[LEAK][i]); strBuild.append("\n"); } strBuild.append("\n"); } return strBuild.toString(); } private void displayStatisticsData(final String[][] raw_data) { if (raw_data == null) { return; } GridBagConstraints gridBagConstraints = new GridBagConstraints(); Color color = new Color(240, 240, 240); if (!AnWindow.getInstance().getFilters().anyFilters()) { JLabel label = new JLabel(AnLocale.getString("Heap Data Statistics For <Total>")); label.setFont(table.getFont().deriveFont(Font.BOLD)); label.setOpaque(true); label.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.left = 0; gridBagConstraints.insets.bottom = 10; statPanel.add(label, gridBagConstraints); } else { JLabel label = new JLabel(AnLocale.getString("Heap Data Statistics For <Total> (filters on)")); label.setFont(table.getFont().deriveFont(Font.BOLD)); label.setOpaque(true); label.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.left = 0; gridBagConstraints.insets.bottom = 10; statPanel.add(label, gridBagConstraints); } gridBagConstraints.insets.bottom = 0; if (raw_data[HEAPSIZE].length > 1) { JPanel heapSizePanel = new JPanel(); heapSizePanel.setLayout(new GridBagLayout()); heapSizePanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsHeapSize = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[HEAPSIZE][0]); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.bottom = 0; gridBagConstraints.insets.top = 0; gridBagConstraints.insets.left = 0; statPanel.add(label1, gridBagConstraints); gridBagConstraintsHeapSize.gridwidth = 1; for (int i = 1; i < raw_data[HEAPSIZE].length; i++) { JLabel label2 = new JLabel(raw_data[HEAPSIZE][i]); label2.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsHeapSize.weightx = 1; gridBagConstraintsHeapSize.weighty = 0; gridBagConstraintsHeapSize.gridx = 0; gridBagConstraintsHeapSize.gridy = gridBagConstraintsHeapSize.gridy + 1; gridBagConstraintsHeapSize.anchor = GridBagConstraints.LINE_START; gridBagConstraintsHeapSize.fill = GridBagConstraints.NONE; gridBagConstraintsHeapSize.insets.left = 0; heapSizePanel.add(label2, gridBagConstraintsHeapSize); i++; JLabel label3 = new JLabel(raw_data[HEAPSIZE][i]); label3.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsHeapSize.weightx = 1; gridBagConstraintsHeapSize.weighty = 0; gridBagConstraintsHeapSize.gridx = gridBagConstraintsHeapSize.gridx + 1; gridBagConstraintsHeapSize.anchor = GridBagConstraints.LINE_START; gridBagConstraintsHeapSize.fill = GridBagConstraints.NONE; gridBagConstraintsHeapSize.insets.left = 170; heapSizePanel.add(label3, gridBagConstraintsHeapSize); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(heapSizePanel, gridBagConstraints); } if (raw_data[ALLOC].length > 1) { JPanel allocPanel = new JPanel(); allocPanel.setLayout(new GridBagLayout()); allocPanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsAlloc = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[ALLOC][0]); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets.bottom = 0; gridBagConstraints.insets.top = 0; gridBagConstraints.insets.left = 0; statPanel.add(label1, gridBagConstraints); gridBagConstraintsAlloc.gridwidth = 1; JLabel label2 = new JLabel(AnLocale.getString("Allocation Size Range")); label2.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsAlloc.weightx = 1; gridBagConstraintsAlloc.weighty = 0; gridBagConstraintsAlloc.gridx = 0; gridBagConstraintsAlloc.gridy = 1; gridBagConstraintsAlloc.anchor = GridBagConstraints.LINE_START; gridBagConstraintsAlloc.fill = GridBagConstraints.NONE; gridBagConstraintsAlloc.insets.bottom = 1; gridBagConstraintsAlloc.insets.top = 0; gridBagConstraintsAlloc.insets.left = 0; allocPanel.add(label2, gridBagConstraintsAlloc); JLabel label3 = new JLabel(AnLocale.getString("Allocations")); label3.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsAlloc.weightx = 1; gridBagConstraintsAlloc.weighty = 0; gridBagConstraintsAlloc.gridx = gridBagConstraintsAlloc.gridx + 1; gridBagConstraintsAlloc.gridy = 1; gridBagConstraintsAlloc.anchor = GridBagConstraints.LINE_START; gridBagConstraintsAlloc.fill = GridBagConstraints.NONE; gridBagConstraintsAlloc.insets.bottom = 1; gridBagConstraintsAlloc.insets.top = 0; gridBagConstraintsAlloc.insets.left = 120; allocPanel.add(label3, gridBagConstraintsAlloc); for (int i = 1; i < raw_data[ALLOC].length; i++) { JLabel label4 = new JLabel(raw_data[ALLOC][i]); label4.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsAlloc.weightx = 1; gridBagConstraintsAlloc.weighty = 0; gridBagConstraintsAlloc.gridx = 0; gridBagConstraintsAlloc.gridy = gridBagConstraintsAlloc.gridy + 1; gridBagConstraintsAlloc.anchor = GridBagConstraints.LINE_START; gridBagConstraintsAlloc.fill = GridBagConstraints.NONE; gridBagConstraintsAlloc.insets.bottom = 0; gridBagConstraintsAlloc.insets.top = 0; if (raw_data[ALLOC][i].trim().indexOf('-') > 0) { gridBagConstraintsAlloc.insets.left = 5; } else { gridBagConstraintsAlloc.insets.left = 0; } allocPanel.add(label4, gridBagConstraintsAlloc); i++; JLabel label5 = new JLabel(raw_data[ALLOC][i]); label5.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsAlloc.weightx = 1; gridBagConstraintsAlloc.weighty = 0; gridBagConstraintsAlloc.gridx = gridBagConstraintsAlloc.gridx + 1; gridBagConstraintsAlloc.anchor = GridBagConstraints.LINE_START; gridBagConstraintsAlloc.fill = GridBagConstraints.NONE; gridBagConstraintsAlloc.insets.left = 120; gridBagConstraintsAlloc.insets.bottom = 0; allocPanel.add(label5, gridBagConstraintsAlloc); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(allocPanel, gridBagConstraints); } if (raw_data[LEAK].length > 1) { JPanel leakPanel = new JPanel(); leakPanel.setLayout(new GridBagLayout()); leakPanel.setBackground(Color.WHITE); GridBagConstraints gridBagConstraintsLeak = new GridBagConstraints(); JLabel label1 = new JLabel(raw_data[LEAK][0]); label1.setFont(table.getFont().deriveFont(Font.BOLD)); label1.setOpaque(true); label1.setBackground(color); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.insets.bottom = 0; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label1, gridBagConstraints); gridBagConstraintsLeak.gridwidth = 1; JLabel label2 = new JLabel(AnLocale.getString("Leak Size Range")); label2.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsLeak.weightx = 1; gridBagConstraintsLeak.weighty = 0; gridBagConstraintsLeak.gridx = 0; gridBagConstraintsLeak.gridy = 1; gridBagConstraintsLeak.anchor = GridBagConstraints.LINE_START; gridBagConstraintsLeak.fill = GridBagConstraints.NONE; gridBagConstraintsLeak.insets.bottom = 1; leakPanel.add(label2, gridBagConstraintsLeak); JLabel label3 = new JLabel(AnLocale.getString("Leaks")); label3.setFont(table.getFont().deriveFont(Font.BOLD)); gridBagConstraintsLeak.weightx = 1; gridBagConstraintsLeak.weighty = 0; gridBagConstraintsLeak.gridx = gridBagConstraintsLeak.gridx + 1; gridBagConstraintsLeak.gridy = 1; gridBagConstraintsLeak.anchor = GridBagConstraints.LINE_START; gridBagConstraintsLeak.fill = GridBagConstraints.NONE; gridBagConstraintsLeak.insets.bottom = 1; gridBagConstraintsLeak.insets.left = 135; leakPanel.add(label3, gridBagConstraintsLeak); for (int i = 1; i < raw_data[LEAK].length; i++) { JLabel label4 = new JLabel(raw_data[LEAK][i]); label4.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsLeak.weightx = 1; gridBagConstraintsLeak.weighty = 0; gridBagConstraintsLeak.gridx = 0; gridBagConstraintsLeak.gridy = gridBagConstraintsLeak.gridy + 1; gridBagConstraintsLeak.anchor = GridBagConstraints.LINE_START; gridBagConstraintsLeak.fill = GridBagConstraints.NONE; gridBagConstraintsLeak.insets.bottom = 0; gridBagConstraintsLeak.insets.top = 0; if (raw_data[LEAK][i].trim().indexOf('-') > 0) { gridBagConstraintsLeak.insets.left = 5; } else { gridBagConstraintsLeak.insets.left = 0; } leakPanel.add(label4, gridBagConstraintsLeak); i++; JLabel label5 = new JLabel(raw_data[LEAK][i]); label5.setFont(table.getFont().deriveFont(Font.PLAIN)); gridBagConstraintsLeak.weightx = 1; gridBagConstraintsLeak.weighty = 0; gridBagConstraintsLeak.gridx = gridBagConstraintsLeak.gridx + 1; gridBagConstraintsLeak.anchor = GridBagConstraints.LINE_START; gridBagConstraintsLeak.fill = GridBagConstraints.NONE; gridBagConstraintsLeak.insets.left = 135; gridBagConstraintsLeak.insets.bottom = 0; leakPanel.add(label5, gridBagConstraintsLeak); } gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.REMAINDER; gridBagConstraints.insets.bottom = 10; statPanel.add(leakPanel, gridBagConstraints); } // The last component. It will push everything up. JLabel label = new JLabel(""); gridBagConstraints.weightx = 1; gridBagConstraints.weighty = 1; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridBagConstraints.gridy + 1; gridBagConstraints.anchor = GridBagConstraints.FIRST_LINE_START; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; statPanel.add(label, gridBagConstraints); statPanel.invalidate(); statPanel.validate(); statPanel.repaint(); } public void updateStackView(long stackId) { if (stackId == 0 /*null*/) { stack_view.reset(); // update stack in right-hand tab return; // Request for details about uninstrumented code is not supported yet. } AnUtility.checkIPCOnWrongThread(false); long[] pcs = window.getStackPCs(stackId); // IPC! String[] pcnames = window.getStackNames(stackId); // IPC! long[] funcs = window.getStackFunctions(stackId); // IPC! String[] fnames = window.getFuncNames(funcs); // IPC! AnUtility.checkIPCOnWrongThread(true); Vector<StackState> state_vec = new Vector<StackState>(); int i; for (i = 0; i < funcs.length; i++) { StackViewState svstate = new StackViewState(fnames[i], pcnames[i], funcs[i], pcs[i]); state_vec.add(svstate); } final int selected_frame = funcs.length - 1; clmap.addStates(state_vec); stack_view.setStates(state_vec, selected_frame); // update stack in right-hand tab stack_view.setStackId(stackId); stackViewPane.setVisible(true); stackViewPane.revalidate(); AnWindow.getInstance().setSubviewReadyToShow("heapCallStackSubview", true); } // Listener for updating table private final class TableHandler implements AnListener { @Override public void valueChanged(final AnEvent event) { switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting stackRowId = event.getValue(); computed = false; AnUtility.dispatchOnSwingThread( new Runnable() { // @Override @Override public void run() { long id = dataCalStkIds[stackRowId]; int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, DSP_Heap); window.getSelectionManager().updateSelection(ids, DSP_Heap, subtype, 1); } updateStackView(id); } }); break; case AnEvent.EVT_SORT: // Sorting // save current scroll location updateIfNotSort = false; getSettings() .getMetricsSetting() .setSortMetricByDType(this, ((Integer) event.getAux()).intValue(), type); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } int from = event.getValue(); int to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; case AnEvent.EVT_UPDATE: // setUpdated(false); break; case AnEvent.EVT_COMPUTE: computed = false; break; } } } // color change(s) @Override public void valueChanged(AnEvent e) { // setUpdated(false); stack_view.repaint(); } // Set selected function private void updateSummary(final StackState tmpstate) { if (!(tmpstate instanceof StackViewState)) { System.err.println("XXXmpview heapactivitydisp: not StackViewState"); return; } StackViewState state = (StackViewState) tmpstate; final long sel_func; final long sel_pc; sel_func = state.getNumber(); sel_pc = state.getPC(); long sel_obj = window.getSelectedObject().getObject(sel_func, sel_pc); if (sel_obj != 0L) { window.getSelectedObject().setSelObj(sel_obj, AnDisplay.DSP_Heap, 0); // lazy computing may be needed for if Summary is not been selected if (window.getViews().getCurrentViewDisplay() == window.getHeapView()) { int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, getDisplayMode()); window.getSelectionManager().updateSelection(ids, getDisplayMode(), 0, 1); } } else { AnWindow.getInstance() .getViews() .getCurrentViewDisplay() .computeOnAWorkerThread(); // Update selection. FIXUP: Views that react on selections // should change selction on SELECTION_CHANGED or // SELECTED_OBJECT_CHANGED events if not from own view } } } @Override public void adjustmentValueChanged(final AdjustmentEvent e) { revalidate(); } @Override public void mouseClicked(final MouseEvent event) { if (SwingUtilities.isLeftMouseButton(event)) { funcChanged(event); } if (SwingUtilities.isRightMouseButton(event)) { stackViewPopupListener.maybeShowPopup(event); } } @Override public void mouseEntered(final MouseEvent event) {} @Override public void mouseExited(final MouseEvent event) {} @Override public void mousePressed(final MouseEvent event) {} @Override public void mouseReleased(final MouseEvent event) {} // Will be needed if I want to update summary tab based on selection @Override public void valueChanged(final ListSelectionEvent event) { funcChanged(event); } // (MUST BE CALLED ON AWT THREAD) public void funcChanged(EventObject event) { final JList list; StackState state = null; if (event instanceof MouseEvent) { if (window.getColorChooser().isVisible()) { window.getColorChooser().setVisible(true); } if (((MouseEvent) event).getClickCount() > 1) { window.setSelectedView(AnDisplay.DSP_Source); } } else { if (window.getColorChooser().isVisible()) { window.getColorChooser().setVisible(true); } } if (event.getSource() instanceof StackView) { list = stack_view; state = (StackState) list.getSelectedValue(); } else { // XXXmpview, figure this out... // System.err.println("XXXmpview heapactivitydisp: eventsource unknown"); return; } if (state == null) { return; } stack_view.setSelectedFunction(state.getNumber()); // is this redundant? window.getColorChooser().setSelectedFunction(state.getNumber()); updateSummary(state); } @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, boolean caseSensitive) { int find_row; if ((str == null) || (str.length() == 0)) { return -1; } find_row = table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = table.findBefore(str, next, caseSensitive); } // Update summary display if (find_row != -1) { goToLine(table, find_row); } return find_row; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = super.exportAsText(limit, format, delimiter); // exports the main table // Export lower panel if format is TEXT if (format == ExportFormat.TEXT && (limit == null || limit >= 0)) { statisticsData = getHeapStatistics(); text += exportStatisticsData(statisticsData); } return text; } // Native methods from liber_dbe.so private String[][] getHeapStatistics() { synchronized (IPC.lock) { window.IPC().send("getHeapStatistics"); window.IPC().send(0); return (String[][]) window.IPC().recvObject(); } } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getHeapCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getHeapCallStackSubview()); return list; } @Override public void goToLine(final AnTable tbl, final int row) { tbl.setSelectedRow(row); int[] rows = table.getSelectedRows(); if (rows != null) { long[] ids = getSelectedIds(rows, getDisplayMode()); window.getSelectionManager().updateSelection(ids, getDisplayMode(), subtype, 1); long id = dataCalStkIds[row]; updateStackView(id); } } } ������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnDouble.java������������������������������������������������������0000644�0001750�0001750�00000005471�15044710303�016267� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; // Analyzer Double object import static org.gprofng.mpmt.AnObject.format_group_decimal; import static org.gprofng.mpmt.AnObject.format_sdecimal; import static org.gprofng.mpmt.AnObject.zero_decimal; public final class AnDouble extends AnObject implements Comparable<AnDouble> { private final double value; private final Double obj; // Constructor public AnDouble(double value) { this.value = value; obj = value; } // Analyzer Double printing format @Override public String toString() { if (value > 99.999 && xtimes.compareTo("") != 0) { return ">99.999" + xtimes; } if (value == 0.0) { return get_zero_decimal() + xtimes; } if (sign) { return format_sdecimal.format(value) + xtimes; } return format_decimal.format(value) + xtimes; } // Analyzer formatted printing format @Override public String toFormString() { if (value > 99.999 && xtimes.compareTo("") != 0) { return ">99.999" + xtimes; } if (value == 0.0) { if (showZero) { return zero_decimal + xtimes; } else { return quote_space + xtimes; } } if (sign) { return format_group_sdecimal.format(value) + xtimes; } return format_group_decimal.format(value) + xtimes; } // Percent printing @Override public String toPercent(double total) { if (value == 0.0) { if (showZero) { return zero_percent; } else { return quote_space; } } double percent = value * total; if (percent > 100.0) { percent = 100.0; } return format_percent.format(percent); } // To Double public Double toDouble() { return obj; } // To double @Override public double doubleValue() { return value; } // As Double.compareTo @Override public int compareTo(AnDouble o) { return obj.compareTo(o.toDouble()); } // Convert double[] to AnDouble[] public static AnDouble[] toArray(double[] list) { int length = list.length; AnDouble[] new_list = new AnDouble[length]; for (int i = 0; i < length; i++) { new_list[i] = new AnDouble(list[i]); } return new_list; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/��������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723233�014767� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015555� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnMenuBar.java��������������������������������������������0000644�0001750�0001750�00000003152�14744453367�020165� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JMenuBar; /** * @author tpreisle */ public class AnMenuBar extends JMenuBar { public AnMenuBar() { super(); AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Tabbed Pane")); } @Override protected void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); Graphics2D g2d = (Graphics2D) g; GradientPaint gp; gp = new GradientPaint( 0, 0, AnEnvironment.MENUBAR_BACKGROUND_COLOR1, 0, height, AnEnvironment.MENUBAR_BACKGROUND_COLOR2); g2d.setPaint(gp); g2d.fillRect(0, 0, width, height); g.setColor(AnEnvironment.MENUBAR_BORDER_COLOR); g.drawLine(0, 0, width - 1, 0); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnDialog2.java��������������������������������������������0000644�0001750�0001750�00000011345�14744453367�020120� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Dialog; import java.awt.Font; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.KeyStroke; public class AnDialog2 extends JDialog { private Font font = null; private AnDialogOuterPanel anDialogOuterPanel; public enum Status { OK, CANCEL }; private Status status = Status.CANCEL; private Component relativeToComponent; private boolean locationSet = false; public AnDialog2(Frame owner, Component relativeToComponent, String title) { super(owner, title); init(relativeToComponent); } public AnDialog2(Dialog owner, Component relativeToComponent, String title) { super(owner, title); init(relativeToComponent); } private void init(Component relativeToComponent) { this.relativeToComponent = relativeToComponent; setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); anDialogOuterPanel = new AnDialogOuterPanel(this); AnInsetsPanel anInsetsPanel = new AnInsetsPanel(anDialogOuterPanel, 12, 12, 12, 12); anInsetsPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); anDialogOuterPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); Container contentPane = getContentPane(); contentPane.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); contentPane.setLayout(new BorderLayout()); contentPane.add(anInsetsPanel, BorderLayout.CENTER); setModal(true); // close/dispose when ESC getRootPane() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "esc"); // NOI18N getRootPane() .getActionMap() .put( "esc", new AbstractAction() { // NOI18N @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); pack(); } public void setCustomPanel(JPanel customPanel) { anDialogOuterPanel.setCustomPanel(customPanel); pack(); } public void addAuxButton(JButton auxButton) { anDialogOuterPanel.addAuxButton(auxButton); } public void setHelpTag(final String helpTag) { anDialogOuterPanel.setHelpTag(helpTag); if (helpTag != null) { // F1 help getRootPane() .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put( KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); // NOI18N getRootPane() .getActionMap() .put( KeyboardShortcuts.helpActionShortcut, new AbstractAction() { // NOI18N private final String helpId = helpTag; @Override public void actionPerformed(ActionEvent e) { Analyzer.showHelp(helpId); } }); } pack(); } /** * @return the status */ public Status getStatus() { return status; } /** * @param status the status to set */ protected void setStatus(Status status) { this.status = status; } public JButton getOKButton() { return anDialogOuterPanel.getOKButton(); } public JButton getCancelButton() { return anDialogOuterPanel.getCancelButton(); } public JButton getHelpButton() { return anDialogOuterPanel.getHelpButton(); } public Font getDialogFont() { if (font == null) { font = getFont().deriveFont(Font.PLAIN); } return font; } public void busyCursor(boolean set) { setCursor(set ? AnUtility.wait_cursor : AnUtility.norm_cursor); } @Override public void setVisible(boolean b) { if (b && !locationSet) { setLocationRelativeTo(relativeToComponent); locationSet = true; } super.setVisible(b); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnTextIcon.java�������������������������������������������0000644�0001750�0001750�00000002053�14744453367�020370� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import javax.swing.*; public final class AnTextIcon { private final String text; private final Icon icon; // Constructor public AnTextIcon(final String text, final Icon icon) { this.text = text; this.icon = icon; } // Get text public String getText() { return text; } // Get icon public Icon getIcon() { return icon; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnUtility.java��������������������������������������������0000644�0001750�0001750�00000132056�15044710303�020261� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.collect.CollectUtility; import org.gprofng.mpmt.metrics.MetricColors; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.lang.ref.WeakReference; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.accessibility.AccessibleContext; import javax.imageio.ImageIO; import javax.swing.BoundedRangeModel; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; public final class AnUtility { private static boolean checkIPCOnWrongThread = true; // Checks ony if true private static int checkIPCOnWrongThreadCounter = 0; // Checks only if counter == 0 private static final int TEXT_LEFT = 1; // public final static int TEXT_CENTER = 2; // public final static int TEXT_RIGHT = 3; public static final int ERROR_MSG = 1; public static final int WARNING_MSG = 2; public static final int PSTAT_MSG = 3; public static final int PWARN_MSG = 4; public static final int SPACES_BETWEEN_COLUMNS = 3; public static final String SPACE = " "; public static final String EOL = "\n"; // mime types for files public static final int MIME_ELF_EXECUTABLE = 0x7f454c46; public static final int MIME_JAVA_CLASS_FILE = 0xcafebabe; public static final int MIME_JAR_FILE = 0x504b0304; private static final int MIME_UNKNOWN_FILE_TYPE = 0x00000000; public static final int MIME_DIRECTORY = 1; public static final int MIME_EXECUTABLE = 2; public static final int MIME_CANNOT_READ_FILE = 0xFFFFFFFF; public static final Cursor norm_cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); public static final Cursor wait_cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); private static final String package_mpmt = "org/gprofng/mpmt/icons/"; // NOI18N private static final String green_bar_image = "green100.png"; // NOI18N // Icons public static final ImageIcon addColumnIcon = getImageIcon("addtablecolumns.png"); // NOI18N public static final ImageIcon add_icon = getImageIcon("add.png"); // NOI18N public static final ImageIcon appl_filt_icon = getImageIcon("apply_filter.png"); // NOI18N public static final ImageIcon attr_icon = getImageIcon("attributed.png"); // NOI18N public static final ImageIcon back_filt_icon = getImageIcon("back_filter.png"); // NOI18N public static final ImageIcon back_icon = getImageIcon("backward.png"); // NOI18N public static final ImageIcon blankIcon = getImageIcon("blank.png"); // NOI18N public static final ImageIcon bubble_icon = getImageIcon("bubble_icon_16.png"); // NOI18N public static final ImageIcon cale_icon = getImageIcon("callee.png"); // NOI18N public static final ImageIcon calr_icon = getImageIcon("caller.png"); // NOI18N public static final ImageIcon cls_icon = getImageIcon("class.png"); // NOI18N public static final ImageIcon collect_icon = getImageIcon("collect.png"); // NOI18N public static final ImageIcon colr_icon = getImageIcon("color.png"); // NOI18N public static final ImageIcon compare_icon = getImageIcon("compare.png"); // NOI18N public static final ImageIcon connect_icon = getImageIcon("connect.png"); // NOI18NNOI18N public static final ImageIcon data_icon = getImageIcon("data.png"); // NOI18N public static final ImageIcon del_icon = getImageIcon("delete.png"); // NOI18N public static final ImageIcon down_icon = getImageIcon("down.png"); // NOI18N public static final ImageIcon ebad_icon = getImageIcon("badexperiment.png"); // NOI18N public static final ImageIcon egrp_icon = getImageIcon("expgroup.png"); // NOI18N public static final ImageIcon elf_icon = getImageIcon("exe_elf.png"); // NOI18N public static final ImageIcon eold_icon = getImageIcon("oldexperiment.png"); // NOI18N public static final ImageIcon epcl_icon = getImageIcon("expandcollaps.png"); // NOI18N public static final ImageIcon circleBlueIcon = getImageIcon("circleBlue.gif"); // NOI18N public static final ImageIcon circleRedIcon = getImageIcon("circleRed.gif"); // NOI18NNOI18N public static final ImageIcon circleGreenIcon = getImageIcon("circleGreen.gif"); // NOI18N public static final ImageIcon circleOrangeIcon = getImageIcon("circleOrange.gif"); // NOI18N public static final ImageIcon ewarn_icon = getImageIcon("warnexperiment.png"); // NOI18N public static final ImageIcon excl_icon = getImageIcon("exclusive.png"); // NOI18N public static final ImageIcon expt_icon = getImageIcon("experiment.png"); // NOI18N public static final ImageIcon fileResolved = getImageIcon("fileResolved.png"); // NOI18N public static final ImageIcon fileUnResolved = getImageIcon("fileUnResolved.png"); // NOI18N public static final ImageIcon filt_icon = getImageIcon("filter.png"); // NOI18N public static final ImageIcon forw_icon = getImageIcon("forward.png"); // NOI18N public static final ImageIcon func_icon = getImageIcon("func_item.png"); // NOI18N public static final ImageIcon fwd_filt_icon = getImageIcon("forward_filter.png"); // NOI18N public static final ImageIcon gear_icon = getImageIcon("gear.png"); // NOI18N public static final ImageIcon goBackwardIcon = getImageIcon("gobackward.png"); // NOI18N public static final ImageIcon goDownIcon = getImageIcon("godown.png"); // NOI18N public static final ImageIcon goForwardIcon = getImageIcon("goforward.png"); // NOI18N public static final ImageIcon goUpIcon = getImageIcon("goup.png"); // NOI18N public static final ImageIcon hamburgerFocusedIcon = getImageIcon("hamburgerFocused.png"); // NOI18N public static final ImageIcon hamburgerIcon = getImageIcon("hamburger.png"); // NOI18N public static final ImageIcon hamburgerBlankIcon = getImageIcon("hamburgerBlank.png"); // NOI18N public static final ImageIcon heap_icon = getImageIcon("heaptrace.png"); // NOI18N public static final ImageIcon hollowArrowDownIcon = getImageIcon("hollowArrowDown.png"); // NOI18N public static final ImageIcon hollowArrowLeftIcon = getImageIcon("hollowArrowLeft.png"); // NOI18N public static final ImageIcon hollowArrowRightIcon = getImageIcon("hollowArrowRight.png"); // NOI18N public static final ImageIcon hollowArrowUpIcon = getImageIcon("hollowArrowUp.png"); // NOI18N public static final ImageIcon hot_icon = getImageIcon("hot.png"); // NOI18N public static final ImageIcon hwc_icon = getImageIcon("hwc.png"); // NOI18N public static final ImageIcon incl_icon = getImageIcon("inclusive.png"); // NOI18N public static final ImageIcon iotrace_icon = getImageIcon("i_o_usage_16.png"); // NOI18N public static final ImageIcon jar_icon = getImageIcon("jar.png"); // NOI18N public static final ImageIcon mpi_icon = getImageIcon("mpitrace.png"); // NOI18N public static final ImageIcon mtall_icon = getImageIcon("apply_mtrs.png"); // NOI18N public static final ImageIcon moreIcon = getImageIcon("more_icon.png"); // NOI18N public static final ImageIcon next_icon = getImageIcon("find_next.png"); // NOI18N public static final ImageIcon open_icon = getImageIcon("open.png"); // NOI18N public static final ImageIcon panhand_icon = getImageIcon("panhand.png"); // NOI18N public static final ImageIcon prev_icon = getImageIcon("find_prev.png"); // NOI18N public static final ImageIcon prof_icon = getImageIcon("profile.png"); // NOI18N public static final ImageIcon races_icon = getImageIcon("races.png"); // NOI18N public static final ImageIcon redo_icon = getImageIcon("redo.png"); // NOI18N public static final ImageIcon removeFocusedIcon = getImageIcon("removeFocused.png"); // NOI18N public static final ImageIcon removeIcon = getImageIcon("remove.png"); // NOI18N public static final ImageIcon removeIconBlank = getImageIcon("removeBlank.png"); // NOI18N public static final ImageIcon restore_icon = getImageIcon("stop.png"); // NOI18N public static final ImageIcon rset_icon = getImageIcon("reset.png"); // NOI18N public static final ImageIcon samp_icon = getImageIcon("sample.png"); // NOI18N public static final ImageIcon save_icon = getImageIcon("save.png"); // NOI18N public static final ImageIcon smallArrowBlankIcon = getImageIcon("smallBlank.png"); // NOI18N public static final ImageIcon smallArrowDownFocusedIcon = getImageIcon("small_down_focused.png"); // NOI18N public static final ImageIcon smallArrowUpFocusedIcon = getImageIcon("small_up_focused.png"); // NOI18N public static final ImageIcon smallArrowDownIcon = getImageIcon("small_down.png"); // NOI18N public static final ImageIcon smallArrowLeftIcon = getImageIcon("small_left.png"); // NOI18N public static final ImageIcon smallArrowRightIcon = getImageIcon("small_right.png"); // NOI18N public static final ImageIcon smallArrowUpIcon = getImageIcon("small_up.png"); // NOI18N public static final ImageIcon sodn_icon = getImageIcon("sort_dn.png"); // NOI18N public static final ImageIcon soup_icon = getImageIcon("sort_up.png"); // NOI18N public static final ImageIcon sync_icon = getImageIcon("synctrace.png"); // NOI18N public static final ImageIcon undo_icon = getImageIcon("undo.png"); // NOI18N public static final ImageIcon up_icon = getImageIcon("up.png"); // NOI18N public static final ImageIcon valuesIcon = getImageIcon("values.png"); // NOI18N public static final ImageIcon warningIcon = getImageIcon("warning.png"); // NOI18N public static final ImageIcon errorIcon = getImageIcon("error.png"); // NOI18N public static final ImageIcon warningNewIcon = getImageIcon("warningNew.png"); // NOI18N public static final ImageIcon errorNewIcon = getImageIcon("errorNew.png"); // NOI18N public static final ImageIcon errorWarningNewIcon = getImageIcon("errorWarningNew.png"); // NOI18N public static final ImageIcon zmin_icon = getImageIcon("zoom_in.png"); // NOI18N public static final ImageIcon zmot_icon = getImageIcon("zoom_out.png"); // NOI18N public static final ImageIcon numberIcon = getImageIcon("number.png"); // NOI18N public static final ImageIcon timeIcon = getImageIcon("time.png"); // NOI18N public static final ImageIcon percentIcon = getImageIcon("percent.png"); // NOI18N public static final ImageIcon nextViewIcon = getImageIcon("nextview.png"); // NOI18N public static final ImageIcon previousViewIcon = getImageIcon("previousview.png"); // NOI18N public static final ImageIcon base1Icon = getImageIcon("base1.png"); // NOI18N public static final ImageIcon base2Icon = getImageIcon("base2.png"); // NOI18N public static final ImageIcon compareAbsoluteIcon = getImageIcon("compareAbsolute.png"); // NOI18N public static final ImageIcon compareDeltaIcon = getImageIcon("compareDelta.png"); // NOI18N public static final ImageIcon compareRatioIcon = getImageIcon("compareRatio.png"); // NOI18N public static final ImageIcon compareReverseIcon = getImageIcon("compareReverse.png"); // NOI18N public static final ImageIcon compareHamburgerIcon = getImageIcon("compareHamburger.png"); // NOI18N // Other icons public static final ImageIcon analyzer_icon = getImageIcon("analyzer64.png"); // NOI18N private static final int chkbox_height = (new JLabel(" ")).getPreferredSize().height; // NOI18N; private static WeakReference<Map<String, Integer>> wrSigMap; private static boolean lib_path_set = false; private static AnThreadGroup threadGroup = new AnThreadGroup(); public static int getMimeFormat(final File file) { if (file.isDirectory()) { return MIME_DIRECTORY; } if (file.canExecute()) { if (Analyzer.getInstance().remoteConnection == null) { try { final DataInputStream dis = new DataInputStream( new BufferedInputStream(new FileInputStream(file))); int elf_type = 0; int iMagicNumber = dis.readInt(); if (iMagicNumber == MIME_ELF_EXECUTABLE) { // reading elf header dis.skipBytes(12); elf_type = dis.readShort(); // check for elf executable } dis.close(); if (elf_type == 0x0002 || elf_type != 0x0200) { // MSB or LSB elf return MIME_ELF_EXECUTABLE; } } catch (IOException e) { return MIME_CANNOT_READ_FILE; } } return MIME_EXECUTABLE; } String nm = file.getName(); if (nm.endsWith(".class'")) { return MIME_JAVA_CLASS_FILE; } if (nm.endsWith(".jar'")) { return MIME_JAR_FILE; } return MIME_UNKNOWN_FILE_TYPE; } public static boolean isTarget(final File file) { final int type = getMimeFormat(file); return (type == MIME_ELF_EXECUTABLE || type == MIME_JAVA_CLASS_FILE || type == MIME_JAR_FILE); } public static String getRemoteOutput(String cmd) { String rc = Analyzer.getInstance().remoteConnectCommand; ArrayList<String> args = new ArrayList<>( Arrays.asList(rc.split("\\s+"))); args.add(cmd); ProcessBuilder processBuilder = new ProcessBuilder(args); String lines = ""; try { Process process = processBuilder.start(); // Read standard output BufferedReader stdoutReader = new BufferedReader( new InputStreamReader(process.getInputStream())); for (;;) { String line; line = stdoutReader.readLine(); if (line == null) { break; } lines += line + "\n"; } process.waitFor(); } catch (IOException | InterruptedException ex) { } return lines; } // General check box public static final class AnCheckBox extends JCheckBox { public AnCheckBox(final String text) { this(text, false); } public AnCheckBox(final String text, final boolean selected) { super(text, selected); final Dimension psize; setMargin(AnVariable.buttonMargin); setHorizontalAlignment(JCheckBox.CENTER); psize = getPreferredSize(); psize.height = chkbox_height; setPreferredSize(psize); setOpaque(false); if (text != null) { getAccessibleContext().setAccessibleDescription(text); getAccessibleContext().setAccessibleName(text); } } } public static final class AnRadioButton extends JRadioButton { public AnRadioButton() { super(); setOpaque(false); } public AnRadioButton(String text, boolean selected) { super(text, selected); setOpaque(false); getAccessibleContext().setAccessibleDescription(text); getAccessibleContext().setAccessibleName(text); } @Override public void paint(Graphics g) { super.paint(g); if (hasFocus() && getText().length() == 0) { // Accessibility g.setColor(new Color(194 - 40, 214 - 40, 233 - 40)); g.drawLine(getWidth() - 1, 4, getWidth() - 1, getHeight() - 5); } } } // General labels public static final class AnLabel extends JLabel { public AnLabel(final String text, final int alignment, final boolean init_a11y) { super(text, alignment); final float falignment; if (alignment == RIGHT) { falignment = RIGHT_ALIGNMENT; } else if (alignment == LEFT) { falignment = LEFT_ALIGNMENT; } else { falignment = CENTER_ALIGNMENT; } setAlignmentX(falignment); setForeground(AnVariable.LABEL_COLOR); setBorder(AnVariable.labelBorder); if (AnEnvironment.isLFNimbus()) { setFont(getFont().deriveFont(Font.BOLD)); } if (init_a11y) { initializeA11y(); } } public AnLabel( final String text, final Icon icon, final int alignment, final boolean init_a11y) { this(text, alignment, init_a11y); if (AnEnvironment.isLFNimbus()) { setFont(getFont().deriveFont(Font.BOLD)); } if (icon != null) { setIcon(icon); } } private void initializeA11y(final String accessibleName, final String accessibleDesc) { final AccessibleContext context = this.getAccessibleContext(); final String accName = (accessibleName != null && (!accessibleName.equals(""))) ? accessibleName : // NOI18N this.getText(); final String accDesc = (accessibleDesc != null && (!accessibleDesc.equals(""))) ? accessibleDesc : // NOI18N accName; context.setAccessibleName(accName); context.setAccessibleDescription(accDesc); } private void initializeA11y() { initializeA11y(this.getText(), this.getText()); } } // General textarea public static final class AnTextArea extends JTextArea { public AnTextArea(final String text, final boolean editable) { super(text); AnUtility.setAccessibleContext(this.getAccessibleContext(), ""); setBackground(CollectUtility.text_color); setEditable(editable); setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); setCaret( new javax.swing.text.DefaultCaret() { public void focusGained(final FocusEvent event) { if (getComponent().isEnabled()) { setVisible(true); } setSelectionVisible(true); // Don't use selectAll which will move Caret to the end. setCaretPosition(getDocument().getLength()); moveCaretPosition(0); } public void focusLost(final FocusEvent event) { super.focusLost(event); select(0, 0); } }); } } // General textfield public static final class AnText extends JTextField { int text_align; public AnText(final String text, final int columns, final int alignment) { super(text, columns); text_align = TEXT_LEFT; setFont(CollectUtility.text_font); setBackground(CollectUtility.text_color); if (AnEnvironment.isLFNimbus()) { setBackground(AnEnvironment.NIMBUS_PANEL_LIGHT_BACKGROUND); setBorder(null); } setEditable(false); setHorizontalAlignment(alignment); setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); this.getAccessibleContext().setAccessibleName(text); this.getAccessibleContext().setAccessibleDescription(text); setCaret( new javax.swing.text.DefaultCaret() { @Override public void focusGained(final FocusEvent event) { if (getComponent().isEnabled()) { setVisible(true); } setSelectionVisible(true); // Don't use selectAll which will move Caret to the end. if (text_align == TEXT_LEFT) { // This try/catch is an ugly workaround for fixing bug #5025668. // NPE caused because of java 1.4.2_02 DefaultCaret bug. // TODO: remove the workaround when java 1.5 becomes the default // one supported by analyzer. try { setDot(getDocument().getLength()); moveDot(0); } catch (NullPointerException npe) { /* do nothing; workaround*/ } } else { // Same code as selectAll setDot(0); moveDot(getDocument().getLength()); } } @Override public void focusLost(final FocusEvent event) { super.focusLost(event); setDot(text_align == TEXT_LEFT ? 0 : getDocument().getLength()); } }); } public void setVisibleAlign(final int text_align, final boolean delay) { this.text_align = text_align; if (delay) { setCaretPosition(text_align == TEXT_LEFT ? 0 : getDocument().getLength()); } else { // Don't use setCaretPosition which caused flash SwingUtilities.invokeLater( new Runnable() { @Override public void run() { BoundedRangeModel visibility; visibility = getHorizontalVisibility(); visibility.setValue( text_align == TEXT_LEFT ? visibility.getMinimum() : visibility.getMaximum()); } }); } } } public static JComponent getTextArea(final String text) { final AnTextArea text_area; text_area = new AnUtility.AnTextArea(text, false); text_area.setBorder(AnVariable.textBorder); return text_area; } public static JComponent getHeader(final String text) { return new AnLabel(text, JLabel.CENTER, true); } public static JComponent getHeader(final String text, final Icon icon) { return new AnLabel(text, icon, JLabel.CENTER, true); } public static JComponent getTitle(final String text) { return new AnLabel(text, JLabel.LEFT, true); } public static JComponent getTitle(final String text, final Icon icon) { return new AnLabel(text, icon, JLabel.LEFT, true); } public static JComponent getItem(final String text) { return new AnLabel(text, JLabel.RIGHT, true); } public static JComponent getText(final String text, final int columns) { return new AnText(text, columns == 0 ? 0 : columns + 2, JTextField.LEFT); } public static JComponent getNumber(final String text, final int columns) { return new AnText(text, columns == 0 ? 0 : columns + 2, JTextField.RIGHT); } // Class for button public static final class ResponseAction extends JButton { public ResponseAction( final String text, final Icon icon, final char mnemonic, final String tooltip, final Insets margin, final ActionListener listener) { super(text, icon); final AccessibleContext context = this.getAccessibleContext(); context.setAccessibleName(text); context.setAccessibleDescription(text); if (margin != null) { setMargin(AnVariable.buttonMargin); } if (mnemonic != '\0') { setMnemonic(mnemonic); } if (tooltip != null) { setToolTipText(tooltip); } if (text != null) { setActionCommand(text); } else if (tooltip != null) { setActionCommand(tooltip); } addActionListener(listener); } public ResponseAction( final Icon icon, final char mnemonic, final String tooltip, final ActionListener listener) { this(null, icon, mnemonic, tooltip, AnVariable.buttonMargin, listener); } public ResponseAction(final Icon icon, final String tooltip, final ActionListener listener) { this(null, icon, '\0', tooltip, AnVariable.buttonMargin, listener); } public ResponseAction( final Icon icon, final String tooltip, final String actionCommand, final ActionListener listener) { this(icon, tooltip, listener); setActionCommand(actionCommand); } public ResponseAction( final String text, final Icon icon, final char mnemonic, final ActionListener listener) { this(text, icon, mnemonic, null, AnVariable.buttonMargin, listener); } public ResponseAction(final String text, final char mnemonic, final ActionListener listener) { this(text, null, mnemonic, listener); } } // Get experiment list public static List<String> getExpList(final String[] args) { final List<String> exp_list = new ArrayList<>(); final int size = args.length; for (int i = 0; i < size; i++) { List<String> list = getGroupList(args[i]); if (list.size() > 1) { exp_list.add(args[i]); } else { exp_list.addAll(list); } } return exp_list; } // Get experiment from group file public static List<String> getGroupList(String path) { String line; final List<String> exp_list = new ArrayList<>(); BufferedReader br = null; try { br = new BufferedReader(new FileReader(path)); if (((line = br.readLine()) == null) || !line.equals("#analyzer experiment group")) // NOI18N { throw (new IOException()); } while ((line = br.readLine()) != null) { line = line.trim(); if (!line.startsWith("#") && !line.equals("")) // NOI18N { exp_list.add(line); } } } catch (IOException e) { if (path.endsWith("/")) // NOI18N { path = path.substring(0, path.length() - 1); } exp_list.add(path); } finally { try { if (br != null) { br.close(); } } catch (IOException e) { } } return exp_list; } // Get image from resource, from the default path public static ImageIcon getImageIcon(final String name) { final URL iconURL; iconURL = Analyzer.cls_loader.getResource(package_mpmt + name); if (iconURL == null) { return null; } else { return new ImageIcon(iconURL); } } /** * Get ImageIcon bar for specified metric * * @param metric - Use AnMetric.getComd() * @param width * @param height * @return ImageIcon */ public static ImageIcon getImageIconBar(String metric, int width, int height) { ImageIcon icon = null; BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bi.createGraphics(); Color color = null; if (metric != null) { color = MetricColors.getColor(metric); } try { if (color == null) { // Read image final URL iconURL100 = Analyzer.cls_loader.getResource(package_mpmt + green_bar_image); BufferedImage in = ImageIO.read(iconURL100); g2.drawImage(in, 0, 0, null); } else { // Draw image g2.setColor(color); // g2.fill3DRect(0, 0, width, height, true /* raised */); g2.fillRect(0, 0, width, height); } g2.dispose(); } catch (Exception e) { return null; // cannot create } ; icon = new ImageIcon(bi); return icon; } // Remove the trailing new-line public static String trimNewLine(final String org) { int last; for (last = org.length() - 1; last >= 0; last--) { if (org.charAt(last) != '\n') // NOI18N { break; } } return org.substring(0, last + 1); } // Add the trailing new-line to the end of string if needed public static String addNewLine(final String org) { if (org.charAt(org.length() - 1) == '\n') { return org; } else { return new String(org + '\n'); } } // Find the class installed home location public static String findResourceHome(final ClassLoader loader, final String resource) { final URL url; final String file; String home; final int first, index; int last; if ((url = loader.getResource(resource)) == null) { return null; } file = url.getFile(); first = file.indexOf('/'); // NOI18N last = file.indexOf(".jar!", first); // NOI18N last = file.lastIndexOf('/', last); // NOI18N if ((first == -1) || (last == -1)) { try { home = (new File("../..")).getCanonicalPath(); // NOI18N } catch (IOException e) { home = "../.."; // NOI18N } } else { if ((index = file.lastIndexOf('/', last - 1)) != -1) // NOI18N { last = index; } home = file.substring(first, file.lastIndexOf('/', last - 1)); } return home; } // // Get Throwable stack trace // public static String getStackTrace(Throwable th) { // StringWriter str_writer; // // str_writer = new StringWriter(); // th.printStackTrace(new PrintWriter(str_writer)); // // return str_writer.toString(); // } // Add title in work area public static final JLabel setLabel(final JPanel panel, final String text) { final JComponent label; panel.add(label = AnUtility.getTitle(text), BorderLayout.NORTH); AccessibleContext context = panel.getAccessibleContext(); context.setAccessibleName(text); context.setAccessibleDescription(text); context = label.getAccessibleContext(); context.setAccessibleName(text); context.setAccessibleDescription(text); return (JLabel) label; } // Display dialog with message string public static void showMessage(final Component comp, final String msg, final int err_type) { if (msg != null) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { final String title; switch (err_type) { case JOptionPane.ERROR_MESSAGE: title = AnLocale.getString("Error"); // NOI18N break; case JOptionPane.WARNING_MESSAGE: title = AnLocale.getString("Warning"); // NOI18N break; case JOptionPane.INFORMATION_MESSAGE: title = AnLocale.getString("Information"); // NOI18N break; case JOptionPane.QUESTION_MESSAGE: title = AnLocale.getString("Question"); // NOI18N break; default: title = AnLocale.getString("Message"); // NOI18N break; } try { // XXX workaround for Swing bug 4254022 (fixed in JDK 1.6) // ie. don't display more than 500 lines in dialog box String message = msg; int count = 0; int ndx = 0; for (; ; ) { ndx = msg.indexOf('\n', ndx + 1); if (ndx < 0) { break; } count++; if (count > 500) { message = msg.substring(0, ndx + 1) + "..."; // NOI18N break; } } JOptionPane.showMessageDialog(comp, message, title, err_type); } catch (ArrayIndexOutOfBoundsException ae) { System.out.println("****Debug PROBLEM****IGNORING EXCP"); // NOI18N ae.printStackTrace(); } } }); } } // Returns numerical representation of the character signal value public static int getSignalValue(String signal) { int ret = -1; try { ret = Integer.parseInt(signal); } catch (NumberFormatException e) { Map<String, Integer> sig_map = (wrSigMap == null) ? null : wrSigMap.get(); if (sig_map == null) { sig_map = new HashMap<String, Integer>(100); sig_map.put("SIGHUP", 1); // NOI18N sig_map.put("SIGINT", 2); // NOI18N sig_map.put("SIGQUIT", 3); // NOI18N sig_map.put("SIGILL", 4); // NOI18N sig_map.put("SIGTRAP", 5); // NOI18N sig_map.put("SIGABRT", 6); // NOI18N sig_map.put("SIGIOT", 6); // NOI18N sig_map.put("SIGEMT", 7); // NOI18N sig_map.put("SIGFPE", 8); // NOI18N sig_map.put("SIGKILL", 9); // NOI18N sig_map.put("SIGBUS", 10); // NOI18N sig_map.put("SIGSEGV", 11); // NOI18N sig_map.put("SIGSYS", 12); // NOI18N sig_map.put("SIGPIPE", 13); // NOI18N sig_map.put("SIGALRM", 14); // NOI18N sig_map.put("SIGTERM", 15); // NOI18N sig_map.put("SIGUSR1", 16); // NOI18N - wrong number on Linux sig_map.put("SIGUSR2", 17); // NOI18N - wrong number on Linux sig_map.put("SIGCHLD", 18); // NOI18N sig_map.put("SIGCLD", 18); // NOI18N sig_map.put("SIGPWR", 19); // NOI18N sig_map.put("SIGWINCH", 20); // NOI18N sig_map.put("SIGURG", 21); // NOI18N sig_map.put("SIGIO", 22); // NOI18N sig_map.put("SIGSTOP", 23); // NOI18N sig_map.put("SIGTSTP", 24); // NOI18N sig_map.put("SIGCONT", 25); // NOI18N sig_map.put("SIGTTIN", 26); // NOI18N sig_map.put("SIGTTOU", 27); // NOI18N sig_map.put("SIGVTALRM", 28); // NOI18N sig_map.put("SIGPROF", 29); // NOI18N sig_map.put("SIGXCPU", 30); // NOI18N sig_map.put("SIGXFSZ", 31); // NOI18N wrSigMap = new WeakReference<Map<String, Integer>>(sig_map); } signal = signal.trim(); if (!signal.startsWith("SIG")) { signal = "SIG" + signal; // NOI18N } ret = getSignalValueIPC(signal); if (ret > 0) { return ret; } final Integer obj = sig_map.get(signal); if (obj != null) { ret = obj.intValue(); } } return ret; } public static void setLibPath() { if (!lib_path_set) { lib_path_set = true; } } /** Get the value of an environment variable */ public static String getenv(final String name) { return System.getenv(name); } // mouse enter/exit listener for buttons private static final MouseInputAdapter sharedMouseListener = new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(true); btn.setContentAreaFilled(true); } } @Override public void mouseExited(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(false); btn.setContentAreaFilled(false); } } }; // set button look & feel to match mars IDE public static void setButtonLF(JButton button) { button.setBorderPainted(false); button.setContentAreaFilled(false); button.setFocusable(false); button.addMouseListener(sharedMouseListener); } public static String dirname(String path) { String name = path; int i = path.lastIndexOf("/"); // NOI18N if (i > 0) { name = path.substring(0, i); } return name; } public static String basename(String path) { String name = path; int i = path.lastIndexOf("/"); // NOI18N if (i >= 0 && i < (path.length() - 1)) { name = path.substring(i + 1); } return name; } public static void setAccessibleContext(AccessibleContext ac, String txt) { if (ac != null) { ac.setAccessibleName(txt); ac.setAccessibleDescription(txt); } } public static void setAccessibleContext(JLabel label) { setAccessibleContext(label.getAccessibleContext(), label.getText()); } public static void setTextAndAccessibleContext(JLabel label, String text) { label.setText(text); setAccessibleContext(label.getAccessibleContext(), text); } public static void setTextAndAccessibleContext(JCheckBox checkBox, String text) { checkBox.setText(text); setAccessibleContext(checkBox.getAccessibleContext(), text); } public static void setTextAndAccessibleContext(JButton button, String text) { button.setText(text); setAccessibleContext(button.getAccessibleContext(), text); } public static void setTTAndAccessibleContext(JComponent component, String text) { component.setToolTipText(text); setAccessibleContext(component.getAccessibleContext(), text); } /** * Dispatch a task to the AWT thread * * @param r */ public static void dispatchOnSwingThread(Runnable r) { if (SwingUtilities.isEventDispatchThread()) { r.run(); return; } try { SwingUtilities.invokeAndWait(r); } catch (Exception ex) { System.err.println("dispatchOnSwingThread exception: " + ex); // NOI18N ex.printStackTrace(); } } /** * Dispatch a task to the AWT thread * * @param r */ public static void invokeLaterOnSwingThread(Runnable r) { if (SwingUtilities.isEventDispatchThread()) { r.run(); } else { SwingUtilities.invokeLater(r); } } /** * Dispatch a task to a worker thread * * @param task * @param threadName */ public static Thread dispatchOnAWorkerThread(final Runnable task, String threadName) { final Thread worker; try { worker = new Thread(threadGroup, threadName) { @Override public void run() { task.run(); } }; worker.start(); return worker; } catch (Exception ex) { System.err.println("dispatchOnWorkerThread exception: " + ex); // NOI18N } return null; } private static class AnThreadGroup extends ThreadGroup { public AnThreadGroup() { super("analyzer_group"); // NOI18N } @Override public void uncaughtException(final Thread t, final Throwable e) { e.printStackTrace(); String tmp = e.getLocalizedMessage(); String msg = AnLocale.getString("Uncaught Exception: ") + e + '\n' + // NOI18N ((tmp == null) ? AnLocale.getString("gp-display-text exited due to internal error") + '\n' : "") + // NOI18N AnLocale.getString("Exception in thread ") + t.getName() + '.'; // NOI18N Analyzer.getInstance().endIPC(msg); } } public static boolean checkIfOnAWTThread(boolean shouldBe) { // FIXUP: enable after Beta boolean ok = true; if (SwingUtilities.isEventDispatchThread()) { if (!shouldBe) { reportWrongThread(shouldBe); ok = false; } } else if (shouldBe) { reportWrongThread(shouldBe); ok = false; } return ok; } private static void reportWrongThread(boolean shouldBe) { if ((debugFlags & DEBUG_AWT_THR) == 0) { return; } Exception awtException = new Exception(); StackTraceElement[] se = awtException.getStackTrace(); StringBuilder s = new StringBuilder(); String msg = shouldBe ? "Should be on AWT" : "Should not be on AWT"; s.append("*** Wrong Thread: " + msg + "\n"); s.append(Thread.currentThread().getName() + "\n"); for (int i = 0; i < se.length; i++) { s.append(se[i].toString() + "\n"); } AnLog.log(s.toString()); System.err.println("DEBUG: Invalid use of AWT thread. See log file: " + AnLog.getLogFilePath()); } public static void checkIPCOnWrongThread(boolean set) { if (set) { checkIPCOnWrongThreadCounter--; } else { checkIPCOnWrongThreadCounter++; } } public static boolean checkIPCOnWrongThread() { return checkIPCOnWrongThread && checkIPCOnWrongThreadCounter == 0; } public static String toFullPath(String path) { String ret = path; if (!path.startsWith("/")) { // NOI18N ret = Analyzer.getInstance().getWorkingDirectory() + "/" + path; // NOI18N } return ret; } /** * Remove duplicate '/' characters in path: * @param path * @return */ public static String clearPath(String path) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < path.length(); i++) { if (path.charAt(i) == '/' && i > 0 && path.charAt(i - 1) == '/') { continue; } sb.append(path.charAt(i)); } return sb.toString(); } public static String getShortString(String string, int maxLength) { int len = string.length(); if ((len - 1) <= maxLength) { return string; } else { return "..." + string.substring(len - maxLength); // NOI18N } } public static void copyDirectory(File fromDirectoryFile, File toDirectoryFile) throws IOException { if (fromDirectoryFile.exists() && fromDirectoryFile.isDirectory()) { if (!toDirectoryFile.exists()) { toDirectoryFile.mkdirs(); } String[] children = fromDirectoryFile.list(); for (String children1 : children) { File fromFile = new File(fromDirectoryFile, children1); File toFile = new File(toDirectoryFile, children1); if (fromFile.isDirectory()) { copyDirectory(fromFile, toFile); } else { copyFile(fromFile, toFile); } } } else { // FIXUP: do something reasonable } } public static void copyFile(File fromFile, File toFile) throws IOException { if (fromFile.exists() && !fromFile.isDirectory()) { InputStream inputStream = new FileInputStream(fromFile); OutputStream outputStream = new FileOutputStream(toFile); byte[] buffer = new byte[1024]; int nbytes; while ((nbytes = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, nbytes); } inputStream.close(); outputStream.close(); } else { // FIXUP: do something reasonable } } public static void copyToClipboard(String text) { if (text != null && text.length() > 0) { StringSelection data = new StringSelection(text); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(data, data); } } public static String keyStrokeToStringFormatted(KeyStroke keyStroke) { return " (" + keyStrokeToString(keyStroke) + ")"; // NOI18N } /** Simple KeyStroke to String. Does not (yet) handle META, ALT modifiers and some other keys. */ public static String keyStrokeToString(KeyStroke keyStroke) { if (keyStroke == null) { return ""; } StringBuilder buf = new StringBuilder(); int modifiers = keyStroke.getModifiers(); if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) { buf.append("Ctrl+"); // NOI18N } if ((modifiers & InputEvent.META_DOWN_MASK) != 0) { buf.append("Meta+"); // NOI18N } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) { buf.append("Alt+"); // NOI18N } if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { buf.append("Shift+"); // NOI18N } if (buf.length() > 0) { buf.deleteCharAt(buf.length() - 1); buf.append("-"); // NOI18N } int x = keyStroke.getKeyCode(); switch (x) { case KeyEvent.VK_F1: buf.append("F1"); break; case KeyEvent.VK_F2: buf.append("F2"); break; case KeyEvent.VK_F3: buf.append("F3"); break; case KeyEvent.VK_F4: buf.append("F4"); break; case KeyEvent.VK_F5: buf.append("F5"); break; case KeyEvent.VK_F6: buf.append("F6"); break; case KeyEvent.VK_F7: buf.append("F7"); break; case KeyEvent.VK_F8: buf.append("F8"); break; case KeyEvent.VK_F9: buf.append("F9"); break; case KeyEvent.VK_F10: buf.append("F10"); break; case KeyEvent.VK_F11: buf.append("F11"); break; case KeyEvent.VK_F12: buf.append("F21"); break; case KeyEvent.VK_UP: buf.append("Up"); break; case KeyEvent.VK_DOWN: buf.append("Down"); break; case KeyEvent.VK_LEFT: buf.append("Left"); break; case KeyEvent.VK_RIGHT: buf.append("Right"); break; case KeyEvent.VK_ENTER: buf.append("Enter"); break; case KeyEvent.VK_BACK_SPACE: buf.append("Backspace"); break; default: buf.append((char) (keyStroke.getKeyCode())); break; } return buf.toString(); } private static int getSignalValueIPC(final String signal) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getSignalValue"); // NOI18N anWindow.IPC().send(signal); return anWindow.IPC().recvInt(); } } public static String escapeSpecialHTMLCharacters(String s) { s = s.replace("&", "&"); // NOI18N s = s.replace("<", "<"); // NOI18N s = s.replace(">", ">"); // NOI18N s = s.replace("'", "'"); // NOI18N s = s.replace("\"", """); // NOI18N return s; } public static int debugFlags = 0; public static int DEBUG_AWT_THR = 1; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnDialogOuterPanel.java�����������������������������������0000644�0001750�0001750�00000014623�14744453367�022037� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.Analyzer; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JPanel; class AnDialogOuterPanel extends javax.swing.JPanel { private AnDialog2 dialog; private JPanel customPanel; private String helpTag; private int auxGridy = 0; public AnDialogOuterPanel(final AnDialog2 dialog) { this.dialog = dialog; initComponents(); helpButton.setVisible(false); helpButton.setEnabled(false); panel.setLayout(new BorderLayout()); okButton.setText(AnLocale.getString("OK")); // NOI18N); // okButton.setMnemonic(AnLocale.getString('O', "EXPORT_DIALOG_OK_MN")); // NOI18N); okButton.setToolTipText(AnLocale.getString("OK")); // NOI18N); okButton.addActionListener( new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dialog.setStatus(AnDialog2.Status.OK); dialog.setVisible(false); } }); cancelButton.setText(AnLocale.getString("Cancel")); // NOI18N); // cancelButton.setMnemonic(AnLocale.getString('C', "EXPORT_DIALOG_CANCEL_MN")); // // NOI18N); cancelButton.setToolTipText(AnLocale.getString("Cancel")); // NOI18N); cancelButton.addActionListener( new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dialog.setStatus(AnDialog2.Status.CANCEL); dialog.setVisible(false); } }); helpButton.setText(AnLocale.getString("Help")); // NOI18N); helpButton.setMnemonic(AnLocale.getString('H', "EXPORT_DIALOG_HELP_MN")); // NOI18N); helpButton.setToolTipText(AnLocale.getString("Help")); // NOI18N); helpButton.addActionListener( new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { Analyzer.showHelp(helpTag); } }); dialog.getRootPane().setDefaultButton(okButton); // default action (Return key) } protected void setCustomPanel(JPanel customPanel) { this.customPanel = customPanel; panel.add(customPanel, BorderLayout.CENTER); } protected void setHelpTag(String helpTag) { this.helpTag = helpTag; helpButton.setVisible(helpTag != null); } protected JButton getOKButton() { return okButton; } protected JButton getCancelButton() { return cancelButton; } protected JButton getHelpButton() { return helpButton; } public void addAuxButton(JButton auxButton) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(auxButton, gridBagConstraints); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; panel = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); helpButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel); panel.setLayout(panelLayout); panelLayout.setHorizontalGroup( panelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE)); panelLayout.setVerticalGroup( panelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 266, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(panel, gridBagConstraints); okButton.setText("jButton1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(okButton, gridBagConstraints); cancelButton.setText("jButton2"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0); add(cancelButton, gridBagConstraints); helpButton.setText("jButton3"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0); add(helpButton, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancelButton; private javax.swing.JButton helpButton; private javax.swing.JButton okButton; private javax.swing.JPanel panel; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/RainbowColorScale.java������������������������������������0000644�0001750�0001750�00000010016�14744453367�021722� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.Color; /** * The RainbowColorScale maps a range of values to colors to use in a chart. The colors range from a * red for high values to green for moderate values to blue for low values. * * @author blewis */ public class RainbowColorScale { private static Color[] colors; private static final int MAX_RAINBOW_COLORS = 256; /** Instantiate a new RainbowColorScale object */ public RainbowColorScale() { initColors(); } /** Compute the colors */ void initColors() { if (colors != null) { return; } int height = MAX_RAINBOW_COLORS; if (height <= 0) { System.err.println("ERROR: RainbowColorScale.initColors(): height<=0, height=" + height); return; } Color colVector[] = new Color[height]; final double minr = 70.0, ming = 70.0, minb = 70.0; final double maxr = 255.0, maxg = 245.0, maxb = 250.0; final double medr = 220; double fr = maxr, fg = ming, fb = minb; int phase; double dstep; phase = 1; dstep = (maxg - ming) / (0.45 * height); // next: add green for 0.45 height for (int i = 0; i < height; i++) { Color c = new Color( new Double(fr).intValue(), new Double(fg).intValue(), new Double(fb).intValue()); int idx = height - i - 1; colVector[idx] = c; if (phase == 1) { // add green till we get to yellow fg += dstep; if (fg > maxg) { fg = maxg; phase++; dstep = (maxr - medr) / (0.1 * height); // next: subtract a little red for 0.1 } } else if (phase == 2) { // subtract red till yellow-green fr -= dstep; if (fr < medr) { fr = medr; phase++; dstep = (medr - minr) / (0.1 * height); // next: subtract remainder of red for 0.1 } } else if (phase == 3) { // subtract red till light green fr -= dstep; if (fr < minr) { fr = minr; phase++; dstep = (maxb - minb) / (0.25 * height); // next: add blue for 0.25 } } else if (phase == 4) { // add blue until full blue fb += dstep; fg -= dstep * 0.8; // start removing green if (fg < ming) { fg = ming; } fr -= dstep * 1.0; // continue removing red if (fr < 0.0) { fr = 0.0; } if (fb > maxb) { fb = maxb; phase++; // dstep // keep it the same, seems ok } } else if (phase == 5) { // intensify/darken the blue fr += dstep * 0.2; // add a bit of red fb -= dstep * 0.5; fg -= dstep * 0.8; // continue removing green if (fg < 0.0) { fg = 0.0; } } } colors = colVector; } /** Compute the color for a single value within a range */ public Color getColorForValue(long v, long start, long end) { int height = MAX_RAINBOW_COLORS; long length = end - start; if (start > end) { return Color.BLACK; } if (v < start || v > end) { return Color.BLACK; } if (length < 0) { return Color.BLACK; } if (length == 0) { return colors[0]; } double percent = (double) (v - start) / length; int i = (int) (percent * height); if (i < 0) { i = 0; } else if (i >= height) { i = height - 1; } Color c = colors[i]; return c; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnScrollBarUI.java����������������������������������������0000644�0001750�0001750�00000017015�14744453367�020760� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.metal.MetalScrollBarUI; public class AnScrollBarUI extends MetalScrollBarUI { private static final int gap = 4; private Color backgroundColor; private static JComponent mouseInsideComponent = null; public static ComponentUI createUI(final JComponent c) { c.addMouseListener( new MouseListener() { @Override public void mouseEntered(MouseEvent e) { mouseInsideComponent = c; c.repaint(); } @Override public void mouseExited(MouseEvent e) { mouseInsideComponent = null; c.repaint(); } @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} }); return new AnScrollBarUI(); } @Override protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { backgroundColor = g.getColor(); // Fill g.setColor(AnEnvironment.SCROLLBAR_TRACK_COLOR); g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height); // Border g.setColor(AnEnvironment.SCROLLBAR_BORDER_COLOR); if (trackBounds.width < trackBounds.height) { g.drawLine(trackBounds.x, trackBounds.y, 0, trackBounds.height + 20); // Why 20 extra? } else { g.drawLine( trackBounds.x, trackBounds.y, trackBounds.width + 20, trackBounds.y); // Why 20 extra? } } @Override protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { // Knob if (mouseInsideComponent == c) { g.setColor(AnEnvironment.SCROLLBAR_THUMB_FOCUSED_COLOR); } else { g.setColor(AnEnvironment.SCROLLBAR_THUMB_COLOR); } g.fillRect( thumbBounds.x + gap, thumbBounds.y + gap, thumbBounds.width - 2 * gap + 1, thumbBounds.height - 2 * gap + 1); // Round the corners // g.setColor(AnEnvironment.SCROLLBAR_TRACK_COLOR); g.setColor(backgroundColor); int x = thumbBounds.x; int y = thumbBounds.y; int width = thumbBounds.width - 2 * gap; int height = thumbBounds.height - 2 * gap; // More rounded corners // g.drawLine(x + gap, y + gap, x + gap + 1, y + gap); // g.drawLine(x + gap, y + gap, x + gap, y + gap + 1); // g.drawLine(x + gap + width - 2, y + gap, x + gap + width - 1, y + gap); // g.drawLine(x + gap + width - 1, y + gap, x + gap + width - 1, y + gap + 1); // g.drawLine(x + gap, y + gap + height - 2, x + gap, y + gap + height - 1); // g.drawLine(x + gap, y + gap + height - 1, x + gap + 1, y + gap + height - 1); // g.drawLine(x + gap + width - 2, y + gap + height - 1, x + gap + width - 1, y + gap + // height - 1); // g.drawLine(x + gap + width - 1, y + gap + height - 2, x + gap + width - 1, y + gap + // height - 1); // One pixel rounded corners g.drawLine(x + gap, y + gap, x + gap, y + gap); g.drawLine(x + gap + width, y + gap, x + gap + width, y + gap); g.drawLine(x + gap, y + gap + height, x + gap, y + gap + height); g.drawLine(x + gap + width, y + gap + height, x + gap + width, y + gap + height); } @Override protected JButton createDecreaseButton(int orientation) { JButton button = new Button(orientation); return button; } @Override protected JButton createIncreaseButton(int orientation) { JButton button = new Button(orientation); return button; } @Override protected Dimension getMinimumThumbSize() { return new Dimension(28, 28); } class Button extends JButton { private static final int buttonSize = 14; private int orientation; private boolean mouseInsideButton = false; public Button(int orientation) { this.orientation = orientation; setMaximumSize(new Dimension(buttonSize, buttonSize)); setMinimumSize(new Dimension(buttonSize, buttonSize)); setPreferredSize(new Dimension(buttonSize, buttonSize)); addMouseListener( new MouseListener() { @Override public void mouseEntered(MouseEvent e) { mouseInsideButton = true; } @Override public void mouseExited(MouseEvent e) { mouseInsideButton = false; } @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} }); } @Override public void paint(Graphics g) { int w = getWidth(); int h = getHeight(); // Fill the area with track color g.setColor(AnEnvironment.SCROLLBAR_TRACK_COLOR); g.fillRect(0, 0, w, h); // paint Increment/Decrement buttons if thumb is vivible Rectangle rec = getThumbBounds(); if (rec.height > 0) { if (mouseInsideButton) { g.setColor(AnEnvironment.SCROLLBAR_INC_DEC_FOCUSED_COLOR); } else { g.setColor(AnEnvironment.SCROLLBAR_INC_DEC_COLOR); } if (orientation == MetalScrollBarUI.NORTH) { g.drawLine(7, 4, 7, 4); g.drawLine(6, 5, 8, 5); g.drawLine(5, 6, 9, 6); g.drawLine(4, 7, 10, 7); g.setColor(AnEnvironment.SCROLLBAR_BORDER_COLOR); g.drawLine(0, 0, 0, h - 1); g.drawLine(0, h - 1, w, h - 1); } else if (orientation == MetalScrollBarUI.SOUTH) { g.drawLine(4, 5, 10, 5); g.drawLine(5, 6, 9, 6); g.drawLine(6, 7, 8, 7); g.drawLine(7, 8, 7, 8); g.setColor(AnEnvironment.SCROLLBAR_BORDER_COLOR); g.drawLine(0, 0, 0, h - 1); g.drawLine(0, 0, w, 0); g.drawLine(0, h - 1, w, h - 1); } else if (orientation == MetalScrollBarUI.WEST) { g.drawLine(4, 7, 4, 7); g.drawLine(5, 6, 5, 8); g.drawLine(6, 5, 6, 9); g.drawLine(7, 4, 7, 10); g.setColor(AnEnvironment.SCROLLBAR_BORDER_COLOR); g.drawLine(0, 0, w - 1, 0); g.drawLine(w - 1, 0, w - 1, h - 1); } else if (orientation == MetalScrollBarUI.EAST) { g.drawLine(5, 4, 5, 10); g.drawLine(6, 5, 6, 9); g.drawLine(7, 6, 7, 8); g.drawLine(8, 7, 8, 7); g.setColor(AnEnvironment.SCROLLBAR_BORDER_COLOR); g.drawLine(0, 0, w - 1, 0); g.drawLine(0, 0, 0, h - 1); g.drawLine(w - 1, 0, w - 1, h - 1); } } } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnJPanel.java���������������������������������������������0000644�0001750�0001750�00000002117�14744453367�020005� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.LayoutManager; import javax.swing.JPanel; /* * Currently same as JPanel... */ public class AnJPanel extends JPanel { public AnJPanel() { super(); init(); } public AnJPanel(LayoutManager layout) { super(layout); init(); } private void init() { setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnJList.java����������������������������������������������0000644�0001750�0001750�00000001744�14744453367�017666� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import javax.swing.JList; public class AnJList extends JList { public AnJList() { super(); init(); } private void init() { if (AnEnvironment.isLFNimbus()) { setBackground(AnEnvironment.NIMBUS_LIST_BACKGROUND); } } } ����������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnJScrollPane.java����������������������������������������0000644�0001750�0001750�00000002460�14744453367�021011� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Component; import javax.swing.JScrollPane; import javax.swing.border.LineBorder; public class AnJScrollPane extends JScrollPane { public AnJScrollPane() { super(); init(); } public AnJScrollPane(Component view) { super(view); init(); } public AnJScrollPane(Component view, int vsbPolicy, int hsbPolicy) { super(view, vsbPolicy, hsbPolicy); init(); } private void init() { getViewport().setBackground(AnEnvironment.SCROLLPANE_BACKGROUND); setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR, 0)); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnCheckBox.java�������������������������������������������0000644�0001750�0001750�00000003100�14744453367�020313� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.Color; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JCheckBox; /** * @author tpreisle */ public class AnCheckBox extends JCheckBox { public AnCheckBox() { super(); init(); } public AnCheckBox(String text) { super(text); init(); } public AnCheckBox(String text, boolean selected) { super(text, selected); init(); } private void init() { setMargin(new Insets(0, 0, 0, 0)); setOpaque(false); } @Override public void paint(Graphics g) { if (isEnabled()) { super.paint(g); if (hasFocus() && getText().length() == 0) { // Accessibility g.setColor(new Color(194 - 40, 214 - 40, 233 - 40)); g.drawLine(getWidth() - 1, 2, getWidth() - 1, getHeight() - 3); } } else { g.setColor(new Color(230, 230, 230)); g.drawRect(2, 2, 12, 12); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnTabbedPaneUI.java���������������������������������������0000644�0001750�0001750�00000016732�14744453367�021067� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JButton; import javax.swing.plaf.basic.BasicTabbedPaneUI; public class AnTabbedPaneUI extends BasicTabbedPaneUI { private static int tabHeight = -1; @Override protected void installDefaults() { super.installDefaults(); tabAreaInsets = new Insets(0, 0, 0, 0); tabInsets = new Insets(0, 0, 0, 1); TabbedPaneMouseListener mouseListener = new TabbedPaneMouseListener(); tabPane.addMouseListener(mouseListener); tabPane.addMouseMotionListener(mouseListener); } @Override protected JButton createScrollButton(int direction) { JButton button = super.createScrollButton( direction); // To change body of generated methods, choose Tools | Templates. button.getAccessibleContext().setAccessibleDescription(""); return button; } @Override protected Insets getContentBorderInsets(int tabPlacement) { return new Insets(0, 0, 0, 0); } @Override protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) { return getTabHeight(); } @Override protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) { // Make the width 10 pixels wider. May have to make room for cancel image. return super.calculateTabWidth(tabPlacement, tabIndex, metrics) + 10; } @Override protected int calculateMaxTabHeight(int tabPlacement) { return getTabHeight(); } @Override protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) { Color topColor = AnEnvironment.TABBED_PANE_TAB_AREA_TOP_COLOR; Color bottomColor = AnEnvironment.TABBED_PANE_TAB_AREA_BOTTOM_COLOR; Graphics2D g2d = (Graphics2D) g; GradientPaint gp = new GradientPaint(0, 0, topColor, 0, getTabHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(0, 0, tabPane.getWidth(), getTabHeight()); super.paintTabArea(g, tabPlacement, selectedIndex); // g.setColor(AnEnvironment.TABBED_PANE_LINE_COLOR); // g.setColor(Color.red); // g.drawLine(0, getTabHeight() - 1, tabPane.getWidth() - 1, getTabHeight() - 1); // g.drawLine(0, getTabHeight() - 0, tabPane.getWidth() - 1, getTabHeight() - 0); } @Override protected void paintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { Color topColor; Color bottomColor; if (isSelected) { topColor = AnEnvironment.TABBED_PANE_SELECTED_TAB_COLOR; bottomColor = AnEnvironment.TABBED_PANE_SELECTED_TAB_COLOR; } else if (getRolloverTab() == tabIndex) { topColor = AnEnvironment.TABBED_PANE_FOCUSED_TAB_TOP_COLOR; bottomColor = AnEnvironment.TABBED_PANE_FOCUSED_TAB_BOTTOM_COLOR; } else { topColor = AnEnvironment.TABBED_PANE_DESELECTED_TAB_TOP_COLOR; bottomColor = AnEnvironment.TABBED_PANE_DESELECTED_TAB_BOTTOM_COLOR; } Graphics2D g2d = (Graphics2D) g; GradientPaint gp = new GradientPaint(0, 0, topColor, 0, getTabHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(x, 0, w, h); // g.setColor(AnEnvironment.TABBED_PANE_LINE_COLOR); // g.setColor(Color.red); // g.drawLine(x, h - 1, x + w - 1, h - 1); // g.drawLine(x, h - 0, x + w - 1, h - 0); } @Override protected void paintTabBorder( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { g.setColor(AnEnvironment.TABBED_PANE_DIVIDER_COLOR); g.drawLine(x + w - 1, 0, x + w - 1, h - 1); } @Override protected void paintContentBorderTopEdge( Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {} @Override protected void paintContentBorderRightEdge( Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {} @Override protected void paintContentBorderLeftEdge( Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {} // @Override @Override protected void paintContentBorderBottomEdge( Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {} @Override protected void paintText( Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) { if (!isSelected) { g.setFont(font); g.setColor(AnEnvironment.TABBED_PANE_DESELECTED_FORGROUND_COLOR); g.drawString(title, textRect.x, textRect.height - 2); } else { super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected); } } @Override protected void paintFocusIndicator( Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) { // super.paintFocusIndicator(g, tabPlacement, rects, tabIndex, iconRect, textRect, // isSelected); Rectangle tabRect = rects[tabIndex]; if (tabPane.hasFocus() && isSelected) { int x, y, w, h; g.setColor(AnEnvironment.TABBED_PANE_TAB_FOCUS_COLOR); x = tabRect.x + 3; y = tabRect.y + 1; w = tabRect.width - 6; h = tabRect.height - 3; g.drawRect(x, y, w, h); } } @Override protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) { return 0; } private int getTabHeight() { if (tabHeight < 0) { tabHeight = tabPane.getFontMetrics(tabPane.getFont()).getHeight() + 2; } return tabHeight; } private int lastRoolOverTab = -1; private class TabbedPaneMouseListener implements MouseListener, MouseMotionListener { @Override public void mouseExited(MouseEvent e) { repaint(); lastRoolOverTab = -1; } @Override public void mouseMoved(MouseEvent e) { if (lastRoolOverTab != getRolloverTab()) { repaint(); lastRoolOverTab = getRolloverTab(); } } @Override public void mouseEntered(MouseEvent e) { if (lastRoolOverTab != getRolloverTab()) { repaint(); lastRoolOverTab = getRolloverTab(); } } @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseDragged(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} private void repaint() { tabPane.repaint(new Rectangle(0, 0, tabPane.getWidth(), getTabHeight() - 1)); } } } ��������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/ToolTipPopup.java�����������������������������������������0000644�0001750�0001750�00000013007�14744453367�020773� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Point; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.Popup; import javax.swing.PopupFactory; public class ToolTipPopup { public enum Location { NORTH, NORTHEAST, EAST, CENTER }; private Popup tooltipPopup = null; private final Component parent; private final Component component; private final Location location; private final boolean bubble; private JPanel panel = null; public ToolTipPopup(Component parent, Component component, Location location, boolean bubble) { this.parent = parent; this.component = component; this.location = location; this.bubble = bubble; } private JPanel getPanel() { if (panel == null) { panel = new JPanel(); panel.setBackground(AnEnvironment.TOOLTIP_POPUP_BACKGROUND_COLOR); panel.setBorder(BorderFactory.createLineBorder(AnEnvironment.TOOLTIP_POPUP_BORDER_COLOR, 1)); panel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; if (bubble) { JLabel iconLabel = new JLabel(AnUtility.bubble_icon); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(8, 8, 8, 0); panel.add(iconLabel, gridBagConstraints); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 1; gridBagConstraints.insets = new Insets(8, 8, 8, 8); panel.add(component, gridBagConstraints); } return panel; } /** Show the dialog */ public void show() { if (tooltipPopup != null) { return; } if (!parent.isShowing()) { return; } Point locationOnScreen = parent.getLocationOnScreen(); int locationx = 0; int locationy = 0; if (null != location) switch (location) { case NORTH: locationx = locationOnScreen.x + parent.getSize().width / 2 - getPanel().getPreferredSize().width / 2; locationy = locationOnScreen.y - getPanel().getPreferredSize().height + 10; break; case NORTHEAST: locationx = locationOnScreen.x + parent.getSize().width - 1; locationy = locationOnScreen.y - getPanel().getPreferredSize().height + 1; break; case EAST: locationx = locationOnScreen.x + parent.getSize().width - 1; locationy = locationOnScreen.y + parent.getSize().height / 2 - getPanel().getPreferredSize().height / 2; break; case CENTER: locationx = locationOnScreen.x + parent.getSize().width / 2 - getPanel().getPreferredSize().width / 2; locationy = locationOnScreen.y + parent.getSize().height / 2 - getPanel().getPreferredSize().height / 2; break; default: assert false; break; } tooltipPopup = PopupFactory.getSharedInstance().getPopup(parent, getPanel(), locationx, locationy); tooltipPopup.show(); } /** hide the dialog */ public void hide() { if (tooltipPopup != null) { tooltipPopup.hide(); tooltipPopup = null; } } /** * show tooltip for ms milliseconds * * @param ms ms to show the dialog */ public void show(final int waitms, final int showms) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { try { Thread.sleep(waitms); } catch (InterruptedException ie) { } AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { show(); } }); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { try { Thread.sleep(showms); } catch (InterruptedException ie) { } AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { hide(); } }); } }, "tooltippopup2"); // NOI18N } }, "tooltippopup1"); // NOI18N } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnInsetsPanel.java����������������������������������������0000644�0001750�0001750�00000004417�14744453367�021066� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JPanel; public class AnInsetsPanel extends javax.swing.JPanel { public AnInsetsPanel(JPanel panel, int n, int w, int s, int e) { initComponents(); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(n, w, s, e); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(panel, gridBagConstraints); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE)); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/ActionTextField.java��������������������������������������0000644�0001750�0001750�00000014516�14744453367�021411� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.mpmt.AnLocale; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JTextField; /** * @author tpreisle */ public class ActionTextField extends JTextField implements MouseListener, MouseMotionListener { private String toolTipText = null; private String actionToolTipText = null; private String fullText = null; private String displayText = null; protected boolean focused = false; private static Image removeImage = null; private static Image removeImageFocused = null; private Image buttonImage = null; private static int removeImageWidth = 0; private static int removeImageHeight = 0; private static int removeImageXOffset = 2; private static int removeImageYOffset = 3; private ToolTipPopup tooltipPopup = null; public ActionTextField() { init(); } public ActionTextField(String text) { setText(text); init(); } private void init() { addMouseListener(this); addMouseMotionListener(this); } @Override public void setToolTipText(String text) { this.toolTipText = text; super.setToolTipText(text); // To change body of generated methods, choose Tools | Templates. } public void setActionToolTipText(String text) { this.actionToolTipText = text; } @Override public void setText(String text) { fullText = text; } @Override public void paint(Graphics g) { String newDisplayText = displayText(g, fullText); if (displayText == null || !displayText.equals(newDisplayText)) { displayText = newDisplayText; super.setText(displayText); } super.paint(g); if (focused) { removeImageYOffset = (getSize().height - removeImageHeight) / 2; g.drawImage( getRemoveButtonImage(), getSize().width - removeImageWidth - removeImageXOffset, removeImageYOffset, this); } } @Override public Dimension getMinimumSize() { return new Dimension(0, 0); } @Override public String getText() { return fullText; } private String displayText(Graphics g, String text) { int maxTextWidth = getWidth(); maxTextWidth -= 20; // make room for spaces around text FontMetrics fontMetrics = g.getFontMetrics(getFont()); int nameWidth = fontMetrics.stringWidth(text); String ret = text; if (nameWidth > maxTextWidth) { ret = shortenText(fontMetrics, text, maxTextWidth) + "..."; // NOI18N } return ret; } private String shortenText(FontMetrics fontMetrics, String text, int maxTextWidth) { String ret = text; for (int newLength = text.length(); newLength > 0; newLength--) { ret = text.substring(0, newLength); if (fontMetrics.stringWidth(ret) < maxTextWidth) { break; } } return ret; } // @Override @Override public void mousePressed(MouseEvent me) {} // @Override @Override public void mouseMoved(MouseEvent me) { Image newButtonImage; int scrollbarOffset = 0; // getScrollbarOffset(); int x = me.getPoint().x; int y = me.getPoint().y; if (x >= getSize().width - removeImageWidth - removeImageXOffset - scrollbarOffset && x <= getSize().width - removeImageXOffset - scrollbarOffset && y >= removeImageYOffset && y <= removeImageHeight + removeImageYOffset) { newButtonImage = getRemoveFocusedImage(); if (actionToolTipText != null) { super.setToolTipText(actionToolTipText); } else { super.setToolTipText(AnLocale.getString("Remove")); } } else { newButtonImage = getRemoveUnfocusedImage(); super.setToolTipText(toolTipText); } if (newButtonImage != getRemoveButtonImage()) { buttonImage = newButtonImage; repaint(100); } } // @Override @Override public void mouseClicked(MouseEvent me) {} // @Override @Override public void mouseDragged(MouseEvent me) {} // @Override @Override public void mouseEntered(MouseEvent me) { focused = true; refresh(); } // @Override @Override public void mouseExited(MouseEvent me) { focused = false; refresh(); } // @Override @Override public void mouseReleased(MouseEvent me) { int scrollbarOffset = 0; // getScrollbarOffset(); int x = me.getPoint().x; int y = me.getPoint().y; if (x >= getSize().width - removeImageWidth - removeImageXOffset - scrollbarOffset && x <= getSize().width - removeImageXOffset - scrollbarOffset && y >= removeImageYOffset && y <= removeImageHeight + removeImageYOffset) { removeButtonActionPerformed(null); me.consume(); } } private void refresh() { repaint(100); } protected Image getRemoveButtonImage() { if (buttonImage == null) { buttonImage = getRemoveUnfocusedImage(); } return buttonImage; } protected Image getRemoveUnfocusedImage() { if (removeImage == null) { removeImage = AnUtility.removeIcon.getImage(); removeImageWidth = removeImage.getWidth(this); removeImageHeight = removeImage.getHeight(this); } return removeImage; } protected Image getRemoveFocusedImage() { if (removeImageFocused == null) { removeImageFocused = AnUtility.removeFocusedIcon.getImage(); } return removeImageFocused; } protected void removeButtonActionPerformed(java.awt.event.ActionEvent evt) { ActionListener[] actionListeners = getActionListeners(); for (ActionListener actionListener : actionListeners) { actionListener.actionPerformed(evt); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnTabbedPane.java�����������������������������������������0000644�0001750�0001750�00000002472�14744453367�020625� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import java.awt.Dimension; import java.awt.Font; import javax.swing.BorderFactory; import javax.swing.JTabbedPane; public class AnTabbedPane extends JTabbedPane { public AnTabbedPane() { AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Tabbed Pane")); setFont(getFont().deriveFont(Font.BOLD)); setBorder(BorderFactory.createLineBorder(AnEnvironment.TABBED_PANE_BORDER_COLOR, 1)); setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); setMinimumSize(new Dimension(0, 0)); setUI(new AnTabbedPaneUI()); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnJTree.java����������������������������������������������0000644�0001750�0001750�00000002515�14744453367�017647� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeNode; public class AnJTree extends JTree { public AnJTree() { super(); init(); } public AnJTree(TreeNode root) { super(root); init(); } private void init() { if (AnEnvironment.isLFNimbus()) { setBackground(AnEnvironment.NIMBUS_TREE_BACKGROUND); } ((DefaultTreeCellRenderer) getCellRenderer()).setLeafIcon(null); ((DefaultTreeCellRenderer) getCellRenderer()).setClosedIcon(null); ((DefaultTreeCellRenderer) getCellRenderer()).setOpenIcon(null); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnGradientPanel.java��������������������������������������0000644�0001750�0001750�00000002621�14744453367�021351� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; /** * @author tpreisle */ public class AnGradientPanel extends javax.swing.JPanel { private Color topColor; private Color bottomColor; public AnGradientPanel(Color topColor, Color bottomColor) { this.topColor = topColor; this.bottomColor = bottomColor; } @Override public void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); Graphics2D g2d = (Graphics2D) g; GradientPaint gp; gp = new GradientPaint(0, 0, topColor, 0, height, bottomColor); g2d.setPaint(gp); g2d.fillRect(0, 0, width - 1, height - 1); setOpaque(false); } } ���������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnLongScrollBar.java��������������������������������������0000644�0001750�0001750�00000016230�15044710303�021314� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.util.ArrayList; import javax.swing.JScrollBar; /** * A scrollbar class that takes long value instead of ints. This class uses the swing JScrollBar but * handles the conversion of long values to pixels. */ public class AnLongScrollBar extends JScrollBar { private long longMin; private long longMax; private long longExtent; private long longMaxWithExtent; private long longValue; private int intMin; private int intMax; private int intExtent; private int intMaxWithExtent; private int oldIntVal; private long longUnitInc; private long longBlockInc; private int shift; private boolean setting_values = false; private ArrayList<LongAdjustmentListener> longListeners; private final int BLOCK_STEP_MAGIC = 2; private final int UNIT_STEP_MAGIC = 1; /** Creates a new instance of JLongScroll */ public AnLongScrollBar(int orientation) { super(orientation); initialize(); } /** initialize listeners */ private void initialize() { addAdjustmentListener( new AdjustmentListener() { /** When an adjustment is made to the integer value, compute a new long value */ public void adjustmentValueChanged(AdjustmentEvent e) { /* If adjustment initiated by this class ignore the event */ if (setting_values) { return; } int val = e.getValue(); boolean isAdjusting = e.getValueIsAdjusting(); long value; LongAdjustmentEvent le; if (shift == 0) { value = val; le = new LongAdjustmentEvent(value, isAdjusting); } else { int delta = val - oldIntVal; int sign; if (delta > 0) { sign = 1; } else { delta = -delta; sign = -1; } if (delta == UNIT_STEP_MAGIC) { // magic for unit increment value = longValue + longUnitInc * sign; } else if (delta == BLOCK_STEP_MAGIC) { // magic for block increment value = longValue + longBlockInc * sign; } else { // interpret as a drag of the slider value = (long) val * (1L << shift); } setValueInternal(value); le = new LongAdjustmentEvent(longValue, isAdjusting); } fireAdjustementEvent(le); } }); longListeners = new ArrayList<>(); super.setValues(0, 0, 0, 0); } // override parent version public void setUnitIncrement(int inc) { setUnitIncrement((long) inc); } public void setUnitIncrement(long inc) { longUnitInc = inc; int val; if (shift == 0) { val = (int) inc; } else { val = UNIT_STEP_MAGIC; // supply magic value 1 } super.setUnitIncrement(val); } // override parent version public void setBlockIncrement(int inc) { setBlockIncrement((long) inc); } public void setBlockIncrement(long inc) { longBlockInc = inc; int val; if (shift == 0) { val = (int) inc; } else { val = BLOCK_STEP_MAGIC; // supply magic longValue 2 } super.setBlockIncrement(val); } public long getLongValue() { return longValue; } private long setValueInternal(long value) { // correct for overshoot if (value < longMin) { value = longMin; } else if (value > longMaxWithExtent) { value = longMaxWithExtent; } longValue = value; long tmpValue = value >> shift; int intValue = (int) tmpValue; if (intValue < intMin) { intValue = intMin; } else if (intValue > intMaxWithExtent) { intValue = intMaxWithExtent; } oldIntVal = intValue; setting_values = true; { setValue(intValue); } setting_values = false; return longValue; } /** Set the values for the scollbar. Also sets block and unit increment */ private void setValuesInternal(long tmpValue, long tmpExtent, long tmpMin, long tmpMax) { setting_values = true; { longValue = tmpValue; longExtent = tmpExtent; longMin = tmpMin; longMax = tmpMax; longMaxWithExtent = longMax - longExtent; /* scale the long values to fit in int */ int shiftcnt = 0; while (tmpMax > Integer.MAX_VALUE || tmpMin < Integer.MIN_VALUE || tmpExtent > Integer.MAX_VALUE) { tmpMin /= 2; tmpMax /= 2; tmpValue /= 2; tmpExtent /= 2; shiftcnt++; } this.shift = shiftcnt; oldIntVal = (int) tmpValue; intExtent = (int) tmpExtent; intMin = (int) tmpMin; intMax = (int) tmpMax; intMaxWithExtent = intMax - intExtent; super.setValues(oldIntVal, intExtent, intMin, intMax); } setting_values = false; } private void setDefaultIncrementsInternal() { long uinc = longExtent / 50; if (uinc < 1) { uinc = 1; } setUnitIncrement(uinc); long binc = longExtent * 3 / 4; if (binc < 1) { binc = 1; } setBlockIncrement(binc); } public void setValues( // override parent version int tmpValue, int tmpExtent, int tmpMin, int tmpMax) { setValues((long) tmpValue, (long) tmpExtent, (long) tmpMin, (long) tmpMax); } public void setValues(long tmpValue, long tmpExtent, long tmpMin, long tmpMax) { setValuesInternal(tmpValue, tmpExtent, tmpMin, tmpMax); setDefaultIncrementsInternal(); } /** Notify listeners of adjustment */ private void fireAdjustementEvent(LongAdjustmentEvent event) { for (LongAdjustmentListener listener : longListeners) { listener.adjustmentValueChanged(event); } } /** Add LongAdjustmentListener */ public void addLongAdjustmentListener(LongAdjustmentListener listener) { longListeners.add(listener); } /** A listener for adjustements to the AnLongScrollBar */ public interface LongAdjustmentListener { public void adjustmentValueChanged(LongAdjustmentEvent adjustmentEvent); } /** An event for adjestment to JLongScrollBars */ public class LongAdjustmentEvent { private final long value; private final boolean isAdjusting; public LongAdjustmentEvent(long value, boolean isAdjusting) { this.value = value; this.isAdjusting = isAdjusting; } /** Get the new specified value */ public long getValue() { return value; } public boolean getValueIsAdjusting() { return isAdjusting; } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnBorderPanel.java����������������������������������������0000644�0001750�0001750�00000005355�14744453367�021040� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; /** * @author tpreisle */ public class AnBorderPanel extends JPanel { private Color topBorderColor = null; private Color rightBorderColor = null; private Color leftBorderColor = null; private Color bottomBorderColor = null; @Override public void paint(Graphics g) { super.paint(g); if (topBorderColor != null) { g.setColor(topBorderColor); g.drawLine(0, 0, getWidth() - 1, 0); } if (rightBorderColor != null) { g.setColor(rightBorderColor); g.drawLine(getWidth() - 1, 0, getWidth() - 1, getHeight() - 1); } if (getLeftBorderColor() != null) { g.setColor(getLeftBorderColor()); g.drawLine(0, 0, 0, getHeight() - 1); } if (bottomBorderColor != null) { g.setColor(bottomBorderColor); g.drawLine(0, getHeight() - 1, getWidth() - 1, getHeight() - 1); } } /** * @return the topBorder */ public Color getTopBorderColor() { return topBorderColor; } /** * @param topBorder the topBorder to set */ public void setTopBorderColor(Color topBorderColor) { this.topBorderColor = topBorderColor; } /** * @return the rightBorderColor */ public Color getRightBorderColor() { return rightBorderColor; } /** * @param rightBorderColor the rightBorderColor to set */ public void setRightBorderColor(Color rightBorderColor) { this.rightBorderColor = rightBorderColor; } /** * @return the bottomBorderColor */ public Color getBottomBorderColor() { return bottomBorderColor; } /** * @param bottomBorderColor the bottomBorderColor to set */ public void setBottomBorderColor(Color bottomBorderColor) { this.bottomBorderColor = bottomBorderColor; } /** * @return the leftBorderColor */ public Color getLeftBorderColor() { return leftBorderColor; } /** * @param leftBorderColor the leftBorderColor to set */ public void setLeftBorderColor(Color leftBorderColor) { this.leftBorderColor = leftBorderColor; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnSplitPaneInternal.java����������������������������������0000644�0001750�0001750�00000002517�14744453367�022234� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Component; public class AnSplitPaneInternal extends AnSplitPane { public AnSplitPaneInternal(int orientation, Component leftComponent, Component rightComponent) { this(orientation, leftComponent, rightComponent, -1); } public AnSplitPaneInternal( int orientation, Component leftComponent, Component rightComponent, int location) { super(orientation, leftComponent, rightComponent, location); init(); } private void init() { setDividerSize(AnSplitPane.defaultDividerSizeSmall); setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR_INSIDE); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnSplitPaneFixedRightSize.java����������������������������0000644�0001750�0001750�00000010627�14744453367�023351� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import static org.gprofng.mpmt.util.gui.AnSplitPane.defaultDividerSize; import static javax.swing.JSplitPane.HORIZONTAL_SPLIT; import java.awt.Component; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; public class AnSplitPaneFixedRightSize extends AnSplitPane { private int sizeInPixels; private final int defaultSize; private boolean hidden = false; private int sizeInPixelsHidden = -1; public AnSplitPaneFixedRightSize( int newOrientation, Component newLeftComponent, Component newRightComponent, int rightSizeInPixels, int rightDefaultSize) { super(newOrientation, newLeftComponent, newRightComponent, 0); setOneTouchExpandable(true); this.sizeInPixels = rightSizeInPixels; this.defaultSize = rightDefaultSize; setResizeWeight(1); addComponentListener( new ComponentListener() { @Override public void componentShown(ComponentEvent e) {} @Override public void componentResized(ComponentEvent e) { if (!isHidden()) { setDivider(); } } @Override public void componentMoved(ComponentEvent e) {} @Override public void componentHidden(ComponentEvent e) {} }); } private void setDivider() { int location; if (getOrientation() == HORIZONTAL_SPLIT) { location = getWidth() - sizeInPixels; } else { location = getHeight() - sizeInPixels; } if (location != super.getDividerLocation()) { super.setDividerLocation(location); } } @Override public void setDividerLocation(int location) { // Only react to this if it is from a direct user action like dragging or clicking if (isDraggingDivider() || clickedOneTouchButton()) { setDividerLocationInternal(location); } } public void setDividerLocationInternal(int location) { if (getOrientation() == HORIZONTAL_SPLIT) { sizeInPixels = getWidth() - location; } else { sizeInPixels = getHeight() - location; } super.setDividerLocation(location); } @Override public int getLastDividerLocation() { int ldl = super.getLastDividerLocation(); int size; if (getOrientation() == HORIZONTAL_SPLIT) { size = getWidth(); } else { size = getHeight(); } if (ldl <= 8 || ldl > (size - 8)) { int location = size - defaultSize; ldl = location; } return ldl; } /* * Hack...... */ private boolean clickedOneTouchButton() { StackTraceElement[] es = Thread.currentThread().getStackTrace(); int n = 0; for (StackTraceElement e : es) { String s = e.getClassName(); if (s.contains("OneTouchAction")) { // NOI18N return true; } if (n++ > 3) { break; } } return false; } /** * @return the widthInPixels */ public int getSizeInPixels() { if (hidden) { return sizeInPixelsHidden; } else { return sizeInPixels; } } /** * @param sizeInPixels */ public void setSizeInPixels(int sizeInPixels) { this.sizeInPixels = sizeInPixels; setDivider(); } /** * @param hide */ @Override public void setHidden(boolean hide) { if (hide) { if (!hidden) { hidden = true; sizeInPixelsHidden = sizeInPixels; sizeInPixels = 0; setDividerSize(0); super.setDividerLocation(10000); } } else { if (hidden) { hidden = false; sizeInPixels = sizeInPixelsHidden; sizeInPixelsHidden = -1; setDividerSize(defaultDividerSize); setDivider(); } } } /** * @return */ @Override public boolean isHidden() { return hidden; } } ���������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnDialogOuterPanel.form�����������������������������������0000644�0001750�0001750�00000011704�14744453367�022056� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="panel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="5" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="400" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="266" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> </Container> <Component class="javax.swing.JButton" name="okButton"> <Properties> <Property name="text" type="java.lang.String" value="jButton1"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="cancelButton"> <Properties> <Property name="text" type="java.lang.String" value="jButton2"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="helpButton"> <Properties> <Property name="text" type="java.lang.String" value="jButton3"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="4" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnInsetsPanel.form����������������������������������������0000644�0001750�0001750�00000004034�14744453367�021103� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> </AuxValues> <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="400" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <EmptySpace min="0" pref="300" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/gui/AnSplitPane.java������������������������������������������0000644�0001750�0001750�00000027030�14744453367�020534� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.gui; import org.gprofng.analyzer.AnEnvironment; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JSplitPane; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.plaf.basic.BasicSplitPaneDivider; import javax.swing.plaf.basic.BasicSplitPaneUI; public class AnSplitPane extends JSplitPane { private boolean hidden = false; private boolean isDragging = false; public static final int defaultDividerSize = 6; public static final int defaultDividerSizeSmall = 2; private int locationWhenShowing = 0; private int dividerSizeWhenShowing = 0; static { UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder()); // NOI18N } ; public AnSplitPane(int orientation, Component leftComponent, Component rightComponent) { this(orientation, leftComponent, rightComponent, -1); } public AnSplitPane( int orientation, Component leftComponent, Component rightComponent, int location) { super(orientation, leftComponent, rightComponent); init(); if (location >= 0) { setDividerLocation(location); } setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); } private void init() { setContinuousLayout(true); setDividerSize(defaultDividerSize); // setOneTouchExpandable(true); setUI( new BasicSplitPaneUI() { private final int oneTouchSize = 5; @Override public BasicSplitPaneDivider createDefaultDivider() { return new BasicSplitPaneDivider(this) { private boolean mouseInsideRight; private boolean mouseInsideLeft; @Override public void setBorder(Border b) {} @Override public void paint(Graphics g) { g.setColor(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); super.paint(g); } /** * Creates and return an instance of JButton that can be used to collapse the left * component in the split pane. */ /* * Code copied from BasicSplitPaneDivider.java */ @Override protected JButton createLeftOneTouchButton() { JButton b = new JButton() { @Override public void setBorder(Border b) {} @Override public void paint(Graphics g) { if (splitPane != null) { int[] xs = new int[3]; int[] ys = new int[3]; int blockSize; // Fill the background first ...... g.setColor(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); g.fillRect(0, 0, this.getWidth(), this.getHeight()); // ... then draw the arrow. if (mouseInsideLeft) { g.setColor(AnEnvironment.SPLIT_PANE_ONE_TOUCH_BUTTON_FOCUSED_COLOR); } else { g.setColor(AnEnvironment.SPLIT_PANE_ONE_TOUCH_BUTTON_COLOR); } if (orientation == JSplitPane.VERTICAL_SPLIT) { blockSize = Math.min(getHeight(), oneTouchSize); xs[0] = blockSize; xs[1] = 0; xs[2] = blockSize << 1; ys[0] = 0; ys[1] = blockSize; ys[2] = blockSize; g.drawPolygon(xs, ys, 3); } else { blockSize = Math.min(getWidth(), oneTouchSize); xs[0] = blockSize; xs[1] = 0; xs[2] = blockSize; ys[0] = 0; ys[1] = blockSize; ys[2] = blockSize << 1; } g.fillPolygon(xs, ys, 3); g.setColor(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); // g.setColor(Color.red); if (orientation == JSplitPane.VERTICAL_SPLIT) { g.drawLine( 0, this.getHeight() - 1, this.getWidth() - 1, this.getHeight() - 1); } else { g.drawLine( this.getWidth() - 1, 0, this.getWidth() - 1, this.getHeight() - 1); } } } // Don't want the button to participate in focus traversable. @Override public boolean isFocusTraversable() { return false; } }; b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { mouseInsideLeft = true; repaint(); } @Override public void mouseExited(MouseEvent e) { mouseInsideLeft = false; repaint(); } }); return b; } /** * Creates and return an instance of JButton that can be used to collapse the right * component in the split pane. */ /* * Code copied from BasicSplitPaneDivider.java */ @Override protected JButton createRightOneTouchButton() { JButton b = new JButton() { @Override public void setBorder(Border border) {} @Override public void paint(Graphics g) { if (splitPane != null) { int[] xs = new int[3]; int[] ys = new int[3]; int blockSize; // Fill the background first ... g.setColor(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); g.fillRect(0, 0, this.getWidth(), this.getHeight()); // ... then draw the arrow. if (orientation == JSplitPane.VERTICAL_SPLIT) { blockSize = Math.min(getHeight(), oneTouchSize); xs[0] = blockSize - 1; xs[1] = (blockSize << 1) - 1; xs[2] = 0; ys[0] = blockSize + 1; ys[1] = 0 + 1; ys[2] = 0 + 1; } else { blockSize = Math.min(getWidth(), oneTouchSize); xs[0] = 0 + 1; xs[1] = blockSize + 1; xs[2] = 0 + 1; ys[0] = 0; ys[1] = blockSize; ys[2] = blockSize << 1; } if (mouseInsideRight) { g.setColor(AnEnvironment.SPLIT_PANE_ONE_TOUCH_BUTTON_FOCUSED_COLOR); } else { g.setColor(AnEnvironment.SPLIT_PANE_ONE_TOUCH_BUTTON_COLOR); } g.fillPolygon(xs, ys, 3); } } // Don't want the button to participate in focus traversable. @Override public boolean isFocusTraversable() { return false; } }; b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize)); b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); b.setFocusPainted(false); b.setBorderPainted(false); b.setRequestFocusEnabled(false); b.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) { mouseInsideRight = true; repaint(); } @Override public void mouseExited(MouseEvent e) { mouseInsideRight = false; repaint(); } }); return b; } }; } @Override protected void dragDividerTo(int location) { isDragging = true; super.dragDividerTo(location); isDragging = false; } }); } protected boolean isDraggingDivider() { return isDragging; } public void setHidden(boolean hide) { if (hide) { if (!hidden) { locationWhenShowing = getDividerLocation(); dividerSizeWhenShowing = getDividerSize(); setDividerLocation(0); setDividerSize(0); hidden = true; } } else if (hidden) { hidden = false; setDividerLocation(locationWhenShowing); setDividerSize(dividerSizeWhenShowing); } } public boolean isHidden() { return hidden; } public int getDividerLocationWhenShowing() { if (isHidden()) { return locationWhenShowing; } else { return getDividerLocation(); } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/��������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�016121� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/LabelCoordinateCalculator.java��������������������������0000644�0001750�0001750�00000001712�14744453367�023763� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler; /** Computes the coordinates for an axis. */ public interface LabelCoordinateCalculator { /** Get the midpoint of a bin */ public int getCenterCoordForValue(long value); /** Get the size of the ruler portion (w/o margins) */ public int getDataPixels(); } ������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/���������������������������������������������0000755�0001750�0001750�00000000000�15044723234�020322� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesNanoseconds.java�����������������������0000644�0001750�0001750�00000004237�14744453367�024562� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; import org.gprofng.mpmt.AnLocale; /** * This class provides unit strings for a number of nanoseconds that fall withing a specified range. */ public class ValuesNanoseconds extends ValuesWithUnits { /** Instantiate a new ValuesNanoseconds object with a specified range */ public ValuesNanoseconds(long low, long high) { super(low, high); } public String getUnitString() { String units = getUnitString(absMax); return units; } public long getUnitDivisor() { long uDiv = getUnitDivisor(absMax); return uDiv; } /** Get the Unit String to use */ private String getUnitString(long value) { String time_units; if (value < 1000L) { // nanoseconds time_units = AnLocale.getString("nsec"); // NOI18N } else if (value < 1000000L) { // microseconds time_units = AnLocale.getString("usec"); // NOI18N } else if (value < 1000000000L) { // millisenconds time_units = AnLocale.getString("msec"); // NOI18N } else { // seconds time_units = AnLocale.getString("sec"); // NOI18N } return time_units; } /* * Get the divisor required to use the metric unit prefix * supplied by getUnitString() */ private long getUnitDivisor(long value) { long divisor; if (value < 1000L) { divisor = 1L; } else if (value < 1000000L) { divisor = 1000L; } else if (value < 1000000000L) { divisor = 1000000L; } else { divisor = 1000000000L; } return divisor; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesBytes.java�����������������������������0000644�0001750�0001750�00000003675�14744453367�023403� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; import org.gprofng.mpmt.AnLocale; /** This class provides unit strings for a number of bytes that fall withing a specified range. */ public class ValuesBytes extends ValuesWithUnits { /** Instantiate a new ValuesBytes object with a specified range */ public ValuesBytes(long low, long high) { super(low, high); } public String getUnitString() { String units = getUnitString(absMax); return units; } public long getUnitDivisor() { long uDiv = getUnitDivisor(absMax); return uDiv; } /** Get the Unit String to use */ public String getUnitString(long value) { String units; if (value < 1000L) { units = AnLocale.getString("Bytes"); // NOI18N } else if (value < 1000000L) { units = AnLocale.getString("KB"); // NOI18N } else if (value < 1000000000L) { units = AnLocale.getString("MB"); // NOI18N } else { units = AnLocale.getString("GB"); // NOI18N } return units; } private long getUnitDivisor(long value) { long divisor; if (value < 1000L) { divisor = 1L; } else if (value < 1000000L) { divisor = 1000L; } else if (value < 1000000000L) { divisor = 1000000L; } else { divisor = 1000000000L; } return divisor; } } �������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesWithUnits.java�������������������������0000644�0001750�0001750�00000006425�14744453367�024247� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; import java.text.DecimalFormat; /* * The ValuesWithUnits stores a range for values that can be expressed * with modifiers like kilo or nano. * Values are of type long and must be stored in the highest-resolusion. */ public abstract class ValuesWithUnits implements ValuesGeneric { protected long low; protected long high; protected long absMax; // maximum absolute value /** Instantiate a new ValuesWithUnits object */ public ValuesWithUnits(long v1, long v2) { setRange(v1, v2); } /* * Get the units' string. * Example: value units = bytes -> Bytes, KB, MB, ... * Example: value units = nanoseconds -> Nanoseconds, Milliseconds... * Assumes <value> is in highest-resolusion units. */ public abstract String getUnitString(); /* * Get the divisor required to convert to the units * supplied by getUnitString(). */ public abstract long getUnitDivisor(); /* * Format a value using <range> to set number of sig digits */ public String getFormattedValue(long value, long range) { String myformat = "###,###,###,###,###,##0"; // convert origValue to desired units long uDiv = getUnitDivisor(); double uValue = value; uValue /= uDiv; // calculate # of places to right of decimal point required to show // MSD of <range> range = Math.abs(range); // ensure range>=1 range = Math.max(1, range); if (range < uDiv) { // range is a fraction of uDiv long tmp = range; int decimalPlaces = 0; while (tmp < uDiv) { tmp *= 10; decimalPlaces++; } String decimalfmt = ".000000000000000000000000000"; myformat = myformat + decimalfmt.substring(0, decimalPlaces + 1); } // generate string DecimalFormat df = new DecimalFormat(myformat); // bd = bd.setScale(decimalPlaces,BigDecimal.ROUND_HALF_UP); String text = df.format(uValue); return text; } /** Format a value based on default setting */ public String getFormattedValue(long value) { long range = high - low + 1; String ss = getFormattedValue(value, range); return ss; } /** Get the low value */ public long getLowValue() { return low; } /** Get the high value */ public long getHighValue() { return high; } /** Set the range of values */ public void setRange(long v1, long v2) { if (v1 < v2) { low = v1; high = v2; } else { low = v2; high = v1; } absMax = 0; long tmp = Math.abs(v1); if (absMax < tmp) { absMax = tmp; } tmp = Math.abs(v2); if (absMax < tmp) { absMax = tmp; } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesLabelList.java�������������������������0000644�0001750�0001750�00000004164�14744453367�024162� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; /** Display formatting for any text-based values such (e.g. function name) */ public class ValuesLabelList implements ValuesGeneric { private long low; private long high; private String labels[]; /** Instantiate a new GenericValueType */ public ValuesLabelList(String labels[]) { this.labels = labels; } /** Display as the value converted to a string */ public String getFormattedValue(long value) { if (value >= 0 && value < labels.length) { int idx = (int) value; return labels[idx]; // YXXX could show a range in the future } else { return ""; } } /** No units for generic data */ public String getUnitString() { return null; } /** Display as the value converted to a string */ public String getFormattedValue(long value, long range) { return getFormattedValue(value); } /** Return the low value index */ public long getLowValue() { return low; } /** Return the high value index */ public long getHighValue() { return high; } private int limit(long value) { int rc; if (value < 0) { rc = 0; } else if (value >= labels.length) { rc = labels.length - 1; } else { rc = (int) value; } return rc; } /** Set the range */ public void setRange(long v1, long v2) { if (v1 < v2) { low = limit(v1); high = limit(v2); } else { low = limit(v2); high = limit(v1); } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesLong.java������������������������������0000644�0001750�0001750�00000003253�14744453367�023204� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; /** Display formatting for generic values such as a count. */ public class ValuesLong implements ValuesGeneric { private long low; private long high; /** Instantiate a new ValuesLong */ public ValuesLong(long low, long high) { setRange(low, high); } /** Display as the value converted to a string */ public String getFormattedValue(long value) { return Long.toString(value); } /** No units for generic data */ public String getUnitString() { return null; } /** Display as the value converted to a string */ public String getFormattedValue(long value, long range) { return getFormattedValue(value); } /** Return the low value */ public long getLowValue() { return low; } /** Return the high value */ public long getHighValue() { return high; } /** Set the range */ public void setRange(long v1, long v2) { if (v1 < v2) { low = v1; high = v2; } else { low = v2; high = v1; } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/valuetypes/ValuesGeneric.java���������������������������0000644�0001750�0001750�00000002603�14744453367�023657� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler.valuetypes; /** * The ValuesGeneric interface allows for specification of how to format a value to display it and * what unit string to use. */ public interface ValuesGeneric { /** Get the units (e.g. "usec") */ public String getUnitString(); /** get <value> as a string (does not include units) */ public String getFormattedValue(long value); /** get <value> as a string, with enough precision to show <range> */ public String getFormattedValue(long value, long range); /** Get the low value for the range */ public long getLowValue(); /** Get the high value for the range */ public long getHighValue(); /** Set the data range */ public void setRange(long v1, long v2); } �����������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/Ruler.java����������������������������������������������0000644�0001750�0001750�00000003332�14744453367�020013� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler; /** * A Component that is suitable to representa range of values or a discrete set of labels in a chart * or timeline. The ruler has three levels, one for ticks, one for labels, and one for the title. * * @author blewis */ public interface Ruler { // orientation public static final int VERTICAL_ORIENTATION = 1; public static final int HORIZONTAL_ORIENTATION = 2; // ticks placement public static final int TICKS_ON_THE_BOTTOM = 1; public static final int TICKS_ON_THE_TOP = 2; // title location public static final int PLACEMENT_NONE = 0; // title not displayed public static final int PLACEMENT_WITH_LABELS = 1; // title inline w/tick labels public static final int PLACEMENT_TITLE_LEVEL = 2; // separate row for title /** * Set a spacing to align component padLo is at the 0 end of the graphics' coordinate system padHi * is at the opposite end */ public void setPadding(int padLo, int padHi); /** set direction of ruler w.r.t. coordinate system */ public void setOrderReverse(boolean reverse); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/ruler/RangeRuler.java�����������������������������������������0000644�0001750�0001750�00000074154�15044710303�020756� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.ruler; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.timeline_common.CoordCalcTimeReader; import org.gprofng.mpmt.timeline_common.VerticalRowRuler; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.ruler.valuetypes.ValuesGeneric; import org.gprofng.mpmt.util.zoomruler.PaintListener; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.util.ArrayList; import java.util.List; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import javax.swing.JTable; // import org.gprofng.mpmt.GraphControls; /** * A component that is suitable to show the labels for an axis of the graph which has a range of * values. Special processing is made to for nano second values to show the time units. */ public class RangeRuler extends VerticalRowRuler implements Ruler, Accessible { // user settings private ValuesGeneric valueType; private LabelCoordinateCalculator coordCalculator; private boolean isContinuous; private int orientation; // see enum above private int paddingLow; private int paddingHigh; private int tickPlacement; // see enum above private int titlePlacement = PLACEMENT_NONE; // see enum above private boolean inverseOrder = false; private boolean useTickCenterForUnitSteps; // ticks geometry private final int MIN_PIXELS_BETWEEN_TICKS = 4; private final int SMALL_TICK_LENGTH = 2; private final int MAXTICKLEN = SMALL_TICK_LENGTH * 4; // font settings private final int MIN_PIXELS_BETWEEN_LABELS = 30; private static final double RADIANS_90DEGREES = Math.PI / 2; private int MARGIN = 2; // font state private static Font TEXT_FONT; private int FONT_HEIGHT = 0; private int FONT_ASCENT = 0; private int FONT_DESCENT = 0; // state private boolean staggerHorizontalLabels; private int labelBoundaryCoord = 0; // coordinate of edge of title private String title; private ArrayList<PaintListener> paintListeners = new ArrayList<>(); private boolean lockPreferredSize = false; private Dimension preferredD = new Dimension(1, 1); // non-zero for layout mgr // TabStops // TBR: eventually move to new class that implements RangeRuler public enum TabStopTypes { TABSTOP_GENERIC, TABSTOP_LEFT, TABSTOP_RIGHT }; private List<TabStopTypes> tabStopTypes; private List<Long> tabStopValues; private CoordCalcTimeReader tabStopCalc; private final int TABSTOP_WIDTH = 5; private final int TABSTOP_LENGTH = MAXTICKLEN - 1; private final Color tabStopColorLeft = new Color(0, 32, 255); // Microstate Sleep blue private final Color tabStopColorRight = new Color(255, 16, 0); // Microstate Stopped red /** Instantiate a RangeRuler with a specified orientation */ public RangeRuler(ValuesGeneric type, int orientation) { super(); initRangeRuler(type, orientation, null, true); } static { JTable jtable = new JTable(); Font org_font = jtable.getFont(); TEXT_FONT = new Font( "SansSerif", org_font.getStyle(), // NOI18N org_font.getSize()); } public RangeRuler( ValuesGeneric type, int orientation, LabelCoordinateCalculator coordCalculator, boolean continuous) { super(); initRangeRuler(type, orientation, coordCalculator, continuous); } private void initRangeRuler( ValuesGeneric type, int orientation, LabelCoordinateCalculator coordCalculator, boolean isContinuous) { this.valueType = type; this.paddingLow = 0; this.paddingHigh = 0; this.orientation = orientation; if (coordCalculator == null) { this.coordCalculator = new LocalCalculator(); isContinuous = true; } else { this.coordCalculator = coordCalculator; } this.isContinuous = isContinuous; this.useTickCenterForUnitSteps = true; this.tickPlacement = TICKS_ON_THE_BOTTOM; this.title = ""; // NOI18N if (this.orientation == this.VERTICAL_ORIENTATION) { inverseOrder = !inverseOrder; } this.tabStopTypes = new ArrayList<>(); this.tabStopValues = new ArrayList<>(); String aText = orientation == RangeRuler.HORIZONTAL_ORIENTATION ? AnLocale.getString("Horizontal Ruler") : AnLocale.getString("Vertical Ruler"); AnUtility.setAccessibleContext(getAccessibleContext(), aText); } private boolean isFontInitialized() { if (FONT_HEIGHT != 0) { return true; } if (TEXT_FONT != null) { FontMetrics fm = this.getFontMetrics(TEXT_FONT); if (fm != null) { FONT_ASCENT = fm.getAscent() - 1; // YXXX bogus adjust for looks FONT_DESCENT = fm.getDescent() - 2; // YXXX bogus adjust for looks FONT_HEIGHT = FONT_ASCENT + FONT_DESCENT; return true; } } return false; } /** * Set a spacing to align component padLo is at the "0" end of the graphics' coordinate system * padHi is at the opposite end */ public void setPadding(int padLo, int padHi) { if (paddingLow != padLo || paddingHigh != padHi) { paddingLow = padLo; paddingHigh = padHi; repaint(); // should we do this elsewhere, as well? } } public int getPaddingLow() { return paddingLow; } public int getPaddingHigh() { return paddingHigh; } public void setUseTickCenterForUnitSteps(boolean center) { useTickCenterForUnitSteps = center; } /** set direction of ruler w.r.t. coordinate system */ public void setOrderReverse(boolean reverse) { this.inverseOrder = reverse; } /** Set title for the axis */ public void setTitle(String title) { this.title = title; if (title != null && titlePlacement == PLACEMENT_NONE) { setTitlePlacement(PLACEMENT_TITLE_LEVEL); } } /** Set to TICKS_ON_THE_BOTTOM or TICKS_ON_THE_TOP */ public void setTickPlacement(int p) { tickPlacement = p; } public void setTitlePlacement(int placement) { titlePlacement = placement; repaint(); } public void addPaintLister(PaintListener paintListener) { paintListeners.add(paintListener); } private void notifyPaintListeners(Graphics g) { for (PaintListener l : paintListeners) { l.timelinePainted(g); } } // if the LabelCoordinateCalculator stays the same, you can call this // WARNING: Modifies values in the global variable that was passed in! public final void setRange(long lo, long hi) { if (valueType.getLowValue() != lo || valueType.getHighValue() != hi) { valueType.setRange(lo, hi); repaint(); } } // --- accessability public final AccessibleContext getAccessibleContext() { // variable accessibleContext is protected in superclass if (accessibleContext == null) { accessibleContext = new AccessibleRuler(); } return accessibleContext; } final class AccessibleRuler extends AccessibleJComponent { public AccessibleRole getAccessibleRole() { return AccessibleRole.CANVAS; } } // --- calculators private class LocalCalculator implements LabelCoordinateCalculator { public int getCenterCoordForValue(long vv) { int absoluteCoord; // pretty inefficient, could cache some of these values int pixelsAvailForData = getDataPixels(); long dataHi = valueType.getHighValue(); long dataLo = valueType.getLowValue(); long dataRange = dataHi - dataLo + 1; double pixelsPerVal = (double) pixelsAvailForData / dataRange; double relOffset = vv - dataLo; if (useTickCenterForUnitSteps) { relOffset += 0.5; } int tmp = (int) (pixelsPerVal * relOffset); if (inverseOrder) { absoluteCoord = pixelsAvailForData - tmp; } else { absoluteCoord = tmp; } return absoluteCoord; } public int getDataPixels() { int availPixels; if (orientation == HORIZONTAL_ORIENTATION) { availPixels = getWidth() - paddingLow - paddingHigh; } else { availPixels = getHeight() - paddingLow - paddingHigh; } return availPixels; } } private boolean setPreferredForVertical(final Graphics g) { if (!isFontInitialized()) { return false; } int w = calcWidestLabel(g, valueType.getLowValue(), valueType.getHighValue(), 1); int width = w + MAXTICKLEN + MARGIN; if (titlePlacement != PLACEMENT_NONE) { width += FONT_HEIGHT + MARGIN; } boolean changed = internalSetPreferredSize(width, 0); return changed; } private boolean setPreferredForHorizontal(final Graphics g) { if (!isFontInitialized()) { return false; } int level = 1; // basic labels if (false) { // YXXX maybe the right thing to do, but I want to minimize resizes setStaggerHorizontalLabels(g); // compute staggerHorizontalLabels if (staggerHorizontalLabels) { level++; } } else { if (!isContinuous) { level++; } } if (titlePlacement == PLACEMENT_TITLE_LEVEL) { level++; } int height = computeDistanceFromHorizontalRuler(level); height += MARGIN; boolean changed = internalSetPreferredSize(0, height); return changed; } private int computeYCoordForHorizontalLabel(int level) { int coord = computeDistanceFromHorizontalRuler(level); if (tickPlacement == TICKS_ON_THE_BOTTOM) { coord += FONT_DESCENT; coord = preferredD.height - coord; } else { coord += FONT_ASCENT; } return coord; } // note: modifies staggerHorizontalLabels private int setStaggerHorizontalLabels(final Graphics g) { int availPixels = coordCalculator.getDataPixels(); if (availPixels <= 0) { return 0; } long lo = valueType.getLowValue(); long hi = valueType.getHighValue(); long dataRange = hi - lo + 1; // must be positive long estDataStep = dataRange / 80; // worst case, say 80 labels int maxLabelPixels; // max number of pixels per label, on-axis direction // # of allowable offsets (e.g. 2 for alternating) for tick labels boolean doStagger = false; maxLabelPixels = calcWidestLabel(g, lo, hi, estDataStep); maxLabelPixels += FONT_HEIGHT / 2; // add horzontal space based on font int estLabelCount = availPixels / maxLabelPixels; if (estLabelCount < dataRange && !isContinuous) { // labels don't all fit, use multi level doStagger = true; // two levels of labels -> divide by 2 maxLabelPixels = maxLabelPixels / 2 + 1; } staggerHorizontalLabels = doStagger; return maxLabelPixels; // largest size allowed for a single label } private int computeDistanceFromHorizontalRuler(int level) { int coord = MAXTICKLEN; coord += level * (FONT_HEIGHT); return coord; } // --- paint functions private void paintHorizontal(final Graphics g) { g.setFont(TEXT_FONT); g.setColor(Color.black); // direction-specific geometry int originX = 0; int originY; if (tickPlacement == TICKS_ON_THE_BOTTOM) { originY = this.getHeight(); } else { originY = 0; } int maxLabelPixels = setStaggerHorizontalLabels(g); // sets staggerHorizontalLabels // draw title int title_x; int title_y; String lbl = title; String units = valueType.getUnitString(); if (units != null && !units.equals("")) { lbl += "(" + units + ")"; // NOI18N } if (titlePlacement == PLACEMENT_TITLE_LEVEL) { title_x = coordCalculator.getDataPixels() / 2 + paddingLow; int level = 1; if (staggerHorizontalLabels) { level++; } title_y = computeYCoordForHorizontalLabel(level); drawCenteredString(g, lbl, title_x, title_y, 0); // YXXX add right bound later labelBoundaryCoord = MARGIN; } else if (titlePlacement == PLACEMENT_WITH_LABELS) { title_x = MARGIN; title_y = computeYCoordForHorizontalLabel(0); g.drawString(lbl, title_x, title_y); int titleWidth = g.getFontMetrics(TEXT_FONT).stringWidth(lbl); labelBoundaryCoord = title_x + titleWidth + MARGIN; } // draw ticks drawAllTicks(g, maxLabelPixels, originX, originY); drawAllTabStops(g, originX, originY); } private void paintVertical(final Graphics g) { g.setFont(TEXT_FONT); g.setColor(Color.black); // direction-specific geometry int originY = this.getHeight(); int originX; if (tickPlacement == TICKS_ON_THE_BOTTOM) { // right originX = this.getWidth(); } else { originX = 0; } int maxLabelPixels = FONT_HEIGHT + 1; // draw title if (titlePlacement == PLACEMENT_NONE) { labelBoundaryCoord = MARGIN; } else { int title_x = FONT_ASCENT + MARGIN; int title_y; String lbl = title; String units = valueType.getUnitString(); if (units != null && !units.equals("")) { lbl += "(" + units + ")"; // NOI18N } int w = g.getFontMetrics(TEXT_FONT).stringWidth(lbl); title_y = (coordCalculator.getDataPixels() + w) / 2 + paddingLow; Graphics2D g2 = (Graphics2D) g; g2.rotate(-RADIANS_90DEGREES); g2.drawString(lbl, -title_y, title_x); g2.rotate(RADIANS_90DEGREES); labelBoundaryCoord = MARGIN + FONT_HEIGHT + MARGIN; } // draw ticks drawAllTicks(g, maxLabelPixels, originX, originY); } // color must already be set private void drawAllTicks( final Graphics g, int maxLabelPixels, // pixels to allocate per label int originX, int originY) { g.setColor(Color.black); // estimate label sizes int availPixels = coordCalculator.getDataPixels(); long lo = valueType.getLowValue(); long hi = valueType.getHighValue(); long dataRange = hi - lo + 1; // must be positive // get array which specifies tick spacing long[] tickStep = calcTickSteps(availPixels, maxLabelPixels, dataRange); int tickLen = SMALL_TICK_LENGTH; // loop thru each level of tick spacing for (int ii = 0; ii < tickStep.length; ii++) { boolean showLabels = false; if (ii == tickStep.length - 1) { // last element in list specifies Labels showLabels = true; } drawTicks(g, originX, originY, tickStep[ii], tickLen, showLabels); tickLen += SMALL_TICK_LENGTH; } } // color must already be set private boolean drawTicks( final Graphics g, int originX, int originY, long dataStep, int tickLen, boolean showLabels) { if (dataStep == 0) { // no ticks at this dataStep level return false; } int pixelsAvailForData = coordCalculator.getDataPixels(); long dataHi = valueType.getHighValue(); long dataLo = valueType.getLowValue(); long dataRange = dataHi - dataLo + 1; double nsteps = (double) dataRange / dataStep; long pixelsPerTick = (long) (pixelsAvailForData / nsteps); if (pixelsPerTick < MIN_PIXELS_BETWEEN_TICKS) { // ticks too close together for screen if (showLabels) { return false; // gets here when there's no space for labels } return false; } // calculate loop start and end long alignedStart; // first value >= dataLo that is aligned to dataStep long alignedEnd; if (dataLo >= 0) { alignedStart = (dataLo + dataStep - 1) / dataStep * dataStep; } else { alignedStart = (dataLo) / dataStep * dataStep; } if (useTickCenterForUnitSteps) { alignedEnd = dataHi; } else { alignedEnd = dataHi + 1; // show most extreme tickmark } int labelOffsetLevel = 0; if (staggerHorizontalLabels) { long topDigit = alignedStart / dataStep; labelOffsetLevel = (int) (topDigit % 2); } // step thru range by tick step for (long vv = alignedStart; vv <= alignedEnd; vv += dataStep) { int x, y; // tick x and y // compute pixel location in axis direction int tickLocation; tickLocation = coordCalculator.getCenterCoordForValue(vv); tickLocation += paddingLow; if (orientation == HORIZONTAL_ORIENTATION) { x = tickLocation; if (showLabels) { int labelTickLen = computeDistanceFromHorizontalRuler(labelOffsetLevel); // draw extended ticks to handle staggered labels if (tickPlacement == TICKS_ON_THE_BOTTOM) { y = originY - labelTickLen; } else { y = originY + labelTickLen; } g.drawLine(x, originY, x, y); int lx = x; int ly = computeYCoordForHorizontalLabel(labelOffsetLevel); String label = valueType.getFormattedValue(vv, dataStep); int labelRightLimit = lx + (int) pixelsPerTick / 2; drawCenteredString(g, label, lx, ly, labelRightLimit); if (staggerHorizontalLabels) { labelOffsetLevel = (labelOffsetLevel + 1) % 2; } } else { if (tickPlacement == TICKS_ON_THE_BOTTOM) { y = originY - tickLen; } else { y = originY + tickLen; } g.drawLine(x, originY, x, y); } } else { // VERTICAL_ORIENTATION y = tickLocation; if (tickPlacement == TICKS_ON_THE_BOTTOM) { // on the right x = originX - tickLen; if (x < labelBoundaryCoord) { // no space to draw continue; } } else { x = tickLen; if (x > labelBoundaryCoord) { // no space to draw continue; } } if (showLabels) { String label = valueType.getFormattedValue(vv, dataStep); int lx = x; int ly = y - FONT_HEIGHT / 2 + FONT_ASCENT; if (tickPlacement == TICKS_ON_THE_BOTTOM) { // on the right drawRightAdjustedString(g, label, lx, ly); } else { drawLeftAdjustedString(g, label, lx, ly); } } else { g.drawLine(originX, y, x, y); } } } return true; } // tabStop code to show caliper "handles" // TBR, refactor to class that implements RangeRuler public final void setTabStops( List<Long> vals, List<TabStopTypes> types, CoordCalcTimeReader calc) { final int valuesSize = (vals != null) ? vals.size() : 0; final int typesSize = (types != null) ? types.size() : 0; boolean needsUpdate = false; tabStopCalc = calc; // TBR after refactoring tabStop* into separate class if (tabStopValues.size() != valuesSize || tabStopTypes.size() != typesSize) { needsUpdate = true; } for (int ii = 0; !needsUpdate && ii < valuesSize; ii++) { if (tabStopValues.get(ii) != vals.get(ii)) { needsUpdate = true; break; } if (tabStopTypes.get(ii) != types.get(ii)) { needsUpdate = true; break; } } if (!needsUpdate) { return; } tabStopValues.clear(); tabStopTypes.clear(); for (int ii = 0; ii < valuesSize; ii++) { tabStopValues.add(vals.get(ii)); TabStopTypes newType = TabStopTypes.TABSTOP_GENERIC; if (types != null && ii < types.size()) { newType = types.get(ii); } tabStopTypes.add(newType); } repaint(); } private void drawAllTabStops(final Graphics g, int originX, int originY) { if (tabStopValues.size() != 2) { // only handle caliper pairs for now return; } { int bin; int cx; final int margin = tabStopCalc.getMargin(); int ii = 0; bin = tabStopCalc.getBinAtTime(tabStopValues.get(ii)); cx = tabStopCalc.getLowCoordForBin(bin) - margin; drawTabStop(g, originX, originY, margin, cx, tabStopTypes.get(ii)); ii = 1; bin = tabStopCalc.getBinAtTime(tabStopValues.get(ii)); cx = (tabStopCalc.getLowCoordForBin(bin + 1) - 1) - margin; drawTabStop(g, originX, originY, margin, cx, tabStopTypes.get(ii)); } } private void drawTabStop( final Graphics g, int originX, int originY, int margin, int coord, TabStopTypes type) { if (coord < -margin || coord > coordCalculator.getDataPixels() + margin) { return; } int tickLen = TABSTOP_LENGTH; int x, y; // tick x and y // compute pixel location in axis direction int tickLocation = coord + paddingLow; if (orientation == HORIZONTAL_ORIENTATION) { x = tickLocation; int midY; if (tickPlacement == TICKS_ON_THE_BOTTOM) { y = originY - tickLen; midY = originY - TABSTOP_WIDTH; } else { y = originY + tickLen; midY = originY + TABSTOP_WIDTH; } int w = 0; Color c = Color.black; switch (type) { case TABSTOP_LEFT: w = -TABSTOP_WIDTH; c = tabStopColorLeft; break; case TABSTOP_RIGHT: w = TABSTOP_WIDTH; c = tabStopColorRight; break; default: case TABSTOP_GENERIC: g.setColor(Color.red); g.drawLine(x, originY, x, y); break; } if (w != 0) { Polygon p; { int xx[] = {x, x, x + w, x + w, x}; int yy[] = {originY, y, y, midY, originY}; p = new Polygon(xx, yy, xx.length); // This polygon represents a triangle with the above } g.setColor(c); g.fillPolygon(p); g.setColor(Color.DARK_GRAY); g.drawPolygon(p); } } } // --- string utilites private void drawRightAdjustedString(Graphics g, String label, int rightBoundary, int ycoord) { if (rightBoundary <= labelBoundaryCoord) { // right of string is already infringing on title return; } int xlabelsz = g.getFontMetrics(TEXT_FONT).stringWidth(label); int startx = rightBoundary - xlabelsz; if (startx >= labelBoundaryCoord) { g.drawString(label, startx, ycoord); } else { int availWidth = rightBoundary - labelBoundaryCoord; String printString = squishString(g, label, availWidth); if (printString != null) { xlabelsz = g.getFontMetrics(TEXT_FONT).stringWidth(printString); startx = rightBoundary - xlabelsz; g.drawString(printString, startx, ycoord); } } } private void drawLeftAdjustedString(Graphics g, String label, int leftBoundary, int ycoord) { g.drawString(label, leftBoundary, ycoord); // YXXX implement limited print later } private void drawCenteredString( Graphics g, String label, int labelCenter, int ycoord, int rightBoundary) { if (labelCenter <= labelBoundaryCoord) { // middle of string is already infringing on title return; } int xlabelsz = g.getFontMetrics(TEXT_FONT).stringWidth(label); int startx = labelCenter - xlabelsz / 2; if (startx >= labelBoundaryCoord) { g.drawString(label, startx, ycoord); } else { int availWidth = rightBoundary - labelBoundaryCoord; String printString = squishString(g, label, availWidth); if (printString != null) { g.drawString(printString, labelBoundaryCoord, ycoord); } } } private String squishString(Graphics g, String label, int availWidth) { int strlen; strlen = g.getFontMetrics(TEXT_FONT).stringWidth(label); if (strlen <= availWidth) { return label; } String newString = ".."; strlen = g.getFontMetrics(TEXT_FONT).stringWidth(newString); if (strlen > availWidth) { return null; } String currString = newString; int ii = 0; if (false) { ii += 1; // show first N characters then ".." newString = label.substring(0, ii) + currString; strlen = g.getFontMetrics(TEXT_FONT).stringWidth(newString); if (strlen > availWidth) { return currString; } ii += 1; // skip N characters currString = newString; int max = label.length(); // find largest tail segment that fits for (; ii < max; ii++) { newString = currString + label.substring(ii); strlen = g.getFontMetrics(TEXT_FONT).stringWidth(newString); if (strlen < availWidth) { return newString; } } } else { // chop off tailing characters and end with ".." int max = label.length(); currString = newString; // find largest head segment that fits for (ii = 0; ii < max; ii++) { newString = label.substring(0, max - ii - 1) + ".."; strlen = g.getFontMetrics(TEXT_FONT).stringWidth(newString); if (strlen < availWidth) { return newString; } } } return currString; } // --- return array which specifies tick spacing private long[] calcTickSteps(int pixelsAvailForData, int maxLabelSize, long dataRange) { // how far apart should labels be? int strPixels = maxLabelSize; if (isContinuous && strPixels < MIN_PIXELS_BETWEEN_LABELS) { // for continuous axes, require more space between labels strPixels = MIN_PIXELS_BETWEEN_LABELS; } if (strPixels <= 0) { strPixels = 1; } // estimate max # of labels based on estimated label size int maxNumLabels; maxNumLabels = pixelsAvailForData / strPixels; if (maxNumLabels < 1) { // one label may not fit! maxNumLabels = 1; } // types of steps to calculate long labelStep; // value step between labels long wholeStep; // value step for Ones long midStep; // value step for Halves long tenthStep; // value step for 10ths // determine labelStep double d_minValueStep; // smallest step allowed based on label size d_minValueStep = (double) dataRange / maxNumLabels; long multipleOfTen = getMultipleOfTen((long) d_minValueStep); double d_minValStepMSD; // most significant digit of minValueStep d_minValStepMSD = d_minValueStep / multipleOfTen; int labelMSD; // significant digit of step for Labels if (isContinuous) { // show a sparse # of labels & let the ticks show intermediate vals if (d_minValStepMSD <= 1.0) { labelMSD = 1; } else { labelMSD = 10; // try 10x first long estNumLabels = dataRange / (labelMSD * multipleOfTen); if (estNumLabels < 2 && d_minValStepMSD <= 5) { // label half-steps to increase # of labels labelMSD = 5; estNumLabels = dataRange / (labelMSD * multipleOfTen); if (estNumLabels < 2 && d_minValStepMSD <= 2) { // label half-steps to increase # of labels labelMSD = 2; } } } } else { // !isContinous // show as many labels as possible if (d_minValStepMSD <= 1.0) { labelMSD = 1; } else if (d_minValStepMSD <= 2) { labelMSD = 2; } else if (d_minValStepMSD <= 5) { labelMSD = 5; } else { labelMSD = 10; } } labelStep = labelMSD * multipleOfTen; // decide step for ticks if (d_minValStepMSD <= 1.0) { wholeStep = multipleOfTen; } else { wholeStep = multipleOfTen * 10; } midStep = wholeStep / 2; tenthStep = wholeStep / 10; if (labelMSD == 2) { midStep = 0; // don't emphasize "5" ticks if labels are at steps of 2 } long rc[] = new long[4]; // smallest tick first, label last rc[0] = tenthStep; rc[1] = midStep; rc[2] = wholeStep; rc[3] = labelStep; return rc; } private long getMultipleOfTen(long value) { long d = value; long multipleOfTen = 1; while (d >= 10) { d /= 10; multipleOfTen *= 10; } return multipleOfTen; } private int calcWidestLabel(final Graphics g, long lo, long hi, long dataStep) { if (!isFontInitialized()) { return 0; // YXXX or could return a guess } int strPixels = 0; long step = 1; if (isContinuous) { // just the endpoints are OK step = hi - lo; if (step < 1) { step = 1; } } for (long ii = lo; ii <= hi; ii += step) { String stmp = valueType.getFormattedValue(ii, dataStep); int itmp = g.getFontMetrics(TEXT_FONT).stringWidth(stmp); if (strPixels < itmp) { strPixels = itmp; } } return strPixels; } /** Recompute preferred size */ private boolean recomputePreferredSize(Graphics g) { boolean changed; if (orientation == HORIZONTAL_ORIENTATION) { changed = setPreferredForHorizontal(g); } else { changed = setPreferredForVertical(g); } return changed; } public void lockRulerThickness(Graphics g, boolean lock) { /* * YXXX not sure if it ok to use g from another context, but * font size is needed to set preferred ruler size, and * I don't know how else to get font size without g. * Maybe we should never attempt to lock ruler thickness? * Unfortunately, changing thickness might unexpectedly change * data range that can be shown on center panel. * For now, workaround is to provide g. */ if (!lockPreferredSize && lock) { recomputePreferredSize(g); } lockPreferredSize = lock; } // override parent public Dimension getPreferredSize() { return preferredD; } private boolean internalSetPreferredSize(int width, int height) { boolean changed = false; if (preferredD.width != width || preferredD.height != height) { preferredD.width = width; preferredD.height = height; changed = true; } return changed; } protected void paintComponent(Graphics g) { if (!isFontInitialized()) { // should never happen since <g> should allow font to be set return; } if (!lockPreferredSize) { boolean changed = recomputePreferredSize(g); if (changed) { revalidate(); // YXXX not supposed to revalidate from paint } } if (orientation == HORIZONTAL_ORIENTATION) { paintHorizontal(g); } else { paintVertical(g); } this.notifyPaintListeners(g); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/����������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�017026� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/PaintListener.java����������������������������������0000644�0001750�0001750�00000001647�14744453367�022417� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; import java.awt.Graphics; /** * A listener that listens when the timeline is repainted. It used by the zoomRuler overlay to know * when to redraw. */ public interface PaintListener { void timelinePainted(Graphics g); } �����������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/OverlayMouseHandler.java����������������������������0000644�0001750�0001750�00000003237�14744453367�023563� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; import java.awt.Cursor; /** * The OverlayMouseHander object allows for components with an overlayed image to defer mouse * handling in the overlay to the overlay. The overlayed image will be the zoomruler but this could * be used with other overlayed images that want mouse control. */ public interface OverlayMouseHandler { /** Test wether a mouse action was in the overlay. */ public boolean inOverlay(int x, int y); /** * Deactive mouse handling and let the overlay handle mouse event, presumably called when the * mouse gestures are within the overlay. */ public void deactivate(); /** * Active mouse handling and handling and handle mouse events, presumably called when the mouse * has left the overlay. */ public void activate(); /** Get the cursor cursor. */ public Cursor getCursor(); /** The default cursor to show when the mouse is in an overlay. */ public static final Cursor overlaycursor = new Cursor(Cursor.HAND_CURSOR); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/ZoomRulerOverlay.java�������������������������������0000644�0001750�0001750�00000074437�14744453367�023145� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.Timer; /** * The ZoomrulerOverlay class draws the ZoomRuler on top of a component. It registers a * MouseListener and MouseMotionListener on that component and handles mouse events that occur * within the overlay. It generates ZoomRoulerEvent objects when the user requests a change in zoom. * Along with the ruler to display the levels, a reset button and a revert button can be used. There * is also some support for a pan button but it is not fully supported at this point. The overlay * does require the component to interact with it. The overlay doesn't not know when to repaint. So * the component must tell it to repaint. Additionally MouseHandling usually should be coordinated * through the OverlayMouseHandler class. * * @author blewis */ public class ZoomRulerOverlay { // geometry (LD == long direction, SD == short direction) // distance from canvas edge private static final int BORDER = 1; // size of +/- and arrow boxes private static final int ANCHOR_SIZE = 14; // panning arrows private static final int ARROW_WIDTH = 4; private static final int ARROW_LENGTH = 4; // slider private static final int MARKER_LD = 6; private static final int MARKER_SD = 14; // slider bar (ruler) public static final int RULER_LD_DEFAULT = 50 + MARKER_LD; // 10e15/log(2)=50 // whitespace between anchor border and +/- labels private static final int LABEL_BORDER = 3; // colors and shape private static final Color borderColor = new Color(0x44, 0x44, 0x44); private static final Color buttonFillColor = new Color(0xf4, 0xf4, 0xf4); private static final Color labelShadowColor = new Color(0xcc, 0xcc, 0xcc); private static final Color shadowColor = new Color(0x99, 0x99, 0x99); private static final boolean useLabelShadow = true; private static final int rectRadius = 3; // components and listeners private Vector<ZoomRulerListener> listeners; private JComponent component; private static final ImageIcon revertImg = AnUtility.undo_icon; private static final ImageIcon resetImg = AnUtility.rset_icon; // levels, modified at runtime private int nlevels; // total levels private int ilevel; // current level // state private boolean active = true; private boolean dragging = false; private int recent_mouse_button = -1; // set by user at or near creation private static final int RULER_SD = 4; private final int RULER_LD; // full ruler including +/- boxes private static final int TOTAL_SD = 2 * BORDER + ANCHOR_SIZE; private final int TOTAL_LD; // +/- box far from origin private static final int ANCHOR2_OFFSET_SD = BORDER; private final int ANCHOR2_OFFSET_LD; // +/- box near origin private static final int ANCHOR1_OFFSET_SD = BORDER; private final int ANCHOR1_OFFSET_LD; // reset box private static final int RESET_OFFSET_SD = BORDER; private final int RESET_OFFSET_LD; // revert box private static final int REVERT_OFFSET_SD = BORDER; private final int REVERT_OFFSET_LD; private final boolean hasSlider; private final int orientation; private final boolean revertable; private final boolean PANNING = false; // enable panning mode private final boolean resetable1d; private final boolean resetable2d; private final boolean autoRepeat; private int xoff; private int yoff; private boolean paintBackground; private boolean isEnabled; // user-accessible enums public static final int VERTICAL_ORIENTATION = 1; public static final int HORIZONTAL_ORIENTATION = 2; /** * Instantiate a new overlay object that will draw the ruler on the given component, with nlevels, * starting at coordinate(x,y) with the specified orientation. Usage of Resetable and Revertable * buttons are also specified. */ public ZoomRulerOverlay( JComponent component, int x, int y, final int orientation, final int slider_length, final boolean resetable1d, final boolean resetable2d, final boolean revertable, final boolean autoRepeat) { if (slider_length < MARKER_LD * 2) { hasSlider = false; } else { hasSlider = true; } RULER_LD = slider_length; // precalculate offsets on the long axis RESET_OFFSET_LD = BORDER; if (resetable2d) { if (orientation == this.HORIZONTAL_ORIENTATION) { ANCHOR1_OFFSET_LD = RESET_OFFSET_LD + resetImg.getIconWidth() + 1; } else { ANCHOR1_OFFSET_LD = RESET_OFFSET_LD + resetImg.getIconHeight() + 1; } } else if (resetable1d) { ANCHOR1_OFFSET_LD = RESET_OFFSET_LD + ANCHOR_SIZE + 2; } else { ANCHOR1_OFFSET_LD = RESET_OFFSET_LD; } ANCHOR2_OFFSET_LD = ANCHOR1_OFFSET_LD + ANCHOR_SIZE + RULER_LD; REVERT_OFFSET_LD = ANCHOR2_OFFSET_LD + ANCHOR_SIZE + 1; int ld_total = REVERT_OFFSET_LD; if (orientation == this.HORIZONTAL_ORIENTATION) { if (revertable) ld_total += revertImg.getIconWidth(); } else { if (revertable) ld_total += revertImg.getIconHeight(); } TOTAL_LD = ld_total; this.component = component; this.nlevels = 0; this.ilevel = 0; this.xoff = x; this.yoff = y; this.orientation = orientation; this.resetable1d = resetable1d; this.resetable2d = resetable2d; this.revertable = revertable; this.autoRepeat = autoRepeat; listeners = new Vector(); initializeMouseListeners(); isEnabled = true; } /** Get the height of the overlay */ public int getHeight() { if (orientation == HORIZONTAL_ORIENTATION) return TOTAL_SD + 1; else { return TOTAL_LD + 1; } } /** Get the widht of the overlay */ public int getWidth() { if (orientation == HORIZONTAL_ORIENTATION) { return TOTAL_LD + 1; } else return TOTAL_SD + 1; } /** Get the horizontal offset in the component where the overlay is drawn */ public int getX() { return xoff; } /** Get the vertical offset in the component where the overlay is drawn */ public int getY() { return yoff; } /** Set the number of zoom levels to display */ public void setNumberOfLevels(int n) { if (n != nlevels && n >= 0) { nlevels = n; doRepaint(); } } /** Get the the number of possible levels */ public int getNumberOfLevels() { return nlevels; } /** quietly changes the level without notify listeners */ public void setZoomLevel(int il) { if (il < 0) { il = 0; // weird } else if (il >= nlevels) { il = nlevels - 1; // weird } if (ilevel != il && il < nlevels) { ilevel = il; // YXXX this might cause lack of paints doRepaint(); } } /** sets the current level and notifies listeners */ private void setCurrentLevel(int il) { setZoomLevel(il); notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.SET_LEVEL, ilevel)); } /** sets the current level and notifies listeners */ private void setNotifyPlus() { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.LEVEL_PLUS, 0)); } /** sets the current level and notifies listeners */ private void setNotifyMinus() { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.LEVEL_MINUS, 0)); } /** Notify listeners of a revert event */ private void undo() { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.UNDO, 0)); } private void redo() { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.REDO, 0)); } /** Notify listeners of a pan event */ private void pan(int idir) { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.PAN, idir)); } /** Notify listeners of a rest event */ private void reset() { notifyListeners(new ZoomRulerEvent(ZoomRulerEvent.RESET, 0)); } /** Notify listeners of a ZoomRulerEvent */ private void notifyListeners(ZoomRulerEvent event) { for (ZoomRulerListener listener : listeners) { listener.zoomChanged(event); } } private boolean isInComponent(int x, int y) { if (x > xoff && x < xoff + getWidth() && y > yoff && y < yoff + getHeight()) { return true; } else { return false; } } private class TimelineMouseAdapter extends MouseAdapter { private Timer autoScrollTimer; private final int AUTO_PLUS_MINUS_REPEAT_TIME = 120; // ms between repeats private final int AUTO_PLUS_MINUS_REPEAT_INITIAL = 360; // ms before first repeat private int clickType = ZoomRulerEvent.UNKNOWN; public TimelineMouseAdapter() { if (autoRepeat) { autoScrollTimer = new Timer( AUTO_PLUS_MINUS_REPEAT_TIME, new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (clickType == ZoomRulerEvent.LEVEL_MINUS) { setNotifyMinus(); } else if (clickType == ZoomRulerEvent.LEVEL_PLUS) { setNotifyPlus(); } else { int ii = 1; // weird autoScrollTimer.stop(); } } }); autoScrollTimer.setInitialDelay(AUTO_PLUS_MINUS_REPEAT_INITIAL); autoScrollTimer.setRepeats(true); } } public void mousePressed(MouseEvent event) { int button = event.getButton(); recent_mouse_button = button; if (button != event.BUTTON1) { return; } if (!active) return; int x = event.getX(); int y = event.getY(); clickType = getClickType(x, y); if (clickType == ZoomRulerEvent.LEVEL_MINUS || clickType == ZoomRulerEvent.LEVEL_PLUS) { if (autoScrollTimer != null && !autoScrollTimer.isRunning()) { autoScrollTimer.start(); } } } public void mouseReleased(MouseEvent event) { recent_mouse_button = -1; int button = event.getButton(); if (button != event.BUTTON1) { return; } if (autoScrollTimer != null) { autoScrollTimer.stop(); } if (!active && !dragging) return; int x = event.getX(); int y = event.getY(); // clickType<0 if (dragging) { processDrag(x, y); setCurrentLevel(ilevel); // notifies listeners dragging = false; return; } int releaseClickType = getClickType(x, y); if (releaseClickType >= 0) { if (releaseClickType != clickType) { // mouse drifted across buttons, do nothing return; } switch (releaseClickType) { case ZoomRulerEvent.LEVEL_MINUS: setNotifyMinus(); break; case ZoomRulerEvent.LEVEL_PLUS: setNotifyPlus(); break; case ZoomRulerEvent.PAN_RIGHT: case ZoomRulerEvent.PAN_LEFT: case ZoomRulerEvent.PAN_UP: case ZoomRulerEvent.PAN_DOWN: pan(releaseClickType); break; case ZoomRulerEvent.REDO: case ZoomRulerEvent.UNDO: undo(); break; case ZoomRulerEvent.RESET: reset(); break; case ZoomRulerEvent.UNKNOWN: default: { int ii = 0; // weird } } return; } else { // negative value int il = (-releaseClickType) - 1; setCurrentLevel(il); } } public void mouseDragged(MouseEvent event) { if (recent_mouse_button != event.BUTTON1) { return; } if (!active) return; if (!hasSlider) return; if (clickType >= 0) return; // initial click was not on ruler int x = event.getX(); int y = event.getY(); /* process if the coordinate is in the boundaries of the overaly */ if (dragging || isInComponent(x, y)) { processDrag(x, y); dragging = true; } } public void mouseMoved(MouseEvent e) {} public void mouseClicked(MouseEvent event) {} } /** Add listeners to the component to handle mouse events in the overlay */ private void initializeMouseListeners() { if (component == null) { return; } TimelineMouseAdapter timelineMouseAdapter = new TimelineMouseAdapter(); component.addMouseWheelListener(timelineMouseAdapter); component.addMouseMotionListener(timelineMouseAdapter); component.addMouseListener(timelineMouseAdapter); } /** Add ZoomRulerListener */ public void addZoomRulerListener(ZoomRulerListener listener) { listeners.add(listener); } /** Draw the Ruler */ public void paintRuler(Graphics g) { if (!isEnabled) { return; } if (component == null) { return; } if (paintBackground) { g.setColor(component.getBackground()); g.fillRect(xoff, yoff, getWidth(), getHeight()); } // Graphics2D g2d = (Graphics2D) g; // RenderingHints rhints = g2d.getRenderingHints(); // boolean antialiasOn = rhints.containsValue(RenderingHints.VALUE_ANTIALIAS_ON); // if(!antialiasOn){ // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_ON); // } paintRuler(g, xoff, yoff); if (PANNING) { paintPanButtons(g, xoff, yoff); } // if(!antialiasOn){ // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_OFF); // } } private void paintPanButtons(Graphics g, final int xstart, final int ystart) { // pan buttons would need work to make them usable final int sz = ANCHOR1_OFFSET_LD; g.setColor(borderColor); g.drawRect(BORDER, 1, ANCHOR_SIZE, ANCHOR_SIZE); g.drawRect(1, BORDER, ANCHOR_SIZE, ANCHOR_SIZE); g.drawRect(BORDER, BORDER, ANCHOR_SIZE, ANCHOR_SIZE); g.drawRect(BORDER + BORDER, BORDER, ANCHOR_SIZE, ANCHOR_SIZE); g.drawRect(BORDER, BORDER + BORDER, ANCHOR_SIZE, ANCHOR_SIZE); // g.fillRect(xstart, ystart, (2 * BORDER + ANCHOR_SIZE), (2 * BORDER + ANCHOR_SIZE)); int ps = revertImg.getIconHeight(); int pb = (sz - ps) / 2; g.setColor(buttonFillColor); g.fillOval(xstart + pb, ystart + pb, ps, ps); g.setColor(borderColor); // g.drawOval(xstart+pb, ystart+pb, ps, ps); int xend = xstart + sz - pb; int yend = ystart + sz - pb; int xmid = xstart + pb + ps / 2; int ymid = ystart + pb + ps / 2; g.drawLine(xstart + pb, ymid, xend, ymid); g.drawLine(xmid, ystart + pb, xmid, yend); int xps[] = new int[3]; int yps[] = new int[3]; xps[0] = xmid; xps[1] = xmid + ARROW_WIDTH; xps[2] = xmid - ARROW_WIDTH; yps[0] = ystart + pb; yps[1] = ystart + pb + ARROW_LENGTH; yps[2] = ystart + pb + ARROW_LENGTH; g.fillPolygon(xps, yps, 3); xps[0] = xmid; xps[1] = xmid + ARROW_WIDTH; xps[2] = xmid - ARROW_WIDTH; yps[0] = yend; yps[1] = yend - ARROW_LENGTH; yps[2] = yend - ARROW_LENGTH; g.fillPolygon(xps, yps, 3); xps[0] = xstart + pb; xps[1] = xstart + pb + ARROW_LENGTH; xps[2] = xstart + pb + ARROW_LENGTH; yps[0] = ymid; yps[1] = ymid + ARROW_WIDTH; yps[2] = ymid - ARROW_WIDTH; g.fillPolygon(xps, yps, 3); xps[0] = xend; xps[1] = xend - ARROW_LENGTH; xps[2] = xend - ARROW_LENGTH; yps[0] = ymid; yps[1] = ymid + ARROW_WIDTH; yps[2] = ymid - ARROW_WIDTH; g.fillPolygon(xps, yps, 3); } private void paintRuler(Graphics g, final int inX, final int inY) { for (int ii = 0; ii < 4; ii++) { if (!useLabelShadow && ii == 2) { continue; } final int xOffset, yOffset; // includes shadow shift // final int xstart, ystart; final Color lineColor; final Color fillColor; final boolean doLabel; final boolean doFill; final boolean doIcons; final boolean doBorder; switch (ii) { case 0: // border shadow doFill = true; doBorder = true; doLabel = false; doIcons = false; lineColor = shadowColor; fillColor = shadowColor; xOffset = inX + 1; yOffset = inY + 1; break; case 1: // border main doFill = true; doBorder = true; doLabel = false; doIcons = true; lineColor = borderColor; fillColor = buttonFillColor; xOffset = inX; yOffset = inY; break; case 2: // label shadow doFill = false; doBorder = false; doLabel = true; doIcons = false; lineColor = labelShadowColor; fillColor = labelShadowColor; xOffset = inX + 1; yOffset = inY + 1; break; case 3: default: // label main doFill = false; doBorder = false; doLabel = true; doIcons = false; lineColor = borderColor; fillColor = buttonFillColor; xOffset = inX; yOffset = inY; break; } // Draw anchors and main bar { final int ix1, iy1; final int ix2, iy2; final int sx, sy, sl, sw; if (orientation == this.HORIZONTAL_ORIENTATION) { ix1 = xOffset + ANCHOR1_OFFSET_LD; iy1 = yOffset + ANCHOR1_OFFSET_SD; ix2 = xOffset + ANCHOR2_OFFSET_LD; iy2 = yOffset + ANCHOR2_OFFSET_SD; sx = ix1 + ANCHOR_SIZE; sy = iy1 + ANCHOR_SIZE / 2 - 2; sw = RULER_LD; sl = RULER_SD; } else { ix1 = xOffset + ANCHOR1_OFFSET_SD; iy1 = yOffset + ANCHOR1_OFFSET_LD; ix2 = xOffset + ANCHOR2_OFFSET_SD; iy2 = yOffset + ANCHOR2_OFFSET_LD; sx = ix1 + ANCHOR_SIZE / 2 - 2; sy = iy1 + ANCHOR_SIZE; sw = RULER_SD; sl = RULER_LD; } if (doFill) { g.setColor(fillColor); myFillRect(g, ix1, iy1, ANCHOR_SIZE, ANCHOR_SIZE); myFillRect(g, ix2, iy2, ANCHOR_SIZE, ANCHOR_SIZE); if (hasSlider) { myFillRect(g, sx, sy, sw, sl); } } if (doBorder) { g.setColor(lineColor); myDrawRect(g, ix1, iy1, ANCHOR_SIZE, ANCHOR_SIZE); myDrawRect(g, ix2, iy2, ANCHOR_SIZE, ANCHOR_SIZE); if (hasSlider) { myDrawRect(g, sx, sy, sw, sl); } } if (doLabel) { g.setColor(lineColor); if (orientation == this.HORIZONTAL_ORIENTATION) { drawMinusLabel(g, ix1, iy1, ANCHOR_SIZE, ANCHOR_SIZE); drawPlusLabel(g, ix2, iy2, ANCHOR_SIZE, ANCHOR_SIZE); } else { drawPlusLabel(g, ix1, iy1, ANCHOR_SIZE, ANCHOR_SIZE); drawMinusLabel(g, ix2, iy2, ANCHOR_SIZE, ANCHOR_SIZE); } } if (hasSlider && nlevels > 0) { final float wp = pixelsPerLevel(); final int ix, iy, length, width; if (orientation == HORIZONTAL_ORIENTATION) { iy = iy1 + ANCHOR_SIZE / 2 - MARKER_SD / 2; ix = sx + Math.round(wp * ilevel); length = MARKER_LD; width = MARKER_SD; } else { iy = sy + Math.round(wp * (nlevels - 1 - ilevel)); ix = ix1 + ANCHOR_SIZE / 2 - MARKER_SD / 2; width = MARKER_LD; length = MARKER_SD; } if (doFill) { g.setColor(fillColor); myFillRect(g, ix, iy, length, width); } if (doBorder) { g.setColor(lineColor); myDrawRect(g, ix, iy, length, width); } } } if (resetable1d || resetable2d) { final int resetX, resetY; if (orientation == this.HORIZONTAL_ORIENTATION) { resetX = xOffset + RESET_OFFSET_LD; resetY = yOffset + RESET_OFFSET_SD; } else { resetX = xOffset + RESET_OFFSET_SD; resetY = yOffset + RESET_OFFSET_LD; } if (resetable1d) { if (doFill) { g.setColor(fillColor); myFillRect(g, resetX, resetY, ANCHOR_SIZE, ANCHOR_SIZE); } if (doBorder) { g.setColor(lineColor); myDrawRect(g, resetX, resetY, ANCHOR_SIZE, ANCHOR_SIZE); } if (doLabel) { g.setColor(lineColor); drawResetLeftLabel(g, resetX, resetY, ANCHOR_SIZE, ANCHOR_SIZE); } } else if (resetable2d) { if (doIcons) { final int rx, ry; if (orientation == HORIZONTAL_ORIENTATION) { int offset = (ANCHOR_SIZE - resetImg.getIconWidth()) / 2; rx = resetX + BORDER; ry = resetY + offset + BORDER; } else { int offset = (ANCHOR_SIZE - resetImg.getIconHeight()) / 2; rx = resetX + offset + BORDER; ry = resetY + BORDER; } g.drawImage(resetImg.getImage(), rx, ry, null); } } } if (revertable) { if (doIcons) { final int rx, ry; if (orientation == HORIZONTAL_ORIENTATION) { int iy = (REVERT_OFFSET_SD - revertImg.getIconHeight()) / 2 + 2; rx = xOffset + REVERT_OFFSET_LD; ry = yOffset + iy; } else { int ix = (REVERT_OFFSET_SD - revertImg.getIconWidth()) / 2 + 1; rx = xOffset + ix; ry = yOffset + REVERT_OFFSET_LD; } g.drawImage(revertImg.getImage(), rx, ry, null); } } } } private void myDrawRect(Graphics g, int x1, int y1, int x2, int y2) { if (rectRadius > 1) { g.drawRoundRect(x1, y1, x2, y2, rectRadius, rectRadius); } else { g.drawRect(x1, y1, x2, y2); } } private void myFillRect(Graphics g, int x1, int y1, int w, int h) { if (rectRadius > 1) { g.fillRoundRect(x1, y1, w, h, rectRadius, rectRadius); } else { g.fillRect(x1, y1, w, h); } } private void drawMinusLabel(Graphics g, final int x, final int y, int width, int height) { final int x1 = x + LABEL_BORDER; final int y1 = y + height / 2; final int x2 = x + width - LABEL_BORDER; final int y2 = y1; g.drawLine(x1, y1, x2, y2); } private void drawResetLeftLabel(Graphics g, final int x, final int y, int width, int height) { final int x1 = x + (width - ARROW_LENGTH) / 2; final int yBorder = (height - ARROW_WIDTH * 2) / 2 + 1; final int y1 = y + yBorder; final int x2 = x1; final int y2 = y + width - yBorder; g.drawLine(x1, y1, x2, y2); // triangle: { int xps[] = new int[3]; int yps[] = new int[3]; final int ymid = y + height / 2; final int xstart = x1 + 1; xps[0] = xstart; xps[1] = xstart + ARROW_LENGTH; xps[2] = xstart + ARROW_LENGTH; yps[0] = ymid; yps[1] = ymid + ARROW_WIDTH; yps[2] = ymid - ARROW_WIDTH; g.fillPolygon(xps, yps, 3); } } private void drawPlusLabel(Graphics g, final int x, final int y, int width, int height) { drawMinusLabel(g, x, y, width, height); final int x1 = x + width / 2; final int y1 = y + LABEL_BORDER; final int x2 = x1; final int y2 = y + width - LABEL_BORDER; g.drawLine(x1, y1, x2, y2); } /** Handle a mouse click at (xin, yin) */ // NOTE: this method should not change class state. private int getClickType(final int _mouseX, final int _mouseY) { final int mouseX = _mouseX - 1; final int mouseY = _mouseY - 1; /* create local x and y relative to the Overlay */ if (!active) return ZoomRulerEvent.UNKNOWN; if (!isInComponent(mouseX, mouseY)) return ZoomRulerEvent.UNKNOWN; final int xl, yl; if (orientation == this.VERTICAL_ORIENTATION) { /* the logic is set up for a horizontal orientation, swap the values */ xl = mouseY - yoff; yl = mouseX - xoff; } else { xl = mouseX - xoff; yl = mouseY - yoff; } /* if PANNING is supported, handle it here */ if (nlevels <= 0) return ZoomRulerEvent.UNKNOWN; /* check for click on ZoomOut Anchor */ if (xl >= ANCHOR1_OFFSET_LD && xl <= ANCHOR1_OFFSET_LD + ANCHOR_SIZE && yl >= ANCHOR1_OFFSET_SD && yl <= ANCHOR1_OFFSET_SD + ANCHOR_SIZE) { if (orientation == this.VERTICAL_ORIENTATION) { if (ilevel + 1 < nlevels) { return ZoomRulerEvent.LEVEL_PLUS; } } else { if (ilevel > 0) { return ZoomRulerEvent.LEVEL_MINUS; } } return ZoomRulerEvent.UNKNOWN; } /* check for a click on the ZoomIn Anchor */ if (xl >= ANCHOR2_OFFSET_LD && xl <= ANCHOR2_OFFSET_LD + ANCHOR_SIZE && yl >= ANCHOR2_OFFSET_SD && yl <= ANCHOR2_OFFSET_SD + ANCHOR_SIZE) { if (orientation == this.VERTICAL_ORIENTATION) { if (ilevel > 0) { return ZoomRulerEvent.LEVEL_MINUS; } } else { if (ilevel + 1 < nlevels) { return ZoomRulerEvent.LEVEL_PLUS; } } return ZoomRulerEvent.UNKNOWN; } /* check for a click on the ruler */ if (hasSlider && xl > ANCHOR1_OFFSET_LD + ANCHOR_SIZE && xl < ANCHOR2_OFFSET_LD && yl > ANCHOR1_OFFSET_SD && yl < ANCHOR1_OFFSET_SD + ANCHOR_SIZE) { final int levelValue = getLevel(_mouseX, _mouseY); return -(levelValue + 1); } /* check for a click on the 1d reset button*/ if (resetable1d) { int s1 = RESET_OFFSET_LD; int s2 = RESET_OFFSET_SD; int h = ANCHOR_SIZE; int w = ANCHOR_SIZE; if (xl > s1 && xl < s1 + w && yl > s2 && yl < s2 + h) { return ZoomRulerEvent.RESET; } } /* check for a click on the 2d reset button*/ if (resetable2d) { final int h, w; if (orientation == this.VERTICAL_ORIENTATION) { // reversed w = resetImg.getIconHeight(); h = resetImg.getIconWidth(); } else { h = resetImg.getIconHeight(); w = resetImg.getIconWidth(); } final int s1 = RESET_OFFSET_LD; final int s2 = RESET_OFFSET_SD + (ANCHOR_SIZE - h) / 2; if (xl > s1 && xl < s1 + w && yl > s2 && yl < s2 + h) { return ZoomRulerEvent.RESET; } } /* check for a click on the revert button*/ if (revertable) { final int h, w; if (orientation == this.VERTICAL_ORIENTATION) { // reversed w = revertImg.getIconHeight(); h = revertImg.getIconWidth(); } else { h = revertImg.getIconHeight(); w = revertImg.getIconWidth(); } int s1 = REVERT_OFFSET_LD; final int s2 = RESET_OFFSET_SD + (ANCHOR_SIZE - h) / 2; if (xl > s1 && xl < s1 + w && yl > s2 && yl < s2 + h) { return ZoomRulerEvent.UNDO; } } return ZoomRulerEvent.UNKNOWN; } /** Process a mouse drag at (x, y). */ private void processDrag(final int _mouseX, final int _mouseY) { if (!active && !dragging) return; if (nlevels <= 0) return; if (!hasSlider) return; final int levelValue = getLevel(_mouseX, _mouseY); setZoomLevel(levelValue); } private float pixelsPerLevel() { return (float) (RULER_LD - MARKER_LD) / (nlevels - 1); } private int getLevel(final int _mouseX, final int _mouseY) { final int mouseX = _mouseX - 1; final int mouseY = _mouseY - 1; final int sliderX; if (orientation == this.VERTICAL_ORIENTATION) { /* vertical ruler level decreases as y values increase, so invert * coordiantes on the ruler, if outside the ruler it may be on the * revert button */ int offsetAdjusted = mouseY - yoff; sliderX = (ANCHOR2_OFFSET_LD - MARKER_LD / 2) - offsetAdjusted - 1; } else { int offsetAdjusted = mouseX - xoff; sliderX = offsetAdjusted - (ANCHOR1_OFFSET_LD + ANCHOR_SIZE + MARKER_LD / 2); } /* subtract of pan area */ final float pixels_per_level = pixelsPerLevel(); int levelValue = Math.round(sliderX / pixels_per_level); if (levelValue < 0) { levelValue = 0; } if (levelValue > nlevels - 1) { levelValue = nlevels - 1; } return levelValue; } /** Check if a (x,y) coordinate is with the overlay. */ public boolean withinBounds(int x, int y) { x -= xoff; y -= yoff; int w = getWidth(); if (x < 0 || x > w) { return false; } int h = getHeight(); if (y < 0 || y > h) { return false; } return true; } /** Turn on mouse handling */ public void activateMouseHandling() { active = true; } /** Turn off mouse handling */ public void deactivateMouseHandling() { active = false; } /** Set the component that the overlay is drawn on */ public void setComponent(JComponent component) { this.component = component; initializeMouseListeners(); } /** Determine if a mouse drag is occuring */ public boolean isDragging() { return dragging; } /** Return dimensions of the overlay */ public static int getDefaultDimension() { return TOTAL_SD; } /** Set the offset at which to draw the overlay */ public void setOffsets(int x, int y) { if (this.xoff != x || this.yoff != y) { this.xoff = x; this.yoff = y; doRepaint(); } } /* * Set the boolean to indicate wether to paint a solid background or let the * underlying image show through */ public void setPaintBackground(boolean pb) { this.paintBackground = pb; } public void show(boolean show) { if (isEnabled != show) { isEnabled = show; dragging = false; active = isEnabled; // YXXX not sure if this is right doRepaint(); } } private void doRepaint() { if (component != null) { component.repaint(); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/ZoomRulerListener.java������������������������������0000644�0001750�0001750�00000001436�14744453367�023276� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; public interface ZoomRulerListener { public void zoomChanged(ZoomRulerEvent event); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/ZoomRulerComponent.java�����������������������������0000644�0001750�0001750�00000004215�14744453367�023451� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; import java.awt.Dimension; import java.awt.Graphics; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.swing.JComponent; import javax.swing.JLabel; public class ZoomRulerComponent extends JComponent implements Accessible { private JLabel accessibleHelper = new JLabel(); private ZoomRulerOverlay overlay; public ZoomRulerComponent( int orientation, int slide_length, boolean resetable1d, boolean revertable, boolean autoRepeat) { super(); overlay = new ZoomRulerOverlay( this, 0, 0, orientation, slide_length, resetable1d, false, revertable, autoRepeat); Dimension d; d = new Dimension(overlay.getWidth() + 1, overlay.getHeight() + 1); super.setMinimumSize(d); super.setMaximumSize(d); super.setPreferredSize(d); } public void setNumberOfLevels(int n) { overlay.setNumberOfLevels(n); } public void addZoomRulerListener(ZoomRulerListener listener) { overlay.activateMouseHandling(); overlay.addZoomRulerListener(listener); } @Override public void setEnabled(boolean enable) { overlay.show(enable); } public void setZoomLevel(int il) { overlay.setZoomLevel(il); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); overlay.paintRuler(g); } @Override public AccessibleContext getAccessibleContext() { return accessibleHelper.getAccessibleContext(); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/util/zoomruler/ZoomRulerEvent.java���������������������������������0000644�0001750�0001750�00000005577�14744453367�022604� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.util.zoomruler; /** * A an event the was triggered from the ZoomRuler. The types of possible events include - set level * - The zoom level changes to a specific level revert - The zoom level changes back to the prevous * level pan - A pan up, down, left, or right is requested reset - Zoom all the way out to the * initial level. */ public class ZoomRulerEvent { private int arg; private int type; // Identifiers for click locations // NOTE: negative numbers reserved for indicating the level selected: public static final int SET_LEVEL = 11; public static final int UNDO = 12; public static final int PAN = 13; public static final int LEVEL_PLUS = 14; public static final int LEVEL_MINUS = 15; public static final int REDO = 16; public static final int PAN_UP = 0; public static final int PAN_RIGHT = 1; public static final int PAN_DOWN = 2; public static final int PAN_LEFT = 3; public static final int RESET = 4; public static final int UNKNOWN = Integer.MAX_VALUE; /** Create a new event with the specified type and one argument. */ public ZoomRulerEvent(int type, int arg) { this.type = type; this.arg = arg; } /** Get the specifies the zoom level for SET_LEVEL events */ // XXXmpview need error handling public int getZoomLevel() { return arg; } /** Get direction for pan events */ // XXXmpview need error handling public int getDirection() { return arg; } /** Return true if this is a revert event. */ public boolean isUndo() { return (type == UNDO); } /** Return true if this is a revert event. */ public boolean isRedo() { return (type == REDO); } /** Return true if this is a Zoom Level Change event. */ public boolean isLevelChange() { return (type == SET_LEVEL); } /** Return true if this is a Zoom Plus click */ public boolean isLevelPlus() { return (type == LEVEL_PLUS); } /** Return true if this is a Zoom Minus click */ public boolean isLevelMinus() { return (type == LEVEL_MINUS); } /** Return true if this is a pan event. */ public boolean isPan() { return (type == PAN); } /** Return true if this is a reset event. */ public boolean isReset() { return (type == RESET); } } ���������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/FuncListDisp.java��������������������������������������������������0000644�0001750�0001750�00000125534�15044710303�017150� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.AnDisplay.DSP_Functions; import static org.gprofng.mpmt.AnDisplay.DSP_Lines; import static org.gprofng.mpmt.AnDisplay.DSP_PCs; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnTable.SelObjInfo; import org.gprofng.mpmt.export.Export; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.ViewsSetting; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.KeyStroke; import javax.swing.border.LineBorder; public class FuncListDisp extends AnDisplay implements ExportSupport { // public AnHotGap gap; // defined in AnDisplay protected AnTable table; protected long sel_func, sel_src; protected int name_col; protected String[] names; private int[] src_type; private boolean can_comp; private int prevScroll = -1; protected long[] current_ids; protected boolean ignoreSelected = false; protected boolean updateSummary = true; /** Keeps last warning to avoid showing the same warning message many times */ private String lastWarning = null; protected JPanel warningPane; // Constructor public FuncListDisp( final AnWindow window, final int type, final int subtype, final String help_id) { super(window, type, subtype, help_id); sel_func = 0; sel_src = 0; name_col = 0; can_comp = false; current_ids = null; } @Override public void requestFocus() { if (table != null) { table.requestFocus(); } } @Override public JPopupMenu getFilterPopup() { if (table != null) { return table.initPopup(true); } else { return null; } } // Initialize GUI components @Override protected void initComponents() { // System.err.println("XXX In FLD initComponents()"); setLayout(new BorderLayout()); String acName = null; String acDesc = null; JLabel acLabel = null; switch (type) { case AnDisplay.DSP_Functions: acName = AnLocale.getString("Functions"); acDesc = AnLocale.getString("Show function list"); break; case AnDisplay.DSP_Source: acName = AnLocale.getString("Source"); acDesc = AnLocale.getString("Show source for selected function"); break; case AnDisplay.DSP_IO: case AnDisplay.DSP_IOFileDescriptors: case AnDisplay.DSP_IOCallStacks: acName = AnLocale.getString("IOActivity"); acDesc = AnLocale.getString("Show I/O activity for selected application"); break; case AnDisplay.DSP_Heap: acName = AnLocale.getString("HeapActivity"); acDesc = AnLocale.getString("Show Heap activity for selected application"); break; case AnDisplay.DSP_Disassembly: acName = AnLocale.getString("Disasm"); acDesc = AnLocale.getString("Show assembly for selected function"); break; case AnDisplay.DSP_Lines: acName = AnLocale.getString("Hot Lines"); acDesc = AnLocale.getString("Show hot lines"); break; case AnDisplay.DSP_PCs: acName = AnLocale.getString("PC"); acDesc = AnLocale.getString("Show hot PCs"); break; case AnDisplay.DSP_IndexObject: // XXX: This is not a good idea to use subtype, // but we don't have a better API yet. if ((0 <= subtype) && (9 >= subtype)) { switch (subtype) { case 0: // Threads acName = AnLocale.getString("Threads"); acDesc = acName; break; case 1: // CPUs acName = AnLocale.getString("CPUs"); acDesc = acName; break; case 2: // Samples acName = AnLocale.getString("Samples"); acDesc = acName; break; case 3: // Seconds acName = AnLocale.getString("Seconds"); acDesc = acName; break; case 4: // Processes acName = AnLocale.getString("Processes"); acDesc = acName; break; case 5: // ExperimentIDs acName = AnLocale.getString("ExperimentIDs"); acDesc = acName; break; case 6: // Data Size acName = AnLocale.getString("Data Size"); acDesc = acName; break; case 7: // Duration acName = AnLocale.getString("Duration"); acDesc = acName; break; case 8: // OpenMP Parallel Region acName = AnLocale.getString("OpenMP Parallel Region"); acDesc = acName; break; case 9: // OpenMP Tasks acName = AnLocale.getString("OpenMP Tasks"); acDesc = acName; break; } } break; } if (acName != null) { acLabel = new JLabel(acName, JLabel.RIGHT); } table = new AnTable(type, true, true, can_sort, false, true, true, true, acName, acDesc, acLabel); table.setParent(this); if (acLabel != null) { acLabel.setVisible(false); acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); } table.addAnListener(new TableHandler()); add(table, BorderLayout.CENTER); // if (type == DSP_DataLayout) { // HotGapPanel hotGapPanel = createHotGapPanel(); // table.setHotGapPanel(hotGapPanel); // add(hotGapPanel, BorderLayout.EAST); // } switch (type) { case AnDisplay.DSP_Source: warningPane = new JPanel(); warningPane.setVisible(false); warningPane.setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR)); add(warningPane, BorderLayout.SOUTH); break; } } private static JPanel toolbarPanel = null; // Fixup: XXXX ugly design public void updateToolBar() { if (type != AnDisplay.DSP_Functions) { return; } if (backForwardControls == null) { backForwardControls = new BackForwardControls(); } backForwardControls.updateToolBarStatus(); FuncListDisp.getToolbarPanelInternal().removeAll(); FuncListDisp.getToolbarPanelInternal().add(backForwardControls, BorderLayout.CENTER); FuncListDisp.getToolbarPanelInternal().repaint(); } protected BackForwardControls backForwardControls = null; protected JPanel backForwardControlsPanel = null; public static JPanel getToolbarPanelInternal() { if (toolbarPanel == null) { toolbarPanel = new JPanel(); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); toolbarPanel.setLayout(new BorderLayout()); } return toolbarPanel; } @Override public JPanel getToolbarPanel() { return getToolbarPanelInternal(); } /** * @return the settings */ public Settings getSettings() { return AnWindow.getInstance().getSettings(); } protected class BackForwardControls extends JPanel { protected AnIconButton backButton; protected AnIconButton forwardButton; public BackForwardControls() { setOpaque(false); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; // Back button gridBagConstraints = new GridBagConstraints(); backButton = new AnIconButton(AnUtility.goBackwardIcon); backButton.setMargin(new Insets(2, 0, 2, 2)); backButton.setToolTipText( AnLocale.getString("Back") + AnUtility.keyStrokeToStringFormatted(KeyboardShortcuts.backwardActionShortcut)); backButton.setEnabled(true); backButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Hook it up to back action; table.goBack(); } }); // Backward KeyStroke keyStrokeBackward = KeyboardShortcuts.backwardActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeBackward, keyStrokeBackward); getActionMap() .put( keyStrokeBackward, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { backButton.doClick(); } }); add(backButton, gridBagConstraints); // Back button gridBagConstraints = new GridBagConstraints(); forwardButton = new AnIconButton(AnUtility.goForwardIcon); forwardButton.setMargin(new Insets(2, 4, 2, 4)); forwardButton.setToolTipText( AnLocale.getString("Forward") + AnUtility.keyStrokeToStringFormatted(KeyboardShortcuts.forwardActionShortcut)); forwardButton.setEnabled(true); forwardButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Hook it up to forward action; table.goForward(); } }); // Forward KeyStroke keyStrokeForward = KeyboardShortcuts.forwardActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStrokeForward, keyStrokeForward); getActionMap() .put( keyStrokeForward, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { forwardButton.doClick(); } }); add(forwardButton, gridBagConstraints); } public void updateToolBarStatus() { if (backButton != null) { backButton.setEnabled(table.canGoBack()); } if (forwardButton != null) { forwardButton.setEnabled(table.canGoForward()); } } } public void tryAddNewObj(int row) { // add new obj to history if it's different from current if (table.getNavigationHistoryPool().getHistory().enabled && table.getType() == AnDisplay.DSP_Functions) { SelObjInfo cur_so = table.getNavigationHistoryPool().getHistory().getCurrent(); if (cur_so == null || cur_so.lineno != row) { SelObjInfo new_so = new SelObjInfo(0, row, ""); table.getNavigationHistoryPool().getHistory().goToNew(new_so); } else { table.getNavigationHistoryPool().getHistory().newAdded = false; } } } // Clear display @Override public void clear() { if (table != null) { table.removeAll(); } } /** Copy all lines to the system clipboard */ protected void copyAll() { String text = exportAsText(null, ExportFormat.TEXT, null); AnUtility.copyToClipboard(text); } /** Copy selected lines to the system clipboard */ protected void copySelected() { String sortedby = AnLocale.getString("sorted by metric:"); String textImage = table.printTableHeader(sortedby, MaximumValues); int printLimit = 0; textImage += table.printSelectedTableContents(MaximumValues, printLimit); AnUtility.copyToClipboard(textImage); } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String sortedby = AnLocale.getString("sorted by metric:"); String textImage = ""; if (format == ExportFormat.TEXT) { textImage = table.printTableHeader(sortedby, MaximumValues); if (null == MaximumValues) { return textImage; // empty report } int printLimit = limit != null ? limit : 0; textImage += table.printTableContents(MaximumValues, printLimit); } else if (format == ExportFormat.CSV || format == ExportFormat.HTML) { // FIXUP: code shold be moved form gp-display-text to GUI AnUtility.checkIPCOnWrongThread(false); Export.setLimit(limit); Export.setFormat(format, delimiter); String fake_printer = "-"; textImage = Export.printData(type, subtype, fake_printer, null); // IPC call AnUtility.checkIPCOnWrongThread(true); } return textImage; } // Get new selected func index & compare to the old one // Note: must be called from doCompute protected final long getFuncObj() { final long func_obj; final long src_obj; // System.err.println("XXX In FLD getFuncObj()"); // need Total/Maximum from func-list data window .getFunctionsView() .computeIfNeeded(); // on worker thread and synchronized (AnVariable.mainFlowLock) func_obj = window.getSelectedObject().getSelObj(DSP_Functions, 0); if (sel_func != func_obj) { computed = false; if (type == DSP_Source) { src_obj = window.getSelectedObject().getSelObj(DSP_SourceSelectedObject, 0); if (src_obj != sel_src) { sel_src = src_obj; } } } else if (type != DSP_Source) { computed = false; } else { src_obj = window.getSelectedObject().getSelObj(DSP_SourceSelectedObject, 0); if (src_obj != sel_src) { computed = false; sel_src = src_obj; } } return func_obj; } private String getTabName() { List<ViewsSetting.View> indx_tablist = AnWindow.getInstance().getSettings().getViewsSetting().getIndexViews(); if (type == AnDisplay.DSP_IndexObject && subtype < indx_tablist.size()) { AnWindow.AnDispTab adt = indx_tablist.get(subtype).getAnDispTab(); return adt.getTCmd(); } return ""; // NO18N } protected int getMetricMType() { if (isOmpInxObj()) { return AnDisplay.DSP_Functions; // FIXUP: this is UGLY!!!!!!!!!!! } else { return type; } } protected boolean isOmpInxObj() { if (type == AnDisplay.DSP_IndexObject) { String cmd = getTabName(); if (cmd.equalsIgnoreCase("OMP_preg") // NO18N || cmd.equalsIgnoreCase("OMP_task")) { // NO18N return true; } } return false; } // Compute & update function list table @Override public void doCompute() { final long sel_obj; int new_ind = -1; boolean reset_new_ind = false; final int sort_ind; final Object[] raw_data; final String pwarnstr; final MetricLabel[] label; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected && !ignoreSelected) { return; } if (inCompute) { // NM TEMPORARY should be synchronized return; } else { inCompute = true; } // System.err.println("XXX In FLD doCompute - 1 ()"); // window.setBusyCursor(true); if (can_comp) { // System.err.println("XXX In FLD doCompute - 2 ()"); sel_obj = window.getSelectedObject().getSelObj(DSP_Lines, 0); sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) can_comp = false; computed = false; } else { // System.err.println("XXX In FLD doCompute - 3 ()"); sel_obj = window.getSelectedObject().getSelObj(type, subtype); if (can_sort) { // Function/LINE/PC sel_func = sel_obj; } else { // Annotated src/dis sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } } // Special code for Index tabs and for OpenMP tabs int typeForPresentation = type; String typeStr = "INDEXOBJ"; String subtypeStr = "" + subtype; String modeStr = "ALL"; String mlistStr = "MET_INDX"; if (isOmpInxObj()) { mlistStr = "MET_NORMAL"; typeForPresentation = AnDisplay.DSP_Functions; } if (!computed) { // need re-compute // System.err.println("XXX In FLD doCompute - 4 ()"); reset(); // window.setBusyCursor(true); Object[] res = setFuncData(sel_func, type, subtype); new_ind = (int) ((long[]) (res[0]))[0]; String errstr = ((String[]) (res[1]))[0]; // Update table if (errstr == null) { // System.err.println("XXX In FLD doCompute - 5 ()"); switch (type) { case AnDisplay.DSP_Source: updateWarningPanel(); break; default: String warning = window.getMsg(AnUtility.WARNING_MSG); if (null != warning) { if (!(warning.equalsIgnoreCase(lastWarning))) { lastWarning = warning; showWarning(lastWarning); } } break; } table.setViewport(); Object[][] table_data; int raw_data_length = -1; final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(typeForPresentation); final IPCResult ipcr_getNames = SendRequest_getNames(typeForPresentation, 0); // ASYNC IPC if (type == AnDisplay.DSP_IndexObject) { // Use new API Object[] raw_data_with_ids = window.getTableDataV2(mlistStr, modeStr, typeStr, subtypeStr, null); table_data = localProcessData(mlist, raw_data_with_ids); src_type = null; } else { // Use old API new_ind = -1; // reset new_ind for old API raw_data = getFuncList(type, subtype); if (raw_data != null && raw_data.length > 0) { raw_data_length = raw_data.length; table_data = localProcessData(mlist, raw_data); // first index is for column, second index is for rows: src_type = (int[]) raw_data[raw_data.length - 1]; // AT_SRC, DIS, QUOTE, etc. } else { // Should never happen but it does sometimes if you quickly select/deselect metrics in // overview // Changdao? String txt = "IPC ERROR (?) in FuncListDisp: raw_data is null or empty"; AnLog.log(txt); if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } String[] hdrContent = ipcr_getNames.getStrings(); // To exclude the reply from the queue inCompute = false; return; } } // String[] hdrContent = getNames(typeForPresentation, 0); // name column table header // contents (?) // SYNC IPC String[] hdrContent = ipcr_getNames.getStrings(); label = getSettings().getMetricsSetting() .getLabel(table_data, null, typeForPresentation, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(getMetricMType()); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(typeForPresentation); new_ind = (new_ind == -1) ? 0 : new_ind; if (!(window.getSelectedObject().wasASelDone())) { if ((new_ind < 1) && (raw_data_length > 1)) { // Change selected object to first function reset_new_ind = true; new_ind = 1; } } table.setData(label, table_data, hdrContent, src_type, new_ind, name_col, sort_ind); if (table.getTable().getColumnCount() == 1) { // Show "No Metrics Selected" instaed of only name column in table for certain views if (MetricsSetting.dtype2mtype(type) == MetricsSetting.MET_DATA) { table.showMessage(new NoMetricsSelectedPanel(type)); inCompute = false; return; } } if ((sel_func == 0) || (reset_new_ind)) { window.getSelectedObject().setSelObj(new_ind, typeForPresentation, subtype); // SYNC IPC } } else { // System.err.println("XXX In FLD doCompute - 6 ()"); window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); table.showMessage(errstr); } } // Update selected row if (!reset_new_ind) { new_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); // SYNC IPC } if (new_ind == -1) { new_ind = table.getSelectedRow(); if (type == AnDisplay.DSP_Functions) { tryAddNewObj(new_ind); } table.showSelectedRow(); window.getSelectedObject().setSelObj(new_ind, type, subtype); // SYNC IPC sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } else { if (type == AnDisplay.DSP_Functions) { tryAddNewObj(new_ind); } table.setSelectedRow(new_ind); } // scroll to previous location after re-sort if (prevScroll > 0) { table.setScroll(prevScroll); prevScroll = -1; } updateGap(); // Update summary display if (updateSummary) { updateSummary(new_ind); } // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // SYNC IPC // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } FuncListDisp.getToolbarPanelInternal().removeAll(); if (type == AnDisplay.DSP_Functions && window.getViews().getCurrentViewDisplay() == this) { // FIXUP: REARCH // Set toolbar and select subviews updateToolBar(); window .getCalledByCallsFunctionsView() .doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } computed = true; ignoreSelected = false; updateSummary = true; if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } inCompute = false; } // show warning panel public void updateWarningPanel() { String warning = window.getMsg(AnUtility.WARNING_MSG); if (null != warning) { if (!(warning.equalsIgnoreCase(lastWarning))) { warningPane.removeAll(); lastWarning = warning; String temp[] = lastWarning.split("[`']"); String text = " "; for (int i = 0; i < temp.length; i += 2) { String temp2[] = temp[i].split("[ ]"); for (int j = 0; j < temp2.length; j++) { if (!temp2[j].startsWith("Warning") && temp2[j].length() > 0) { text = text + temp2[j].replaceAll("[ ]", "") + " "; } } } JLabel lb = new JLabel(text, JLabel.LEFT); Font newLabelFont = new Font(lb.getFont().getName(), Font.PLAIN, lb.getFont().getSize()); warningPane.setLayout(new BorderLayout()); JLabel wlb = new JLabel(AnLocale.getString(" Warning:"), JLabel.LEFT); // I18N lb.setFont(newLabelFont); JLabel ilb = new JLabel(AnUtility.warningIcon, JLabel.LEFT); JPanel msgPanel = new JPanel(); msgPanel.setOpaque(false); msgPanel.setLayout(new BoxLayout(msgPanel, BoxLayout.X_AXIS)); msgPanel.add(ilb); msgPanel.add(wlb); msgPanel.add(lb); warningPane.add(msgPanel, BorderLayout.WEST); warningPane.setToolTipText(lastWarning); JPanel panel = new JPanel(); panel.setOpaque(false); JButton btn = new JButton(AnUtility.removeFocusedIcon); Dimension dm = new Dimension( AnUtility.removeFocusedIcon.getIconWidth() + 1, AnUtility.removeFocusedIcon.getIconHeight() + 1); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setPreferredSize(dm); btn.setMaximumSize(dm); btn.setPreferredSize(dm); btn.setMargin(new Insets(0, 0, 0, 0)); btn.setSize(dm); panel.add(btn); btn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { warningPane.setVisible(false); } }); warningPane.add(panel, BorderLayout.EAST); warningPane.setBackground(AnVariable.WARNINGPANEL_COLOR); // showWarning(lastWarning); warningPane.setVisible(true); } } else { warningPane.setVisible(false); } } // Set current func/load-object in 'selected func' & summary display private void updateSummary(final int new_ind) { // sel_func = can_sort ? new_ind : getFuncObj(); // window.updateSummary(new_ind, type, subtype); int[] rows = null; if (table != null) { rows = table.getSelectedRows(); } if (rows != null && rows.length > 1) { window.getSelectionManager().updateSelection(rows, type, subtype, 1); } else { window.getSelectionManager().updateSelection(new_ind, type, subtype, 1); } } // Update gap panel protected final void updateGap() { if (gap != null) { gap.update(); } } @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, boolean caseSensitive) { int find_row; if ((str == null) && (type != DSP_Source) && (type != DSP_Disassembly) && (type != DSP_DualSource) && (type != DSP_DataLayout)) { return -1; } find_row = table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = table.findBefore(str, next, caseSensitive); } // Update summary display if (find_row != -1) { goToLine(table, find_row); } return find_row; } public void goToLine(final AnTable tbl, final int row) { final boolean can_nav; if (can_sort) { can_nav = true; } else { int stype = tbl.getSrcType(row); can_nav = (stype == AnTable.AT_SRC) || (stype == AnTable.AT_DIS) || (stype == AnTable.AT_QUOTE); } tbl.setSelectedRow(row); // Set selected object & Update summary display if (can_nav) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { window.getSelectedObject().setSelObj(row, type, subtype); if (type == AnDisplay.DSP_Functions) { if (tbl.getNavigationHistoryPool() != null) { tbl.getNavigationHistoryPool().getHistory().goToFuncNew(row); updateToolBar(); } window.getCalledByCallsFunctionsView().setComputed(false); window.getCalledByCallsFunctionsView().computeOnAWorkerThread(); } updateSummary(row); } }, "funcdisplist selection"); } } // Is current selected tab? public void setSelected(final boolean set) { selected = set; if (type == AnDisplay.DSP_Functions) { window.getCalledByCallsFunctionsView().setSelected(set); } } // Sort public void sort(final int index) { if (table != null) { table.sort(index); } } protected Object[][] MaximumValues = null; int totalColumn = -1; protected Object[][] localProcessData(final AnMetric[] mlist, final Object[] raw_data) { final Object[][] data = get_data(mlist, raw_data); if (data == null) { return null; } if ((raw_data.length > mlist.length) && (raw_data[mlist.length] != null) && (raw_data[mlist.length] instanceof long[])) { current_ids = (long[]) raw_data[mlist.length]; // per-row HistItem->obj->id } // XXXX (Mez) Neew to remove MaximumValues from FuncListDisp MaximumValues = AnObject.updateMaxValues(data, MaximumValues); return data; } protected Object[][] get_data(final AnMetric[] mlist, final Object[] raw_data) { // raw_data has one vector for each column of metric values. // In addition, it has a vector of dbe row identifiers (HistItem->obj->id) if ((raw_data == null) || (mlist == null) || (mlist.length == 0) || (mlist.length > raw_data.length)) { return null; } // "Bugs 16624403 and 19539622" (leave this string intact for searches) // look for the row that has name==<Total> int row_with_Total = -1; for (int i = 0; i < mlist.length; i++) { AnMetric m = mlist[i]; if (!m.isNameMetric()) { continue; } Object[] d = (Object[]) raw_data[i]; for (int j = 0; j < d.length; j++) { if (d[j].toString().equals("<Total>")) { // FOUND IT!!! row_with_Total = j; break; } } break; } final Object[][] data = new Object[mlist.length][]; for (int i = 0; i < mlist.length; i++) { AnMetric m = mlist[i]; switch (m.get_valtype()) { case AnMetric.VT_LLONG: case AnMetric.VT_ULLONG: if (raw_data[i] instanceof long[]) { data[i] = AnLong.toArray((long[]) raw_data[i]); } else { data[i] = AnDouble.toArray((double[]) raw_data[i]); } break; case AnMetric.VT_ADDRESS: if (raw_data[i] instanceof long[]) { data[i] = AnAddress.toArray((long[]) raw_data[i]); } else { data[i] = AnDouble.toArray((double[]) raw_data[i]); } break; case AnMetric.VT_DOUBLE: data[i] = AnDouble.toArray((double[]) raw_data[i]); break; case AnMetric.VT_LABEL: data[i] = (Object[]) raw_data[i]; break; default: System.err.println( String.format( "Error in localProcessData: unrecognized get_valtype(): %d", m.get_valtype())); data[i] = (Object[]) raw_data[i]; break; } CompareMode mode = m.getCompareMode(); if (mode == CompareMode.CMP_DELTA) { switch (m.get_valtype()) { case AnMetric.VT_LLONG: // EUGENE why not also other types like VT_INT? case AnMetric.VT_ULLONG: case AnMetric.VT_ADDRESS: case AnMetric.VT_DOUBLE: Object[] row = data[i]; for (int j = 0, jsz = (row == null) ? 0 : row.length; j < jsz; j++) { ((AnObject) row[j]).showSign(true); } break; } } if (mode == CompareMode.CMP_RATIO) { switch (m.get_valtype()) { case AnMetric.VT_LLONG: // EUGENE why not also other types like VT_INT? case AnMetric.VT_ULLONG: case AnMetric.VT_DOUBLE: Object[] row = data[i]; for (int j = 0, jsz = (row == null) ? 0 : row.length; j < jsz; j++) { ((AnObject) row[j]).showXtimes(true); } break; } } // "Bugs 16624403 and 19539622" (leave this string intact for searches) if (m.getUserName().equals("Block Covered %") || m.getUserName().equals("Instr Covered %")) { if (row_with_Total >= 0) { // to blank this item out, set to 0 and set showZero(false) data[i][row_with_Total] = new AnLong((long) 0); ((AnObject) data[i][row_with_Total]).showZero(false); } } } return data; } protected AnObject[] getTotals(int type, int subtype) { AnUtility.checkIPCOnWrongThread(false); Object[] raw_data = dbeGetTotals(type, subtype); AnUtility.checkIPCOnWrongThread(true); if ((raw_data == null) || (raw_data.length != 2)) { return null; } Object[] data = (Object[]) raw_data[1]; AnMetric[] mlist = getSettings().getMetricList((Object[]) raw_data[0]); if ((mlist == null) || (mlist.length == 0) || (mlist.length != data.length)) { return null; } AnObject[] res = new AnObject[mlist.length]; for (int i = 0; i < mlist.length; i++) { AnMetric m = mlist[i]; switch (m.get_valtype()) { case AnMetric.VT_LLONG: case AnMetric.VT_ULLONG: res[i] = new AnLong(((long[]) data[i])[0]); break; case AnMetric.VT_ADDRESS: res[i] = new AnAddress(((long[]) data[i])[0]); break; case AnMetric.VT_DOUBLE: res[i] = new AnDouble(((double[]) data[i])[0]); break; case AnMetric.VT_LABEL: res[i] = new AnDouble((double) 0); break; default: System.err.println( String.format("Error in getTotals: unrecognized get_valtype(): %d", m.get_valtype())); res[i] = new AnDouble((double) 0); break; } } return res; } /* * Returns MaximumValues (Total and Max values), calculated by processData() */ public Object[] getTotalMax() { return MaximumValues; } // // Create the filter clause based on the selected objects // public String createFilterClause() { // int[] selected_indices = table.selected_indices; // if (isOmpInxObj()) { // Use new API // String clause = ""; // if (selected_indices.length <= 0) { // return clause; // } // String IDs = ""; // for (int i = 0; i < selected_indices.length; i++) { // long id = current_ids[selected_indices[i]]; // IDs = IDs + id; // if (i + 1 < selected_indices.length) { // IDs = IDs + ","; // } // } // clause = "(" + getTabName() + " IN (" + IDs + "))"; // return clause; // } // String clause = composeFilterClause(type, subtype, selected_indices); // return clause; // } // Listener for updating table private final class TableHandler implements AnListener { public void valueChanged(final AnEvent event) { final int from; final int to; int stype = 0; final boolean can_nav; switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting from = event.getValue(); if (can_sort) { can_nav = true; } else { stype = src_type[from]; if (stype < 0) { stype = -stype; } can_nav = (stype == AnTable.AT_SRC) || (stype == AnTable.AT_DIS) || (stype == AnTable.AT_QUOTE); } if ((type == DSP_Source)) { deselectRaceStack(subtype); // FIXUP: REARCH window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } if ((type == DSP_SourceDisassembly) || (type == DSP_Disassembly)) { if (stype == AnTable.AT_DIS) { window.getSourceDisassemblyView().focusInHalf(AnTable.AT_DIS); } else { // SOURCE window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } } // Set selected object & Update summary display if (can_nav) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { window.getSelectedObject().setSelObj(from, type, subtype); if (type == AnDisplay.DSP_Functions) { window.getCalledByCallsFunctionsView().setComputed(false); window.getCalledByCallsFunctionsView().computeOnAWorkerThread(); } updateSummary(from); } }, "funclistdisp selection"); } else // in other cases (eg. AT_SRC_ONLY), just update summary { // updateSummary(from); if (type == AnDisplay.DSP_Functions) { window.getCalledByCallsFunctionsView().setComputed(false); window.getCalledByCallsFunctionsView().computeOnAWorkerThread(); } updateSummary(from); } break; case AnEvent.EVT_SORT: // Sorting // save current scroll location prevScroll = table.getScroll(); getSettings() .getMetricsSetting() .setSortMetricByDType(this, ((Integer) event.getAux()).intValue(), getMetricMType()); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } from = event.getValue(); to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, getMetricMType()); break; } } } protected void deselectRaceStack(int subtype) { // FIXUP: REARCH // System.err.println("The selection is done in Source # " + subtype); if (subtype == 0) { return; } window.getDualSourceView().focusInHalf(subtype); } // Native methods from liber_dbe.so protected Object[] setFuncData(final long sel_func, final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("setFuncDataV2"); window.IPC().send(0); window.IPC().send(sel_func); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } // protected void dbe_archive(final long ids[], final String locations[]) { // synchronized (IPC.lock) { // window.IPC().send("dbe_archive"); // window.IPC().send(ids); // window.IPC().send(locations); // window.IPC().recvVoid(); // } // } // // protected void dbeSetLocations(final String fnames[], final String locations[]) { // synchronized (IPC.lock) { // window.IPC().send("dbeSetLocation"); // window.IPC().send(fnames); // window.IPC().send(locations); // window.IPC().recvVoid(); // } // } // // protected Object[] dbeResolvedWith_setpath(final String path) { // // obj[0] - list of old pathes // // obj[1] - list of new pathes // // obj[2] - list of ids // synchronized (IPC.lock) { // window.IPC().send("dbeResolvedWith_setpath"); // window.IPC().send(path); // return (Object[]) window.IPC().recvObject(); // } // } // // protected Object[] dbeResolvedWith_pathmap(final String old_prefix, final String new_prefix) // { // // obj[0] - list of old pathes // // obj[1] - list of new pathes // // obj[2] - list of ids // synchronized (IPC.lock) { // window.IPC().send("dbeResolvedWith_pathmap"); // window.IPC().send(old_prefix); // window.IPC().send(new_prefix); // return (Object[]) window.IPC().recvObject(); // } // } protected Object[] getFuncList(final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("getFuncList"); window.IPC().send(0); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } protected Object[] dbeGetTotals(int dsptype, int subtype) { synchronized (IPC.lock) { IPC ipc = window.IPC(); ipc.send("dbeGetTotals"); ipc.send(0); ipc.send(dsptype); ipc.send(subtype); return (Object[]) ipc.recvObject(); } } protected Object[] getHotMarks(final int type) { synchronized (IPC.lock) { window.IPC().send("getHotMarks"); window.IPC().send(0); window.IPC().send(type); return (Object[]) window.IPC().recvObject(); } } protected Object[] getHotMarksInc(final int type) { synchronized (IPC.lock) { window.IPC().send("getHotMarksInc"); window.IPC().send(0); window.IPC().send(type); return (Object[]) window.IPC().recvObject(); } } protected String[] getNames(final int type, final long sel_obj) { synchronized (IPC.lock) { window.IPC().send("getNames"); window.IPC().send(0); window.IPC().send(type); window.IPC().send(sel_obj); return (String[]) window.IPC().recvObject(); } } /** * Send request to get Names. Non-blocking IPC call. Caller should call ipcResult.getStrings() to * get the result * * @return IPCResult */ public static IPCResult SendRequest_getNames(final int type, final long sel_obj) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("getNames"); ipcHandle.append(0); ipcHandle.append(type); ipcHandle.append(sel_obj); IPCResult ipcResult = ipcHandle.sendRequest(); // Object[] result = ipcResult.getStrings() // blocking return ipcResult; } protected String composeFilterClause( final int type, final int subtype, final int[] selected_ids) { synchronized (IPC.lock) { window.IPC().send("composeFilterClause"); window.IPC().send(0); window.IPC().send(type); window.IPC().send(subtype); window.IPC().send(selected_ids); return window.IPC().recvString(); } } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); formats.add(ExportFormat.HTML); formats.add(ExportFormat.CSV); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return true; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); if (type == DSP_Functions || type == DSP_Lines || type == DSP_PCs) { list.add(window.getTimelineCallStackSubview()); list.add(window.getIoCallStackSubview()); list.add(window.getHeapCallStackSubview()); } if (type == DSP_Functions) { if (!window.getSettings().getCompareModeSetting().comparingExperiments()) { list.add(window.getCalledByCallsFuncSubview()); } } return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } @Override public void setComputed(boolean set) { super.setComputed(set); if (table != null) { // possible major change to table, so rebuild columns table.columnsSaved = false; } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/guitesting/��������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�016175� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/guitesting/GUITesting.java�����������������������������������������0000644�0001750�0001750�00000011370�14744453367�020761� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.guitesting; import org.gprofng.mpmt.AnWindow; /* * Miscellenuous support for automated GUI testing */ public class GUITesting { private static final String GUI_TESTING_ENVVAR = "SP_ANALYZER_GUI_TESTING"; private static final String GUI_TESTING_EXTRA = "SP_ANALYZER_GUI_TESTING_EXTRA"; private static final String GUI_RUNNING_UNDER_NB = "SP_RUNNING_UNDER_NB"; private static GUITesting instance = null; private boolean enableGUITestingExtra = false; private boolean runningUnderGUITesting = false; private boolean runningUnderNB = false; public GUITesting() { String guiTestingExtra = System.getenv(GUI_TESTING_EXTRA); if (guiTestingExtra == null) { guiTestingExtra = System.getProperty(GUI_TESTING_EXTRA); } enableGUITestingExtra = guiTestingExtra != null; String guiTesting = System.getenv(GUI_TESTING_ENVVAR); if (guiTesting == null) { guiTesting = System.getProperty(GUI_TESTING_ENVVAR); } runningUnderGUITesting = guiTesting != null; String underNB = System.getenv(GUI_RUNNING_UNDER_NB); if (underNB == null) { underNB = System.getProperty(GUI_RUNNING_UNDER_NB); } runningUnderNB = underNB != null; if (enableGUITestingExtra) { System.out.println("GUITesting: SP_ANALYZER_GUI_TESTING_EXTRA: " + enableGUITestingExtra); } if (runningUnderGUITesting) { System.out.println("GUITesting: SP_ANALYZER_GUI_TESTING: " + runningUnderGUITesting); } if (runningUnderNB) { System.out.println("GUITesting: SP_RUNNING_UNDER_NB: " + runningUnderNB); } } public static GUITesting getInstance() { if (instance == null) { instance = new GUITesting(); } return instance; } /** * @return the runningUnderGUITesting */ public boolean isRunningUnderGUITesting() { return runningUnderGUITesting; } /** * @return the runningUnderNB */ public boolean isRunningUnderNB() { return runningUnderNB; } /** * @return the enableGUITestingExtra */ public boolean guiTestingExtraEnabled() { return enableGUITestingExtra; } public String filter(String in) { String out = in; out = out.replaceAll("\\(found as .*\\)", "(found as <FILTERED>)"); out = out.replaceAll("...... file: /.*/", "...... file: <FILTERED>/"); // Source or Object file out = out.replaceAll("Stack 0x.*", "Stack 0x<FILTERED>"); // I/O view out = out.replaceAll("Process Id.*", "Process Id <FILTERED>"); // I/O subview out = out.replaceAll("Time of peak.*", "Time of peak <FILTERED>"); // I/O subview out = out.replaceAll("Total time.*", "Total time <FILTERED>"); // I/O subview // out = out.replaceAll("Heap size bytes.*", "Heap size bytes <FILTERED>"); // I/O // subview // out = out.replaceAll("Total bytes.*", "Total bytes <FILTERED>"); // I/O subview out = out.replaceAll( "Instruction freq.*", "Instruction freq... <FILTERED>"); // instruction Frequency return out; } /** * Dump contents of main view. Used in unit tests. * * @return */ public String dumpMainview() { return dumpMainview(0); } /** * Dump contents of main view. Used in unit tests. * * @param maxLines limit output to top maxLines lines. 0 meaning all lines. * @return */ public String dumpMainview(int maxLines) { AnWindow window = AnWindow.getInstance(); String txt = window.dumpMainview(maxLines); txt = filter(txt); return txt; } /** * Dump contents of all visible sub views. Used in unit tests. * * @return */ public String dumpSubviews() { AnWindow window = AnWindow.getInstance(); String txt = window.dumpSubviews(); txt = filter(txt); return txt; } /** * Dump visibility of main view and sub views. Used in unit tests. * * @return */ public String dumpViewsVisibility() { AnWindow window = AnWindow.getInstance(); return window.dumpViewsVisibility(); } public String dumpAvailableViews() { AnWindow window = AnWindow.getInstance(); String txt = window.getViewsPanel().dumpAvailableViews(); return txt; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AboutPanel.form����������������������������������������������������0000644�0001750�0001750�00000014460�14744453367�016674� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-85,0,0,2,123"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="innerPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="iconLabel"> <Properties> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Image iconType="3" name="/org/gprofng/mpmt/icons/performanceAnalyzerSplash.gif"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="infoScrollPane"> <Properties> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[300, 180]"/> </Property> </Properties> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTextPane" name="infoTextPane"> <Properties> <Property name="editable" type="boolean" value="false"/> </Properties> </Component> </SubComponents> </Container> <Container class="javax.swing.JScrollPane" name="copyrightScrollPane"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTextArea" name="copyrightTextArea"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="columns" type="int" value="20"/> <Property name="lineWrap" type="boolean" value="true"/> <Property name="rows" type="int" value="8"/> <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> <Insets value="[4, 4, 4, 4]"/> </Property> </Properties> </Component> </SubComponents> </Container> </SubComponents> </Container> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ExperimentsView.java�����������������������������������������������0000644�0001750�0001750�00000074724�15044710303�017743� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.util.gui.AnJPanel; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPane; import org.gprofng.mpmt.util.gui.AnTabbedPane; import org.gprofng.mpmt.util.gui.AnTextIcon; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; import java.util.ArrayList; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.event.PopupMenuEvent; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; public final class ExperimentsView extends AnDisplay implements ExportSupport, AnChangeListener { private boolean initialized = false; private AnTree tree; private AnUtility.AnTextArea log; private AnTextIcon[] exp_list; private AnMenuListener menuListener; // Menu actions // final String STR_ACTION_SETFILTER_SEO = AnLocale.getString("Add Filter: Selected Experiments // Only"); 11 // final String STR_ACTION_SETFILTER_ESE = AnLocale.getString("Add Filter: Exclude Selected // Experiments"); 12 // final String STR_ACTION_EXPERIMENTS = AnLocale.getString("Filter Experiments..."); // final String STR_ACTION_SETFILTER_RDF = AnLocale.getString("Remove All Filters"); // private final String STR_ACTION_UNDOFILTER = AnLocale.getString("Undo Last Filter"); // private final String STR_ACTION_MANAGEFILTERS = AnLocale.getString("Manage Filters..."); // Constructor public ExperimentsView() { super(AnWindow.getInstance(), AnDisplay.DSP_Experiments, AnVariable.HELP_TabsExperiments); setAccessibility(AnLocale.getString("Experiments")); AnEventManager.getInstance().addListener(this); } public void initErrorsAndWarnings(String[] errors, String[] warnings) { cleanLog(); // Clean old messages if (errors != null) { appendLog("" + AnLocale.getString("Errors:") + "\n"); for (String msg : errors) { if (msg != null) { appendLog(msg + "\n"); } } appendLog("\n"); } if (warnings != null) { appendLog("" + AnLocale.getString("Warnings:") + "\n"); for (String msg : warnings) { if (msg != null) { appendLog(msg + "\n"); } } appendLog("\n"); } } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("ExperimentsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case FILTER_CHANGING: case FILTER_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: // Nothing break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void requestFocus() { initGUIComponents(); if (tree != null) { tree.requestFocus(); } } /** * Override and return true if text find is supported * * @return */ @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, final boolean caseSensitive) { int selectedIndex = findSelectedIndex(); Object root = tree.getModel().getRoot(); int childCount = tree.getModel().getChildCount(root); DefaultMutableTreeNode foundNode = null; if (next) { if (selectedIndex >= 0 && selectedIndex < childCount - 1) { foundNode = findNode(selectedIndex + 1, childCount - 1, str, caseSensitive); if (foundNode == null) { foundNode = findNode(0, selectedIndex, str, caseSensitive); } } else { foundNode = findNode(0, childCount - 1, str, caseSensitive); } } else if (selectedIndex > 0) { foundNode = findNode(selectedIndex - 1, 0, str, caseSensitive); if (foundNode == null) { foundNode = findNode(childCount - 1, selectedIndex, str, caseSensitive); } } else { foundNode = findNode(childCount - 1, 0, str, caseSensitive); } if (foundNode != null) { TreePath treePath = new TreePath(foundNode.getPath()); tree.scrollPathToVisible(treePath); tree.setSelectionPath(treePath); // tree.expandPath(treePath); return 0; } else { return -1; } } private DefaultMutableTreeNode findNode(int from, int to, String str, boolean caseSensitive) { // System.out.println(from + " " + to); Object root = tree.getModel().getRoot(); DefaultMutableTreeNode foundNode = null; if (from <= to) { for (int i = from; i <= to; i++) { Object child = tree.getModel().getChild(root, i); foundNode = match(child, str, caseSensitive); if (foundNode != null) { break; } } } else { for (int i = from; i >= to; i--) { Object child = tree.getModel().getChild(root, i); foundNode = match(child, str, caseSensitive); if (foundNode != null) { break; } } } return foundNode; } private DefaultMutableTreeNode match(Object child, String str, boolean caseSensitive) { if (child instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) child; Object userObject = node.getUserObject(); if (userObject instanceof AnTextIcon) { AnTextIcon anTextIcon = (AnTextIcon) userObject; if (!caseSensitive && anTextIcon.getText().toLowerCase().contains(str.toLowerCase())) { return node; } else if (anTextIcon.getText().contains(str)) { return node; } } } return null; } private int findSelectedIndex() { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); Object root = tree.getModel().getRoot(); int childCount = tree.getModel().getChildCount(root); for (int i = 0; i < childCount; i++) { Object child = tree.getModel().getChild(root, i); if (child instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) child; if (node == selectedNode) { return i; } } } return -1; } @Override protected void initComponents() {} // @Override private void initGUIComponents() { if (!initialized) { initGUIComponentsInternal(); initialized = true; } } /** Initialize GUI components */ // @Override private void initGUIComponentsInternal() { JLabel treeLabel; JPanel logPanel; setLayout(new BorderLayout()); // Experiment tree area String text = AnLocale.getString("Experiments"); tree = new AnTree(text, 2); tree.getAccessibleContext().setAccessibleName(text); tree.getAccessibleContext().setAccessibleDescription(text); treeLabel = new JLabel(text); treeLabel.setLabelFor(tree); treeLabel.getAccessibleContext().setAccessibleName(text); treeLabel.getAccessibleContext().setAccessibleDescription(text); treeLabel.setVisible(false); JScrollPane treeScrollPane = new AnJScrollPane(tree); treeScrollPane.setBorder( BorderFactory.createMatteBorder(0, 0, 1, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); treeScrollPane.add(treeLabel); // Errors and warnings list area JPanel listPanel = new JPanel(); listPanel.setBackground(Color.WHITE); JScrollPane listScrollPane = new AnJScrollPane(listPanel); // listScrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, // AnEnvironment.SPLIT_PANE_BORDER_COLOR)); // Errors and warnings log area log = new AnUtility.AnTextArea(null, false); log.setBackground(AnEnvironment.DEFAULT_DIALOG_BACKGROUND); AnUtility.setAccessibleContext(log.getAccessibleContext(), AnLocale.getString("Logs")); logPanel = new JPanel(new BorderLayout()); logPanel.add(log, BorderLayout.CENTER); JScrollPane logScrollPane = new AnJScrollPane(logPanel); // logScrollPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, // AnEnvironment.SPLIT_PANE_BORDER_COLOR)); // Errors and warnings tabs JTabbedPane tabbedPane = new AnTabbedPane(); tabbedPane.setBorder( BorderFactory.createMatteBorder( 1, 0, 0, 0, new Color(219, 219, 219))); // AnEnvironment.SPLIT_PANE_BORDER_COLOR)); tabbedPane.add(AnLocale.getString("List"), listScrollPane); tabbedPane.add(AnLocale.getString("Log"), logScrollPane); tabbedPane.setSelectedIndex(1); // FIXUP: justfornow JPanel errorsAndWarningsPanel = new JPanel(new GridBagLayout()); errorsAndWarningsPanel.setBackground(Color.WHITE); errorsAndWarningsPanel.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); GridBagConstraints gridBagConstraints; gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(2, 0, 2, 0); JLabel eawLabel = new JLabel(AnLocale.getString("Errors & Warnings:")); eawLabel.getAccessibleContext().setAccessibleDescription(""); eawLabel.setOpaque(false); errorsAndWarningsPanel.add(eawLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; errorsAndWarningsPanel.add(tabbedPane, gridBagConstraints); // JSplitPane splitPane = new AnSplitPane(JSplitPane.VERTICAL_SPLIT, treeScrollPane, errorsAndWarningsPanel); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(1.0); add(splitPane, BorderLayout.CENTER); // Popup menu menuListener = new AnMenuListener(tree); tree.addMouseListener(menuListener); // this.addMouseListener(menuListener); // Do we need i? // KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; // tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); // tree.getActionMap().put(ks, new AbstractAction() { // public void actionPerformed(ActionEvent ev) { // JPopupMenu popup = menuListener.init_popup(); // if (popup != null) { // JTree src = (JTree) ev.getSource(); // Rectangle cellRect, visRect; // // visRect = src.getVisibleRect(); // cellRect = visRect; // int selrow = src.getMaxSelectionRow(); // if (selrow >= 0) { // cellRect = src.getRowBounds(selrow); // } // // // if current view doesn't include selected row, scroll // if (!visRect.contains(cellRect)) { // // calculate middle based on selected row // // being below or above current visible rows // if (visRect.y < cellRect.y) { // cellRect.y += visRect.height / 2; // } else { // cellRect.y -= visRect.height / 2; // } // src.scrollRectToVisible(cellRect); // } // popup.show(src, cellRect.x, cellRect.y + cellRect.height); // } // } // }); } /** Append added experiments */ private void addExperiment() { exp_list = window.getExperimentList(); if (exp_list == null) { return; } // Add the extra node "Load Objects" if needed & Get the last index int last = tree.addExtra(AnLocale.getString("Load Objects")); // Add experiments into tree tree.addNodes(exp_list, last); } private void cleanLog() { initGUIComponents(); log.setText(""); } public void appendLog(final String text) { initGUIComponents(); log.append(AnUtility.trimNewLine(text) + "\n"); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { final Dimension logSize; final Rectangle endRect; logSize = log.getPreferredSize(); endRect = new Rectangle(0, logSize.height, 1, 1); log.scrollRectToVisible(endRect); } }); } /** Compute & update Experiment display */ @Override public void doCompute() { // System.out.println("ExperimentsView:doCompute: " + selected + " " + computed); AnUtility.checkIfOnAWTThread(false); initGUIComponents(); if (!computed) { addExperiment(); String[] info = window.getExpInfo(); if (info != null) { int nc = (info.length - 1) / 2 + 1; JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2)); panel.add(new AnUtility.AnTextArea(AnUtility.trimNewLine(info[0]), false)); // Load Objects panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); tree.setContent(0, panel); int k = 1; for (int i = 1; i < nc; i++) { panel = new AnTreePanel(info[k++], info[k++], i - 1); panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); tree.setContent(i, panel); } } tree.setSelectionRow(0); computed = true; } } class AnTreePanel extends AnJPanel implements UndoableEditListener, FocusListener, KeyListener, ActionListener { private static final int SAVE_FILE = 0; private static final int DELETE_FILE = 1; public static final int UNDO_LIMIT = 1500; // Setting Undo Limit to 1500 edits private int cnt_edit_actions, cnt_undo_actions; private final int exp_id; private boolean undo_manager_exists = false; public String notesText; public final String info_text; public AnUtility.AnTextArea notes_text_area; private AnUndoManager undoManager; public AnUtility.ResponseAction saveAction, undoAction, redoAction, deleteAction; public AnTreePanel(final String notes_text, final String info_text, final int exp_id) { super(); this.exp_id = exp_id; cnt_edit_actions = cnt_undo_actions = 0; this.notesText = notes_text; this.info_text = info_text; initComponents(); notes_text_area.getDocument().addUndoableEditListener(this); notes_text_area.addFocusListener(this); notes_text_area.addKeyListener(this); // final String[] initMessages; // initMessages = getInitMessages(); // for (int i = 0; i < initMessages.length; i++) { // appendLog(initMessages[i]); // } } private void initComponents() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); final JPanel notesPanel = new JPanel(); notesPanel.setLayout(new javax.swing.BoxLayout(notesPanel, BoxLayout.X_AXIS)); notesPanel.setBorder(new javax.swing.border.EtchedBorder()); final JPanel buttPanel = new JPanel(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 2, 2)); saveAction = new AnUtility.ResponseAction( AnUtility.save_icon, AnLocale.getString("Save notes") + " Ctrl+S", "__save", this); saveAction.setEnabled(false); undoAction = new AnUtility.ResponseAction( AnUtility.undo_icon, AnLocale.getString("Undo") + " Ctrl+Z", "__undo", this); undoAction.setEnabled(false); redoAction = new AnUtility.ResponseAction( AnUtility.redo_icon, AnLocale.getString("Redo") + " Ctrl+Y", "__redo", this); redoAction.setEnabled(false); deleteAction = new AnUtility.ResponseAction( AnUtility.del_icon, AnLocale.getString("Delete notes") + " Ctrl+D", "__delete", this); deleteAction.setEnabled(notesText != null && !notesText.equals("")); buttPanel.add(saveAction); buttPanel.add(undoAction); buttPanel.add(redoAction); buttPanel.add(deleteAction); AnUtility.AnLabel notesLabel = (AnUtility.AnLabel) AnUtility.getHeader(AnLocale.getString("Notes:")); if (notesText == null || notesText.equals("")) { notesText = AnLocale.getString("<Empty>"); } notes_text_area = new AnUtility.AnTextArea(AnUtility.trimNewLine(notesText), true); AnUtility.setAccessibleContext( notes_text_area.getAccessibleContext(), AnLocale.getString("Notes area")); notesLabel.setLabelFor(notes_text_area); notesLabel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(1, 4, 1, 1))); notesLabel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); notesPanel.add(notesLabel); notesPanel.add(buttPanel); add(notesPanel); add(notes_text_area); final JPanel infoPanel = new JPanel(new FlowLayout(java.awt.FlowLayout.LEFT, 2, 2)); infoPanel.setBorder(new EtchedBorder()); final AnUtility.AnLabel infoLabel = (AnUtility.AnLabel) AnUtility.getHeader(AnLocale.getString("Info:")); final AnUtility.AnTextArea infoTextArea = new AnUtility.AnTextArea(AnUtility.trimNewLine(info_text), false); AnUtility.setAccessibleContext( infoTextArea.getAccessibleContext(), AnLocale.getString("Info area")); infoLabel.setLabelFor(infoTextArea); infoLabel.setBorder(new EmptyBorder(new java.awt.Insets(1, 2, 1, 1))); infoPanel.add(infoLabel); add(infoPanel); add(infoTextArea); } // createUndoMananger creating undo manager public void createUndoMananger() { if (undo_manager_exists) { return; } undoManager = new AnUndoManager(); undoManager.setLimit(UNDO_LIMIT); undo_manager_exists = true; } // removeUndoMananger removing undo manager public void removeUndoMananger() { undoManager.end(); cnt_edit_actions = 0; cnt_undo_actions = 0; saveAction.setEnabled(false); undoAction.setEnabled(false); redoAction.setEnabled(false); undo_manager_exists = false; } @Override public void focusGained(final FocusEvent fe) { createUndoMananger(); } @Override public void focusLost(final FocusEvent fe) { // removeUndoMananger(); } // undoableEditHappened called when edit happened @Override public void undoableEditHappened(final UndoableEditEvent e) { // add the edits to the unod manager undoManager.addEdit(e.getEdit()); cnt_edit_actions++; cnt_undo_actions = 0; // no redo acts after editing redoAction.setEnabled(false); saveAction.setEnabled(true); undoAction.setEnabled(true); } @Override public void keyPressed(final KeyEvent e) { createUndoMananger(); if ((e.getKeyCode() == KeyEvent.VK_Z) && (e.isControlDown())) { if (!undoAction.isEnabled()) { return; // Undo changes } try { undoManager.undo(); } catch (CannotUndoException cue) { Toolkit.getDefaultToolkit().beep(); } } if ((e.getKeyCode() == KeyEvent.VK_Y) && (e.isControlDown())) { if (!redoAction.isEnabled()) { return; // Redo changes } try { undoManager.redo(); } catch (CannotRedoException cue) { Toolkit.getDefaultToolkit().beep(); } } if ((e.getKeyCode() == KeyEvent.VK_S) && (e.isControlDown())) { // Save changes if (!saveAction.isEnabled()) { return; } undoManager.save(); } if ((e.getKeyCode() == KeyEvent.VK_D) && (e.isControlDown())) { // Delete notes file if (!deleteAction.isEnabled()) { return; } undoManager.delete(true); } } @Override public void keyReleased(final KeyEvent e) {} @Override public void keyTyped(final KeyEvent e) {} @Override public void actionPerformed(final ActionEvent e) { createUndoMananger(); if (e.getActionCommand().equals("__save")) { undoManager.save(); } else if (e.getActionCommand().equals("__undo")) { try { undoManager.undo(); } catch (CannotUndoException cue) { Toolkit.getDefaultToolkit().beep(); } } else if (e.getActionCommand().equals("__redo")) { try { undoManager.redo(); } catch (CannotRedoException cue) { Toolkit.getDefaultToolkit().beep(); } } else if (e.getActionCommand().equals("__delete")) { undoManager.delete(true); } } public void updateAllExps(final int type) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { DefaultMutableTreeNode root, node; AnTree the_tree; AnTreePanel panel; final String cur_exp; String exp; // final int win_size = window.get_win_size(); cur_exp = new File(exp_list[exp_id].getText()).getAbsolutePath(); // for (int i = 0; i < win_size; i++) { the_tree = window.getExperimentsView().tree; root = ((DefaultMutableTreeNode) the_tree.getModel().getRoot()); final int cnt = root.getChildCount(); for (int k = 1; k < cnt; k++) { node = (DefaultMutableTreeNode) root.getChildAt(k); exp = new File(((AnTextIcon) node.getUserObject()).getText()).getAbsolutePath(); if (cur_exp.equals(exp)) { final DefaultMutableTreeNode nd = (DefaultMutableTreeNode) node.getChildAt(0); panel = (AnTreePanel) nd.getUserObject(); if (!panel.equals(AnTreePanel.this)) { panel.createUndoMananger(); panel.notes_text_area.setText(notesText); updateNotes(panel.exp_id, type, (type == SAVE_FILE) ? notesText : null, false); panel.deleteAction.setEnabled(type == SAVE_FILE); panel.removeUndoMananger(); ((DefaultTreeModel) the_tree.getModel()).nodeChanged(node); } } } } // } }); } private final class AnUndoManager extends UndoManager { @Override public synchronized void undo() throws CannotUndoException { super.undo(); cnt_edit_actions--; cnt_undo_actions++; if (cnt_edit_actions == 0) { saveAction.setEnabled(false); undoAction.setEnabled(false); } else { saveAction.setEnabled(true); } redoAction.setEnabled(true); } // undo @Override public synchronized void redo() throws CannotUndoException { super.redo(); cnt_edit_actions++; cnt_undo_actions--; saveAction.setEnabled(true); undoAction.setEnabled(true); redoAction.setEnabled(cnt_undo_actions != 0); } // redo public synchronized void save() { notesText = notes_text_area.getText(); // delete emty notes files if (notesText.equals("")) { if (delete(deleteAction.isEnabled()) != 0) { // delete if file exists undo_all(); // undo all changes if not confirmed } removeUndoMananger(); return; } final int status = updateNotes(exp_id, SAVE_FILE, AnUtility.addNewLine(notesText), true); if (status != 0) { window.showError(AnLocale.getString("Cannot write notes file")); undo_all(); } else { deleteAction.setEnabled(true); final DefaultMutableTreeNode root; final DefaultMutableTreeNode node; root = ((DefaultMutableTreeNode) tree.getModel().getRoot()); node = (DefaultMutableTreeNode) root.getChildAt(exp_id + 1); ((DefaultTreeModel) tree.getModel()).nodeChanged(node); updateAllExps(SAVE_FILE); } removeUndoMananger(); } // save public synchronized int delete(final boolean confirm) { if (confirm) { final int resp = JOptionPane.showConfirmDialog( window.getFrame(), AnLocale.getString("Delete notes file ?"), UIManager.getString("OptionPane.titleText"), JOptionPane.YES_NO_OPTION); if (resp != JOptionPane.YES_OPTION) { return -1; } } final int status = updateNotes(exp_id, DELETE_FILE, null, true); notesText = AnLocale.getString("<Empty>"); deleteAction.setEnabled(false); if (status != 0) { if (confirm) { window.showError(AnLocale.getString("Cannot delete notes file")); } return -1; } notes_text_area.setText(AnUtility.trimNewLine(notesText)); updateAllExps(DELETE_FILE); removeUndoMananger(); return 0; } // delete private void undo_all() { while (cnt_edit_actions > 0) { undo(); } } // undo_all } } private int updateNotes( final int exp_id, final int type, final String text, final boolean handle_file) { synchronized (IPC.lock) { window.IPC().send("updateNotes"); window.IPC().send(0); window.IPC().send(exp_id); window.IPC().send(type); window.IPC().send(text); window.IPC().send(handle_file); return window.IPC().recvInt(); } } private class AnMenuListener extends MouseAdapter { private boolean debug; // NM private AnTable anTable; JTree tree; AnMenuListener(JTree tree) { this.tree = tree; debug = false; } public JPopupMenu initPopup(MouseEvent event) { AccessibleContext ac; JMenuItem mi; JPopupMenu popup = new JPopupMenu(); String txt; boolean row_selected = false; int row = tree.getLeadSelectionRow(); if (row >= 0) { row_selected = true; } return popup; } @Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); } @Override public void mouseReleased(MouseEvent e) { maybeShowPopup(e); } private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JPopupMenu popup = initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); } } } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeInvisible(" + e + ")"); } } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuWillBecomeVisible(" + e + ")"); } } public void popupMenuCanceled(PopupMenuEvent e) { if (debug) { System.out.println("AnMenuListener:popupMenuCanceled(" + e + ")"); } } } @Override public java.util.List<ExportFormat> getSupportedExportFormats() { java.util.List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return true; } } ��������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ExperimentPickList.java��������������������������������������������0000644�0001750�0001750�00000007431�15044710303�020357� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.picklist.PickList; import org.gprofng.mpmt.picklist.PickListElement; import java.io.File; import java.util.ArrayList; import java.util.List; public class ExperimentPickList extends PickList { public ExperimentPickList(int max) { super(max); } public List<ExperimentPickListElement> getRecentExperiments() { List<ExperimentPickListElement> list = new ArrayList<>(); List<PickListElement> mostRecentExperiments = getElements(); for (PickListElement ple : mostRecentExperiments) { list.add((ExperimentPickListElement) ple); } return list; } public List<ExperimentPickListElement> getRecentExperiments(int max) { int numberAdded = 0; List<ExperimentPickListElement> list = new ArrayList<>(); List<PickListElement> mostRecentExperiments = getElements(); for (PickListElement ple : mostRecentExperiments) { list.add((ExperimentPickListElement) ple); numberAdded++; if (max > 0 && numberAdded >= max) { break; } } return list; } public List<ExperimentPickListElement> getRecentValidExperiments(int max) { int numberAdded = 0; List<ExperimentPickListElement> list = new ArrayList<>(); List<PickListElement> mostRecentExperiments = getElements(); for (PickListElement ple : mostRecentExperiments) { if (exists(((ExperimentPickListElement) ple).getPath())) { list.add((ExperimentPickListElement) ple); numberAdded++; if (max > 0 && numberAdded >= max) { break; } } } return list; } public void removeExperiment(String path) { List<ExperimentPickListElement> list = getRecentExperiments(); for (ExperimentPickListElement experimentPickListElement : list) { if (experimentPickListElement.getPath().equals(path)) { removeElement(experimentPickListElement); break; } } } private boolean exists(String path) { // FIXUP: need to validate on remote host in case of remote String host = Analyzer.getInstance().getHost(); if (host == null || !host.equals("localhost")) { return true; // FIXUP: need to validate on remote host in case of remote } FileExists fileExists = new FileExists(path); fileExists.start(); try { fileExists.join(100); // Wait at most .1 sec for result. Interrupt if hanging. fileExists.interrupt(); } catch (InterruptedException ie) { } // System.out.println(path + " " + exists.existsResult.exists); return fileExists.getExistsResult().exists; } private class ExistsResult { public boolean exists = false; } private class FileExists extends Thread { private final String path; private final ExistsResult existsResult = new ExistsResult(); public FileExists(String path) { this.path = path; } // @Override @Override public void run() { // System.out.println("Checking " + path); existsResult.exists = new File(path).exists(); } /** * @return the existsResult */ public ExistsResult getExistsResult() { return existsResult; } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ITreeToPanel.java��������������������������������������������������0000644�0001750�0001750�00000001507�14744453367�017111� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; /** * @author nd159473 */ public interface ITreeToPanel { public IExtTreeModel getModel(); public void onSelect(int i, Object aRace); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/IDispToModel.java��������������������������������������������������0000644�0001750�0001750�00000001721�14744453367�017110� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; /** * @author nd159473 */ // this interface from a race tree model to race disp public interface IDispToModel { public String[] getSubEventsDataData(final int exp_id, final int race_id, final int type); public AnWindow getWindow(); public IExtTreeModel createModel(); } �����������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/���������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�014566� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCRequest.java������������������������������������������������0000644�0001750�0001750�00000010642�14744453367�017355� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; class IPCRequest { private StringBuilder body; protected IPCRequest() { body = new StringBuilder(); } protected void append(final int i) { body.append(sendByte(IPCProtocol.L_INTEGER)); body.append(sendVal(i)); } protected void append(final long l) { body.append(sendByte(IPCProtocol.L_LONG)); body.append(sendVal(l)); } protected void append(final boolean b) { body.append(sendByte(IPCProtocol.L_BOOLEAN)); body.append(sendVal(b)); } protected void append(final String s) { body.append(sendByte(IPCProtocol.L_STRING)); String ss = sendVal(s); body.append(ss); } protected void append(final Object object) { body.append(sendByte(IPCProtocol.L_ARRAY)); body.append(sendVal(object)); } protected String getBody() { return body.toString(); } private String sendByte(final int b) { return IPCProtocol.encodeByte(b); } private String sendVal(final long l) { return IPCProtocol.encodeVal(l); } private String sendVal(final int i) { return IPCProtocol.encodeVal(i); } private String sendVal(final String s) { if (s == null) { return sendVal(-1); } byte[] sb = s.getBytes(); StringBuilder buf = new StringBuilder(); buf.append(sendVal(sb.length)); for (byte b : sb) { buf.append((char) b); } return buf.toString(); } private String sendVal(final boolean b) { return sendByte(b ? 1 : 0); } private String sendVal(final char c) { return sendByte((int) c); } private String sendVal(final double d) { return sendVal(Double.toString(d)); } private String sendVal(final Object object) { StringBuilder buf = new StringBuilder(); if (object == null) { buf.append(sendByte(IPCProtocol.L_INTEGER)); buf.append(sendVal(-1)); return buf.toString(); } if (object instanceof double[]) { buf.append(sendByte(IPCProtocol.L_DOUBLE)); final double[] array = (double[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof int[]) { buf.append(sendByte(IPCProtocol.L_INTEGER)); final int[] array = (int[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof long[]) { buf.append(sendByte(IPCProtocol.L_LONG)); final long[] array = (long[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof char[]) { buf.append(sendByte(IPCProtocol.L_CHAR)); final char[] array = (char[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof boolean[]) { buf.append(sendByte(IPCProtocol.L_BOOLEAN)); final boolean[] array = (boolean[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof String[]) { buf.append(sendByte(IPCProtocol.L_STRING)); final String[] array = (String[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } else if (object instanceof Object[]) { buf.append(sendByte(IPCProtocol.L_OBJECT)); final Object[] array = (Object[]) object; buf.append(sendVal(array.length)); for (int i = 0; i < array.length; i++) { buf.append(sendVal(array[i])); } } return buf.toString(); } } ����������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCHandle.java�������������������������������������������������0000644�0001750�0001750�00000033017�15044710303�017075� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.ipc.IPCProtocol.CurChar; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; /** * Examples: * * <p>// Simplest code IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); * ipcHandle.append("getFilterStr"); ipcHandle.append(window.getID()); IPCResult ipcResult = * ipcHandle.sendRequest(); String result = ipcResult.getString(); // blocking * * <p>// Checking completion code IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); * ipcHandle.append("getFilterStr"); ipcHandle.append(window.getID()); IPCResult ipcResult = * ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { // blocking // Things * are fine String result = ipcResult.getString(); return result; } else { // error handling } * * <p>// Handling progress, not cancellable IPCContext ipcContext = new * IPCContext(IPCContext.Scope.WINDOW, this); IPCHandle ipcHandle = new * IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); ipcHandle.append("getFilterStr"); * ipcHandle.append(window.getID()); ipcHandle.addIPCListener(new IPCListener() { public void * started(int requestId) { System.out.println("*******: MyOwnProgressListener: " + requestId + " * Start..."); } public void progress(int requestId, String what, int percentage) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + what + " " + * percentage); } public void finished(int requestId, IPCResult ipcResult) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + " Stop..."); } }); * IPCResult ipcResult = ipcHandle.sendRequest(); String result = ipcResult.getString(); // blocking * * <p>// Handling progress, cancellable IPCContext ipcContext = new IPCContext("getFilterStr", * IPCContext.Scope.WINDOW, true, false, IPCContext.Request.SINGLE, 1, this); IPCHandle ipcHandle = * new IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); ipcHandle.append("getFilterStr"); * ipcHandle.append(window.getID()); ipcHandle.addIPCListener(new IPCListener() { public void * started(int requestId) { System.out.println("*******: MyOwnProgressListener: " + requestId + " * Start..."); } public void progress(int requestId, String what, int percentage) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + what + " " + * percentage); } public void finished(int requestId, IPCResult ipcResult) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + " Stop..."); } }); * IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { * // blocking // Things are fine String result = ipcResult.getString(); return result; } else * (ipcResult.getCC() == IPCResult.CC.CANCELED) // cancelled } else { // error handling } * * <p>// Handling progress and reading result in finished() callback IPCContext ipcContext = new * IPCContext("getFilterStr", IPCContext.Scope.WINDOW, true, false, IPCContext.Request.SINGLE, 1, * this); IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); * ipcHandle.append("getFilterStr"); ipcHandle.append(window.getID()); ipcHandle.addIPCListener(new * IPCListener() { public void started(int requestId) { System.out.println("*******: * MyOwnProgressListener: " + requestId + " Start..."); } public void progress(int requestId, String * what, int percentage) { System.out.println("*******: MyOwnProgressListener: " + requestId + " " + * what + " " + percentage); } public void finished(int requestId, IPCResult ipcResult) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + " Stop..."); String * result = ipcResult.getString(); // blocking but result is ready System.out.println("*******: * MyOwnProgressListener: " + requestId + " Result=" + result); } }); IPCResult ipcResult = * ipcHandle.sendRequest(); * * <p>// Handling progress and reading result in main flow and in finishd() callback IPCContext * ipcContext = new IPCContext("getFilterStr", IPCContext.Scope.WINDOW, true, false, * IPCContext.Request.SINGLE, 1, this); IPCHandle ipcHandle = new * IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); ipcHandle.append("getFilterStr"); * ipcHandle.append(window.getID()); ipcHandle.addIPCListener(new IPCListener() { public void * started(int requestId) { System.out.println("*******: MyOwnProgressListener: " + requestId + " * Start..."); } public void progress(int requestId, String what, int percentage) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + what + " " + * percentage); } public void finished(int requestId, IPCResult ipcResult) { * System.out.println("*******: MyOwnProgressListener: " + requestId + " " + " Stop..."); // Result * can be read here and/or in main flow // Need to rewind input buffer before result is read again * ipcResult.rewindInputBuffer(); String result = ipcResult.getString(); // blocking * System.out.println("*******: MyOwnProgressListener: " + requestId + " Result=" + result); } }); * IPCResult ipcResult = ipcHandle.sendRequest(); String result = ipcResult.getString(); // blocking */ public class IPCHandle { private static int globalRequestID = 0; public enum RequestKind { NON_DBE, DBE }; public enum RequestType { DEFAULT(0), CANCEL(1), HANDSHAKE(2); private final int index; RequestType(int index) { this.index = index; } public int index() { return index; } }; private List<IPCListener> ipcListeners = new ArrayList<>(); private RequestType requestType; private IPCContext ipcContext; private IPCRequest ipcRequest; public IPCHandle(RequestKind requestKind) { this(requestKind, null); } public IPCHandle(RequestKind requestKind, IPCContext ipcContext) { requestType = RequestType.DEFAULT; if (ipcContext == null) { if (requestKind == RequestKind.DBE) { ipcContext = IPCContext.getDefaultDBEIPCContext(); } else { ipcContext = IPCContext.getDefaultNONDBEIPCContext(); } } this.ipcContext = ipcContext; this.ipcRequest = new IPCRequest(); } public static IPCHandle newHandshakeIPCHandle() { return new IPCHandle(RequestType.HANDSHAKE, IPCContext.getDefaultNONDBEIPCContext()); } public static IPCHandle newCancelIPCHandle(IPCContext originalIPCContext, int originalRequestID) { IPCContext ipcContext = IPCContext.newCancelContext( originalIPCContext.getChannel(), originalIPCContext.getRequest() == IPCContext.Request.SINGLE ? originalRequestID : -1); return new IPCHandle(RequestType.CANCEL, ipcContext); } protected IPCHandle(RequestType requestType, IPCContext ipcContext) { this.requestType = requestType; this.ipcContext = ipcContext; } public void append(final int i) { ipcRequest.append(i); } public void append(final long l) { ipcRequest.append(l); } public void append(final boolean b) { ipcRequest.append(b); } public void append(final String s) { ipcRequest.append(s); } public void append(final Object object) { ipcRequest.append(object); } private static synchronized int getNextGlobalRequestID() { globalRequestID++; return (globalRequestID); } public synchronized IPCResult sendRequest() { int requestID = getNextGlobalRequestID(); // globalRequestID++; IPCResult ipcResult = new IPCResult(this, requestID, ipcContext); Analyzer.getInstance().IPC_session.getIPCReader().addToRequestPool(ipcResult); OutputStream processInput = Analyzer.getInstance().IPC_session.getOutputStream(); try { String requestBody = null; byte[] requestBodyBytes = new byte[0]; // default empty body if (ipcRequest != null) { requestBody = ipcRequest.getBody(); requestBodyBytes = requestBody.getBytes(); } IPCRequestHeader ipcRequestHeader = null; if (requestType == RequestType.DEFAULT) { ipcRequestHeader = new IPCRequestHeader( requestID, requestType, ipcContext.getChannel(), requestBodyBytes.length); } else if (requestType == RequestType.HANDSHAKE) { ipcRequestHeader = new IPCRequestHeader( requestID, requestType, ipcContext.getChannel(), IPCProtocol.version); } else if (requestType == RequestType.CANCEL) { ipcRequestHeader = new IPCRequestHeader( requestID, requestType, ipcContext.getCancelChannel(), ipcContext.getCancelRequest()); } else { assert false; } String headerBody = ipcRequestHeader.getBody(); byte[] headerBodyBytes = headerBody.getBytes(); IPCLogger.logRequest(headerBody, requestBody); String request = ""; if (requestBodyBytes != null && requestBodyBytes.length > 0) { CurChar curChar = new CurChar(); IPCProtocol.decodeByte(requestBodyBytes, curChar); request = "\"" + IPCProtocol.decodeSVal(requestBodyBytes, curChar) + "\""; } IPCLogger.logTrace( ipcRequestHeader.getRequestID() + " IPCHandle sendRequest " + ipcContext.getChannel() + " " + request); // send header and body using one write String request_str = headerBody; if (null != requestBody) { request_str += requestBody; } byte[] request_arr = request_str.getBytes(); processInput.write(request_arr); processInput.flush(); } catch (IOException ioe) { AnLog.log("sendRequest: IOException" + ioe); // ioe.getStackTrace()); // ioe.printStackTrace(); if (Analyzer.getInstance().known_problem_10.equals(ioe.getMessage())) { // Show error dialog and exit if (null != Analyzer.getInstance().remoteConnection) { String msg = AnLocale.getString("Remote connection closed"); JOptionPane.showMessageDialog( (AnWindow.getInstance()).getFrame(), msg, AnLocale.getString("Error"), JOptionPane.ERROR_MESSAGE); System.err.println(msg); } else { if (Analyzer.getInstance().IPC_started != false) { System.err.println("Connection closed (gp-display-text died unexpectedly)"); } else { // Normal exit System.exit(0); // Should we simply return null here? } } System.exit(1); // AnWindow.getInstance().exitAction(); } throw new IPC.AnIPCException(ioe); } catch (Exception e) { if (null != Analyzer.getInstance().remoteConnection) { String msg = AnLocale.getString("Remote connection closed"); JOptionPane.showMessageDialog( (AnWindow.getInstance()).getFrame(), msg, AnLocale.getString("Error"), JOptionPane.ERROR_MESSAGE); System.err.println(msg); System.exit(1); // AnWindow.getInstance().exitAction(); } AnLog.log("sendRequest: Exception" + e); // e.printStackTrace(); throw new IPC.AnIPCException(e); } return ipcResult; } public void addIPCListener(IPCListener listener) { synchronized (ipcListeners) { ipcListeners.add(listener); } } public void removeIPCListener(IPCListener listener) { synchronized (ipcListeners) { ipcListeners.remove(listener); } } protected void fireResponse(IPCResponse ipcResponse, IPCResult ipcResult) { if (ipcListeners.isEmpty()) { return; } if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.ACK) { synchronized (ipcListeners) { for (IPCListener listener : ipcListeners) { listener.started(ipcResponse.getHeader().getRequestID()); } } } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.COMPLETE) { synchronized (ipcListeners) { for (IPCListener listener : ipcListeners) { listener.finished(ipcResponse.getHeader().getRequestID(), ipcResult); } } } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.HANDHAKE) { } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.PROGRESS) { IPCProtocol.CurChar curChar = new IPCProtocol.CurChar(); int progress = IPCProtocol.decodeByte(ipcResponse.getBody(), curChar); int percentage = IPCProtocol.decodeIVal(ipcResponse.getBody(), curChar); String what = IPCProtocol.decodeSVal(ipcResponse.getBody(), curChar); synchronized (ipcListeners) { for (IPCListener listener : ipcListeners) { listener.progress(ipcResponse.getHeader().getRequestID(), what, percentage); } } } else { assert false; } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCTester.java�������������������������������������������������0000644�0001750�0001750�00000003535�14744453367�017176� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.mpmt.util.gui.AnUtility; public class IPCTester { public static int ipcTestCounter = 0; public static class IPCTestSender implements Runnable { @Override public void run() { System.out.println("\nStart"); for (int i = 0; i < 25; i++) { if (i == 10) { IPCLogger.setIpcDelay(500); } IPCHandle ipcHandle = IPCHandle.newHandshakeIPCHandle(); IPCResult ipcResult = ipcHandle.sendRequest(); // no body IPCTestReader ccReader = new IPCTestReader(ipcResult, ipcTestCounter++); System.out.println("Request " + ipcTestCounter + " sent"); AnUtility.dispatchOnAWorkerThread(ccReader, "CCReader" + " " + ipcTestCounter); } System.out.println("End"); } } private static class IPCTestReader implements Runnable { IPCResult ipcResult = null; int counter; public IPCTestReader(IPCResult ipcResult, int counter) { this.ipcResult = ipcResult; this.counter = counter; } @Override public void run() { IPCResult.CC cc = ipcResult.getCC(); // blocking System.out.println("Result " + counter + " received: " + cc); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCContext.java������������������������������������������������0000644�0001750�0001750�00000015117�14744453367�017353� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; /** */ public class IPCContext { private static final int NON_DBE_CHANNEL = 0; private static final int DEF_DBE_CHANNEL = 1; private static final int UNIQUE_DBE_CHANNEL_START = 2; private static int currentUniqueDBEChannel = UNIQUE_DBE_CHANNEL_START; public enum Scope { SYSTEM, SESSION, NONE }; public enum Request { SINGLE, GROUP }; private static final IPCContext defaultDBEIPCContext = new IPCContext(null, Scope.NONE, false, false, Request.SINGLE, 1, null); private static final IPCContext defaultNONDBEIPCContext = new IPCContext(null, Scope.SYSTEM, false, false, Request.SINGLE, 0, null); private String taskName; private Scope scope; private boolean systemProgressBar; private boolean cancellable; private Request request; private int channel; private AnWindow anWindow; private int cancelChannel; private int cancelRequest; /** * Context for progress updates. Creates a context that has progress updates but task is not * cancellable. * * @param scope the scope of the command. WINDOW: progress update on anWindow only. SESSION: * progress update on all windows. * @param anWindow the current anWindow (owner of progress status panel) */ public IPCContext(Scope scope, AnWindow anWindow) { this(null, scope, true, false, Request.SINGLE, -1, anWindow); } /** * Context for progress updates and cancellable task. Creates a context that has progress updates * and task is cancellable. * * @param userActionName name of task used in cancel dialog * @param scope the scope of the command. WINDOW: progress update in current AnWindow only. * SESSION: progress updates in all windows. * @param systemProgressBar set to true to enable system progress updates * @param cancellable set to true to make this task cancellable via the progress status * @param request whether to cancel a single request or a group of request (on a unique channel) * @param channel the channel to cancel in case of request==GROUP * @param anWindow the current anWindow (owner of progress status panel) */ public IPCContext( String taskName, Scope scope, boolean systemProgressBar, boolean cancellable, Request request, int channel, AnWindow anWindow) { this.taskName = taskName; this.scope = scope; this.systemProgressBar = systemProgressBar; this.cancellable = cancellable; this.request = request; this.channel = channel; this.anWindow = anWindow; } /** * Context for a cancel request * * @param cancelChannel * @param cancelRequest */ private IPCContext(int cancelChannel, int cancelRequest) { this.cancelChannel = cancelChannel; this.cancelRequest = cancelRequest; } public static IPCContext newDBEIPCContext( String userActionName, Scope scope, boolean systemProgressBar, boolean cancellable, Request request, AnWindow anWindow) { return new IPCContext( userActionName, scope, systemProgressBar, cancellable, request, request == Request.SINGLE ? DEF_DBE_CHANNEL : getUniqueDBEChannel(), anWindow); } public static IPCContext newNONDBEIPCContext( String userActionName, boolean systemProgressBar, boolean cancellable) { return new IPCContext( userActionName, Scope.SYSTEM, systemProgressBar, cancellable, Request.SINGLE, NON_DBE_CHANNEL, null); } public static IPCContext newCancelContext(int cancelChannel, int cancelRequest) { return new IPCContext(cancelChannel, cancelRequest); } public static IPCContext getDefaultDBEIPCContext() { return defaultDBEIPCContext; } public static IPCContext getDefaultNONDBEIPCContext() { return defaultNONDBEIPCContext; } /** * @return the taskName */ public String getTaskName() { return taskName; } /** * @param taskName the taskName to set */ public void setTaskName(String taskName) { this.taskName = taskName; } /** * @return the scope */ public Scope getScope() { return scope; } /** * @return the systemProgressBar */ public boolean isSystemProgressBar() { return systemProgressBar; } /** * @return the cancellable */ public boolean isCancellable() { return cancellable; } /** * @param cancellable the cancellable to set */ public void setCancellable(boolean cancellable) { this.cancellable = cancellable; } /** * @return the request */ public Request getRequest() { return request; } /** * @return the channel */ public int getChannel() { return channel; } /** * @return the anWindow */ public AnWindow getAnWindow() { return anWindow; } /** * @return the cancelChannel */ public int getCancelChannel() { return cancelChannel; } /** * @return the cancelRequest */ public int getCancelRequest() { return cancelRequest; } private static int getUniqueDBEChannel() { return currentUniqueDBEChannel++; } /*********/ private static IPCContext currentContext = defaultDBEIPCContext; public static IPCContext newCurrentContext( String userActionName, Scope scope, boolean cancellable, AnWindow anWindow) { if (userActionName == null) { userActionName = AnLocale.getString("Unknown action...."); } currentContext = newDBEIPCContext( userActionName, scope, true, cancellable, Request.GROUP, anWindow); // Default not cancellable // // System.out.print("\n--------------------------------------------------------newCurrentContext: " + currentContext.getChannel()); return currentContext; } public static IPCContext getCurrentContext() { return currentContext; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCCancelledException.java�������������������������������������0000644�0001750�0001750�00000001357�14744453367�021461� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; public class IPCCancelledException extends Error {} ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCResponseHeader.java�����������������������������������������0000644�0001750�0001750�00000005066�14744453367�020640� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ /** * <Header, ResponseBody> where * * <p>Header <HeaderMarker, RequestID, ResponseType, ResponseStatus, nBytes> * * <p>HeaderMarker (1 byte, value=255) RequestID (4 bytes) ResponseType (INTEGER): (1 byte) o 0: ACK * o 1: PROGRESS o 2: COMPLETE o 3: HANDSHAKE ResponseStatus: (1 byte) o 0: DEFAULT, IGNORE o 1: * SUCCESS o 2: FAILURE o 3: CANCELED -or- o VersionID in case of Handshake requests nBytes: Number * of bytes in the response body (4 bytes) * * <p>ResponseBody string containing the final result or intermediate status details */ package org.gprofng.mpmt.ipc; class IPCResponseHeader { protected static final int headerSizeInBytes = 11; protected enum ResponseType { ACK(0), PROGRESS(1), COMPLETE(2), HANDHAKE(3); private final int value; private ResponseType(int value) { this.value = value; } protected int value() { return value; } protected static ResponseType fromValue(int val) { for (ResponseType rt : ResponseType.values()) { if (rt.value() == val) { return rt; } } return null; } }; private int requestID; private ResponseType responseType; private IPCResult.CC responseStatus; private int nBytes; protected IPCResponseHeader( int requestID, ResponseType responseType, IPCResult.CC responseStatus, int nBytes) { this.requestID = requestID; this.responseType = responseType; this.responseStatus = responseStatus; this.nBytes = nBytes; } /** * @return the requestID */ protected int getRequestID() { return requestID; } /** * @return the responseType */ protected ResponseType getResponseType() { return responseType; } /** * @return the responseStatus */ protected IPCResult.CC getResponseStatus() { return responseStatus; } /** * @return the nBytes */ protected int getnBytes() { return nBytes; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCResponse.java�����������������������������������������������0000644�0001750�0001750�00000002102�14744453367�017513� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; class IPCResponse { private IPCResponseHeader header; private byte[] body; protected IPCResponse(IPCResponseHeader header, byte[] body) { this.header = header; this.body = body; } /** * @return the header */ protected IPCResponseHeader getHeader() { return header; } /** * @return the body */ protected byte[] getBody() { return body; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCReader.java�������������������������������������������������0000644�0001750�0001750�00000026327�14744453367�017136� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.util.gui.AnUtility; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class IPCReader implements Runnable { private IPC ipc; private Map<Integer, IPCResult> requestPool = new HashMap<Integer, IPCResult>(); private final int READY_TO_RUN = 1; private final int RUNNING = 2; private final int REQUEST_TO_STOP = 3; private final int CONNECTING = 4; // Temporary solution for remote analyzer: special state "CONNECTING" private final int CONNECTION_CLOSDED = 5; // Connection closed by gp-display-text private final int RESTARTING = 6; // Restarting gp-display-text private int state = READY_TO_RUN; private String unknown_input = ""; // Internal statistics private long totalReceivedMessages = 0; private long totalReceivedBytes = 0; public IPCReader(IPC ipc) { this.ipc = ipc; state = RUNNING; new Thread(this, "IPCReader").start(); } // NM Temporary solution for remote analyzer: use flag "run" to decide how to read data public IPCReader(IPC ipc, boolean run) { this.ipc = ipc; if (run) { state = RUNNING; } else { state = CONNECTING; } new Thread(this, "IPCReader").start(); } /** Checks if thread is ready to run */ public boolean isThreadReady() { if (RUNNING == state) return true; if (READY_TO_RUN == state) return true; return (false); } /** Sets request to stop IPCReader thread */ public void stopThread() { state = REQUEST_TO_STOP; try { ipc.getInputStream().close(); ipc.getOutputStream().close(); } catch (IOException ex) { } } /** //NM Temporary solution for remote analyzer: Sets request to run IPCReader thread */ public void runThread() { state = RUNNING; } /** Sets request to suspend IPCReader thread */ public void suspendThread() { state = RESTARTING; // CONNECTING } /** Sets request to resume IPCReader thread */ public void resumeThread() { state = RUNNING; } /** Gets input as a String */ public String getUnknownInput() { return unknown_input; } /** Gets Total Received Bytes */ public long getTotalReceivedBytes() { return totalReceivedBytes; } /** Gets Total Received Messages */ public long getTotalReceivedMessages() { return totalReceivedMessages; } /** * Reads exactly buffer.length() bytes from stream. * * @param buffer * @return bytes read (buffer.length()) */ private int readFromInputStream(byte[] buffer) { try { int nBytesToRead = buffer.length; int nBytesRead = 0; while (nBytesRead < nBytesToRead) { int got = ipc.getInputStream().read(buffer, nBytesRead, nBytesToRead - nBytesRead); if (got < 0) { AnWindow.getInstance().getSystemProgressPanel().reset(); if (state == REQUEST_TO_STOP) { return 0; } if ((state == RESTARTING) || (state == CONNECTING)) { return got; } state = REQUEST_TO_STOP; // CONNECTION_CLOSDED; break; // throw new IPC.AnIPCException(); } totalReceivedBytes += got; nBytesRead += got; } return nBytesToRead; } catch (IOException ioe) { if (state == REQUEST_TO_STOP) { return 0; } state = REQUEST_TO_STOP; // CONNECTION_CLOSDED; return -1; // throw new IPC.AnIPCException(ioe); } } private byte[] readFromStream(int nBytes) { byte[] buffer = new byte[nBytes]; int got = readFromInputStream(buffer); return buffer; } // @Override @Override public void run() { while (true) { IPCResponseHeader ipcResponseHeader = null; byte[] responseBody = null; byte[] responseHeaderBytes = null; if (state != RUNNING) { // Read raw input byte[] responseHeaderBytes_1 = new byte[1]; int nBytes = readFromInputStream(responseHeaderBytes_1); if (state == REQUEST_TO_STOP) { // Connection closed break; } if (state == CONNECTING) { if (nBytes < 0) { // Connection error break; } for (int i = 0; i < nBytes; i++) { unknown_input += (char) responseHeaderBytes_1[i]; } continue; } if (state == RESTARTING) { if (nBytes < 0) { // Connection error // System.err.println("***** NOTE: RESTARTING: nBytes < 0"); break; } for (int i = 0; i < nBytes; i++) { unknown_input += (char) responseHeaderBytes_1[i]; } String restartEngine = "Restart engine"; if (unknown_input.contains(restartEngine)) { // System.err.println("***** NOTE: gp-display-text restarted"); resumeThread(); // System.err.println("***** NOTE: unknown_input:" + unknown_input); // clean unknown input unknown_input = ""; } continue; } if (nBytes < 0) { // Read error state = REQUEST_TO_STOP; // CONNECTION_CLOSDED; break; // throw new IPC.AnIPCException(); } // Read the rest of the header and combine it with the first byte byte[] responseHeaderBytes_2 = readFromStream(IPCResponseHeader.headerSizeInBytes * 2 - 1); if (state == REQUEST_TO_STOP) break; responseHeaderBytes = new byte[responseHeaderBytes_2.length + 1]; responseHeaderBytes[0] = responseHeaderBytes_1[0]; for (int i = 1; i < responseHeaderBytes.length; i++) { responseHeaderBytes[i] = responseHeaderBytes_2[i - 1]; } totalReceivedMessages++; } else { // state == RUNNING // clean unknown input unknown_input = ""; // Read a header and a nBytes (specified in header) body responseHeaderBytes = readFromStream(IPCResponseHeader.headerSizeInBytes * 2); totalReceivedMessages++; } if (state == REQUEST_TO_STOP) { break; } ipcResponseHeader = decodeIPCResponseHeader(responseHeaderBytes); if (ipcResponseHeader.getResponseType() != IPCResponseHeader.ResponseType.HANDHAKE) { int nBytes = ipcResponseHeader.getnBytes(); if (nBytes > 0) { responseBody = readFromStream(nBytes); } } IPCLogger.logResponse(responseHeaderBytes, responseBody); // Send result to IPCResult IPCResult ipcResult = findInRequestPool(ipcResponseHeader.getRequestID()); final int additionalLatency = IPCLogger.getIpcDelay(); // milliseconds if (ipcResult != null) { if (additionalLatency <= 0) { IPCResponse ipcResponse = new IPCResponse(ipcResponseHeader, responseBody); ipcResult.fireResponse(ipcResponse); ipcResult.getIPCHandle().fireResponse(ipcResponse, ipcResult); // Fixup: new thread? } else { // use a "latency" thread final IPCResult my_ipcResult = ipcResult; final IPCResponseHeader my_ipcResponseHeader = ipcResponseHeader; final byte[] my_responseBody = responseBody; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { if (additionalLatency > 0) { try { Thread.sleep(additionalLatency); // milliseconds } catch (Exception e) { // check that we did sleep enough? } } IPCResponse ipcResponse = new IPCResponse(my_ipcResponseHeader, my_responseBody); my_ipcResult.fireResponse(ipcResponse); my_ipcResult.getIPCHandle().fireResponse(ipcResponse, my_ipcResult); } }, "AdditionalUploadLatency_thread"); } } else { if (IPCResponseHeader.ResponseType.PROGRESS == ipcResponseHeader.getResponseType()) { // System.err.println("***** NOTE: IPCReader: PROGRESS: ipcResult==null"); // // Check responseBody // String restartEngine = "Restart engine"; // IPCProtocol.CurChar curChar = new IPCProtocol.CurChar(); // int progress = IPCProtocol.decodeByte(responseBody, curChar); // int percentage = IPCProtocol.decodeIVal(responseBody, curChar); // String what = IPCProtocol.decodeSVal(responseBody, curChar); // if (100 == percentage) { // if (restartEngine.equals(what)) { // if ((state == RESTARTING) || (state == CONNECTING)) { // resumeThread(); // System.err.println("***** NOTE: gp-display-text restarted"); // } // } // } continue; } // System.err.println("********************ERROR: IPCReader: state="+state+" // ipcResponseHeader="+ipcResponseHeader.toString()+" // responseBody="+responseBody.toString()); if (state != RUNNING) { continue; // ignore all messages } // FIXUP should not happen System.err.println("********************ERROR: IPCReader: ipcHandle==null"); assert false; } } } private IPCResponseHeader decodeIPCResponseHeader(byte[] bytes) { IPCProtocol.CurChar curChar = new IPCProtocol.CurChar(); int headerMarker = IPCProtocol.decodeByte(bytes, curChar); if (headerMarker != IPCProtocol.L_HEADER) { // FIXUP assert false; } int requestID = IPCProtocol.decodeIVal(bytes, curChar); int responseType = IPCProtocol.decodeByte(bytes, curChar); int responseStatus = IPCProtocol.decodeByte(bytes, curChar); int nBytes = IPCProtocol.decodeIVal(bytes, curChar); IPCResponseHeader ipcResponseHeader = new IPCResponseHeader( requestID, IPCResponseHeader.ResponseType.fromValue(responseType), IPCResult.CC.fromValue(responseStatus), nBytes); return ipcResponseHeader; } protected void addToRequestPool(IPCResult ipcResult) { IPCLogger.logTrace("\n" + ipcResult.getRequestID() + " IPCReader addToRequestPool"); synchronized (requestPool) { requestPool.put(ipcResult.getRequestID(), ipcResult); } } protected IPCResult findInRequestPool(int ipcRequestId) { synchronized (requestPool) { return requestPool.get(ipcRequestId); } } protected void removeFromRequestPool(int ipcRequestId) { IPCLogger.logTrace(ipcRequestId + " IPCReader removeFromRequestPool"); synchronized (requestPool) { requestPool.remove(ipcRequestId); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCProtocol.java�����������������������������������������������0000644�0001750�0001750�00000006314�14744453367�017527� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; public class IPCProtocol { public static final int version = 38; // IPC PROTOCOL VERSION - DO NOT CHANGE THIS COMMENT public static final String IPC_PROTOCOL_STR = "IPC_PROTOCOL_" + version; // Dodona build 29 protected static final int L_PROGRESS = 0; protected static final int L_INTEGER = 1; protected static final int L_BOOLEAN = 2; protected static final int L_LONG = 3; protected static final int L_STRING = 4; protected static final int L_DOUBLE = 5; protected static final int L_ARRAY = 6; protected static final int L_OBJECT = 7; protected static final int L_CHAR = 8; protected static final int L_HEADER = 255; protected static final char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; protected static String encodeByte(final int b) { StringBuilder buf = new StringBuilder(); buf.append(hex[(b >> 4) & 0xf]); buf.append(hex[b & 0xf]); return buf.toString(); } protected static String encodeVal(final int i) { StringBuilder buf = new StringBuilder(); for (int j = 28; j >= 0; j = j - 4) { buf.append(hex[(i >> j) & 0xf]); } return buf.toString(); } protected static String encodeVal(final long l) { StringBuilder buf = new StringBuilder(); for (int j = 60; j >= 0; j = j - 4) { buf.append(hex[(int) ((l >> j) & 0xf)]); } return buf.toString(); } protected static class CurChar { int pos = 0; } protected static int decodeByte(byte[] bytes, CurChar curChar) { int val = 0; for (int i = 0; i < 2; i++) { final int c = bytes[curChar.pos]; curChar.pos++; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': val = val * 16 + c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': val = val * 16 + c - 'a' + 10; break; } } return val; } protected static int decodeIVal(byte[] bytes, CurChar curChar) { int val = decodeByte(bytes, curChar); for (int i = 0; i < 3; i++) { val = val * 256 + decodeByte(bytes, curChar); } return val; } protected static String decodeSVal(byte[] bytes, CurChar curChar) { int len = decodeIVal(bytes, curChar); if (len == -1) { return null; } String s = new String(bytes, curChar.pos, len); curChar.pos += len; return s; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCErrorReader.java��������������������������������������������0000644�0001750�0001750�00000007124�14744453367�020142� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.mpmt.IPC; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class IPCErrorReader implements Runnable { private IPC ipc; private Map<Integer, IPCResult> requestPool = new HashMap<Integer, IPCResult>(); private final int READY_TO_RUN = 1; private final int RUNNING = 2; private final int REQUEST_TO_STOP = 3; private final int CONNECTING = 4; // NM Temporary solution for remote analyzer: special state "CONNECTING" private int state = READY_TO_RUN; private String unknown_input = ""; public IPCErrorReader(IPC ipc) { this.ipc = ipc; state = RUNNING; new Thread(this, "IPCErrorReader").start(); } // NM Temporary solution for remote analyzer: use flag "run" to decide how to read data public IPCErrorReader(IPC ipc, boolean run) { this.ipc = ipc; if (run) { state = RUNNING; } else { state = CONNECTING; } new Thread(this, "IPCErrorReader").start(); } /** Sets request to stop IPCErrorReader thread */ public void stopThread() { state = REQUEST_TO_STOP; try { ipc.getErrorStream().close(); } catch (IOException ex) { } } /** //NM Temporary solution for remote analyzer: Sets request to run IPCReader thread */ public void runThread() { state = RUNNING; } /** Sets request to run IPCErrorReader thread */ public String getUnknownInput() { return unknown_input; } /** * Reads bytes from standard error stream. * * @param buffer * @return bytes read (buffer.length()) */ private int readFromErrorStream(byte[] buffer) { try { int nBytesToRead = buffer.length; int nBytesRead = 0; while (nBytesRead < nBytesToRead) { int got = ipc.getErrorStream().read(buffer, nBytesRead, nBytesToRead - nBytesRead); if (got < 0) { if (state == REQUEST_TO_STOP) { return 0; } if (state == CONNECTING) { return got; } throw new IPC.AnIPCException(); } nBytesRead += got; } return nBytesToRead; } catch (IOException ioe) { if (state == REQUEST_TO_STOP) { return 0; } throw new IPC.AnIPCException(ioe); } } // @Override public void run() { while (true) { try { byte[] buffer_1 = new byte[1]; int nBytes = readFromErrorStream(buffer_1); if (state == REQUEST_TO_STOP) { // Connection closed break; } if (nBytes < 0) { // Connection error break; } for (int i = 0; i < nBytes; i++) { char c = (char) buffer_1[i]; if (c == '\n') { System.err.println(unknown_input); unknown_input = ""; } else { unknown_input += c; } } continue; } catch (IPC.AnIPCException ae) { break; // gp-display-text closed stderr } } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCRequestHeader.java������������������������������������������0000644�0001750�0001750�00000005172�14744453367�020470� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; /** * <Header, RequestBody> where * * <p>Header: < HeaderMarker, RequestID, RequestType, ChannelID, nBytes/CancelRequestID/VersionID> * * <p>HeaderMarker (1 byte, value=255) RequestID: Unique numerical identifier generated by GUI - * positive integer - SIZE 4 bytes RequestType (INTEGER: enum SIZE 1 byte) o 0: Default: + Non-DBE * e.g. File Chooser, Remote Shell Command, Signal or + DBE e.g. Load Exp, Drop Exp, Get Data, Set * Filter o 1: Cancel o 2: Handshake ChannelID (INTEGER, SIZE 4 bytes) o 0: Non-DBE, or ignore in * case of Handshake requests o 1, 2, 3, ...: DBE nBytes: number of bytes in the request string. * (SIZE 4 bytes) OR CancelRequestID: For cancellation requests only, the ID of the request being * canceled. 0xFFFF for Cancel all requests OR VersionID: integer indicating version number in case * of Handshake requests * * <p>RequestBody: * * <p>RequestString: Body of the request itself (as a string). */ class IPCRequestHeader { private int requestID; private IPCHandle.RequestType requestType; private int channel; private int value; // nBytes in body (DEFAULT), cancelRequestID (CANCEL), version (HANDSHAKE) protected IPCRequestHeader( int requestID, IPCHandle.RequestType requestType, int channel, int value) { this.requestID = requestID; this.requestType = requestType; this.channel = channel; this.value = value; } protected String getBody() { StringBuilder buf = new StringBuilder(); buf.append(sendByte(IPCProtocol.L_HEADER)); buf.append(sendVal(requestID)); buf.append(sendByte(requestType.index())); buf.append(sendVal(channel)); buf.append(IPCProtocol.encodeVal(value)); return buf.toString(); } private String sendByte(final int b) { return IPCProtocol.encodeByte(b); } private String sendVal(final int i) { return IPCProtocol.encodeVal(i); } /** * @return the requestID */ protected int getRequestID() { return requestID; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCListener.java�����������������������������������������������0000644�0001750�0001750�00000002332�14744453367�017507� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; public interface IPCListener { /** * Fired when ACK is received from IPC * * @param requestId */ public void started(int requestId); /** * Fired when progress is received from IPC * * @param requestId * @param what * @param percentage */ public void progress(int requestId, String what, int percentage); /** * Fired when request has been completed (success, error, canceled, ...) * * @param requestId * @param ipcResult */ public void finished(int requestId, IPCResult ipcResult); } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCLogger.java�������������������������������������������������0000644�0001750�0001750�00000013443�15044710303�017122� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import java.io.PrintStream; import java.util.Date; import java.util.Formatter; /* * Log Levels checks the following bits in the value of SP_ANALYZER_LOG_IPC * 1: log packages * 2: include time stamps * 4: log full package. Default is to trunckate packages at ~80 chars * 8: tracing * * Example: * SP_ANALYZER_LOG_IPC=0 no logging * SP_ANALYZER_LOG_IPC=1 log packages * SP_ANALYZER_LOG_IPC=3 log packages with timestamps (milliseconds since start) * SP_ANALYZER_LOG_IPC=8 tracing */ public class IPCLogger { private static final String ENVVAR = "SP_ANALYZER_LOG_IPC"; private static final String DELAYENVVAR = "SP_ANALYZER_IPC_DELAY"; private static PrintStream printStream = System.out; private static long now = new Date().getTime(); private static int maxNoCharsLogged = 140; private static int noCharsLogged = 0; private static boolean logPackage = false; private static boolean logTimeStamp = false; private static boolean logFullLine = false; private static boolean logTrace = false; private static Object lock = new Object(); private static int ipcDelay = 0; static { // Log level int logLevel = 0; String logIpc = System.getenv(ENVVAR); if (logIpc == null) { logIpc = System.getProperty(ENVVAR); } // Delay (to similuate slow connection (remote) ipcDelay = 0; String ipcDelayString = System.getenv(DELAYENVVAR); if (ipcDelayString == null) { ipcDelayString = System.getProperty(DELAYENVVAR); } if (ipcDelayString != null) { try { ipcDelay = Integer.valueOf(ipcDelayString); } catch (NumberFormatException nfe) { } } if (logIpc != null) { try { if (logIpc.startsWith("0x") || logIpc.startsWith("0X")) { logLevel = Integer.parseInt(logIpc.substring(2), 16); } else { logLevel = Integer.parseInt(logIpc); } logPackage = (logLevel & 1) > 0; logTimeStamp = (logLevel & 2) > 0; logFullLine = (logLevel & 4) > 0; logTrace = (logLevel & 8) > 0; } catch (NumberFormatException nfe) { } if (logLevel > 0) { printStream.println( "IPC logging: trace=" + logTrace + " fullLine=" + logFullLine + " timestamp=" + logTimeStamp + " package=" + logPackage + " now=" + now); } } if (ipcDelay > 0) { String txt = "Adding a " + ipcDelay + "ms delay to all IPC packages to simulate a slow (remote) connection."; System.err.println(txt); } } public static void logRequest(String headerBody, String requestBody) { if (!logPackage) { return; } synchronized (lock) { printStream.println(); printTimeStamp(); printStream.print("REQUEST: "); noCharsLogged = 0; logRequest(headerBody); logRequest(" "); logRequest(requestBody); } } private static void logRequest(String s) { if (s == null) { return; } if (!logPackage) { return; } if (!logFullLine && noCharsLogged >= maxNoCharsLogged) { return; } if (logFullLine) { printStream.print(s); return; } if (noCharsLogged + s.length() >= maxNoCharsLogged) { s = s.substring(0, maxNoCharsLogged - noCharsLogged); } printStream.print(s); noCharsLogged += s.length(); if (noCharsLogged >= maxNoCharsLogged) { printStream.print("..."); noCharsLogged += 3; } } public static void logResponse(byte[] responseHeaderBytes, byte[] responseBody) { if (!logPackage) { return; } synchronized (lock) { printStream.println(); printTimeStamp(); printStream.print(".......: "); noCharsLogged = 0; logResponse(responseHeaderBytes); if (responseBody != null) { logResponse(' '); logResponse(responseBody); } } } private static void logResponse(char c) { if (!logPackage) { return; } if (!logFullLine && noCharsLogged >= maxNoCharsLogged) { return; } printStream.print(c); noCharsLogged++; if (logFullLine) { return; } if (noCharsLogged >= maxNoCharsLogged) { printStream.print("..."); noCharsLogged += 3; } } private static void logResponse(byte[] bytes) { if (!logPackage) { return; } for (byte b : bytes) { logResponse((char) b); } } public static void logTrace(String trace) { if (!logTrace) { return; } printTimeStamp(); printStream.println(trace); } private static void printTimeStamp() { if (logTimeStamp) { printStream.print(timeStamp()); } } private static String timeStamp() { long ts = new Date().getTime() - now; return new Formatter().format("%7d: ", ts).toString(); } public static long getTimeStamp() { long ts = new Date().getTime() - now; return ts; } public static int getIpcDelay() { return ipcDelay; } public static void setIpcDelay(int id) { ipcDelay = id; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ipc/IPCResult.java�������������������������������������������������0000644�0001750�0001750�00000032641�14744453367�017206� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.ipc; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.progress.CancelContext; import org.gprofng.mpmt.progress.Cancellable; import org.gprofng.mpmt.util.gui.AnUtility; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.ParseException; import java.util.Locale; /** */ public class IPCResult implements Cancellable { public enum CC { DEFAULT(0), SUCCESS(1), FAILURE(2), CANCELED(3); private final int value; private CC(int value) { this.value = value; } private int value() { return value; } protected static CC fromValue(int val) { for (CC rt : CC.values()) { if (rt.value() == val) { return rt; } } return null; } }; private IPCHandle ipcHandle; private int requestID; private IPCContext ipcContext; private IPCResponse ipcResponse; private boolean resultIsReady = false; private int curChar; private int iVal; private boolean bVal; private long lVal; private String sVal; private Object aVal; private DecimalFormat format; protected IPCResult(IPCHandle ipcHandle, int requestID, IPCContext ipcContext) { this.ipcHandle = ipcHandle; this.requestID = requestID; this.ipcContext = ipcContext; curChar = 0; format = new DecimalFormat(); format.setDecimalFormatSymbols( new DecimalFormatSymbols(Locale.US)); // Use non-localized double values } protected IPCHandle getIPCHandle() { return ipcHandle; } protected int getRequestID() { return requestID; } // Public begin public CC getCC() { waitForResult(); return ipcResponse.getHeader().getResponseStatus(); } public int getInt() { waitForResult(); readResult(); return iVal; } public String getString() { waitForResult(); readResult(); return sVal; } public long getLong() { waitForResult(); readResult(); return lVal; } public boolean getBoolean() { waitForResult(); readResult(); return bVal; } public Object getObject() { waitForResult(); readResult(); return aVal; } public Object[] getObjects() { return (Object[]) getObject(); } public String[] getStrings() { return (String[]) getObject(); } public int[] getInts() { return (int[]) getObject(); } public long[] getLongs() { return (long[]) getObject(); } public boolean[] getBooleans() { return (boolean[]) getObject(); } public void getVoid() { waitForResult(); } public int getVersion() { waitForResult(); if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.HANDHAKE) { return ipcResponse.getHeader().getnBytes(); } return -1; } /** Send a cancel request for this particular request */ public boolean cancel() { IPCHandle cancelIPCHandle = IPCHandle.newCancelIPCHandle(ipcContext, requestID); IPCResult ipcResult = cancelIPCHandle.sendRequest(); // no body if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { IPCLogger.logTrace( ipcResult.getRequestID() + " IPCResult Cancel SUCCESS channel " + ipcContext.getChannel()); return true; // it is being cancelled } else { IPCLogger.logTrace( ipcResult.getRequestID() + " IPCResult Cancel FAILURE channel " + ipcContext.getChannel()); System.err.println( "Cancel FAILURE channel " + ipcContext.getChannel() + " (may not work yet)"); return false; // not being cancelled (not cancellable?) } } /** rewinds input buffer so it can be read again with getXxxx() */ public void rewindInputBuffer() { curChar = 0; } // Public end protected void started(int requestId) { IPCLogger.logTrace(requestId + " IPCResult started "); if (ipcContext.isSystemProgressBar() && ipcContext.isCancellable()) { CancelContext cancelContext = new CancelContext(ipcContext.getTaskName(), this); AnWindow.getInstance().getSystemProgressPanel().setProgressCancelContext(cancelContext); } } protected void progress(IPCResponse ipcResponse) { IPCLogger.logTrace(ipcResponse.getHeader().getRequestID() + " IPCResult progress "); if (ipcContext.isSystemProgressBar()) { IPCProtocol.CurChar curChar = new IPCProtocol.CurChar(); int progress = IPCProtocol.decodeByte(ipcResponse.getBody(), curChar); int percentage = IPCProtocol.decodeIVal(ipcResponse.getBody(), curChar); String what = IPCProtocol.decodeSVal(ipcResponse.getBody(), curChar); AnWindow.getInstance().getSystemProgressPanel().setProgress(percentage, what); } } protected void finished(int requestId, IPCResponse ipcResponse) { IPCLogger.logTrace(requestId + " IPCResult finished "); this.ipcResponse = ipcResponse; resultIsReady(); Analyzer.getInstance().IPC_session.getIPCReader().removeFromRequestPool(requestId); } protected void fireResponse(IPCResponse ipcResponse) { if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.ACK) { started(ipcResponse.getHeader().getRequestID()); } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.COMPLETE) { finished(ipcResponse.getHeader().getRequestID(), ipcResponse); } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.HANDHAKE) { finished(ipcResponse.getHeader().getRequestID(), ipcResponse); } else if (ipcResponse.getHeader().getResponseType() == IPCResponseHeader.ResponseType.PROGRESS) { progress(ipcResponse); } else { assert false; } } protected void waitForResult() { AnUtility.checkIfOnAWTThread(false); waitOrNotify(true); if (ipcResponse == null) { System.out.println("" + requestID + " ipcResponse1 " + ipcResponse); } } protected void resultIsReady() { waitOrNotify(false); } protected synchronized void waitOrNotify(boolean readData) { if (readData) { IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 1 " + resultIsReady); if (!resultIsReady) { while (!resultIsReady) { try { IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 2 " + resultIsReady); this.wait(); IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 3 " + resultIsReady); } catch (InterruptedException ie) { IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 4 " + resultIsReady); } } } else { IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 5 " + resultIsReady); } } else { resultIsReady = true; IPCLogger.logTrace(requestID + " IPCResult waitOrNotify 6 " + resultIsReady); this.notify(); } } private int nextChar() { if (curChar < ipcResponse.getBody().length) { return ipcResponse.getBody()[curChar++]; } else { System.err.println("IPCResult " + curChar + " " + ipcResponse.getBody().length); assert false; return 'x'; } } private int readByte() { int val = 0; for (int i = 0; i < 2; i++) { final int c = nextChar(); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': val = val * 16 + c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': val = val * 16 + c - 'a' + 10; break; } } return val; } private int readIVal() { int val = readByte(); for (int i = 0; i < 3; i++) { val = val * 256 + readByte(); } return val; } private long readLVal() { long val = readByte(); for (int i = 0; i < 7; i++) { val = val * 256 + readByte(); } return val; } private boolean readBVal() { final int val = readByte(); return val != 0; } private char readCVal() { final int val = readByte(); return (char) val; } /** * Reads double value This method is synchronized because "format" is not thread safe * * @return double value */ private synchronized double readDVal() { final String s = readSVal(); final double DValue; try { DValue = format.parse(s).doubleValue(); // format is not thread safe } catch (ParseException ex) { ex.printStackTrace(); return 0.0; } return DValue; } private String readSVal() { final int len = readIVal(); if (len == -1) { return null; } final String s = new String(ipcResponse.getBody(), curChar, len); curChar = curChar + len; return s; } private Object readAVal() { boolean twoD = false; int type = readByte(); if (type == IPCProtocol.L_ARRAY) { twoD = true; type = readByte(); } final int len = readIVal(); if (len == -1) { return null; } switch (type) { case IPCProtocol.L_INTEGER: if (twoD) { final int[][] array = new int[len][]; for (int i = 0; i < len; i++) { array[i] = (int[]) readAVal(); } return array; } else { final int[] array = new int[len]; for (int i = 0; i < len; i++) { array[i] = readIVal(); } return array; } // break; case IPCProtocol.L_LONG: if (twoD) { final long[][] array = new long[len][]; for (int i = 0; i < len; i++) { array[i] = (long[]) readAVal(); } return array; } else { final long[] array = new long[len]; for (int i = 0; i < len; i++) { array[i] = readLVal(); } return array; } // break; case IPCProtocol.L_DOUBLE: if (twoD) { final double[][] array = new double[len][]; for (int i = 0; i < len; i++) { array[i] = (double[]) readAVal(); } return array; } else { final double[] array = new double[len]; for (int i = 0; i < len; i++) { array[i] = readDVal(); } return array; } // break; case IPCProtocol.L_BOOLEAN: if (twoD) { final boolean[][] array = new boolean[len][]; for (int i = 0; i < len; i++) { array[i] = (boolean[]) readAVal(); } return array; } else { final boolean[] array = new boolean[len]; for (int i = 0; i < len; i++) { array[i] = readBVal(); } return array; } // break; case IPCProtocol.L_CHAR: if (twoD) { final char[][] array = new char[len][]; for (int i = 0; i < len; i++) { array[i] = (char[]) readAVal(); } return array; } else { final char[] array = new char[len]; for (int i = 0; i < len; i++) { array[i] = readCVal(); } return array; } // break; case IPCProtocol.L_STRING: if (twoD) { final String[][] array = new String[len][]; for (int i = 0; i < len; i++) { array[i] = (String[]) readAVal(); } return array; } else { final String[] array = new String[len]; for (int i = 0; i < len; i++) { array[i] = readSVal(); } return array; } // break; case IPCProtocol.L_OBJECT: if (twoD) { final Object[][] array = new Object[len][]; for (int i = 0; i < len; i++) { array[i] = (Object[]) readAVal(); } return array; } else { final Object[] array = new Object[len]; for (int i = 0; i < len; i++) { array[i] = readAVal(); } return array; } // break; } return null; } private void readResult() { if (AnUtility.checkIPCOnWrongThread()) { AnUtility.checkIfOnAWTThread(false); } for (; ; ) { // AnMemoryManager.getInstance().checkMemoryUsage(); final int tVal = readByte(); switch (tVal) { case IPCProtocol.L_INTEGER: iVal = readIVal(); break; case IPCProtocol.L_LONG: lVal = readLVal(); break; case IPCProtocol.L_BOOLEAN: bVal = readBVal(); break; case IPCProtocol.L_STRING: sVal = readSVal(); break; case IPCProtocol.L_ARRAY: aVal = readAVal(); break; default: System.err.println("Unknown code: " + tVal); break; } return; } } } �����������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CalledByCallsDisassemblyView.java����������������������������������0000644�0001750�0001750�00000002011�14744453367�022276� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; public final class CalledByCallsDisassemblyView extends CalledByCallsDisp { public CalledByCallsDisassemblyView() { super( AnWindow.getInstance(), AnDisplay.DSP_Callers, AnVariable.HELP_TabsDisassembly, AnDisplay.DSP_Disassembly); setAccessibility(AnLocale.getString("Called By Calls")); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnAction.java������������������������������������������������������0000644�0001750�0001750�00000010471�14744453367�016312� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Insets; import java.awt.event.ActionEvent; import javax.accessibility.AccessibleContext; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.KeyStroke; public class AnAction extends AbstractAction { private String text; private Icon icon; private String tooltipText; private String accDescription; private Action action; private KeyStroke keyStroke = null; private Character mnemonic = null; private JMenuItem menuItem = null; public AnAction(String text, Action action) { this(text, null, null, null, action); } public AnAction(String text, Icon icon, Action action) { this(text, icon, null, null, action); } public AnAction( String text, Icon icon, String tooltipText, String accDescription, Action action) { super(text, icon); this.text = text; this.icon = icon; this.tooltipText = tooltipText; if (accDescription != null) { this.accDescription = accDescription; } else { this.accDescription = text; } this.action = action; } public JButton createActionButton() { JButton actionButton = new AnIconButton(icon); actionButton.setMargin(new Insets(4, 5, 4, 5)); actionButton.setHideActionText(true); actionButton.setAction(this); actionButton.setActionCommand((String) getValue(Action.NAME)); actionButton.setToolTipText(getTooltipText()); AccessibleContext context = actionButton.getAccessibleContext(); context.setAccessibleName(text); context.setAccessibleDescription(accDescription); return actionButton; } public JMenuItem getMenuItem() { return getMenuItem(true); } public JMenuItem getMenuItem(boolean addAccelerator) { if (menuItem == null) { menuItem = new JMenuItem(); menuItem.setText(text); menuItem.setAction(this); if (keyStroke != null) { if (addAccelerator) { menuItem.setAccelerator(keyStroke); } else { menuItem.setText(text + AnUtility.keyStrokeToStringFormatted(keyStroke)); } } if (mnemonic != null) { menuItem.setMnemonic(mnemonic); } } return menuItem; } public void setKeyboardShortCut(KeyStroke keyStroke) { setKeyboardShortCut(AnWindow.getInstance().getMainPanel(), keyStroke.toString(), keyStroke); } public void setKeyboardShortCut(JPanel panel, String id, KeyStroke keyStroke) { this.keyStroke = keyStroke; if (panel != null) { panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(keyStroke, id); panel .getActionMap() .put( id, new AbstractAction() { @Override public void actionPerformed(ActionEvent ev) { AnAction.this.actionPerformed(ev); } }); } } public void setMnemonic(char m) { mnemonic = m; } @Override public void actionPerformed(final ActionEvent event) { action.actionPerformed(event); } public String getTooltipText() { String tt = tooltipText; if (tt == null) { tt = text; } if (tt != null && keyStroke != null) { tt = tt + AnUtility.keyStrokeToStringFormatted(keyStroke); } return tt; } public String getText() { return text; } public String getTextNoDots() { String textnd = text; if (textnd != null && textnd.endsWith("...")) { textnd = textnd.substring(0, textnd.length() - 3); } return textnd; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/MiniFuncListDisp.java����������������������������������������������0000644�0001750�0001750�00000016700�14744453367�020003� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.overview.OverviewPanel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JScrollPane; public class MiniFuncListDisp extends FuncListDisp { private int[] src_type; public MiniFuncListDisp(final AnWindow window, final int type, final String help_id) { super(window, type, 0, help_id); } // Initialize GUI components @Override protected void initComponents() { // System.err.println("XXX In FLD initComponents()"); setLayout(new BorderLayout()); String acName = null; String acDesc = null; JLabel acLabel = null; switch (type) { case AnDisplay.DSP_Functions: acName = AnLocale.getString("Functions"); acDesc = AnLocale.getString("Show function list"); break; } if (acName != null) { acLabel = new JLabel(acName, JLabel.RIGHT); } table = new AnTable( DSP_MiniFunctions, true, true, false, false, true, true, false, acName, acDesc, acLabel); // HERE table.setParent(this); if (acLabel != null) { acLabel.setVisible(false); acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); } table.addAnListener(new TableHandler()); table.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); add(table, BorderLayout.CENTER); } // static int count = 0; @Override public void doCompute() { // System.out.println("MiniFuncListDisp - doCompute " + count++ + selected + " " + // computed + " " + type); final long sel_obj; int new_ind; final int sort_ind; final Object[] raw_data; final String errstr, pwarnstr; final MetricLabel[] label; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (inCompute) { // NM TEMPORARY should be synchronized return; } else { inCompute = true; } // System.err.println("XXX In FLD doCompute - 1 ()"); // window.setBusyCursor(true); // System.err.println("XXX In FLD doCompute - 3 ()"); sel_obj = window.getSelectedObject().getSelObj(type, subtype); if (can_sort) { // Function/LINE/PC sel_func = sel_obj; } else { // Annotated src/dis sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // Required to initialize Functions list } // Special code for Index tabs and for OpenMP tabs int typeForPresentation = type; String typeStr = "INDEXOBJ"; String subtypeStr = "" + subtype; String modeStr = "ALL"; String mlistStr = "MET_INDX"; if (isOmpInxObj()) { mlistStr = "MET_NORMAL"; typeForPresentation = AnDisplay.DSP_Functions; } if (!computed) { // need re-compute // System.err.println("XXX In FLD doCompute - 4 ()"); reset(); // window.setBusyCursor(true); // new_ind = setFuncData(sel_func, type, subtype); window .getFunctionsView() .computeIfNeeded(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) errstr = window.getMsg(AnUtility.ERROR_MSG); // Update table if (errstr == null) { // System.err.println("XXX In FLD doCompute - 5 ()"); table.setViewport(); Object[][] table_data; raw_data = getFuncListMini(type, subtype); if ((raw_data == null) || (raw_data.length < 1)) { String txt = "IPC ERROR (?) in MiniFuncListDisp: raw_data is null or empty"; AnLog.log(txt); inCompute = false; return; // No data } final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(typeForPresentation); table_data = localProcessData( mlist, raw_data); // first index is for column, second index is for rows // System.err.println("XXX after processData table_data.length = " + table_data.length + "; // row_length " + table_data[0].length ); src_type = (int[]) raw_data[raw_data.length - 1]; // AnTable.AT_SRC, DIS, QUOTE, etc. String[] hdrContent = getNames(typeForPresentation, 0); // name column table header contents (?) label = getSettings() .getMetricsSetting() .getLabel(table_data, null, typeForPresentation, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(getMetricMType()); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(typeForPresentation); new_ind = 0; table.setData(label, table_data, hdrContent, src_type, new_ind, name_col, sort_ind); table.repaint(); } else { // System.err.println("XXX In FLD doCompute - 6 ()"); window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); table.showMessage(errstr); } OverviewPanel.getInstance().previewChanged(); } // table.requestFocus(); computed = true; // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } inCompute = false; } // Listener for updating table private final class TableHandler implements AnListener { @Override public void valueChanged(final AnEvent event) { final int from; final int to; int stype = 0; final boolean can_nav; switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting break; case AnEvent.EVT_SORT: // Sorting break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } from = event.getValue(); to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, getMetricMType()); break; } } } private Object[] getFuncListMini(final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("getFuncListMini"); window.IPC().send(0); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } } ����������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/Analyzer.java������������������������������������������������������0000644�0001750�0001750�00000223172�15044710303�016363� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.collect.Collector; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCLogger; import org.gprofng.mpmt.ipc.IPCProtocol; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.metrics.MetricColors; import org.gprofng.mpmt.metrics.MetricColors.MetricColor; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.remote.ConnectionDialog; import org.gprofng.mpmt.remote.ConnectionManager; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Date; import java.util.List; import java.util.Locale; import javax.swing.JOptionPane; public final class Analyzer { // Runtime environment public static final String PERFORMANCE_ANALYZER_RELEASE_NAME = "gprofng GUI"; public static final String jvm_ver = System.getProperty("java.version", "unknown"); public static final String jvm_home = System.getProperty("java.home", "unknown"); public static final String home_dir = UserPref.getHomeDirectory(); // System.getProperty("user.home", "."); private String workingDirectory = System.getProperty("user.dir", "."); public String os_name = null; public String er_print = null; public String localHost = null; public String remoteConnectCommand = null; // For example, "ssh USER@HOST" public String remoteGprofngPath = null; public String remoteConnection = null; public String remoteHost = null; public String remoteShell = "/usr/bin/ssh"; public static ClassLoader cls_loader = null; public boolean normalSelection = false; // Right click changes selection public boolean IPC_started = false; public boolean connectingToRemoteHost = false; // true during the connecting process public boolean connectingToRemoteHostEnabled = true; public boolean profileRunningProcessEnabled = false; public boolean kernelProfilingEnabled = false; public boolean old_IPC_status = false; public int cur_id = 0; public static boolean compareMode = false; public static String fdversion, fdhome, licpath, licsts; public IPC IPC_session = null; public IPC old_IPC_session = null; private static Analyzer instance; private static String[] arguments = null; private AnFrame anFrame = null; private ConnectionManager connectionManager = null; private String emptyString = ""; // Known connection problems private String known_problem_0 = AnLocale.getString("Empty host name is not valid."); private String known_problem_1 = AnLocale.getString("Authentication failed. User name or password did not match"); private String known_problem_2 = AnLocale.getString("Authentication failed. Password is required."); private String known_problem_3 = AnLocale.getString("Connection failed. Timeout."); private String known_problem_4 = AnLocale.getString("Authentication failed. Password was not requested."); private String known_problem_5 = AnLocale.getString("Connection failed. Host is unreachable."); private String known_problem_6 = AnLocale.getString("Connection failed. Installation path is not correct."); private String known_problem_7 = AnLocale.getString("Connection failed. Unrecognized reply from remote host."); private String known_problem_8 = AnLocale.getString("Connection failed. Canceled by user."); private String known_problem_9 = AnLocale.getString("Connection failed. Incompatible versions."); public String known_problem_10 = AnLocale.getString("Stream Closed"); // Explanations for known connection problems private String explanation_0 = AnLocale.getString("Empty host name is not valid. Please specified remote host."); private String explanation_3_1 = AnLocale.getString( "gprofng GUI did not get a reply from the remote host. Please check that the" + " specified remote host exists, and the specified remote gprofng path exists on the" + " remote host."); private String explanation_3_2 = AnLocale.getString( "gprofng GUI did not get a reply from the remote host. Please check that the" + " specified remote gprofng path exists on the remote host."); private String explanation_9 = AnLocale.getString( "gprofng GUI version does not match version on the remote host as specified by" + " the remote gprofng path."); // Connection protocol version private static String IPC_PROTOCOL = IPCProtocol.IPC_PROTOCOL_STR; private final String ipc_protocol = IPC_PROTOCOL; public static final String DisplayAppName = "gp-display-text"; private static final String CollectAppName = "gp-collect-app"; private static final String KernelAppName = "gp-collect-kernel"; public Analyzer() { instance = this; // Find installed directory fdhome & nbhome cls_loader = Analyzer.class.getClassLoader(); fdhome = AnUtility.findResourceHome(cls_loader, "org/gprofng/mpmt/Analyzer.class"); // Method AnUtility.findResourceHome()returns wrong path on Windows // System.err.println("AnUtility.findResourceHome returned fdhome = " + fdhome); os_name = System.getProperty("os.name"); if (os_name.contains("Windows")) { remoteShell = "ssh"; if (fdhome.length() > 2 && fdhome.charAt(2) == ':' && fdhome.charAt(0) == '/') { fdhome = fdhome.substring(1); } } licpath = System.getProperty("analyzer.licpath", fdhome + "/lib/serial.dat"); String s = AnUtility.getenv("GPROFNG_DEBUG"); if (s != null) { try { AnUtility.debugFlags = Integer.parseInt(s); } catch (NumberFormatException e) { } } IPC_session = new IPC(this); } public static Analyzer getInstance() { return instance; } public void initMetricColors() { UserPref userPref = UserPref.getInstance(); if (userPref.getCustomMetricColors() != null) { for (MetricColor metricColor : userPref.getCustomMetricColors()) { MetricColors.setCustomMetricColor(metricColor.getMetricName(), metricColor.getColor()); } } } /** * @return the workingDirectory */ public String getWorkingDirectory() { // System.out.println("getWorkingDirectory: " + workingDirectory); return workingDirectory; } /** * @param workingDirectory the workingDirectory to set */ public void setWorkingDirectory(String workingDirectory) { // System.out.println("setWorkingDirectory: " + workingDirectory); this.workingDirectory = workingDirectory; setCurrentDirectory(workingDirectory); // IPC call AnWindow.getInstance().updateWorkingDirectoryStatus(); } /** * @param workingDirectory the workingDirectory to set */ public void initWorkingDirectory() { if (IPC_session == null) { workingDirectory = System.getProperty("user.dir", "."); } else { String wd = getCurrentDirectory(); // IPC call! if (wd == null) { wd = System.getProperty("user.dir", "."); } workingDirectory = wd; } } /** * @return returns name of remote host in case of a remote connection otherwise it returns * "localhost" */ public String getHost() { if (remoteHost != null) { return remoteHost; } return "localhost"; } /** * @return returns name of local host */ public String getLocalHost() { return localHost; } /** * @return returns name of remote host in case of a remote connection otherwise it returns null */ public String getRemoteHost() { String remoteHostName = null; if (isRemote()) { remoteHostName = remoteHost; } return remoteHostName; } /** * @return returns whether it is connected remotely */ public boolean isRemote() { return remoteConnection != null; } /** * @return returns whether it is connected locally or remotely */ public boolean isConnected() { return (IPC_started); } /** * @return returns whether kernel profiling is enabled */ public boolean isKernelProfilingEnabled() { return kernelProfilingEnabled; } /** Start Connection Manager */ public void startConnectionManager() { if (null == connectionManager) { connectionManager = new ConnectionManager(); if (connectionManager != null) { connectionManager.start(); } } if (connectionManager != null) { connectionManager.startChecking(); } } /** Stop Connection Manager */ public void stopConnectionManager() { if (connectionManager != null) { connectionManager.stopChecking(); } } private String get_exe_name(String nm) { if (nm != null && !nm.equals(emptyString) && Files.exists(Paths.get(nm))) { return nm; } return null; } public void startIPC() throws Exception { if (IPC_started) { return; } fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CHANGING); // $SP_ANALYZER_CONFIG_MODE may be set to "R" to tell the spawned // gp-display-text to configure for race detection // It will spawn gp-display-text -RIPC, rather than -IPC in that case // // $SP_COLLECTOR_IPC_DEBUG may be set to a string to use to prepend // to the gp-display-text -[R]IPC command -- examples: // "LD_PRELOAD mem.so; " // "collect -Z -O /dev/null" -- to do the same thing // "collect -p on -H on -O /dev/null" to collect an experiments // The -O command is necessary, since any IO from // collect to stdout before the gp-display-text target is // spawned will confuse the GUI and gp-display-text // communication channel. // "dbx ..." can not be prepended, because there's no way to convince // dbx to not write anything to stdout, and anything written // will confuse the gp-display-text process String str = null; // AnUtility.getenv("SP_COLLECTOR_IPC_DEBUG"); if (str != null && !str.equals(emptyString)) { IPCLogger.logTrace("\n" + "analyzer: SP_COLLECTOR_IPC_DEBUG `" + str + "'"); } else { str = emptyString; } String cmode = AnUtility.getenv("SP_ANALYZER_CONFIG_MODE"); if (cmode == null) { cmode = emptyString; } else if (cmode.equals(emptyString)) { // OK, but why was this set? } else if (!cmode.equals("R")) { System.err.println("analyzer: SP_ANALYZER_CONFIG_MODE `" + cmode + "' unrecognized"); System.exit(1); } // SP_ANALYZER_ER_PRINT may be set to use the other gp-display-text. // Also SP_ANALYZER_ER_PRINT can be used instead SP_COLLECTOR_IPC_DEBUG // For example:: // "ssh host /bin/gp-display-text" - to use // the other gp-display-text on the other machine. // "LD_PRELOAD mem.so /opt/SUNWSpro/bin/gp-display-text" // "collect -H on -O /dev/null /bin/gp-display-text" - // to collect an experiments. // The -O command is necessary, since any IO from // collect to stdout before the gp-display-text target is // spawned will confuse the GUI and gp-display-text // communication channel. if (er_print == null || er_print.equals(emptyString)) { er_print = AnUtility.getenv("SP_ANALYZER_ER_PRINT"); } if (er_print == null || er_print.equals(emptyString)) { er_print = getPathToApp(DisplayAppName); } else { IPCLogger.logTrace("\n" + "analyzer: SP_ANALYZER_ER_PRINT='" + er_print + "'"); if (remoteConnection != null) { if (str.equals(emptyString)) { str = remoteConnection; } else { str = remoteConnection + " " + str; } } } AnLog.log("analyzer: gp-display-text=" + er_print + "\n"); // Check the OS - only Solaris and Linux are supported if (remoteHost == null) { if (null == os_name) { throw new Exception("OS is not supported yet."); } if ((!os_name.equals("SunOS")) && (!os_name.equals("Linux"))) { throw new Exception("OS " + os_name + " is not supported yet."); } } String er_printCmd; if (str.equals(emptyString)) { er_printCmd = er_print + " -" + cmode + "IPC"; } else { er_printCmd = str + " " + er_print + " -" + cmode + "IPC"; } // IPC_session.init(er_printCmd + " -" + cmode + "IPC"); String tracelevel = null; // AnUtility.getenv("SP_ER_PRINT_TRACE_LEVEL"); if (tracelevel != null) { String er_printCmd_extn = " -E SP_ER_PRINT_TRACE_LEVEL=" + tracelevel; er_printCmd = er_printCmd + er_printCmd_extn; } stopConnectionManager(); IPC_session.init(er_printCmd, true); setIPCStarted(true); startConnectionManager(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CHANGED); } /** * Creates new IPC connection Connection_thread * * @param cc * @param host * @param name * @param p * @param connectCommand * @param path * @return */ public String createNewIPC( ConnectionDialog cc, String host, String name, char[] p, String connectCommand, String path) { kernelProfilingEnabled = false; AnLog.log("host: " + host); AnLog.log("name: " + name); AnLog.log("p: " + (p == null ? "NULL" : String.valueOf(p))); AnLog.log("connectCommand: " + connectCommand); AnLog.log("path: " + path); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CHANGING); stopConnectionManager(); // Destroy old IPC session if (null != old_IPC_session) { IPC new_IPC_session = IPC_session; IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); old_IPC_session.destroyIPCProc(); IPC_session = new_IPC_session; } // Save current IPC session old_IPC_session = IPC_session; old_IPC_status = IPC_started; IPC newIPC = new IPC(this); String path_to_er_print = DisplayAppName; String l_fdhome = emptyString; if (null != path) { l_fdhome = path.trim(); if (l_fdhome.length() > 0) { if (!l_fdhome.equals(path_to_er_print)) { if (l_fdhome.endsWith("/" + DisplayAppName)) { path_to_er_print = l_fdhome; } else if (l_fdhome.endsWith("/bin/")) { path_to_er_print = l_fdhome + DisplayAppName; } else if (l_fdhome.endsWith("/bin")) { path_to_er_print = l_fdhome + "/" + DisplayAppName; } else if (l_fdhome.endsWith("/")) { path_to_er_print = l_fdhome + "bin/" + DisplayAppName; } else { path_to_er_print = l_fdhome + "/bin/" + DisplayAppName; } } } AnLog.log("path: " + path); } AnLog.log("l_fdhome: " + l_fdhome); AnLog.log("str_gp_display_text: " + DisplayAppName); int i = path_to_er_print.lastIndexOf(DisplayAppName); String path_to_collect = path_to_er_print.substring(0, i) + CollectAppName; String er_printCmd = path_to_er_print; String rc = null; String emsg = null; // Authentication String rh = host; if (rh != null) { rh = rh.trim(); // remove spaces } // Empty host name is not accepted if (rh == null || rh.length() == 0) { return AnLocale.getString("Empty host name is not valid."); } if (rh.length() > 0 && !rh.equals("localhost")) { // Add user name if it is not empty if (name != null) { name = name.trim(); // remove spaces if (name.length() > 0) { rh = name + "@" + rh; } } remoteConnectCommand = connectCommand + " " + rh; er_printCmd = remoteConnectCommand + " " + er_printCmd; } rc = er_printCmd; er_printCmd = er_printCmd + " -IPC"; String tracelevel = null; // AnUtility.getenv("SP_ER_PRINT_TRACE_LEVEL"); if (tracelevel != null) { er_printCmd = er_printCmd + " -E SP_ER_PRINT_TRACE_LEVEL=" + tracelevel; } if (ipc_protocol != null) { er_printCmd = er_printCmd + " -E SP_IPC_PROTOCOL=" + ipc_protocol; } // Initialize new IPC connection - start gp-display-text try { AnLog.log("Start connection:\n" + er_printCmd); newIPC.init(er_printCmd, false); sendP(newIPC, p, cc); er_print = path_to_er_print; } catch (Exception e) { newIPC.destroyIPCProc(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return (e.getMessage()); } newIPC.getIPCReader().runThread(); // TEMPORARY FOR DEBUG if (IPC_started) { // see newinit() // AnFrame if fully initialized try { IPC_session = newIPC; // Version Handshake int res = versionHandshake(); if (res != 0) { fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return AnLocale.getString("Connection failed: versions do not match"); } IPC_initView(0, -1); if (cc.cancelRequest) { emsg = AnLocale.getString("Connection canceled"); } } catch (Exception e) { emsg = AnLocale.getString("Cannot establish connection with remote host ") + rh; } if (emsg != null) { // Could not establish new connection IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); newIPC.destroyIPCProc(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return (emsg); } // Successfully connected! remoteHost = rh; remoteConnection = rc; // Clean everything that belongs to the old IPC session IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); // Use new IPC session IPC_session = newIPC; // Version Handshake int res = versionHandshake(); if (res != 0) { fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return AnLocale.getString("Connection failed: versions do not match"); } syncTime(); // Call initApplication String l_licpath = System.getProperty("analyzer.licpath", l_fdhome + "/lib/serial.dat"); String[] args = new String[1]; args[0] = er_print; String[] license_info = new String[2]; license_info[0] = "ERROR"; license_info[1] = "Unknown"; try { license_info = initApplication(false, l_fdhome, l_licpath, args); } catch (Exception e) { if (null == license_info[0]) { license_info[0] = "ERROR"; } } String l_licsts = license_info[0]; String l_fdversion = license_info[1]; if (l_licsts != null && l_licsts.equals("ERROR")) { // Problem getting license emsg = AnLocale.getString("License Path: ") + l_licpath + "\n" + AnLocale.getString("Error: ") + l_fdversion; // Restore old IPC_session IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); newIPC.destroyIPCProc(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return (emsg); } } else { // need AnFrame initialization if (old_IPC_status) { // can it be true? // Clean everything that belongs to the old IPC session IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); } // Use new IPC session IPC_session = newIPC; IPC_started = true; // Version Handshake int res = versionHandshake(); if (res != 0) { return AnLocale.getString("Connection failed: versions do not match"); } // Call initApplication String l_licpath = System.getProperty("analyzer.licpath", l_fdhome + "/lib/serial.dat"); String[] args = new String[1]; args[0] = er_print; String[] license_info = new String[2]; license_info[0] = "ERROR"; license_info[1] = "Unknown"; try { license_info = initApplication(false, l_fdhome, l_licpath, args); } catch (Exception e) { if (null == license_info[0]) { license_info[0] = "ERROR"; } } String l_licsts = license_info[0]; String l_fdversion = license_info[1]; if (l_licsts != null && l_licsts.equals("ERROR")) { emsg = AnLocale.getString("License Path: ") + l_licpath + "\n" + AnLocale.getString("Error: ") + l_fdversion; // Restore old IPC_session IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); newIPC.destroyIPCProc(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return (emsg); } try { // Successfully connected! remoteHost = rh; remoteConnection = rc; // Use new IPC session IPC_session = newIPC; setIPCStarted(true); try { initAnalyzerIPC(); } catch (Exception e) { fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return AnLocale.getString("Initialization failed"); } if (cc.cancelRequest) { emsg = AnLocale.getString("Connection canceled"); } } catch (Exception e) { emsg = AnLocale.getString("Cannot establish connection with remote host ") + rh; } if (emsg != null) { // Could not establish new connection IPC_session = old_IPC_session; setIPCStarted(old_IPC_status); newIPC.destroyIPCProc(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); return (emsg); } // Successfully connected! remoteHost = rh; remoteConnection = rc; } // Use new IPC session IPC_session = newIPC; setIPCStarted(true); startConnectionManager(); fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CHANGED); // Measure connection performance (DEBUG) measureConnectionPerformance(cc); // // Check if "er_kernel" is enabled // checkKernelProfilingEnabled(); // Update connection information updateConnectionInfo(host, name, p, path_to_collect); // Synchronize Locale with remote engine if (isRemote()) { synchronizeLocale(); } logInit(); // Create Collector GUI dialog using a background thread (optimization) Thread createCollectorDialog = new Thread( new Runnable() { @Override public void run() { AnWindow.getInstance().resetProfileDialogs(); // AnWindow.getInstance().getRemoteCollectDialog(); } }); createCollectorDialog.run(); return null; } /** * Explain Connection Problem * * @param msg * @return explanation */ public String explainConnectionProblem(String msg, String un) { String explanation = msg; if (msg == null) { return explanation; } if (msg.equals(known_problem_0)) { explanation = explanation_0; } if (msg.equals(known_problem_3) || msg.equals(known_problem_10)) { if ((un == null) || (un.length() < 1)) { explanation = explanation_3_1; } else { explanation = explanation_3_2; } } if (msg.equals(known_problem_9)) { explanation = explanation_9; } return explanation; } private static int connectionID = 0; /** Send pass */ private void sendP(IPC ipc, char[] pass, ConnectionDialog cc) throws Exception { // This is a temporary code, just to prove the concept connectionID++; long ts = System.currentTimeMillis(); boolean skip_pass = false; boolean auth_failed = true; String pattern1 = "Password"; String pattern2 = " " + pattern1 + ":"; String pattern3 = pattern1 + " for "; String pattern4 = "ER_IPC: IPC_PROTOCOL_"; String pattern5 = "Fatal error: host not found: "; String pattern6 = ": not found"; String pattern7 = "Killed"; String pattern8 = "ER_IPC: " + ipc_protocol + "\n"; String pattern9 = "ER_IPC: IPC_PROTOCOL_UNKNOWN\n"; String pattern10 = ": No such file"; String status1 = AnLocale.getString("Looking for remote host..."); String status2 = AnLocale.getString("Verifying authentication..."); String status3 = AnLocale.getString("Connection established. Compatibility checking..."); String status4 = AnLocale.getString("Password is not requested (!?)"); String ask = emptyString; AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") started. Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(status1); if ((null != pass) && (pass.length > 0)) { int c = 190; // timeout 19 seconds // Don't read - another thread (IPCReader) is already reading it. while (c-- > 0) { Thread.sleep(100); ask = ipc.getIPCReader().getUnknownInput(); AnLog.log(String.format("connectionID=%d Timestamp=%ld ask=%s;\n", ts)); if (ask.contains(pattern2)) { break; } if (ask.contains(pattern3)) { break; } if (ask.contains(pattern8)) { // Connection established skip_pass = true; cc.updateConnectionStatus(status3); auth_failed = false; break; } if (ask.contains(pattern4) || ask.contains(pattern9)) { auth_failed = true; // Incompatible IPC protocol ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_9 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_9); throw new Exception(known_problem_9); } if (ask.contains(pattern5)) { auth_failed = true; // Unreachable host ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_5 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_5); throw new Exception(known_problem_5); } if (ask.contains(pattern6) || ask.contains(pattern10)) { auth_failed = true; // Installation path is not correct cc.updateConnectionStatus(known_problem_6); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG throw new Exception(known_problem_6); } if (ask.contains(pattern7)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } } if (!skip_pass) { // got request for the password ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Verifying authentication... Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(status2); for (int i = 0; i < pass.length; i++) { ipc.processInput.write(pass[i]); } ipc.processInput.write('\n'); // ipc.processInput.write('\0'); ipc.processInput.flush(); } else { if (auth_failed) { // Probably the delay is not enough to get the request for the password cc.updateConnectionStatus(status4); System.err.println("Error 1: unrecognized request: " + ask); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 1: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_4 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_4); throw new Exception(known_problem_4); } } c = 190; // timeout 19 seconds while (c-- > 0) { Thread.sleep(100); ask = ipc.getIPCReader().getUnknownInput(); // Check if request for password appeared twice if (ask.contains(pattern1)) { if (skip_pass) { System.err.println("Error 2: unrecognized request: " + ask); auth_failed = true; // Delay is not enough to get request for password ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 2: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_1 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_1); throw new Exception(known_problem_1); } int p = ask.indexOf(pattern1); String s = ask.substring(p + 1); if (s.contains(pattern1)) { auth_failed = true; // Password does not match // System.err.println("Error 3: unrecognized request: " + ask); DEBUG ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 3: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_1 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_1); throw new Exception(known_problem_1); } } if (ask.contains(pattern8)) { // Connection established cc.updateConnectionStatus(status3); auth_failed = false; break; } if (ask.contains(pattern4) || ask.contains(pattern9)) { auth_failed = true; // Incompatible IPC protocol ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_9 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_9); throw new Exception(known_problem_9); } if (ask.contains(pattern5)) { auth_failed = true; // Unreachable host ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_5 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_5); throw new Exception(known_problem_5); } if (ask.contains(pattern6) || ask.contains(pattern10)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.contains(pattern7)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.length() > 100000) { // Why so many? Something wrong. auth_failed = true; System.err.println("Error 4: unrecognized request: " + ask); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 4: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_7 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_7); throw new Exception(known_problem_7); } } // Check if connection failed if (ipc_protocol == null) { auth_failed = false; // we don't know for sure } if (auth_failed) { System.err.println("Error 5: unrecognized request: " + ask); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 5: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_3 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_3); throw new Exception(known_problem_3); } // Looks like everything is ok. Try to continue } else { // connection without password if (ipc_protocol != null) { ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Connecting ... Timestamp=" + ts); // DEBUG // this hangs if er_print do not send confirmation int c = 190; // timeout 19 seconds // Don't read - another thread (IPCReader) is already reading it. ask = emptyString; while (c-- > 0) { Thread.sleep(100); ask = ipc.getIPCReader().getUnknownInput(); if (ask.contains(pattern8)) { // Connection established cc.updateConnectionStatus(status3); auth_failed = false; break; } if (ask.contains(pattern1)) { auth_failed = true; // System.err.println("Error 6: unrecognized request: " + ask); DEBUG ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 6: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_2 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_2); throw new Exception(known_problem_2); } if (ask.contains(pattern4) || ask.contains(pattern9)) { auth_failed = true; // Incompatible IPC protocol ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_9 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_9); throw new Exception(known_problem_9); } if (ask.contains(pattern5)) { auth_failed = true; // Unreachable host ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_5 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_5); throw new Exception(known_problem_5); } if (ask.contains(pattern6) || ask.contains(pattern10)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.contains(pattern7)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.length() > 100000) { // Why so many? Something wrong. auth_failed = true; System.err.println("Error 7: unrecognized request: " + ask); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 7: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_3 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_3); throw new Exception(known_problem_3); } } } } if (auth_failed) { System.err.println("Error 8: unrecognized request: " + ask); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") Error 8: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_3 + " Timestamp=" + ts); // DEBUG cc.updateConnectionStatus(known_problem_3); throw new Exception(known_problem_3); } // Sleep a little to make sure IPCReader got all bytes from the connection step Thread.sleep(100); ts = System.currentTimeMillis(); AnLog.log( "analyzer: Connect to Remote Host(Connection ID=" + connectionID + ") succeeded. Timestamp=" + ts); // DEBUG } private void measureConnectionPerformance(ConnectionDialog cc) { String runTest = null; // AnUtility.getenv("SP_ANALYZER_SPEED_TEST"); runTest = AnUtility.getenv("SP_ANALYZER_SPEED_TEST"); // DEBUG XXX SWITCH OFF WHEN RELEASE if (runTest == null || runTest.equals("0")) { return; } // Measure connection performance - loop of SYNC calls if (cc != null) { cc.updateConnectionStatus( AnLocale.getString("Connection established. Checking connection performance...")); } long totalBytes = IPC_session.getIPCReader().getTotalReceivedBytes(); long totalMsg = IPC_session.getIPCReader().getTotalReceivedMessages(); long t1 = System.currentTimeMillis(); int max = 100; int k = Integer.valueOf(runTest); if (k > 0) { max = max * k; } for (int i = 0; i < max; i++) { versionHandshake(); // syncTime(); } long t2 = System.currentTimeMillis(); totalBytes = IPC_session.getIPCReader().getTotalReceivedBytes() - totalBytes; totalMsg = IPC_session.getIPCReader().getTotalReceivedMessages() - totalMsg; // System.err.println("Connection performance (SYNC): Total bytes 2=" + totalBytes + " bytes. // Total messages 2=" + totalMsg + " msg."); // DEBUG long delta = t2 - t1; if (delta <= 0) { delta = 1; } double upload = (((double) totalBytes * 1000) / delta); double temp = (((double) totalMsg * 1000) / delta); System.err.println("Connection performance (SYNC): Loop count=" + max); // DEBUG System.err.printf( "Connection performance (SYNC): Upload=%.2f bytes/sec. Temp=%.2f messages/sec.\n", upload, temp); // DEBUG AnLog.log( "Connection performance (SYNC): Upload=" + upload + " bytes/sec. Temp=" + temp + " messages/sec."); // DEBUG System.err.println( "Connection performance (SYNC): Received bytes=" + totalBytes + " bytes. Received messages=" + totalMsg + " msg. Time=" + delta + " ms."); // DEBUG AnLog.log( "Connection performance (SYNC): Received bytes=" + totalBytes + " bytes. Received messages=" + totalMsg + " msg. Time=" + delta + " ms."); // DEBUG if (cc != null) { cc.updateConnectionStatus( "Connection performance (SYNC): Upload " + upload + " bytes/msec. Handshaking..."); } // Measure connection performance - loop of ASYNC calls totalBytes = IPC_session.getIPCReader().getTotalReceivedBytes(); totalMsg = IPC_session.getIPCReader().getTotalReceivedMessages(); // System.err.println("Connection performance (ASYNC): Total bytes 3=" + totalBytes + " bytes. // Total messages 3=" + totalMsg + " msg."); // DEBUG t1 = System.currentTimeMillis(); IPCResult ipcResults[] = new IPCResult[max]; for (int i = 0; i < max; i++) { IPCHandle ipcHandle = IPCHandle.newHandshakeIPCHandle(); ipcResults[i] = ipcHandle.sendRequest(); // no body } for (int i = 0; i < max; i++) { IPCResult.CC c = ipcResults[i].getCC(); // blocking } t2 = System.currentTimeMillis(); totalBytes = IPC_session.getIPCReader().getTotalReceivedBytes() - totalBytes; totalMsg = IPC_session.getIPCReader().getTotalReceivedMessages() - totalMsg; // System.err.println("Connection performance (ASYNC): Total bytes 4=" + totalBytes + " bytes. // Total messages 4=" + totalMsg + " msg."); // DEBUG delta = t2 - t1; if (delta <= 0) { delta = 1; } upload = ((totalBytes * 1000) / delta); temp = ((totalMsg * 1000) / delta); System.err.println("Connection performance (ASYNC): Loop count=" + max); // DEBUG System.err.printf( "Connection performance (ASYNC): Upload=%.2f bytes/sec. Temp=%.2f messages/sec.\n", upload, temp); // DEBUG AnLog.log( "Connection performance (ASYNC): Upload=" + upload + " bytes/sec. Temp=" + temp + " messages/sec."); // DEBUG System.err.println( "Connection performance (ASYNC): Received bytes=" + totalBytes + " bytes. Received messages=" + totalMsg + " msg. Time=" + delta + " ms."); // DEBUG AnLog.log( "Connection performance (ASYNC): Received bytes=" + totalBytes + " bytes. Received messages=" + totalMsg + " msg. Time=" + delta + " ms."); // DEBUG if (cc != null) { cc.updateConnectionStatus( "Connection performance (ASYNC): Upload " + upload + " bytes/msec. Handshaking..."); } } private String last_CC_host = null; private String last_CC_un = null; private char[] last_CC_p = null; private String last_CC_collect = null; /** * Update connection information to run collect * * @param host * @param name * @param p */ private void updateConnectionInfo(String host, String name, char[] p, String path_to_collect) { last_CC_host = host; last_CC_un = name; last_CC_collect = path_to_collect; if (null != last_CC_p) { for (int i = 0; i < last_CC_p.length; i++) { last_CC_p[i] = 0; } } if (null != p) { last_CC_p = p.clone(); } else { last_CC_p = null; } } /** Start Remote Collect */ public void startRemoteCollect(Collector collector, ConnectionDialog cc) throws Exception { char[] p = last_CC_p; sendPCollect(collector, p, cc); } private String getPathToApp(String appName) { String path; if (UserPref.gprofngdir != null) { path = UserPref.gprofngdir + "/" + appName; if (Files.exists(Paths.get(path))) { return path; } } if (UserPref.binDirFromCommandLine != null) { path = UserPref.binDirFromCommandLine + "/" + appName; if (Files.exists(Paths.get(path))) { return path; } } if (fdhome != null) { path = fdhome + "/bin/" + appName; if (Files.exists(Paths.get(path))) { return path; } } return appName; } /** Get path to local or remote collect */ public String getPathToCollect() { if (!isRemote()) { String collectPath = getPathToApp(CollectAppName); AnLog.log("analyzer: COLLECT=" + collectPath + "\n"); return collectPath; } return last_CC_collect; } /** * Get path to er_kernel * * @return */ public String getPathToCollectKernel() { return getPathToApp(KernelAppName); } /** * Connect to remote host * * @param rp * @param pass * @param cc * @throws Exception */ private void sendPCollect(Collector collector, char[] pass, ConnectionDialog cc) throws Exception { // This is a temporary code, just to prove the concept connectionID++; long ts = System.currentTimeMillis(); String remote_protocol = null; boolean skip_pass = false; boolean auth_failed = true; String pattern1 = "Password"; String pattern2 = " " + pattern1 + ":"; String pattern3 = pattern1 + " for "; String pattern4 = "Process ID:"; String pattern5 = "Fatal error: host not found: "; String pattern6 = ": not found"; String pattern7 = "Killed"; String pattern10 = ": No such file"; String ask = emptyString; AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") started. Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus("Looking for remote host..."); if ((null != pass) && (pass.length > 0)) { // this hangs if remote process does not send anything, so we use a timeout int c = 190; // timeout 19 seconds while (c-- > 0) { Thread.sleep(100); ask = collector.getCurrentOutput(); if (ask.contains(pattern2)) { break; } if (ask.contains(pattern3)) { break; } if (ask.contains(pattern4)) { // Connection established skip_pass = true; // cc.updateConnectionStatus("Connection established. Compatibility checking..."); auth_failed = false; break; } if (ask.contains(pattern5)) { auth_failed = true; // Unreachable host ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_5 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_5); throw new Exception(known_problem_5); } if (ask.contains(pattern6) || ask.contains(pattern10)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.contains(pattern7)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } // if (ask.length() > 100000) { // break; // Why so many? Something wrong. // } } if (!skip_pass) { // got request for the password ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Verifying authentication... Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus("Verifying authentication..."); for (int i = 0; i < pass.length; i++) { collector.writeInputChar(pass[i]); } collector.writeInputChar('\n'); } else { if (auth_failed) { // Probably the delay is not enough to get the request for the password // cc.updateConnectionStatus("Password is not requested (!?)"); System.err.println("Error 11: unrecognized request: " + ask); // DEBUG ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Error 11: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_4 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_4); throw new Exception(known_problem_4); } } c = 190; // timeout 19 seconds while (c-- > 0) { Thread.sleep(100); ask = collector.getCurrentOutput(); // rp.getUnknownInput(); // Check if request for password appeared twice if (ask.contains(pattern1)) { if (skip_pass) { System.err.println("Error 12: unrecognized request: " + ask); // DEBUG auth_failed = true; // Delay is not enough to get request for password ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Error 12: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_1 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_1); throw new Exception(known_problem_1); } int p = ask.indexOf(pattern1); String s = ask.substring(p + 1); if (s.contains(pattern1)) { auth_failed = true; // Password does not match System.err.println("Error 13: unrecognized request: " + ask); // DEBUG ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Error 13: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_1 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_1); throw new Exception(known_problem_1); } } if (ask.contains(pattern4)) { // Connection established // cc.updateConnectionStatus("Connection established. Compatibility checking..."); auth_failed = false; break; } if (ask.contains(pattern5)) { auth_failed = true; // Unreachable host ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_5 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_5); throw new Exception(known_problem_5); } if (ask.contains(pattern6) || ask.contains(pattern10)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.contains(pattern7)) { auth_failed = true; // Installation path is not correct ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_6 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_6); throw new Exception(known_problem_6); } if (ask.length() > 100000) { // Why so many? Something wrong. auth_failed = true; System.err.println("Error 14: unrecognized request: " + ask); // DEBUG ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Error 14: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_7 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_7); throw new Exception(known_problem_7); } } // Check if connection failed if (remote_protocol == null) { auth_failed = false; // we don't know for sure } if (auth_failed) { System.err.println("Error 15: unrecognized request: " + ask); // DEBUG ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") Error 15: unrecognized request: " + ask + " Timestamp=" + ts); // DEBUG AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") failed: " + known_problem_3 + " Timestamp=" + ts); // DEBUG // cc.updateConnectionStatus(known_problem_3); throw new Exception(known_problem_3); } // Looks like everything is ok. Try to continue // cc.updateConnectionStatus("Finished authentication. Handshaking..."); // } else { // connection without password - nothing to do // return; } ts = System.currentTimeMillis(); AnLog.log( "collector: Connect to Remote Host(Connection ID=" + connectionID + ") succeeded. Timestamp=" + ts); // DEBUG } private void logInit() { AnLog.log(new Date().toString()); AnLog.log(Analyzer.fdversion); AnLog.log(Analyzer.fdhome); // AnLog.log(Analyzer.getInstance().getWorkingDirectory()); AnLog.log(Analyzer.getInstance().er_print); AnLog.log(Analyzer.getInstance().remoteHost); AnLog.log(Analyzer.jvm_home); AnLog.log("-----------------------------------------------------"); } private static void helpInit(final Window win) {} public static void showHelp(final String help_id) { // System.out.println("Analyzer.showHelp: " + help_id); // Mez: Not supported yet because jh-2.0_05.jar cannot be used. } public static final class HelpAction implements ActionListener { final String id; public HelpAction(final String id) { this.id = id; } @Override public void actionPerformed(final ActionEvent event) { // System.out.println("Analyzer.HelpAction.actionPerformed: " + id); showHelp(id); } } /** Doesn't require running IPC. Called once. AWT thread */ private void initAnalyzer() { String strNormalSelection = AnUtility.getenv("SP_ANALYZER_NORMAL_SELECTION"); if (strNormalSelection != null && !strNormalSelection.equals("NO")) { normalSelection = true; AnLog.log("analyzer: SP_ANALYZER_NORMAL_SELECTION is set"); } // if (remoteHost == null) { // remoteHost = AnUtility.getenv("SP_ANALYZER_REMOTE_HOST"); // } String specialRemoteShell = AnUtility.getenv("SP_ANALYZER_REMOTE_SHELL"); if (specialRemoteShell != null && specialRemoteShell.length() > 0) { remoteShell = specialRemoteShell; } if (remoteHost != null && !remoteHost.equals(emptyString)) { // System.err.println("analyzer: SP_ANALYZER_REMOTE_HOST `" + remoteHost + "'"); AnLog.log("analyzer: SP_ANALYZER_REMOTE_HOST=" + remoteHost + "\n"); remoteConnection = remoteShell + " " + remoteHost; } else { remoteHost = null; remoteConnection = null; } localHost = getLocalHostName(); os_name = System.getProperty("os.name"); logInit(); } public String getLocalHostName() { String localHostName = null; try { java.net.InetAddress addr = java.net.InetAddress.getLocalHost(); localHostName = addr.getHostName(); } catch (Exception e) { } return localHostName; } /** Synchronize Locale with remote engine */ private void synchronizeLocale() { // Set client's locale on remote server // Only 3 locales are supported: ja, zh, C String lc = Locale.getDefault().getLanguage(); String rlc = getLocale(); boolean change = false; if (lc == null) { lc = "C"; } else { if (lc.contains("ja")) { lc = "ja"; } else { if (lc.contains("zh")) { lc = "zh"; } else { lc = "C"; } } } if ((rlc == null) || (rlc.length() < 1) || (!lc.equals(rlc))) { // Set locale change = true; } if (change) { rlc = setLocale(lc); // System.out.println(rlc); } } /** * AWT thread * * @return @throws Exception */ private String initIPC() throws Exception { AnUtility.checkIPCOnWrongThread(false); String temporaryRemoteVersion = getAnalyzerReleaseName(); fdversion = ""; String emsg = null; startIPC(); // Version Handshake if (IPC_started) { versionHandshake(); // Measure connection performance (DEBUG) measureConnectionPerformance(null); } // Initialize gp-display-text final String[] license_info; if (IPC_started) { license_info = initApplication(false, fdhome, licpath, arguments); } else { license_info = new String[2]; license_info[0] = "UNKNOWN"; license_info[1] = temporaryRemoteVersion; } licsts = license_info[0]; fdversion = license_info[1]; if (licsts.equals("ERROR") || licsts.equals("FATAL")) { emsg = String.format(AnLocale.getString("License Path: %s\nError: %s"), licpath, fdversion); System.err.println(emsg); System.exit(1); } else if (licsts.equals("WARN")) { emsg = String.format(AnLocale.getString("License Path: %s\nWarning: %s"), licpath, fdversion); System.err.println(emsg); } if (IPC_started) { anFrame.getWindow().initializeAfterIPCStarted(); } AnUtility.checkIPCOnWrongThread(true); return emsg; } /** * AWT Thread * * @throws Exception */ private void initAnalyzerIPC() throws Exception { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { try { String errmsg = initIPC(); // Possible exception // We only get here if IPC is successfully running List<String> expList = AnUtility.getExpList(arguments); // Here we will try to guess what user wants: open an experiment or profile a target? boolean profile = true; if ((arguments != null) && (arguments.length > 0)) { // We will check if the first argument has suffix .er or .erg String target = arguments[0]; if (target.length() > 3) { if (target.endsWith(".er")) { // Experiment directory profile = false; } if (target.endsWith("/")) { // Experiment directory profile = false; } if (target.endsWith(".erg")) { // Experiment group profile = false; } } } else { profile = false; // No arguments } if (profile) { // Clear expList String[] noarguments = new String[0]; expList = AnUtility.getExpList(noarguments); } boolean cmp = compareMode && (expList.size() > 1); anFrame.setVisible(true); String configurationPath; if (!Analyzer.getInstance().isRemote() && expList.size() > 0) { String expPath = expList.get(0); if (!expPath.startsWith("/")) { expPath = Analyzer.getInstance().getWorkingDirectory() + "/" + expPath; } configurationPath = UserPref.getAsWhenClosedConfigPath(expPath); if (!new File(configurationPath).exists()) { configurationPath = UserPref.getConfigurationDirPath(expPath) + "/" + UserPref.getDefaultConfigurationName(); if (!new File(configurationPath).exists()) { String parent = new AnFile(expPath).getParentFile().getAbsolutePath(); configurationPath = parent + "/" + UserPref.getDefaultConfigurationName(); if (!new File(configurationPath).exists()) { configurationPath = UserPref.getHomeConfigurationDirPath() + "/" + UserPref.getDefaultConfigurationName(); } } } } else { configurationPath = null; } if (null == AnWindow.getInstance().getExperimentGroups()) { // first time here anFrame .getWindow() .loadExperimentList(expList, cmp, null, true, configurationPath, false); } if (profile) { AnWindow.getInstance() .getProfileApplicationAction() .setEnabled(true); // Not enabled this early!!!!!! AnWindow.getInstance().profileApplicationAction(arguments); } if (errmsg != null) { popError(errmsg); } } catch (Exception e) { // IPC didn't run (remote) fireConnectionStatus(AnChangeEvent.Type.REMOTE_CONNECTION_CANCELLED_OR_FAILED); if (IPC_started) { e.printStackTrace(); } try { anFrame.getWindow().welcomeViewOnly(); anFrame.setVisible(true); if (System.getProperty("os.name").contains("Mac")) { // A HACK: Resize +1 Dimension d0 = anFrame.getSize(); Dimension d1 = new Dimension(d0.width + 1, d0.height + 1); anFrame.setSize(d1); anFrame.setSize(d0); } // Show pop-up // String msg = "The Analyzer is now running in remote mode. You can connect to a // remote host."; // AnUtility.showMessage(anFrame, msg, JOptionPane.INFORMATION_MESSAGE); } catch (Exception e2) { // Not our day e2.printStackTrace(); // exit? } } } }); } /** * Main init function. Called from AnMain. Called once. AWT Thread * * @param args * @throws Exception */ public void initAnalyzer(final String[] args) throws Exception { AnUtility.checkIfOnAWTThread(true); arguments = args; anFrame = new AnFrame(this); anFrame.initComponents(); initAnalyzer(); initAnalyzerIPC(); } private void popError(final String msg) { AnWindow.getInstance().getExperimentsView().appendLog(AnLocale.getString("Error: ") + msg); AnUtility.showMessage(anFrame, msg, JOptionPane.ERROR_MESSAGE); } public void endIPC(final String err_msg) { popError(err_msg); if (!IPC_started) { return; } setIPCStarted(false); IPC_session.destroyIPCProc(); } // Experimental code - currently on wrong thread (AWT) public void restartEngine() { AnWindow aw = AnWindow.getInstance(); stopConnectionManager(); try { Thread.sleep(100); // A delay in hope all IPC requests finished if (isRemote()) { Thread.sleep(1000); // An additional delay in hope all IPC requests finished // System.err.println("***** NOTE: Waited 1 second before restart engine"); } } catch (Exception e) { // nothing } // Switch IPCReader to restarting mode IPC_session.getIPCReader().suspendThread(); // Restart gp-display-text reExec(); // Wait till gp-display-text is ready. Maximum 10 seconds int maxmsec = 10000; boolean restarted = false; int msec = 0; for (; msec < maxmsec; msec++) { try { if (isRemote()) { Thread.sleep(1000); // wait 1000 milliseconds msec += 1000; } else { Thread.sleep(100); // wait 100 milliseconds msec += 100; } if (IPC_session.getIPCReader().isThreadReady()) { restarted = true; // Connection established // System.err.println("***** NOTE: Connection established"); DEBUG break; } } catch (Exception e) { // nothing } } if (restarted == false) { // Here we should show an error dialog System.err.println("***** ERROR: Cannot restart gp-display-text. Please, reconnect."); } IPC_session.getIPCReader().runThread(); // Version Handshake int res = versionHandshake(); // Call initApplication String l_fdhome = emptyString; String l_licpath = System.getProperty("analyzer.licpath", l_fdhome + "/lib/serial.dat"); String[] args = new String[1]; args[0] = er_print; String[] license_info = new String[2]; license_info[0] = "ERROR"; license_info[1] = "Unknown"; try { license_info = initApplication(false, l_fdhome, l_licpath, args); } catch (Exception e) { if (null == license_info[0]) { license_info[0] = "ERROR"; } } // Init view aw.initView(0, 0); startConnectionManager(); } // Native methods from liber_dbe.so /** Restart gp-display-text */ public void reExec() { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, null); ipcHandle.append("reExec"); IPCResult ipcResult = ipcHandle.sendRequest(); } // Native methods from liber_dbe.so private String[] initApplication( final boolean in_netbeans, final String fdhome, final String licpath, final String[] args) { synchronized (IPC.lock) { IPC_session.send("initApplication"); IPC_session.send(in_netbeans); IPC_session.send(fdhome); IPC_session.send(licpath); IPC_session.send(args); return (String[]) IPC_session.recvObject(); } } /** * Get backend version and compare with frontend version * * @return 1 if versions do not match, return 0 is versions match */ private int versionHandshake() { synchronized (IPC.lock) { IPCHandle ipcHandle = IPCHandle.newHandshakeIPCHandle(); IPCResult ipcResult = ipcHandle.sendRequest(); // no body IPCResult.CC cc = ipcResult.getCC(); // blocking if (cc == IPCResult.CC.SUCCESS) { int er_printVersion = ipcResult.getVersion(); if (er_printVersion != IPCProtocol.version) { System.err.println("Frontend/backend protocol version mis-match:"); System.err.println("GUI version: " + IPCProtocol.version); System.err.println("gp-display-text version: " + er_printVersion); return (1); } } } return (0); } private int syncTime() { synchronized (IPC.lock) { IPC_session.send("syncTime"); IPC_session.send(IPCLogger.getTimeStamp()); IPC_session.recvString(); // blocking } return (0); } /** * Get backend locale * * @return result : current locale */ final String getLocale() { synchronized (IPC.lock) { IPC_session.send("getLocale"); return IPC_session.recvString(); // blocking } } /** * Set backend locale * * @return result : current locale */ private String setLocale(final String locale) { synchronized (IPC.lock) { IPC_session.send("setLocale"); IPC_session.send(locale); return IPC_session.recvString(); // blocking } } /** * Initialize backend application * * @param win_id * @param clone_id * @return String */ public String IPC_initView(final int win_id, final int clone_id) { IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE); ipcHandle.append("initView"); ipcHandle.append(win_id); ipcHandle.append(clone_id); IPCResult ipcResult = ipcHandle.sendRequest(); String result = ipcResult.getString(); // blocking return result; } /** * Get current directory * * @return result : full path */ final String getCurrentDirectory() { synchronized (IPC.lock) { IPC_session.send("getCurrentDirectory"); return IPC_session.recvString(); } } /** * Set current directory * * @param dir_name * @return result : 0 done, -1 error */ final int setCurrentDirectory(final String dir_name) { synchronized (IPC.lock) { IPC_session.send("setCurrentDirectory"); IPC_session.send(dir_name); return IPC_session.recvInt(); } } public static String getAnalyzerReleaseName() { return PERFORMANCE_ANALYZER_RELEASE_NAME; } /** Update IPC connection status */ public void setIPCStarted(boolean started) { IPC_started = started; } private void fireConnectionStatus(AnChangeEvent.Type type) { AnChangeEvent anChangeEvent = new AnChangeEvent(this, type); AnEventManager.getInstance().fireAnChangeEvent(anChangeEvent); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/�������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�016357� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusLabelValueHandle.java����������������������������0000644�0001750�0001750�00000006262�14744453367�023520� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JLabel; public class StatusLabelValueHandle { public enum Mode { DEFAULT, SET, ERROR }; public static final Color DEFAULT_COLOR = Color.BLACK; public static final Color SET_COLOR = new Color(44, 121, 6); public static final Color ERROR_COLOR = Color.RED; private StatusLabel statusLabel; protected StatusLabelValueHandle( AnWindow anWindow, ImageIcon icon, String labelTxt, String toolTipText, ActionListener actionListener) { String txt = null; if (labelTxt != null) { txt = labelTxt + ": "; } statusLabel = anWindow.getStatusPanel().addStatusLabel(icon, txt, toolTipText, actionListener); } public String get() { return statusLabel.getValueLabel().getText(); } public void update(String text) { update(text, Mode.DEFAULT); } public void updateToolTip(String text) { statusLabel.getTextLabel().setToolTipText(text); statusLabel.getValueLabel().setToolTipText(text); } public void update(String text, Mode mode) { Color color = DEFAULT_COLOR; if (mode == Mode.DEFAULT) { color = DEFAULT_COLOR; } else if (mode == Mode.SET) { color = SET_COLOR; } else if (mode == Mode.ERROR) { color = ERROR_COLOR; } update(text, color); } private void update(final String valueText, final Color color) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { statusLabel.getValueLabel().setForeground(color); statusLabel.getValueLabel().setText(valueText); } }); } public void update(final ImageIcon icon) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { statusLabel.setTextLabelIcon(icon); } }); } public void setVisible(boolean visible) { statusLabel.setVisible(visible); } public void setEnabled(final boolean enabled) { statusLabel.setEnabled(enabled); } public boolean isVisible() { return statusLabel.getValueLabel().isVisible(); } /** * @return the text label */ public JLabel getTextLabel() { return statusLabel.getTextLabel(); } /** * @return the value label */ public JLabel getValueLabel() { return statusLabel.getValueLabel(); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusPanel.form���������������������������������������0000644�0001750�0001750�00000003747�14744453367�021456� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> �������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusLabel.java���������������������������������������0000644�0001750�0001750�00000014056�14744453367�021407� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Cursor; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JSeparator; class StatusLabel { private JSeparator separator; private JLabel textLabel; private JLabel valueLabel; private ActionListener actionListener; private MouseListener mouseListener = null; private KeyboardListener keyboardListener = null; /** * @return the separator */ protected JSeparator getSeparator() { return separator; } /** * @param separator the separator to set */ protected void setSeparator(JSeparator separator) { this.separator = separator; } /** * @return the labelTxt */ protected JLabel getTextLabel() { return textLabel; } protected void setTextLabelIcon(ImageIcon icon) { textLabel.setIcon(icon); } /** * @param textLabel the labelTxt to set */ protected void setTextLabel(final JLabel textLabel) { this.textLabel = textLabel; if (textLabel != null) { textLabel.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { textLabel.setBorder( BorderFactory.createLineBorder(AnEnvironment.STATUS_SELECTED_BORDER_COLOR)); } @Override public void focusLost(FocusEvent e) { textLabel.setBorder(null); } }); } } /** * @return the labelValue */ protected JLabel getValueLabel() { return valueLabel; } /** * @param valueLabel the labelValue to set */ protected void setValueLabel(final JLabel valueLabel) { this.valueLabel = valueLabel; if (valueLabel != null) { valueLabel.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { valueLabel.setBorder( BorderFactory.createLineBorder(AnEnvironment.STATUS_SELECTED_BORDER_COLOR)); } @Override public void focusLost(FocusEvent e) { valueLabel.setBorder(null); } }); } } public void setEnabled(final boolean enabled) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (enabled && getValueLabel().isEnabled()) { return; } if (!enabled && !getValueLabel().isEnabled()) { return; } if (!enabled && getMouseListener() != null) { textLabel.removeMouseListener(getMouseListener()); valueLabel.removeMouseListener(getMouseListener()); } // getTextLabel().setEnabled(enabled); getValueLabel().setEnabled(enabled); if (getSeparator() != null) { getSeparator().setEnabled(enabled); } if (enabled && getMouseListener() != null) { textLabel.addMouseListener(getMouseListener()); valueLabel.addMouseListener(getMouseListener()); } } }); } public void setVisible(final boolean visible) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { getTextLabel().setVisible(visible); getValueLabel().setVisible(visible); if (getSeparator() != null) { getSeparator().setVisible(visible); } } }); } protected void addActionListener(ActionListener actionListener) { this.actionListener = actionListener; if (actionListener != null) { textLabel.addMouseListener(getMouseListener()); textLabel.addKeyListener(getKeyboardListener()); valueLabel.addMouseListener(getMouseListener()); valueLabel.addKeyListener(getKeyboardListener()); } } private MouseListener getMouseListener() { if (mouseListener == null) { mouseListener = new MouseListener(); } return mouseListener; } class MouseListener extends MouseAdapter { private Cursor oldCursor = null; // @Override @Override public void mouseEntered(MouseEvent e) { oldCursor = textLabel.getCursor(); textLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); valueLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } // @Override @Override public void mouseExited(MouseEvent e) { textLabel.setCursor(oldCursor); valueLabel.setCursor(oldCursor); } // @Override @Override public void mouseClicked(MouseEvent e) { if (actionListener != null) { actionListener.actionPerformed(null); } } } private KeyboardListener getKeyboardListener() { if (keyboardListener == null) { keyboardListener = new KeyboardListener(); } return keyboardListener; } class KeyboardListener extends KeyAdapter { @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == ' ' && actionListener != null) { actionListener.actionPerformed(null); } } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusPanel.java���������������������������������������0000644�0001750�0001750�00000015354�14744453367�021431� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.analyzer.AnEnvironment; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; public class StatusPanel extends JPanel { public enum Orientation { LEFT, RIGHT }; private int gridxLeft = 0; private int gridxCenter = 50; private int gridxRight = 100; public StatusPanel() { initComponents(); // setBackground(AnEnvironment.STATUS_PANEL_BACKGROUND_COLOR); // setTopBorderColor(AnEnvironment.STATUS_PANEL_BORDER_COLOR); // setTopBorderColor(Color.red); setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, AnEnvironment.STATUS_PANEL_BORDER_COLOR)); addCenterFill(); } @Override protected void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); Graphics2D g2d = (Graphics2D) g; GradientPaint gp; gp = new GradientPaint( 0, 0, AnEnvironment.STATUS_PANEL_BACKGROUND_COLOR1, 0, height, AnEnvironment.STATUS_PANEL_BACKGROUND_COLOR2); g2d.setPaint(gp); g2d.fillRect(0, 0, width, height); } private final void addCenterFill() { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridxCenter; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; add(new JLabel(""), gridBagConstraints); } protected final StatusComponent addStatusComponent( JComponent component, Orientation orientation) { StatusComponent statusComponent = new StatusComponent(); statusComponent.setComponent(component); GridBagConstraints gridBagConstraints = new GridBagConstraints(); if (orientation == Orientation.LEFT) { if (gridxLeft > 0) { gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridxLeft++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(6, 4, 4, 4); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.anchor = GridBagConstraints.LINE_START; JSeparator separator = new JSeparator(JSeparator.VERTICAL); statusComponent.setSeparator(separator); add(separator, gridBagConstraints); } gridBagConstraints.gridx = gridxLeft++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 4, 2, 8); gridBagConstraints.anchor = GridBagConstraints.LINE_START; } else { gridBagConstraints.gridx = gridxRight--; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(2, 4, 0, gridxRight == 99 ? 18 : 4); gridBagConstraints.anchor = GridBagConstraints.LINE_END; } add(component, gridBagConstraints); return statusComponent; } protected final StatusLabel addStatusLabel( ImageIcon icon, String txt, String toolTipText, ActionListener actionListener) { StatusLabel statusLabel = new StatusLabel(); // String formattedTxt = txt; // int i = txt.indexOf(":"); // if (i > 0 ) { // formattedTxt = "<html>" + txt.substring(0, i+1) + "<font color=#2c7906>" + // txt.substring(i+1); // } JLabel txtLabel = new JLabel(); if (txt != null) { txtLabel.setText(txt); } if (icon != null) { txtLabel.setIcon(icon); } statusLabel.setTextLabel(txtLabel); txtLabel.setFont(txtLabel.getFont().deriveFont(Font.PLAIN)); if (toolTipText != null) { txtLabel.setToolTipText(toolTipText); } JLabel valueLabel = new JLabel(); statusLabel.setValueLabel(valueLabel); valueLabel.setFont(txtLabel.getFont().deriveFont(Font.PLAIN)); if (toolTipText != null) { valueLabel.setToolTipText(toolTipText); } GridBagConstraints gridBagConstraints; if (gridxLeft > 0) { gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridxLeft++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(6, 4, 4, 4); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.anchor = GridBagConstraints.LINE_START; JSeparator separator = new JSeparator(JSeparator.VERTICAL); statusLabel.setSeparator(separator); add(separator, gridBagConstraints); } gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridxLeft++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 6, 2, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_START; add(txtLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridxLeft++; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 2, 2, 8); gridBagConstraints.anchor = GridBagConstraints.LINE_START; add(valueLabel, gridBagConstraints); if (actionListener != null) { statusLabel.addActionListener(actionListener); } return statusLabel; } public final void removeStatusComponent(JComponent component) { remove(component); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusComponent.java�����������������������������������0000644�0001750�0001750�00000002524�14744453367�022327� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import javax.swing.JComponent; import javax.swing.JSeparator; class StatusComponent { private JSeparator separator; private JComponent component; /** * @return the separator */ protected JSeparator getSeparator() { return separator; } /** * @param separator the separator to set */ protected void setSeparator(JSeparator separator) { this.separator = separator; } /** * @return the component */ protected JComponent getComponent() { return component; } /** * @param component the labelTxt to set */ protected void setComponent(JComponent component) { this.component = component; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusHandleFactory.java�������������������������������0000644�0001750�0001750�00000003174�14744453367�023112� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.mpmt.AnWindow; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JComponent; public class StatusHandleFactory { public static StatusLabelValueHandle createStatusLabelValue( AnWindow anWindow, ImageIcon icon, String labelTxt, String labelToolTip, ActionListener actionListener) { return new StatusLabelValueHandle(anWindow, icon, labelTxt, labelToolTip, actionListener); } public static StatusLabelHandle createStatusLabel( AnWindow anWindow, String labelTxt, String labelToolTip, StatusPanel.Orientation orientation) { return new StatusLabelHandle(anWindow, labelTxt, labelToolTip, orientation); } public static StatusComponentHandle createStatusComponent( AnWindow anWindow, JComponent component, StatusPanel.Orientation orientation) { return new StatusComponentHandle(anWindow, component, orientation); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusLabelHandle.java���������������������������������0000644�0001750�0001750�00000004175�14744453367�022524� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnUtility; import javax.swing.JLabel; public class StatusLabelHandle { private JLabel label; private StatusComponent statusComponent; protected StatusLabelHandle( AnWindow anWindow, String labelTxt, String toolTipText, StatusPanel.Orientation orientation) { label = new JLabel(labelTxt); label.setToolTipText(toolTipText); statusComponent = anWindow.getStatusPanel().addStatusComponent(label, orientation); } public void setText(String text) { label.setText(text); } public String getText() { return label.getText(); } public void update(final String text) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { label.setText(text); } }); } public void updateToolTip(String text) { label.setToolTipText(text); } public void setVisible(boolean visible) { statusComponent.getComponent().setVisible(visible); if (statusComponent.getSeparator() != null) { statusComponent.getSeparator().setVisible(visible); } } public void setEnabled(final boolean enabled) { statusComponent.getComponent().setEnabled(enabled); if (statusComponent.getSeparator() != null) { statusComponent.getSeparator().setEnabled(enabled); } } public boolean isVisible() { return statusComponent.getComponent().isVisible(); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/statuspanel/StatusComponentHandle.java�����������������������������0000644�0001750�0001750�00000002414�14744453367�023441� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.statuspanel; import org.gprofng.mpmt.AnWindow; import javax.swing.JComponent; public class StatusComponentHandle { private StatusComponent statusComponent; protected StatusComponentHandle( AnWindow anWindow, JComponent component, StatusPanel.Orientation orientation) { statusComponent = anWindow.getStatusPanel().addStatusComponent(component, orientation); } public void setVisible(boolean visible) { statusComponent.getComponent().setVisible(visible); if (statusComponent.getSeparator() != null) { statusComponent.getSeparator().setVisible(visible); } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SummaryPanel.java��������������������������������������������������0000644�0001750�0001750�00000061776�14744453367�017251� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.collect.CollectUtility; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.event.AnSelectionEvent; import org.gprofng.mpmt.util.gui.AnJPanel; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.AnUtility.AnLabel; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import javax.accessibility.AccessibleContext; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; public final class SummaryPanel extends AnJPanel implements AnChangeListener { private final int win_id; private final AnWindow window; private long cur_sel_obj, cur_sel_type, last_sel_obj; private JPanel info_panel; private AnList func_info, metrics_info; private AnLabel metric_title; private JComponent[] func_text, excl_text, ev_text, incl_text, iv_text; private boolean computed, cur_is_data_or_index, func_renew, metrics_renew; private int[] align; private Object summaryPanelLock = new Object(); // Constructor public SummaryPanel() { window = AnWindow.getInstance(); win_id = 0; computed = false; cur_sel_obj = 0; last_sel_obj = 0; cur_sel_type = AnDisplay.DSP_Null; cur_is_data_or_index = false; func_renew = true; metrics_renew = true; align = null; // Initialize GUI components & set preferred size initComponents(); registerKeyboardAction( new Analyzer.HelpAction(AnVariable.HELP_TabsSummary), "help", KeyboardShortcuts.helpActionShortcut, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); AccessibleContext context = getAccessibleContext(); String loc_string = AnLocale.getString("Summary"); context.setAccessibleName(loc_string); context.setAccessibleDescription(loc_string); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("OverviewView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: reset(); break; case EXPERIMENTS_LOADED_FAILED: case EXPERIMENTS_LOADED: setBaseOnly(window.getSettings().getCompareModeSetting().comparingExperiments()); // Nothing break; case FILTER_CHANGED: computed = false; break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SETTING_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_UPDATE: // Nothing break; case SELECTION_CHANGED: AnSelectionEvent selectionEvent = (AnSelectionEvent) e.getSource(); computed = false; computeOnAWorkerThread( selectionEvent.getSelObj(), selectionEvent.getType(), selectionEvent.getSubtype(), selectionEvent.getVersion()); break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } private void debug() { System.out.println(this.getClass().getSimpleName()); } // public GraphControls toolbar_gctl; // Initialize GUI components private void initComponents() { setLayout(new BorderLayout()); Dimension fillerDim = new Dimension(10, 10); // toolbar_gctl = new GraphControls(this.m_window); // toolbar_gctl.is_UpDownAvail = false; // toolbar_gctl.is_ColorAvail = false; // toolbar_gctl.getCreateToolbar(); // toolbar_gctl.tbar_backward.setEnabled (false); // toolbar_gctl.tbar_forward.setEnabled(false); // toolbar_gctl.tbar_zoom_in.setEnabled(false); // toolbar_gctl.tbar_zoom_out.setEnabled(false); // toolbar_gctl.tbar_zoom_reset.setEnabled(false); info_panel = new AnJPanel(); info_panel.setLayout(new BoxLayout(info_panel, BoxLayout.Y_AXIS)); info_panel.add(new Box.Filler(fillerDim, fillerDim, fillerDim)); // AnLabel anf = (AnLabel) AnUtility.getHeader(AnLocale.getString("Selected Object:")); // info_panel.add(anf); // JToolBar tb = toolbar_gctl.getToolbar(); // tb.setFloatable(false); // JPanel tbPanel = new ANJPanel(new BorderLayout()); // tbPanel.add(tb, BorderLayout.PAGE_START); // // info_panel.add(tbPanel); func_info = new AnList(true); info_panel.add(func_info); // anf.setLabelFor(func_info); func_info.getAccessibleContext().setAccessibleName(AnLocale.getString("Function info")); func_info.getAccessibleContext().setAccessibleDescription(AnLocale.getString("Function info")); // info_panel.add(new JSeparator(SwingConstants.HORIZONTAL)); info_panel.add(new Box.Filler(fillerDim, fillerDim, fillerDim)); AnLabel anm = (AnLabel) AnUtility.getHeader(""); metric_title = anm; info_panel.add(anm); metrics_info = new AnList(true); info_panel.add(metrics_info); info_panel.add(new Box.Filler(fillerDim, fillerDim, fillerDim)); anm.setLabelFor(metrics_info); metrics_info.getAccessibleContext().setAccessibleName(AnLocale.getString("Metrics info")); metrics_info .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Metrics info")); // JScrollPane scrollPane = new AnJScrollPane(info_panel); // scrollPane.setBorder(null); add(info_panel, BorderLayout.CENTER); // func_info.setBorder(AnVariable.boxBorder); // metrics_info.setBorder(AnVariable.boxBorder); // setPreferredSize(new Dimension(AnVariable.INFO_PRF_SIZE)); setMinimumSize(AnVariable.INFO_MIN_SIZE); } // Reset the metrics items (number of func items remains the same). private void reset() { metrics_renew = true; } /* * Use summaryPanelLock so doCompute is called in the same order as computeOnAWorkerThread is called. See 18765370 - Selection Details incorrect after "go back" and "go forward" in src/dis view */ private void computeOnAWorkerThread( final long[] sel_obj, final int type, final int subtype, final int version) { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { synchronized (summaryPanelLock) { synchronized (AnVariable.mainFlowLock) { doCompute(sel_obj, type, subtype, version); } } } }, "Summary_thread"); ; } // Compute summary display private void doCompute( final long[] sel_obj, final int type, final int subtype, final int version) { AnUtility.checkIfOnAWTThread(false); final boolean is_data_or_index; if (computed && (cur_sel_type == type) && (type != AnDisplay.DSP_CallerCalleeSelf) && (cur_sel_obj == sel_obj[0]) && (last_sel_obj == sel_obj[sel_obj.length - 1])) { // multiselection return; } if ((type == AnDisplay.DSP_MemoryObject) || (type == AnDisplay.DSP_DataLayout) || (type == AnDisplay.DSP_DataObjects) || (type == AnDisplay.DSP_IndexObject) || (type == AnDisplay.DSP_IO) || (type == AnDisplay.DSP_IOFileDescriptors) || (type == AnDisplay.DSP_IOCallStacks) || (type == AnDisplay.DSP_Heap)) { is_data_or_index = true; } else { is_data_or_index = false; } if ((cur_is_data_or_index != is_data_or_index) || ((is_data_or_index == true) && (cur_sel_type != type))) { func_renew = true; metrics_renew = true; } cur_sel_obj = sel_obj[0]; cur_sel_type = type; cur_is_data_or_index = is_data_or_index; final Object[] data; if (version == 1) { data = getSummary(sel_obj, type, subtype); // IPC } else if (version == 2) { data = getSummaryV2(sel_obj, type, subtype); // IPC } else { data = null; } final Object[] marks; if (type == AnDisplay.DSP_Source || type == AnDisplay.DSP_SourceV2 || type == AnDisplay.DSP_Disassembly || type == AnDisplay.DSP_DisassemblyV2 || type == AnDisplay.DSP_SourceDisassembly) { marks = getSummaryHotMarks(sel_obj, type); } else { marks = null; } AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { updateSummary(data, type, marks); } }); computed = true; } private void updateSummary(final Object[] data, int type, final Object[] marks) { // System.out.println("SummaryPanel type: " + type); if (data == null) { return; } boolean need_validate = false; char[] mnemonic; final String[] value, iv_label, e_label, ev_label, i_label; final double[] clock, exclusive, e_percent, inclusive, i_percent; final int[] vtype; int size, columns, len, i; JLabel jlabel; JPanel panel; JScrollPane tx_scroll; String[] label; final Dimension msize; final boolean show_inclusive, exclusive_is_data_derived; if ((type == AnDisplay.DSP_MemoryObject) || (type == AnDisplay.DSP_DataLayout) || (type == AnDisplay.DSP_DataObjects)) { show_inclusive = false; exclusive_is_data_derived = true; } else if ((type == AnDisplay.DSP_IndexObject) || (type == AnDisplay.DSP_IO) || (type == AnDisplay.DSP_IOFileDescriptors) || (type == AnDisplay.DSP_IOCallStacks) || (type == AnDisplay.DSP_Heap)) { show_inclusive = false; exclusive_is_data_derived = false; } else { show_inclusive = true; exclusive_is_data_derived = false; } // "Bugs 16624403 and 19539622" (leave this string intact for searches) boolean func_is_Total = false; final Object[] func = (Object[]) data[0]; if (func != null) { align = (int[]) func[0]; mnemonic = (char[]) func[1]; label = (String[]) func[2]; value = (String[]) func[3]; size = label.length; // "Bugs 16624403 and 19539622" (leave this string intact for searches) // check if this func is <Total> for (i = 0; i < size; i++) { if (label[i].equals("Name") && value[i].equals("<Total>")) func_is_Total = true; } if (func_renew) { func_info.removeAll(); func_text = new JComponent[size]; for (i = 0; i < size; i++) { jlabel = (JLabel) AnUtility.getItem(label[i] + ":"); // jlabel.setDisplayedMnemonic(mnemonic[i]); jlabel.getAccessibleContext().setAccessibleName(label[i]); jlabel.getAccessibleContext().setAccessibleDescription(label[i]); if ((type == AnDisplay.DSP_DataObjects) && (i == size - 1)) { func_text[i] = AnUtility.getTextArea(value[i] != null ? value[i] : ""); (func_text[i]).setFont(CollectUtility.text_font); tx_scroll = new AnJScrollPane(func_text[i]); tx_scroll.setPreferredSize(new Dimension(func_text[0].getPreferredSize().width, 120)); tx_scroll.setMaximumSize(new Dimension(func_text[0].getMaximumSize().width, 120)); func_info.add(jlabel, tx_scroll); } else { func_text[i] = AnUtility.getText(value[i] != null ? value[i] : "", 30); func_info.add(jlabel, func_text[i]); } jlabel.setLabelFor(func_text[i]); } // Fix the height msize = func_info.getMaximumSize(); msize.height = func_info.getPreferredSize().height; func_info.setMaximumSize(msize); func_info.invalidate(); func_renew = false; need_validate = true; } else { for (i = 0; i < size; i++) { if (value.length < size) { // TEMPORARY TRAP AnLog.log( "analyzer: race condition in updateSummary(): size=" + size + " value.length=" + value.length); return; } else if ((type == AnDisplay.DSP_DataObjects) && (i == size - 1)) { if (!(func_text[i] instanceof JTextArea)) { AnLog.log( "analyzer: invalid cast in updateSummary(): " + func_text[i] + " is not a JTextArea"); return; } ((JTextArea) func_text[i]).setText(value[i] != null ? value[i] : ""); } else { if (!(func_text[i] instanceof JTextField)) { AnLog.log( "analyzer: invalid cast in updateSummary(): " + func_text[i] + " is not a JTextField"); return; } ((JTextField) func_text[i]).setText(value[i] != null ? value[i] : ""); } } } } else { func_info.removeAll(); func_info.addLabel(new JLabel(AnLocale.getString("No Data"))); } final Object[] metric = (Object[]) data[1]; if (metric != null) { label = (String[]) metric[0]; clock = (double[]) metric[1]; exclusive = (double[]) metric[2]; e_percent = (double[]) metric[3]; inclusive = (double[]) metric[4]; i_percent = (double[]) metric[5]; vtype = (int[]) metric[6]; size = label.length; e_label = new String[size]; ev_label = new String[size]; i_label = new String[size]; iv_label = new String[size]; columns = 0; for (i = 0; i < size; i++) { ev_label[i] = iv_label[i] = null; switch (vtype[i]) { case AnMetric.VT_DOUBLE: e_label[i] = (new AnDouble(exclusive[i])).toPercentQuote(e_percent[i]); if (show_inclusive) { i_label[i] = (new AnDouble(inclusive[i])).toPercentQuote(i_percent[i]); } break; case AnMetric.VT_INT: e_label[i] = (new AnInteger((int) exclusive[i])).toPercentQuote(e_percent[i]); if (show_inclusive) { i_label[i] = (new AnInteger((int) inclusive[i])).toPercentQuote(i_percent[i]); } break; case AnMetric.VT_LLONG: case AnMetric.VT_ULLONG: if (clock[i] == 0.0) { e_label[i] = (new AnLong((long) exclusive[i])).toPercentQuote(e_percent[i]); if (show_inclusive) { i_label[i] = (new AnLong((long) inclusive[i])).toPercentQuote(i_percent[i]); } } else { ev_label[i] = (new AnLong((long) exclusive[i])).toQuoteSpace(); e_label[i] = (new AnDouble(exclusive[i] / clock[i])).toPercentQuote(e_percent[i]); if (show_inclusive) { iv_label[i] = (new AnLong((long) inclusive[i])).toQuoteSpace(); i_label[i] = (new AnDouble(inclusive[i] / clock[i])).toPercentQuote(i_percent[i]); } } break; default: e_label[i] = i_label[i] = " "; break; } // "Bugs 16624403 and 19539622" (leave this string intact for searches) if (func_is_Total) { if (label[i].equals("Block Covered %") || label[i].equals("Instr Covered %")) { if (e_label[i] != null && !e_label[i].equals(" ")) e_label[i] = " "; if (i_label[i] != null && !i_label[i].equals(" ")) i_label[i] = " "; if (ev_label[i] != null && !ev_label[i].equals(" ")) ev_label[i] = " "; if (iv_label[i] != null && !iv_label[i].equals(" ")) iv_label[i] = " "; } } // Compute the maximum width len = e_label[i].length(); if (columns < len) { columns = len; } if (show_inclusive) { len = i_label[i].length(); if (columns < len) { columns = len; } } if (ev_label[i] != null) { len = ev_label[i].length(); if (columns < len) { columns = len; } if (show_inclusive) { len = iv_label[i].length(); if (columns < len) { columns = len; } } } } if (metrics_renew) { metrics_info.removeAll(); panel = new AnJPanel(new GridLayout(1, 2)); if (show_inclusive) { panel.add(AnUtility.getHeader(AnLocale.getString("Exclusive"), AnUtility.excl_icon)); panel.add(AnUtility.getHeader(AnLocale.getString("Inclusive"), AnUtility.incl_icon)); } else if (exclusive_is_data_derived) { panel.add(AnUtility.getHeader(AnLocale.getString("Data-derived"), AnUtility.data_icon)); } else { panel.add(AnUtility.getHeader(AnLocale.getString("Exclusive"), AnUtility.excl_icon)); } metrics_info.add((JComponent) null, panel); excl_text = new AnUtility.AnText[size]; ev_text = new AnUtility.AnText[size]; incl_text = new AnUtility.AnText[size]; iv_text = new AnUtility.AnText[size]; for (i = 0; i < size; i++) { excl_text[i] = AnUtility.getNumber(e_label[i], columns); incl_text[i] = AnUtility.getNumber(i_label[i], columns); if (show_inclusive) { panel = new AnJPanel(new GridLayout(1, 2)); panel.add(excl_text[i]); panel.add(incl_text[i]); } else { panel = new AnJPanel(new GridLayout(1, 1)); panel.add(excl_text[i]); } jlabel = (JLabel) AnUtility.getItem(label[i] + ":"); /* YXXX TBR Thomas, feel free to delete this if (mnemonic[i] != '\0') { jlabel.setDisplayedMnemonic(mnemonic[i]); } */ jlabel.setLabelFor(excl_text[i]); metrics_info.add(jlabel, panel); // A11y: add labels for inclusive metrics if (show_inclusive) { JLabel inclabel = new JLabel(label[i]); /* YXXX TBR Thomas, feel free to delete this if (mnemonic[i] != '\0') { inclabel.setDisplayedMnemonic(mnemonic[i]); } */ inclabel.setLabelFor(incl_text[i]); inclabel.setVisible(false); metrics_info.add(inclabel, panel); } if (ev_label[i] != null) { ev_text[i] = AnUtility.getNumber(ev_label[i], columns); iv_text[i] = AnUtility.getNumber(iv_label[i], columns); if (show_inclusive) { panel = new AnJPanel(new GridLayout(1, 2)); panel.add(ev_text[i]); panel.add(iv_text[i]); } else { panel = new AnJPanel(new GridLayout(1, 1)); panel.add(ev_text[i]); } metrics_info.add(AnUtility.getItem(AnLocale.getString("\" count:")), panel); } else { ev_text[i] = iv_text[i] = null; } } if (marks != null) { int[] nmetric = (int[]) marks[0]; int[] inc = (int[]) marks[1]; for (i = 0; i < nmetric.length; i++) { if (inc[i] == 1) { ((JTextField) incl_text[nmetric[i]]).setBackground(AnVariable.HILIT_INC_COLOR); } else { ((JTextField) excl_text[nmetric[i]]).setBackground(AnVariable.HILIT_COLOR); } } } metrics_info.setAlignmentX(); metrics_info.invalidate(); metrics_renew = false; need_validate = true; } else { if (columns != 0) { columns += 2; } for (i = 0; i < size; i++) { ((JTextField) excl_text[i]).setText(e_label[i]); ((JTextField) excl_text[i]).setColumns(columns); ((JTextField) incl_text[i]).setText(i_label[i]); ((JTextField) incl_text[i]).setColumns(columns); ((JTextField) excl_text[i]).setBackground(Color.white); ((JTextField) incl_text[i]).setBackground(Color.white); if ((ev_text[i] != null) && (ev_label[i] != null)) { ((JTextField) ev_text[i]).setText(ev_label[i]); ((JTextField) ev_text[i]).setColumns(columns); ((JTextField) iv_text[i]).setText(iv_label[i]); ((JTextField) iv_text[i]).setColumns(columns); } } if (marks != null) { int[] nmetric = (int[]) marks[0]; int[] inc = (int[]) marks[1]; for (i = 0; i < nmetric.length; i++) { if (inc[i] == 1) { ((JTextField) incl_text[nmetric[i]]).setBackground(AnVariable.HILIT_INC_COLOR); } else { ((JTextField) excl_text[nmetric[i]]).setBackground(AnVariable.HILIT_COLOR); } } } } } else { metrics_info.removeAll(); final JLabel lab = new JLabel(AnLocale.getString("No Data")); metrics_info.addLabel(lab); lab.getAccessibleContext().setAccessibleName(AnLocale.getString("No Data")); lab.getAccessibleContext().setAccessibleDescription(AnLocale.getString("No Data")); } if (need_validate) { info_panel.validate(); } // Make the most interesting part, the end, visible size = func_text.length; for (i = 0; i < size; i++) { if ((type == AnDisplay.DSP_DataObjects) && (i == size - 1)) { if (!(func_text[i] instanceof AnUtility.AnTextArea)) { AnLog.log( "analyzer: invalid cast in updateSummary(): " + func_text[i] + " is not an AnUtility.AnTextArea"); continue; } ((AnUtility.AnTextArea) func_text[i]).setCaretPosition(0); } else { int align_v = 0; if (align.length > i) { align_v = align[i]; } if (!(func_text[i] instanceof AnUtility.AnText)) { AnLog.log( "analyzer: invalid cast in updateSummary(): " + func_text[i] + " is not an AnUtility.AnText"); continue; } ((AnUtility.AnText) func_text[i]).setVisibleAlign(align_v, need_validate); } } } // Clear summary display after error public void clear() { func_renew = true; func_info.removeAll(); metrics_info.removeAll(); } // XXXX set metrics title for compare mode to indicate base group only public void setBaseOnly(boolean baseOnly) { if (baseOnly == true) { metric_title.setText(AnLocale.getString("Metrics (base group only)")); } else { metric_title.setText(""); } metric_title.repaint(); } // Native methods from liber_dbe.so private Object[] getSummary(final long[] sel_obj, final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("getSummary"); window.IPC().send(win_id); window.IPC().send(sel_obj); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } private Object[] getSummaryV2(final long[] sel_obj, final int type, final int subtype) { synchronized (IPC.lock) { window.IPC().send("getSummaryV2"); window.IPC().send(0); window.IPC().send(sel_obj); window.IPC().send(type); window.IPC().send(subtype); return (Object[]) window.IPC().recvObject(); } } private Object[] getSummaryHotMarks(final long[] sel_obj, final int type) { synchronized (IPC.lock) { window.IPC().send("getSummaryHotMarks"); window.IPC().send(win_id); window.IPC().send(sel_obj); window.IPC().send(type); return (Object[]) window.IPC().recvObject(); } } } ��gprofng-gui-2.1/org/gprofng/mpmt/DisasmDisp.java����������������������������������������������������0000644�0001750�0001750�00000203533�15044710303�016635� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnTable.SelObjInfo; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Font; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.math.BigInteger; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.TreeSet; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextPane; import javax.swing.border.LineBorder; import javax.swing.text.BadLocationException; import javax.swing.text.Highlighter; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class DisasmDisp extends SourceDisp { private int[] src_type; private int prevScroll = -1; private boolean inCompute = false; private int my_src_type = AnTable.AT_DIS; private int my_src_type_only = AnTable.AT_DIS_ONLY; private long lastSelObj = 0; // Constructor public DisasmDisp(final AnWindow window, final int type, final String help_id) { super(window, type, help_id); } // Constructor public DisasmDisp(final AnWindow window, final int type, final String help_id, final int ptype) { super(window, type, help_id, ptype); } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); String acName = AnLocale.getString("Disassembly"); String acDesc = AnLocale.getString("Show disassemled code for selected function"); JLabel acLabel = new JLabel(acName, JLabel.RIGHT); table = new AnTable(type, true, true, can_sort, false, true, true, true, acName, acDesc, acLabel); table.setParent(this); acLabel.setVisible(false); // acLabel.setDisplayedMnemonic(acName.charAt(0)); table.add(acLabel); table.addAnListener(new TableHandler()); add(table, BorderLayout.CENTER); HotGapPanel hotGapPanel = new HotGapPanel(this); table.setHotGapPanel(hotGapPanel); add(hotGapPanel, BorderLayout.EAST); warningPane = new JPanel(); warningPane.setVisible(false); // warningPane.setBorder(AnVariable.textBorder); warningPane.setBorder(new LineBorder(AnEnvironment.SPLIT_PANE_BORDER_COLOR)); add(warningPane, BorderLayout.SOUTH); } // Clear display @Override public void clear() { if (table != null) { table.removeAll(); } } // Compute & update function list table @Override public void doCompute() { final long sel_obj; int new_ind; final int sort_ind; final Object[] raw_data; final String pwarnstr; final MetricLabel[] label; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (inCompute) { // NM TEMPORARY should be synchronized return; } else { inCompute = true; } if (lastFilterSelection != null) { window.getSelectedObject().setSelObjV2(lastFilterSelection.id); } sel_obj = window.getSelectedObject().getSelObj(type, subtype); // sel_func = window.getSelObj(DSP_FUNCTION, 0); // if (-1 == sel_func) { long lastSelFunc = sel_func; sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) if (!forceCompute && parent_type != AnDisplay.DSP_SourceDisassembly && lastSelFunc == sel_func && lastSelObj == sel_obj) { computed = true; } if (forceCompute) { forceCompute = false; } // } if (!computed) { // need re-compute lastSelObj = sel_obj; reset(); Object[] res = setFuncData(sel_func, type, subtype); new_ind = (int) ((long[]) (res[0]))[0]; String errstr = ((String[]) (res[1]))[0]; long sf_id = ((long[]) (res[0]))[1]; String sf_name = ((String[]) (res[1]))[1]; // Update table if (errstr == null) { updateWarningPanel(); table.setViewport(); Object[][] table_data; raw_data = getFuncList(type, subtype); Object[] raw_marks = getHotMarks(type); Object[] raw_marks_inc = getHotMarksInc(type); int[][] marks = new int[2][]; marks[0] = (int[]) raw_marks[0]; marks[1] = (int[]) raw_marks[1]; int[][] marks_inc = new int[2][]; marks_inc[0] = (int[]) raw_marks_inc[0]; marks_inc[1] = (int[]) raw_marks_inc[1]; final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); table_data = localProcessData(mlist, raw_data); src_type = (int[]) raw_data[raw_data.length - 1]; // AnTable.AT_SRC, DIS, QUOTE, etc. String[] hdrContent = getNames(type, 0); // name column table header contents (?) label = getSettings().getMetricsSetting().getLabel(table_data, null, type, table); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); int func_ind = (new_ind == -1) ? 0 : new_ind; new_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); new_ind = (new_ind == -1) ? func_ind : new_ind; table.setData(label, table_data, hdrContent, src_type, new_ind, name_col, sort_ind, marks, marks_inc); if (sel_func == 0) { window.getSelectedObject().setSelObj(new_ind, type, subtype); } } else { window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); table.showMessage(errstr); } } // Update selected row new_ind = window.getSelectedObject().getSelIndex(sel_obj, type, subtype); if (new_ind == -1) { new_ind = table.getSelectedRow(); table.showSelectedRow(); window.getSelectedObject().setSelObj(new_ind, type, subtype); // if (-1 == sel_func) { // Do we need sel_func? sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // } } else { table.setSelectedRow(new_ind); } // scroll to previous location after re-sort if (prevScroll > 0) { table.setScroll(prevScroll); prevScroll = -1; } updateGap(); // Update summary display if (parent_type != AnDisplay.DSP_SourceDisassembly) { updateSummary(new_ind); } computed = true; // pstatstr = window.getMsg(AnUtility.PSTAT_MSG); pwarnstr = window.getMsg(AnUtility.PWARN_MSG); // if (pstatstr != null) { // window.appendLog(pstatstr); // } if (pwarnstr != null) { window.showProcessorWarning(pwarnstr); } if (lastFilterSelection != null) { if (lastSelSrc == sel_src) { table.setSelectedRow(lastFilterSelection.lineno); // XXX we should not call setSelObj when we go to the Source tab window.getSelectedObject().setSelObj(lastFilterSelection.lineno, type, subtype); } lastFilterSelection = null; lastSelSrc = -1; } window .getCalledByCallsDisassemblyView() .doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // Set toolbar and select subviews updateToolBar(); if (tailAction != null) { tailAction.tailFunction(); tailAction = null; } inCompute = false; } // Is current selected tab? public void setSelected(final boolean set) { selected = set; window.getCalledByCallsDisassemblyView().setSelected(set); } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { // Update Total value AnObject[] totals = getTotals(type, subtype); // IPC call if (totals != null) { if (MaximumValues == null) { MaximumValues = new Object[2][totals.length]; MaximumValues[1] = totals; } MaximumValues[0] = totals; } // Call super.exportAsText String text = super.exportAsText(limit, format, delimiter); return text; } // Set current func/load-object in 'selected func' & summary display private void updateSummary(final int new_ind) { // Use "AWT-EventQueue-0" thread to avoid race conditions AnUtility.dispatchOnSwingThread( new Runnable() { public void run() { int[] rows = table.getSelectedRows(); if (null != rows) { if (rows.length > 1) { // Special case for multiselection: pass only lines with my_src_type int len = 0; for (int i = 0; i < rows.length; i++) { int k = rows[i]; if (k < src_type.length) { int stype = src_type[k]; if (stype < 0) { stype = -stype; } if ((stype == my_src_type) || (stype == my_src_type_only)) { len++; } } } if ((len > 0) && (len != rows.length)) { long[] filtered_rows = new long[len]; for (int i = 0, m = 0; i < rows.length; i++) { int k = rows[i]; int stype = src_type[k]; if (stype < 0) { stype = -stype; } if ((stype == my_src_type) || (stype == my_src_type_only)) { filtered_rows[m] = rows[i]; m++; } } window.getSelectionManager().updateSelection(filtered_rows, type, subtype, 1); return; } } window.getSelectionManager().updateSelection(rows, type, subtype, 1); // } else { // no source } } }); } // Listener for updating table private final class TableHandler implements AnListener { public void valueChanged(final AnEvent event) { final int from; final int to; int stype = 0; final boolean can_nav; switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting from = event.getValue(); if (can_sort) { can_nav = true; } else { stype = src_type[from]; if (stype < 0) { stype = -stype; } can_nav = (stype == AnTable.AT_SRC) || (stype == AnTable.AT_DIS) || (stype == AnTable.AT_QUOTE); } if ((type == DSP_Source)) { deselectRaceStack(subtype); // FIXUP: REARCH window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } if ((type == DSP_SourceDisassembly) || (type == DSP_Disassembly)) { if (stype == AnTable.AT_DIS) { window.getSourceDisassemblyView().focusInHalf(AnTable.AT_DIS); } else { // SOURCE window.getSourceDisassemblyView().focusInHalf(AnTable.AT_SRC); } } // Set selected object & Update summary display if (can_nav) { window.getSelectedObject().setSelObj(from, type, subtype); window.getCalledByCallsDisassemblyView().setComputed(false); window.getCalledByCallsDisassemblyView().computeOnAWorkerThread(); updateSummary(from); if (parent_type == DSP_SourceDisassembly) { window.getSourceDisassemblyView().syncHalf(AnTable.AT_SRC); } } else // in other cases (eg. AT_SRC_ONLY), just update summary { window.getCalledByCallsDisassemblyView().setComputed(false); window.getCalledByCallsDisassemblyView().computeOnAWorkerThread(); updateSummary(from); } if (parent_type == DSP_SourceDisassembly) { updateToolBar(); } break; case AnEvent.EVT_SORT: // Sorting // save current scroll location prevScroll = table.getScroll(); int func_sort_col = getFuncSortColumn(((Integer) event.getAux()).intValue()); getSettings() .getMetricsSetting() .setSortMetricByDType(this, func_sort_col, AnDisplay.DSP_Functions); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SWITCH: // Column switching if (table != null) { table.columnsSaved = false; } from = event.getValue(); to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; } } } /* * Class to render source code for simple syntax highlighting */ static class DisRenderer extends SrcRenderer { private final String[] BRANCH_INSTRS = { "goto", // branch for java byte code "goto_w", "jsr", "jsr_w", "if_acmpeq", "if_acmpne", "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge", "if_icmpgt", "if_icmple", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle", "ifnonnull", "ifnull" }; private final String[] X86_BRANCH_INSTRS = { "jmp", "jno", "jb", "jnae", "jc", "jnb", "jae", "jnc", "jz", "je", "jnz", "jne", "jbe", "jna", "jnbe", "ja", "js", "jns", "jp", "jpe", "jnp", "jpo", "jl", "jnge", "jnl", "jge", "jle", "jng", "jnle", "jg", "jo", "jmpf", "loopnz", "loopne", "loopz", "loope", "loop", "jecxz", "jrcxz", "jmpe", "syscall", "sysenter", "sysexit", "rsm", "loadall" }; private static final String SPLIT_PATTERN = "[(),:* \\[\\]]"; public static final int AT_DIS = 3; protected static final int AT_DIS_ONLY = 8; protected int maxDisCachedNumber = 1; // XXXX don't cache disasm view data since there is no consistant row to content map protected int caretLinePosition = -1; protected String previousSelectedReg = ""; protected Integer previousSelectedFunction = -1; protected HashMap<Integer, HashMap<String, ArrayList<Integer>>> regsInFunction = new HashMap< Integer, HashMap< String, ArrayList<Integer>>>(); // stores for each reg which rows it's in for each function protected HashMap<Integer, DisTextMarker> disRendered = null; // stores cached DisTextMarker of each line protected HashMap<Integer, DisTextPane> disPaneCreated = null; // stores cached DisTextPane of each line protected HashMap<Long, HashMap<Integer, DisTextMarker>> disRenderedMap = new HashMap< Long, HashMap< Integer, DisTextMarker>>(); // stores cached disRendered of each selected object that has // been shown in Source View before protected HashMap<Long, HashMap<Integer, DisTextPane>> disPaneCreatedMap = new HashMap<Long, HashMap<Integer, DisTextPane>>(); protected HashMap<String, Integer> addrToRow = new HashMap<String, Integer>(); protected HashMap<Integer, String> rowToAddr = new HashMap<Integer, String>(); protected HashMap<String, Boolean> addrIsBranch = new HashMap<String, Boolean>(); protected boolean isJavaByteCode = false; protected boolean isX86 = false; protected boolean reachedMemLimit = false; protected int numRows = 0; protected final HashMap<String, Boolean> branchInstrMap; protected final HashMap<String, Boolean> x86BranchInstrMap; public DisRenderer(AnTable table) { super(table); branchInstrMap = new HashMap<String, Boolean>(); for (int i = 0; i < BRANCH_INSTRS.length; i++) { branchInstrMap.put(BRANCH_INSTRS[i], Boolean.TRUE); } x86BranchInstrMap = new HashMap<String, Boolean>(); for (int i = 0; i < X86_BRANCH_INSTRS.length; i++) { x86BranchInstrMap.put(X86_BRANCH_INSTRS[i], Boolean.TRUE); } } public boolean regEquals(String r0, String r1) { if ((r0 == null && r1 != null) || (r1 == null && r0 != null)) { return false; } else if (r0 == null && r1 == null) { return true; } String reg0 = r0.replaceFirst("%", ""); String reg1 = r1.replaceFirst("%", ""); if (reg0.equalsIgnoreCase(reg1)) { return true; } else { if (reg0.matches("[rR]([89]|[1][0-6])[bwdBWD]?") && reg1.matches("[rR]([89]|[1][0-6])[bwdBWD]?")) { String number0 = reg0.replaceFirst("[rR]", ""); number0 = number0.replaceFirst("[bwdBWD]", ""); String number1 = reg1.replaceFirst("[rR]", ""); number1 = number1.replaceFirst("[bwdBWD]", ""); return number0.equalsIgnoreCase(number1); } else if (reg0.matches("[erER]?[a-dA-D][xX]|[a-dA-D][hlHL]") && reg1.matches("[erER]?[a-dA-D][xX]|[a-dA-D][hlHL]")) { String number0 = reg0.replaceFirst("[erER]", ""); number0 = number0.replaceFirst("[xhlXHL]", ""); String number1 = reg1.replaceFirst("[erER]", ""); number1 = number1.replaceFirst("[xhlXHL]", ""); return number0.equalsIgnoreCase(number1); } else if (reg0.matches("[erER]?(SI|si|DI|di|BP|bp|SP|sp)|(SI|si|DI|di|BP|bp|SP|sp)[lL]") && reg1.matches("[erER]?(SI|si|DI|di|BP|bp|SP|sp)|(SI|si|DI|di|BP|bp|SP|sp)[lL]")) { String number0 = reg0.replaceFirst("[erER]", ""); number0 = number0.replaceFirst("[lL]", ""); String number1 = reg1.replaceFirst("[erER]", ""); number1 = number1.replaceFirst("[lL]", ""); return number0.equalsIgnoreCase(number1); } else if (reg0.matches("[xyXY](MM|mm)([0-9]|[1][0-5])") && reg1.matches("[xyXY](MM|mm)([0-9]|[1][0-5])")) { String number0 = reg0.replaceFirst("[xyXY](MM|mm)", ""); String number1 = reg1.replaceFirst("[xyXY](MM|mm)", ""); return number0.equalsIgnoreCase(number1); } return false; } } public String regFullName(final String r) { if (r == null) { return r; } String reg = r.replaceFirst("%", ""); if (reg.matches("[rR]([89]|[1][0-6])[bwdBWD]?")) { String number = reg.replaceFirst("[rR]", ""); number = number.replaceFirst("[bwdBWD]", ""); return "%r" + number; } else if (reg.matches("[erER]?[a-dA-D][xX]|[a-dA-D][hlHL]")) { isX86 = true; String number = reg.replaceFirst("[erER]", ""); number = number.replaceFirst("[xhlXHL]", ""); return "%r" + number + "x"; } else if (reg.matches("[erER]?(SI|si|DI|di|BP|bp|SP|sp)|(SI|si|DI|di|BP|bp|SP|sp)[lL]")) { String number = reg.replaceFirst("[erER]", ""); number = number.replaceFirst("[lL]", ""); return "%r" + number; } else if (reg.matches("[xyXY](MM|mm)([0-9]|[1][0-5])")) { isX86 = true; String number = reg.replaceFirst("[xyXY](MM|mm)", ""); return "%ymm" + number; } return r; } protected void renderDis( final Object[][] table_data, final int[] src_type, final long sel_instr) { tableData = table_data; srcTypeData = src_type; previousSelectedReg = ""; previousSelectedFunction = -1; // initialize or store new cached data for the selected object // cache disasm data per function since we don't have a unique id for disasm data in dbe if (disRenderedMap.size() >= maxDisCachedNumber) { // clear data cache before it gets too large disRenderedMap.clear(); disPaneCreatedMap.clear(); } disRendered = disRenderedMap.get(sel_instr); disPaneCreated = disPaneCreatedMap.get(sel_instr); if (disRendered == null || sel_instr == 0) { if (disRendered == null) { disRendered = new HashMap<Integer, DisTextMarker>(); } disRendered.clear(); regsInFunction.clear(); addrToRow.clear(); rowToAddr.clear(); addrIsBranch.clear(); isJavaByteCode = false; isX86 = false; numRows = table_data[fl_table.getNameCol()].length; for (int i = 0; i < numRows; i++) { Object value = table_data[fl_table.getNameCol()][i]; int type = src_type[i] < 0 ? (-src_type[i]) : src_type[i]; if (value instanceof String && (type == AT_DIS || type == AT_DIS_ONLY)) { if (AnMemoryManager.getInstance().checkMemoryThreshold()) { reachedMemLimit = true; break; } DisTextMarker dm = new DisTextMarker(i, ((String) value)); disRendered.put(i, dm); } } Set<Integer> rows = disRendered.keySet(); if (reachedMemLimit) { rows = new TreeSet<Integer>(); for (int i = 0; i < numRows; i++) { Object value = table_data[fl_table.getNameCol()][i]; int type = src_type[i] < 0 ? (-src_type[i]) : src_type[i]; if (value instanceof String && (type == AT_DIS || type == AT_DIS_ONLY)) { rows.add(i); } } } if (rows != null) { for (final Integer r : rows) { if (calleeInfo != null && calleeInfo.get(r) != null) { continue; // skip callsite instruction } DisTextMarker dm = disRendered.get(r); if (reachedMemLimit && dm == null) { dm = newTextMarker(r); dm.renderCode(r, true); } if (dm.addrPositions != null && !dm.addrPositions.isEmpty()) { Set<String> addrs = dm.addrPositions.keySet(); if (addrs.size() > 1) { continue; } for (final String addr : addrs) { Integer addrRow = addrToRow.get(addr); addrIsBranch.put(addr, true); String targetFunc = addrRow == null ? null : getFunction(addrRow.intValue()); String curFunc = getFunction(r.intValue()); if (targetFunc == null || curFunc == null || (!curFunc.equalsIgnoreCase(targetFunc))) { dm.replaceMarkerStyle("jmp_back", "jmp_outside"); dm.replaceMarkerStyle("jmp_other", "jmp_outside"); } } } } } // render block start addresses renderBlocks(0, table_data[fl_table.getNameCol()].length, false); disRenderedMap.put(sel_instr, disRendered); } if (disPaneCreated == null || sel_instr == 0) { if (disPaneCreated == null) { disPaneCreated = new HashMap<Integer, DisTextPane>(); } disPaneCreated.clear(); disPaneCreatedMap.put(sel_instr, disPaneCreated); } if (calleeInfo != null) { for (final Integer callsite : calleeInfo.keySet()) { DisTextMarker dm = disRendered.get(callsite); if (dm != null) { dm.isCallSite = true; } } } // add new obj to history if it's different from current if (fl_table.getNavigationHistoryPool().getHistory().enabled) { int row = fl_table.getSelectedRow(); DisTextMarker dm = disRendered.get(row); if (dm == null) { dm = newTextMarker(row); } if (dm != null) { String baseAddrStr = getRowToAddr(row, row); long fun_id = -1; if (functionId != null && row > 0 && row <= functionId.size()) { fun_id = functionId.get(row); } if (fun_id == 0) { fun_id = fl_table.getAnParent().window.getSelectedObject().getSelObjV2("FUNCTION"); } SelObjInfo cur_so = fl_table.getNavigationHistoryPool().getHistory().getCurrent(); if (cur_so == null || cur_so.id != fun_id || (cur_so.name != null && !cur_so.name.equalsIgnoreCase(baseAddrStr))) { SelObjInfo new_so = new SelObjInfo(fun_id, row, baseAddrStr); fl_table.getNavigationHistoryPool().getHistory().goToNew(new_so); } else { fl_table.getNavigationHistoryPool().getHistory().newAdded = false; } } } } private void renderBlocks( final Integer startRow, final Integer endRow, final boolean allocateMemroy) { if (allocateMemroy) { for (Integer r = startRow; r < endRow; r++) { Object value = tableData[fl_table.getNameCol()][r]; int type = srcTypeData[r] < 0 ? (-srcTypeData[r]) : srcTypeData[r]; if (!(value instanceof String && (type == AT_DIS || type == AT_DIS_ONLY))) { continue; } if (calleeInfo != null && calleeInfo.get(r) != null) { continue; // skip callsite instruction } DisTextMarker dm = disRendered.get(r); DisTextPane dt = disPaneCreated == null ? null : disPaneCreated.get(r); if (dm == null) { dm = new DisTextMarker(r, (String) value); disRendered.put(r, dm); } if (dt == null) { // only create JTextPanel when it needs to be shown if (dm != null) { dm.renderCode(r, true); } if (dm != null && calleeInfo.get(r) != null) { dm.isCallSite = true; } } if (dm.addrPositions != null && !dm.addrPositions.isEmpty()) { Set<String> addrs = dm.addrPositions.keySet(); if (addrs.size() > 1) { continue; } for (final String addr : addrs) { Integer addrRow = getAddrToRow(addr, r); addrIsBranch.put(addr, true); String targetFunc = addrRow == null ? null : getFunction(addrRow.intValue()); String curFunc = getFunction(r.intValue()); if (targetFunc == null || curFunc == null || (!curFunc.equalsIgnoreCase(targetFunc))) { dm.replaceMarkerStyle("jmp_back", "jmp_outside"); dm.replaceMarkerStyle("jmp_other", "jmp_outside"); } } } } } // render block start addresses if (!isJavaByteCode) { int funcStart = 0; int seenCB = 0; for (int i = startRow; i < endRow; i++) { Object value = tableData[fl_table.getNameCol()][i]; int type = srcTypeData[i] < 0 ? (-srcTypeData[i]) : srcTypeData[i]; if (type == AnTable.AT_FUNC) { funcStart = 1; seenCB = 0; } if (value instanceof String && (type == AT_DIS || type == AT_DIS_ONLY)) { DisTextMarker dm = disRendered.get(i); DisTextPane dt = disPaneCreated == null ? null : disPaneCreated.get(i); if (dm == null && allocateMemroy) { dm = new DisTextMarker(i, (String) value); disRendered.put(i, dm); } if (dt == null && allocateMemroy) { // only create JTextPanel when it needs to be shown if (dm != null) { dm.renderCode(i, true); } if (dm != null && calleeInfo.get(i) != null) { dm.isCallSite = true; } } if (i > 0) { int type_pre = srcTypeData[i - 1] < 0 ? (-srcTypeData[i - 1]) : srcTypeData[i - 1]; if (type_pre == AnTable.AT_FUNC) { funcStart = 1; seenCB = 0; } } if (dm != null) { String addr = dm.getAddr(); Boolean isBranch = addrIsBranch.get(addr); if (isBranch != null && isBranch == true) { dm.replaceMarkerStyle("address", "block_start_address"); } if (dm.hasCall || dm.hasBranch || dm.isRet) { seenCB = 1; } } } } } } public DisTextPane getDisTextPane(final String content, final JComponent cmp, final int row) { Integer function = getFunctionBaseRowWhenCompare(row); if (functionCallerCalleeAdded.get(function) == null) { addFunctionByRow(function); } DisTextMarker dm = disRendered.get(row); if (dm == null) { renderBlocks( row - 100 > 0 ? row - 100 : 0, row + 100 > tableData[fl_table.getNameCol()].length ? tableData[fl_table.getNameCol()].length : row + 100, true); } dm = disRendered.get(row); DisTextPane dt = disPaneCreated.get(row); if (dt == null) { // only create JTextPanel when it needs to be shown if (dm != null) { dm.renderCode(row, true); } if (dm != null && calleeInfo.get(row) != null) { dm.isCallSite = true; } dt = new DisTextPane(content, cmp, dm); disPaneCreated.put(row, dt); } final int[] anno_set = fl_table.getAnParent().window.getSettings().getSourceDisassemblySetting().get(); boolean scope_only = false; if (anno_set.length > 8) { // To accomodate older configurations that don't have scope... scope_only = (anno_set[8] != 0); } if (scope_only || (function != null && function.equals(previousSelectedFunction))) { dt.updateRegSelection(previousSelectedReg); } HashMap<String, ArrayList<Integer>> regRows = regsInFunction.get(function); if (regRows == null) { regRows = new HashMap<String, ArrayList<Integer>>(); regsInFunction.put(function, regRows); } if (dm != null) { Set<String> regs = dm.regPositions.keySet(); if (regs != null) { for (final String r : regs) { if (scope_only) { for (Map.Entry entry : regsInFunction.entrySet()) { HashMap<String, ArrayList<Integer>> regMap = (HashMap<String, ArrayList<Integer>>) entry.getValue(); ArrayList<Integer> list = regMap.get(regFullName(r)); if (list == null) { list = new ArrayList<>(); regMap.put(regFullName(r), list); } if (!list.contains(row)) { list.add(row); } } } else { ArrayList<Integer> list = regRows.get(regFullName(r)); if (list == null) { list = new ArrayList<>(); regRows.put(regFullName(r), list); } if (!list.contains(row)) { list.add(row); } } } } } return dt; } protected final class DisTextPane extends JTextPane { private DisTextMarker textMarker = null; private String selectedReg = null; private UnderlineHighlighter highlighter = new UnderlineHighlighter(AnVariable.OPCODE_COLOR); private Highlighter.HighlightPainter painter = highlighter.new UnderlineHighlightPainter(AnVariable.OPCODE_COLOR); public DisTextPane(final String content, final JComponent cmp, final DisTextMarker tm) { textMarker = tm; setEditable(false); setForeground(cmp.getForeground()); setBackground(cmp.getBackground()); setHighlighter(highlighter); Style style1 = addStyle("opcode", null); StyleConstants.setForeground(style1, AnVariable.OPCODE_COLOR); Style style2 = addStyle("oprandreg", null); StyleConstants.setForeground(style2, AnVariable.OPRANDREG_COLOR); Style style3 = addStyle("oprandvalue", null); StyleConstants.setForeground(style3, AnVariable.OPRANDVALUE_COLOR); Style style4 = addStyle("address", null); // StyleConstants.setBold(style4, true); Style style5 = addStyle("selected", null); StyleConstants.setBackground(style5, AnVariable.REGSEL_COLOR); Style style6 = addStyle("defaultbackground", null); StyleConstants.setBackground(style6, cmp.getBackground()); Style style7 = addStyle("jmp_other", null); StyleConstants.setUnderline(style7, true); StyleConstants.setForeground(style7, AnVariable.JMPOTHER_COLOR); Style style8 = addStyle("jmp_back", null); StyleConstants.setUnderline(style8, true); StyleConstants.setForeground(style8, AnVariable.JMPBACK_COLOR); Style style9 = addStyle("jmp_outside", null); StyleConstants.setUnderline(style9, true); StyleConstants.setForeground(style9, AnVariable.JMPOUTSIDE_COLOR); Style style10 = addStyle("line_no", null); // StyleConstants.setBold(style10, true); StyleConstants.setUnderline(style10, true); Style style11 = addStyle("callsite", null); StyleConstants.setUnderline(style11, true); StyleConstants.setBold(style11, true); Style style12 = addStyle("line_no_bold", null); // StyleConstants.setForeground(style12, AnVariable.LINENO_COLOR_BOLD); StyleConstants.setBold(style12, true); StyleConstants.setUnderline(style12, true); Style style13 = addStyle("block_start_address", null); StyleConstants.setBold(style13, true); StyledDocument doc = getStyledDocument(); try { doc.insertString(0, content, null); if (textMarker == null) { return; } for (int i = 0; i < textMarker.marker.size(); i++) { int from = textMarker.marker.get(i).from; int length = textMarker.marker.get(i).length; String style = textMarker.marker.get(i).style; doc.setCharacterAttributes(from, length, getStyle(style), true); } if (textMarker.isCallSite) { highlighter.addHighlight(textMarker.opcodeBegin, textMarker.opcodeEnd, painter); } } catch (BadLocationException e) { } final MouseMotionListener[] ls = getMouseMotionListeners(); for (final MouseMotionListener l : ls) { removeMouseMotionListener(l); } DisTextPaneMouseAdapter ma = new DisTextPaneMouseAdapter(cmp, this); DisTextPaneMouseMotionAdapter mam = new DisTextPaneMouseMotionAdapter(cmp, this); DisTextPaneMouseWheelAdapter maw = new DisTextPaneMouseWheelAdapter(cmp, this); SrcTextPaneKeyAdapter ka = new SrcTextPaneKeyAdapter(cmp); this.addMouseListener(ma); this.addMouseMotionListener(mam); this.addMouseWheelListener(maw); addKeyListener(ka); this.setDragEnabled(false); // this.setFont(cmp.getFont()); this.setFont(new Font(Font.MONOSPACED, Font.PLAIN, cmp.getFont().getSize())); this.setBorder(AnVariable.labelBorder); this.setForeground(cmp.getForeground()); this.setBackground(cmp.getBackground()); this.setOpaque(false); setEditable(false); } public void updateRegSelection(String reg) { if (selectedReg == null) { selectedReg = reg; } else if (regEquals(selectedReg, reg)) { return; } else { // remove previous highlightings if (textMarker == null) { return; } ArrayList<Position> list = textMarker.regPositions == null ? null : textMarker.regPositions.get(regFullName(selectedReg)); if (list != null) { StyledDocument doc = getStyledDocument(); for (int i = 0; i < list.size(); i++) { int start = list.get(i).start; int length = list.get(i).length; doc.setCharacterAttributes(start, length, getStyle("oprandreg"), true); } } selectedReg = reg; } if (textMarker == null) { return; } ArrayList<Position> list = textMarker.regPositions == null ? null : textMarker.regPositions.get(regFullName(reg)); if (list != null) { StyledDocument doc = getStyledDocument(); for (int i = 0; i < list.size(); i++) { int start = list.get(i).start; int length = list.get(i).length; doc.setCharacterAttributes(start, length, getStyle("selected"), true); } } } public String getReg(int pos) { return textMarker.regMap.get(pos); } public String getAddr(int pos) { return textMarker.addrMap.get(pos); } public String getLineNo(int pos) { return textMarker.lineNoMap.get(pos); } } public final class Position { int start; int length; public Position(int s, int l) { start = s; length = l; } } protected final class DisTextPaneMouseMotionAdapter extends MouseMotionAdapter { private Component parentComponent; private JTextPane pane; public DisTextPaneMouseMotionAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseMoved(MouseEvent e) {} } protected final class DisTextPaneMouseWheelAdapter implements MouseWheelListener { private Component parentComponent; private JTextPane pane; public DisTextPaneMouseWheelAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseWheelMoved(MouseWheelEvent e) { propagateToTable(e, true, parentComponent); } } protected final class DisTextPaneMouseAdapter extends MouseAdapter { private Component parentComponent; private JTextPane pane; public DisTextPaneMouseAdapter(JComponent cmp, JTextPane p) { pane = p; parentComponent = cmp; } public void mouseClicked(MouseEvent e) { propagateToTable(e, true, parentComponent); } public void mousePressed(MouseEvent e) { caretLinePosition = pane.getCaretPosition(); } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} } protected final class DisTextMarker { public HashMap<String, ArrayList<Position>> regPositions = new HashMap<String, ArrayList<Position>>(); public HashMap<Integer, String> regMap = new HashMap<Integer, String>(); public HashMap<String, ArrayList<Position>> addrPositions = new HashMap<String, ArrayList<Position>>(); public HashMap<Integer, String> addrMap = new HashMap<Integer, String>(); public HashMap<String, ArrayList<Position>> lineNoPositions = new HashMap<String, ArrayList<Position>>(); public HashMap<Integer, String> lineNoMap = new HashMap<Integer, String>(); public int opcodeBegin = -1; public int opcodeEnd = -1; public boolean isCallSite = false; public boolean hasCall = false; public boolean hasBranch = false; public boolean isBranchTargetMarker = false; public boolean isRet = false; public boolean isNop = false; protected final class Highlighter { public int from; public int length; public String style; public Highlighter(int f, int l, String s) { from = f; length = l; style = s; } } public ArrayList<Highlighter> marker = new ArrayList<>(); private String text = ""; private int curRow = -1; public DisTextMarker(final int row, final String content) { text = content; curRow = row; renderCode(row, false); } public DisTextMarker(final int row, final String content, final boolean doWork) { text = content; curRow = row; if (doWork) { renderCode(row, false); } } public int getRow() { return curRow; } public String getAddr() { String[] words = text.split(SPLIT_PATTERN); int numWords = 0; for (int i = 0; i < words.length; i++) { if (words[i].length() == 0) { } else { numWords++; if (numWords == 2) { return addrStripZero(words[i]); } } } return null; } public void replaceMarkerStyle(String oldStyle, String newStyle) { for (int i = 0; i < marker.size(); i++) { if (marker.get(i).style.equalsIgnoreCase(oldStyle)) { marker.get(i).style = newStyle; } } } public String addrStripZero(final String addr) { if (addr == null) { return addr; } int i = 0; for (i = 0; i < addr.length(); i++) { if (addr.charAt(i) != '0') { break; } } if (i == addr.length()) { i--; } String stripped = addr.substring(i); if (!isJavaByteCode) { return stripped; } else { try { long funcBase = getFunctionBaseRowWhenCompare(curRow) * 100; // XXXX ugly assumption that the longest java bytecode instruction is 100 // bytes BigInteger addrValue = new BigInteger(stripped, 16); BigInteger fBase = BigInteger.valueOf(funcBase); addrValue = fBase.add(addrValue); return addrValue.toString(16); } catch (NumberFormatException e) { return stripped; } } } public void renderCode(final int row, final boolean allocateMemory) { String[] words = text.split(SPLIT_PATTERN); int numWords = 0; int curPos = 0; int hexPos = -1; int hexIdx = -1; boolean seenOpcode = false; boolean seenCall = false; boolean seenBranch = false; String curAddr = null; for (int i = 0; i < words.length; i++) { if (words[i].length() == 0) { } else { numWords++; if (numWords == 1 && allocateMemory) { if (calleeInfo != null && calleeInfo.get(row) != null) { // it's a callsite marker.add(new Highlighter(curPos, words[i].length(), "line_no_bold")); } else { marker.add(new Highlighter(curPos, words[i].length(), "line_no")); } if (!words[i].equals("?")) { for (int temp = curPos; temp < curPos + words[i].length(); temp++) { lineNoMap.put(temp, words[i]); } } } else if (numWords == 2) { if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), "address")); } if (!isJavaByteCode) { if (words[i].equalsIgnoreCase( "00000000")) { // XXXX this is ugly, need a better solution to detect java byte // code isJavaByteCode = true; } } curAddr = addrStripZero(words[i]); if (!words[i].equals("?") && !allocateMemory) { addrToRow.put(curAddr, row); rowToAddr.put(row, curAddr); } } else if (numWords == 3) { if (words[i].length() == 2 && words[i].matches("[0-9a-fA-F][0-9a-fA-F]") && !(curPos + words[i].length() + 1 < text.length() && text.charAt(curPos + words[i].length()) == ',' && text.charAt(curPos + words[i].length() + 1) != ' ')) { // if it seems like a 2 digit hex number we skip it unless there is no opcode found numWords--; hexPos = curPos; hexIdx = i; } else if ((words[i].length() >= 2 && words[i].matches("[0-9._a-zA-Z]*") && !words[i].matches("0x[0-9a-fA-F]*")) || (words[i].length() == 1 && words[i].matches("[a-zA-Z]"))) { if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), "opcode")); } opcodeBegin = (opcodeBegin == -1) ? curPos : opcodeBegin; opcodeEnd = (opcodeEnd < (curPos + words[i].length())) ? (curPos + words[i].length()) : opcodeEnd; seenOpcode = true; if (words[i].equalsIgnoreCase("call")) { seenCall = true; hasCall = true; } else if (branchInstrMap.get(words[i].toLowerCase()) != null || (isX86 && x86BranchInstrMap.get(words[i].toLowerCase()) != null)) { seenBranch = true; hasBranch = true; } if ((curPos + words[i].length() + 1 < text.length() && text.charAt(curPos + words[i].length()) == ',' && text.charAt(curPos + words[i].length() + 1) != ' ') || ((words[i].equalsIgnoreCase("lock") // lock prefix for x86 || words[i].equalsIgnoreCase("rep") // rep* prefix of x86 || words[i].equalsIgnoreCase("repe") || words[i].equalsIgnoreCase("repz") || words[i].equalsIgnoreCase("repne") || words[i].equalsIgnoreCase("repnz")) && curPos + words[i].length() + 1 < text.length() && text.charAt(curPos + words[i].length()) == ' ' && text.charAt(curPos + words[i].length() + 1) != ' ')) { numWords--; } if (words[i].toLowerCase().contains("ret")) { isRet = true; } else if (words[i].equalsIgnoreCase("nop")) { isNop = true; } } else if (words[i].equalsIgnoreCase("<branch") && words[i + 1].equalsIgnoreCase("target>")) { isBranchTargetMarker = true; } } else if (words[i].charAt(0) == '$') { if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), "oprandvalue")); } } else if (words[i].charAt(0) == '%') { if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), "oprandreg")); } if (allocateMemory) { addRegPosition(words[i], curPos, words[i].length()); for (int temp = curPos; temp < curPos + words[i].length(); temp++) { regMap.put(temp, words[i]); } } else if (!isX86) { regFullName(words[i]); // detect whether it's X86 } } else if (calleeInfo != null && calleeInfo.get(row) != null) { // it's a callsite if (words[i].charAt(0) == '0' && words[i].length() > 2 && words[i].charAt(1) == 'x' && ((curPos - 2 >= 0 && curPos + words[i].length() + 1 < text.length() && text.charAt(curPos - 2) == '[' // [ addr ] or [ addr, .-offset] for x86 && (text.charAt(curPos + words[i].length() + 1) == ']' || text.charAt(curPos + words[i].length() + 1) == ' ')) || ((seenCall || seenBranch) && curPos - 1 >= 0 && text.charAt(curPos - 1) != '*'))) { String style = "callsite"; String newAddr = words[i].substring(2); String realAddr = addrStripZero(newAddr); marker.add(new Highlighter(curPos, words[i].length(), style)); addAddrPosition(realAddr, curPos, words[i].length()); if (allocateMemory) { for (int temp = curPos; temp < curPos + words[i].length(); temp++) { addrMap.put(temp, realAddr); } } hasBranch = true; } } else if (!seenCall && words[i].charAt(0) == '0' && words[i].length() > 2 && words[i].charAt(1) == 'x' && ((curPos - 2 >= 0 && curPos + words[i].length() + 1 < text.length() && text.charAt(curPos - 2) == '[' // [ addr ] or [ addr, .-offset] for x86 && (text.charAt(curPos + words[i].length() + 1) == ']' || text.charAt(curPos + words[i].length() + 1) == ' ')) || (seenBranch && (curPos - 2 < 0 || text.charAt(curPos - 2) != ',' // ingnore midle operand || curPos + words[i].length() >= text.length() || text.charAt(curPos + words[i].length()) != ',') && curPos - 1 >= 0 && text.charAt(curPos - 1) != '*'))) { String newAddr = words[i].substring(2); String realAddr = addrStripZero(newAddr); BigInteger realAddrNum = new BigInteger(realAddr, 16); BigInteger curAddrNum = new BigInteger(curAddr, 16); String style = null; if (realAddrNum.compareTo(curAddrNum) > 0) { style = "jmp_other"; } else { style = "jmp_back"; } if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), style)); } addAddrPosition(realAddr, curPos, words[i].length()); if (allocateMemory) { for (int temp = curPos; temp < curPos + words[i].length(); temp++) { addrMap.put(temp, realAddr); } } } } if (i < words.length - 1) { curPos += words[i].length() + 1; } } if (!seenOpcode && hexPos != -1) { marker.add(new Highlighter(hexPos, words[hexIdx].length(), "opcode")); opcodeBegin = (opcodeBegin == -1) ? curPos : opcodeBegin; opcodeEnd = (opcodeEnd < (curPos + words[hexIdx].length())) ? (curPos + words[hexIdx].length()) : opcodeEnd; seenOpcode = true; seenBranch = false; int i = hexIdx; for (i = hexIdx + 1; i < words.length; i++) { if (words[i].length() != 0 && words[i].charAt(0) == '0' && words[i].length() > 2 && words[i].charAt(1) == 'x' && seenBranch) { String newAddr = words[i].substring(2); String realAddr = addrStripZero(newAddr); BigInteger realAddrNum = new BigInteger(realAddr, 16); BigInteger curAddrNum = new BigInteger(curAddr, 16); String style = null; if (realAddrNum.compareTo(curAddrNum) > 0) { style = "jmp_other"; } else { style = "jmp_back"; } if (!allocateMemory) { marker.add(new Highlighter(curPos, words[i].length(), style)); } addAddrPosition(realAddr, curPos, words[i].length()); if (allocateMemory) { for (int temp = curPos; temp < curPos + words[i].length(); temp++) { addrMap.put(temp, realAddr); } } break; } } } } private void addRegPosition(String reg, int start, int length) { ArrayList<Position> positions = regPositions.get(regFullName(reg)); if (positions == null) { positions = new ArrayList<>(); regPositions.put(regFullName(reg), positions); } positions.add(new Position(start, length)); } private void addAddrPosition(String realAddr, int start, int length) { ArrayList<Position> positions = addrPositions.get(realAddr); if (positions == null) { positions = new ArrayList<>(); if (!realAddr.equals("?")) { addrPositions.put(realAddr, positions); } } positions.add(new Position(start, length)); } } private void clearSelectedRegs() { final int[] anno_set = fl_table.getAnParent().window.getSettings().getSourceDisassemblySetting().get(); boolean scope_only = false; if (anno_set.length > 8) { // To accomodate older configurations that don't have scope... scope_only = (anno_set[8] != 0); } if (scope_only) { for (Map.Entry entry : regsInFunction.entrySet()) { HashMap<String, ArrayList<Integer>> oldMap = (HashMap<String, ArrayList<Integer>>) entry.getValue(); ArrayList<Integer> oldList = null; if (oldMap != null) { oldList = oldMap.get(regFullName(previousSelectedReg)); } if (oldList != null) { for (final int r : oldList) { DisTextPane oldDt = disPaneCreated.get(r); if (oldDt != null) { oldDt.updateRegSelection(null); } } } } previousSelectedFunction = -1; previousSelectedReg = ""; return; } HashMap<String, ArrayList<Integer>> oldMap = regsInFunction.get(previousSelectedFunction); ArrayList<Integer> oldList = null; if (oldMap != null) { oldList = oldMap.get(regFullName(previousSelectedReg)); } if (oldList != null) { for (final int r : oldList) { DisTextPane oldDt = disPaneCreated.get(r); if (oldDt != null) { oldDt.updateRegSelection(null); } } } previousSelectedFunction = -1; previousSelectedReg = ""; } protected void updateSelectedRegs(int row) { DisTextPane dt = disPaneCreated.get(row); if (dt != null) { String reg = dt.getReg(caretLinePosition); if (reg != null) { final int[] anno_set = fl_table.getAnParent().window.getSettings().getSourceDisassemblySetting().get(); boolean scope_only = false; if (anno_set.length > 8) { // To accomodate older configurations that don't have scope... scope_only = (anno_set[8] != 0); } if (scope_only) { if (!regEquals(reg, previousSelectedReg)) { clearSelectedRegs(); Integer function = -1; for (Map.Entry entry : regsInFunction.entrySet()) { HashMap<String, ArrayList<Integer>> regMap = (HashMap<String, ArrayList<Integer>>) entry.getValue(); ArrayList<Integer> newList = regMap.get(regFullName(reg)); if (newList != null) { for (final int r : newList) { DisTextPane newDt = disPaneCreated.get(r); if (newDt != null) { newDt.updateRegSelection(reg); } } } function = (Integer) entry.getKey(); } previousSelectedReg = reg; previousSelectedFunction = function; } } else { Integer function = getFunctionBaseRowWhenCompare(row); if (function != null && (!regEquals(reg, previousSelectedReg) || !function.equals(previousSelectedFunction))) { clearSelectedRegs(); ArrayList<Integer> newList = regsInFunction.get(function).get(regFullName(reg)); if (newList != null) { for (final int r : newList) { DisTextPane newDt = disPaneCreated.get(r); if (newDt != null) { newDt.updateRegSelection(reg); } } } previousSelectedReg = reg; previousSelectedFunction = function; } } } else { clearSelectedRegs(); } } else { clearSelectedRegs(); } fl_table.repaint(); } protected boolean goToAddr(int row) { DisTextPane dt = disPaneCreated.get(row); if (dt != null) { String addr = dt.getAddr(caretLinePosition); if (addr == null && calleeInfo != null && calleeInfo.get(row) != null && calleeInfo.get(row).size() > 0 && (caretLinePosition >= dt.textMarker.opcodeBegin && caretLinePosition < dt.textMarker.opcodeEnd)) { for (final String key : dt.textMarker.addrPositions.keySet()) { addr = key; } } if (addr != null) { Integer targetRowObj = getAddrToRow(addr, row); if (targetRowObj != null) { int targetRow = targetRowObj.intValue(); // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToDisNew(row); fl_table.getNavigationHistoryPool().getHistory().enabled = false; fl_table.setSelectedRow(targetRow); fl_table.getNavigationHistoryPool().getHistory().enabled = true; fl_table.fireAnEvent(new AnEvent(fl_table, AnEvent.EVT_SELECT, targetRow, null)); // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToDisNew(targetRow); fl_table.getAnParent().updateToolBar(); return true; } } } return false; } protected void goToCallee(int row, MouseEvent e) { if (calleeInfo == null || calleeInfo.get(row) == null) { return; } DisTextPane dt = disPaneCreated.get(row); if (dt != null) { String addr = dt.getAddr(caretLinePosition); if (addr != null || (caretLinePosition >= dt.textMarker.opcodeBegin && caretLinePosition < dt.textMarker.opcodeEnd)) { if (calleeInfo.get(row).size() > 1) { // pop up context menu JPopupMenu popup = fl_table.getMenuListener().initPopup(e); if (popup != null) { popup.show(e.getComponent(), e.getX(), e.getY()); boolean pressDown = false; for (int i = 0; i < 3; i++) { // XXXX ugly assumption that the "show callee dis" is the 3rd item if (!popup.getComponent(i).isEnabled()) { continue; } popup.dispatchEvent( new KeyEvent(popup, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_DOWN, '\0')); pressDown = true; } if (pressDown) { popup.dispatchEvent( new KeyEvent(popup, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_RIGHT, '\0')); } } } else { long funcId = calleeInfo.get(row).get(0).id; // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToDisNew(row); // change selected object fl_table.getAnParent().window.getSelectedObject().setSelObjV2(funcId); fl_table.getAnParent().setComputed(false); fl_table.getAnParent().computeOnAWorkerThread(); fl_table.updateAnTable(AnTable.STR_ACTION_SHOW_CALLEE_DISASM); } } } } protected void goToSrcLine(int row) { DisTextPane dt = disPaneCreated.get(row); if (dt != null) { String ln = dt.getLineNo(caretLinePosition); if (ln != null) { int targetRow = getRowByLineNo(Integer.parseInt(ln.trim())); if (targetRow != -1) { // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToDisNew(row); fl_table.getNavigationHistoryPool().getHistory().enabled = false; fl_table.setSelectedRow(targetRow); fl_table.getNavigationHistoryPool().getHistory().enabled = true; fl_table.fireAnEvent(new AnEvent(fl_table, AnEvent.EVT_SELECT, targetRow, null)); // add new obj to history if it's different from current fl_table.getNavigationHistoryPool().getHistory().goToDisNew(targetRow); fl_table.getAnParent().updateToolBar(); } } } } protected DisTextMarker newTextMarker(int i) { DisTextMarker dm = null; if (tableData == null || fl_table == null || srcTypeData == null || fl_table.getNameCol() >= tableData.length || i >= tableData[fl_table.getNameCol()].length || i < 0) { return dm; } Object value = tableData[fl_table.getNameCol()][i]; int type = srcTypeData[i] < 0 ? (-srcTypeData[i]) : srcTypeData[i]; if (value instanceof String && (type == AT_DIS || type == AT_DIS_ONLY)) { dm = new DisTextMarker(i, ((String) value), false); } return dm; } public Integer getAddrToRow(String addr) { int base_row = fl_table.getSelectedRow(); return getAddrToRow(addr, base_row); } public Integer getAddrToRow(String addr, int base_row) { Integer row = addrToRow.get(addr); if (row != null || !reachedMemLimit) { return row; } else { // find row row = null; DisTextMarker dm = disRendered.get(base_row); if (dm == null) { dm = newTextMarker(base_row); } String base_addr = dm.getAddr(); BigInteger baseAddrNum = new BigInteger(base_addr, 16); BigInteger curAddrNum = new BigInteger(addr, 16); if (baseAddrNum.compareTo(curAddrNum) > 0) { for (int i = base_row; i > 0; i--) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { String cur_addr = dm.getAddr(); if (cur_addr.equalsIgnoreCase(addr)) { return i; } } } } else if (baseAddrNum.compareTo(curAddrNum) < 0) { for (int i = base_row; i < numRows; i++) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { String cur_addr = dm.getAddr(); if (cur_addr.equalsIgnoreCase(addr)) { return i; } } } } else { return base_row; } if (row == null) { if (baseAddrNum.compareTo(curAddrNum) < 0) { for (int i = base_row; i > 0; i--) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { String cur_addr = dm.getAddr(); if (cur_addr.equalsIgnoreCase(addr)) { return i; } } } } else if (baseAddrNum.compareTo(curAddrNum) > 0) { for (int i = base_row; i < numRows; i++) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { String cur_addr = dm.getAddr(); if (cur_addr.equalsIgnoreCase(addr)) { return i; } } } } } return row; } } public String getRowToAddr(int row) { int base_row = fl_table.getSelectedRow(); return getRowToAddr(row, base_row); } public String getRowToAddr(int row, int base_row) { String addr = rowToAddr.get(row); if (addr != null || !reachedMemLimit) { return addr; } else { // find addr addr = null; DisTextMarker dm = disRendered.get(base_row); if (dm == null) { dm = newTextMarker(base_row); } if (base_row > row) { for (int i = base_row; i > 0; i--) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { int cur_row = dm.getRow(); if (cur_row == row) { return dm.getAddr(); } } } } else if (base_row < row) { for (int i = base_row; i < numRows; i++) { dm = disRendered.get(i); if (dm == null) { dm = newTextMarker(i); } if (dm != null) { int cur_row = dm.getRow(); if (cur_row == row) { return dm.getAddr(); } } } } else { return dm == null ? null : dm.getAddr(); } return addr; } } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CallerCalleesView.java���������������������������������������������0000644�0001750�0001750�00000176742�15044710303�020136� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.AnDisplay.DSP_Callees; import static org.gprofng.mpmt.AnDisplay.DSP_CallerCalleeSelf; import static org.gprofng.mpmt.AnDisplay.DSP_Callers; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import static org.gprofng.mpmt.util.gui.AnUtility.EOL; import static org.gprofng.mpmt.util.gui.AnUtility.SPACES_BETWEEN_COLUMNS; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import java.util.Vector; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.SwingUtilities; import javax.swing.border.EmptyBorder; public final class CallerCalleesView extends FuncListDisp implements ExportSupport, AnChangeListener { private static final int CALLER_MIN_HEIGHT = 80; private static final int CALLEE_MIN_HEIGHT = 60; private AnTable caller, func_item, callee; private Object[][] caller_data = null; private Object[][] func_data = null; private Object[][] callee_data = null; private LocalProcessData caller_data_lpd; private LocalProcessData func_data_lpd; private LocalProcessData callee_data_lpd; private String acNameT1; private String acDescT1; private String acNameT2; private String acDescT2; private String acNameT3; private String acDescT3; private long[] ids_callers = null; private long[] ids_callees = null; private long[] ids_cstack = null; private String[] ids_names = null; private CC_CallStack cc_callstack = new CC_CallStack(); private CallStackToolbarHandler CS_ControlPanel; private boolean singleFunctionMode = false; // Interface strings final String mlistStr = "MET_CALL"; final String typeStrFunc = "FUNCTION"; final String subtypeStr = "0"; final String stab_callers = "CALLERS"; final String stab_callees = "CALLEES"; final String stab_self = "SELF"; // Constructor public CallerCalleesView() { super(AnWindow.getInstance(), AnDisplay.DSP_Callers, 0, AnVariable.HELP_TabsCallersCallees); setAccessibility(AnLocale.getString("Callers and callees of the selected function")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("CallerCalleesView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void requestFocus() { if (caller != null) { caller.requestFocus(); } } @Override public JPanel getToolbarPanel() { return null; } // Initialize GUI components @Override protected void initComponents() { final JPanel pcaller, pfunc_item, pcallee; JLabel label_callers, label_function, label_callees; JLabel label_callers_text, label_function_text, label_callees_text; final JSplitPane split_pane_1; final JSplitPane split_pane_2; Dimension msize; setLayout(new BorderLayout()); // Create table names and descriptions acNameT1 = AnLocale.getString("Callers Table"); acDescT1 = AnLocale.getString("Callers Table (shows functions that call selected function)"); acNameT2 = AnLocale.getString("Self Function Table"); acDescT2 = AnLocale.getString("Self Function Table (shows selected function)"); acNameT3 = AnLocale.getString("Callees Table"); acDescT3 = AnLocale.getString( "Callers Table (shows functions that are called from selected function)"); // Create lables label_callers = new JLabel(AnUtility.calr_icon); label_function = new JLabel(AnUtility.func_icon); // label_function = new JLabel(AnUtility.attr_icon); label_callees = new JLabel(AnUtility.cale_icon); label_callers_text = new JLabel("1"); label_function_text = new JLabel("2"); label_callees_text = new JLabel("3"); // Create tables caller = new AnTable( DSP_Callers, true, true, true, false, false, false, true, acNameT1, acDescT1, label_callers_text); table = caller; caller.setParent((AnDisplay) this); AccessibleContext context = caller.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callers")); context.setAccessibleDescription(AnLocale.getString("Callers")); caller.addAnListener(new TableHandler()); if (singleFunctionMode == true) { func_item = new AnTable( DSP_CallerCalleeSelf, false, false, true, true, false, true, false, acNameT2, acDescT2, label_function_text); func_item.setParent((AnDisplay) this); func_item.addAnListener(new TableHandler()); context = func_item.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Self function")); context.setAccessibleDescription(AnLocale.getString("Self function")); func_item.setHeader(caller); } else { func_item = new AnTable( DSP_CallerCalleeSelf, false, false, true, false, false, false, false, acNameT2, acDescT2, label_function_text); func_item.setParent((AnDisplay) this); func_item.addAnListener(new TableHandler()); context = func_item.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Stack Fragment")); context.setAccessibleDescription(AnLocale.getString("Stack Fragment")); func_item.setHeader(caller); } callee = new AnTable( DSP_Callees, false, false, true, false, true, false, false, acNameT3, acDescT3, label_callees_text); callee.setParent((AnDisplay) this); context = callee.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callees")); context.setAccessibleDescription(AnLocale.getString("Callees")); callee.setHeader(caller); callee.addAnListener(new TableHandler()); // Set header icons & tooltips pcaller = new JPanel(new BorderLayout()); label_callers.setToolTipText(AnLocale.getString("Callers") + " (Alt-1)"); label_callers_text.setText("1"); label_callers_text.setVisible(false); label_callers_text.setDisplayedMnemonic(KeyEvent.VK_1); context = label_callers.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callers")); context.setAccessibleDescription(AnLocale.getString("Callers")); label_callers.setBorder(new EmptyBorder(40, AnVariable.sizeIcon, 0, AnVariable.sizeIcon)); pcaller.add(label_callers_text, BorderLayout.WEST); pcaller.add(label_callers, BorderLayout.WEST); pcaller.add(caller, BorderLayout.CENTER); pfunc_item = new JPanel(new BorderLayout()); JPanel pfunc_internal_panel = new JPanel(new BorderLayout()); // Create Call Stack Builder Control Panel CS_ControlPanel = new CallStackToolbarHandler(); JPanel pfunc_control_toolbar = CS_ControlPanel.initCallStackToolbarHandler(this); // new JToolBar(); JLabel jl = new JLabel(AnLocale.getString("Call Stack Builder")); jl.setVisible(false); pfunc_control_toolbar.add(jl); pfunc_internal_panel.add(pfunc_control_toolbar, BorderLayout.NORTH); pfunc_internal_panel.add(func_item, BorderLayout.CENTER); if (singleFunctionMode == true) { label_function.setToolTipText(AnLocale.getString("Selected Function") + " (Alt-2)"); } else { label_function.setToolTipText(AnLocale.getString("Stack Fragment") + " (Alt-2)"); } label_function_text.setText("2"); label_function_text.setVisible(false); label_function_text.setDisplayedMnemonic(KeyEvent.VK_2); context = label_function.getAccessibleContext(); if (singleFunctionMode == true) { context.setAccessibleName(AnLocale.getString("Selected Function")); context.setAccessibleDescription(AnLocale.getString("Selected Function")); } else { context.setAccessibleName(AnLocale.getString("Stack Fragment")); context.setAccessibleDescription(AnLocale.getString("Stack Fragment")); } label_function.setBorder(AnVariable.iconBorder); pfunc_item.add(label_function_text, BorderLayout.WEST); pfunc_item.add(label_function, BorderLayout.WEST); // NM pfunc_item.add(func_item, BorderLayout.CENTER); pfunc_item.add(pfunc_internal_panel, BorderLayout.CENTER); pcallee = new JPanel(new BorderLayout()); label_callees.setToolTipText(AnLocale.getString("Callees") + " (Alt-3)"); label_callees_text.setText("3"); label_callees_text.setVisible(false); label_callees_text.setDisplayedMnemonic(KeyEvent.VK_3); context = label_callees.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callees")); context.setAccessibleDescription(AnLocale.getString("Callees")); label_callees.setBorder(AnVariable.iconBorder); pcallee.add(label_callees_text, BorderLayout.WEST); pcallee.add(label_callees, BorderLayout.WEST); pcallee.add(callee, BorderLayout.CENTER); // Set the split pane msize = pcaller.getMinimumSize(); msize.height = CALLER_MIN_HEIGHT; pcaller.setMinimumSize(msize); msize = pcallee.getMinimumSize(); msize.height = CALLEE_MIN_HEIGHT; pcallee.setMinimumSize(msize); pfunc_item.setMinimumSize(msize); split_pane_2 = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, pfunc_item, pcallee); split_pane_2.setContinuousLayout(true); split_pane_2.setDividerLocation(AnVariable.WIN_HEIGHT / 2); pcaller.setBorder( BorderFactory.createMatteBorder(0, 0, 1, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR_INSIDE)); split_pane_1 = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, pcaller, split_pane_2); split_pane_1.setContinuousLayout(true); split_pane_1.setDividerLocation(AnVariable.WIN_HEIGHT / 2); add(split_pane_1, BorderLayout.CENTER); } // Clear display @Override public void clear() { caller.removeAll(); func_item.removeAll(); callee.removeAll(); } // Clear selections public void clearSelections() { caller.clearSelection(); func_item.clearSelection(); callee.clearSelection(); } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); // formats.add(ExportFormat.HTML); // formats.add(ExportFormat.CSV); formats.add(ExportFormat.JPG); return formats; } private Object[][] getCurrentTotalMax() { Object[][] total_max = new Object[2][]; total_max[0] = caller_data_lpd.getTotal(); total_max[1] = MaximumValues[1]; return total_max; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String text = exportAsText(limit); return text; } private String exportAsText(Integer limit) { // Prepare text presentation of the table String sortedby = AnLocale.getString("sorted by metric:"); String No = AnLocale.getString("No "); MetricLabel[] labels = func_item.getTableModel().metricLabels; MetricLabel[] labels1 = caller.getTableModel().metricLabels; MetricLabel[] labels2 = callee.getTableModel().metricLabels; int width = -1; for (int i = 0; i < labels.length; i++) { labels[i].updateWidth(labels1[i], labels2[i]); if (i + 1 < labels.length) { width += labels[i].getColumnWidth() + SPACES_BETWEEN_COLUMNS; } } String separator = ""; for (int i = 0; i < width; i++) { separator += "="; } separator += " "; String title1 = caller.getAccessibleContext().getAccessibleName(); String title2 = func_item.getAccessibleContext().getAccessibleName(); String title3 = callee.getAccessibleContext().getAccessibleName(); AnTable tbl = func_item; Object[][] total_max = getCurrentTotalMax(); String textImage = tbl.printTableHeader(title2, sortedby, total_max); int printLimit = limit != null ? limit : 0; tbl = caller; textImage += separator; if (tbl.getRowCount() == 0) { textImage += No; } textImage += title1 + EOL; boolean last_only = false; boolean selected_only = false; textImage += tbl.printTableContents(printLimit, last_only, selected_only); tbl = func_item; textImage += separator; textImage += title2 + EOL; last_only = true; textImage += tbl.printTableContents(printLimit, last_only, selected_only); tbl = callee; textImage += separator; if (tbl.getRowCount() == 0) { textImage += No; } textImage += title3 + EOL; last_only = false; textImage += tbl.printTableContents(printLimit, last_only, selected_only); return textImage; } /** * Sets column height for caller, stack fragment, and callee tables * * @param row_height */ private void setHeightsAndScroll(int row_height) { // This should be done on AWT thread: final int common_row_height = row_height; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { // Set column height/width for caller/func/callee caller.setColumn(common_row_height); func_item.setColumn(common_row_height); callee.setColumn(common_row_height); if (singleFunctionMode == true) { caller.clearSelectedRow(); callee.clearSelectedRow(); } final int sc_pos = callee.getScroll(); caller.setScroll(sc_pos); func_item.setScroll(sc_pos); } }); } // Reset display @Override public void reset() { try { SwingUtilities.invokeAndWait( new Runnable() { @Override public void run() { caller.removeAllRows(); func_item.removeAllRows(); callee.removeAllRows(); } }); } catch (Exception exc) { System.out.println("CallDisp.reset() exception: " + exc); exc.printStackTrace(); } } // Get ID of selected function public long getID() { return window.getSelectedObject().getSelObjV2("FUNCTION"); } // Get current stack fragment public long[] getStack() { return cc_callstack.getIDs(); } // Compute & update function list table @Override public synchronized void doCompute() { final int /*new_ind,*/ sort_ind, sc_pos; int name_len, len, row_height, height; Object[] raw_data_with_ids; final int[] caller_stype, func_stype, callee_stype; MetricLabel[] caller_label, func_label, callee_label; final int[][] caller_width, func_width, callee_width; AnObject obj, max_obj; final long[] cstack; boolean select_self = false; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } caller_label = func_label = callee_label = null; if (null == cc_callstack) { return; // initialization is not finished yet } // R1 Reset stack if necessary if (cc_callstack.needReset()) { cc_callstack.reset(); select_self = true; computed = false; } if (!computed) { // need re-compute sel_func = getFuncObj(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) // Required to initialize Functions list Object[] res = setFuncData(sel_func, type, subtype); // IPC String errstr = ((String[]) (res[1]))[0]; // Update table if (errstr == null) { showWarning(window.getMsg(AnUtility.WARNING_MSG)); table = caller; table.setViewport(); // Update stack /* * The caller-callee display will honor selections * made in other displays. */ cstack = cc_callstack.getIDs(); // Update callers list raw_data_with_ids = /* window. */ getTableData(mlistStr, stab_callers, typeStrFunc, subtypeStr, cstack); caller_data_lpd = new LocalProcessData(raw_data_with_ids); caller_data = caller_data_lpd.get_data(); ids_callers = caller_data_lpd.get_ids(); caller_stype = caller_data_lpd.get_types(); // Update Callers // Pass callers_total_max to support percentage calculation Object[] callers_total_max = caller_data_lpd.getLocalTotalMax(); // XXX Do we need a special case; no callers? caller_label = getSettings() .getMetricsSetting() .getLabel(caller_data, callers_total_max, type, caller); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(type); names = getNames(type, 0); sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(type); // Update function item raw_data_with_ids = /* window. */ getTableData(mlistStr, stab_self, typeStrFunc, subtypeStr, cstack); func_data_lpd = new LocalProcessData(raw_data_with_ids); func_data = func_data_lpd.get_data(); if (func_data.length <= name_col) { // NM Hack against drop experiments return; } if (cstack.length == 1) { ids_cstack = func_data_lpd.get_ids(); // NM fix API problem cc_callstack.setNames((String[]) func_data[name_col]); } else { // Now watch the hands :-) func_data = cc_callstack.recreateStackTable(raw_data_with_ids); } func_stype = func_data_lpd.get_types(); // Update callees list raw_data_with_ids = /* window. */ getTableData(mlistStr, stab_callees, typeStrFunc, subtypeStr, cstack); callee_data_lpd = new LocalProcessData(raw_data_with_ids); callee_data = callee_data_lpd.get_data(); ids_callees = callee_data_lpd.get_ids(); callee_stype = callee_data_lpd.get_types(); // Update Stack Fragment if (caller_data[0].length < 1) { if (callee_data[0].length > 0) { callers_total_max = callee_data_lpd.getLocalTotalMax(); } else { callers_total_max = func_data_lpd.getLocalTotalMax(); // if ((null == MaximumValues) || (null == MaximumValues[0][0])) { // callers_total_max = func_data_lpd.getLocalTotalMax(); // } else { // callers_total_max = new Object[2]; // ANOTHER HACK // callers_total_max[0] = MaximumValues[0]; // ANOTHER HACK // callers_total_max[1] = MaximumValues[1]; // ANOTHER HACK // } } } // Pass callers_total_max to support percentage calculation func_label = getSettings() .getMetricsSetting() .getLabel(func_data, callers_total_max, type, func_item); // Update Callees // Pass callers_total_max to support percentage calculation callee_label = getSettings() .getMetricsSetting() .getLabel(callee_data, callers_total_max, type, callee); { // Use SwingUtilities to update tables final MetricLabel[] label1 = caller_label; final MetricLabel[] label2 = func_label; final MetricLabel[] label3 = callee_label; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { caller.setData(label1, caller_data, names, caller_stype, 0, name_col, sort_ind); func_item.setData(label2, func_data, names, func_stype, 0, name_col, sort_ind); callee.setData(label3, callee_data, names, callee_stype, 0, name_col, sort_ind); } }); } } else { window.getExperimentsView().appendLog(AnLocale.getString("Error: ") + errstr); table.showMessage(errstr); } } // Set the column width // XXX Should all this staff be done on AWT thread? if (caller_label != null) { // Find the 'name' object which has the maximum width max_obj = caller_label[name_col].getMaxAnObject(); name_len = caller.stringWidth(max_obj.toString()); obj = func_label[name_col].getMaxAnObject(); len = func_item.stringWidth(obj.toString()); if (name_len < len) { name_len = len; max_obj = obj; } obj = callee_label[name_col].getMaxAnObject(); len = callee.stringWidth(obj.toString()); if (name_len < len) { // name_len = len; // assignment is never used max_obj = obj; } caller_label[name_col].setMaxAnObject(max_obj); func_label[name_col].setMaxAnObject(max_obj); callee_label[name_col].setMaxAnObject(max_obj); // Find the maximum row height row_height = caller.getRowHeight(); height = func_item.getRowHeight(); if (row_height < height) { row_height = height; } height = callee.getRowHeight(); if (row_height < height) { row_height = height; } // Find the maximum width for each field caller_width = caller.getColumnWidth(); func_width = func_item.getColumnWidth(); callee_width = callee.getColumnWidth(); for (int i = 0; i < caller_width.length; i++) { for (int j = 0; j < 4; j++) { if (caller_width[i][j] < func_width[i][j]) { caller_width[i][j] = func_width[i][j]; } if (caller_width[i][j] < callee_width[i][j]) { caller_width[i][j] = callee_width[i][j]; } func_width[i][j] = callee_width[i][j] = caller_width[i][j]; } } // Set column height/width for caller/func/callee setHeightsAndScroll(row_height); // Use AWT thread } // Update caller table headers. Column width may have changed. caller.getTableModel().updateTableHeaders(); // Update selection if (select_self && (ids_cstack.length > 0)) { cc_callstack.setSelectedObject(ids_cstack[0]); cc_callstack.saveSelection(ids_cstack[0], func_item, 0); } cc_callstack.computeSelection(); // Update summary display window.getSelectionManager().updateSelection(); computed = true; } @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, boolean caseSensitive) { int find_row; final AnTable next_table; if (str == null) { return -1; } table.clearSelection(); next_table = (table == caller) ? callee : caller; find_row = table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = next_table.findBefore(str, next, caseSensitive); if (find_row == -1) { find_row = next_table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = table.findBefore(str, next, caseSensitive); } else { table = next_table; } } else { table = next_table; } } if (find_row != -1) { table.setSelectedRow(find_row); } return find_row; } // Find name and select this raw public int findName(final String str, final boolean next, AnTable table, boolean caseSensitive) { int find_row = -1; AnTable next_table; if (str == null) { return -1; } next_table = table; if (null == table) { next_table = caller; } for (int i = 1; i <= 3; i++) { find_row = next_table.findAfter(str, next, caseSensitive); if (find_row == -1) { find_row = next_table.findBefore(str, next, caseSensitive); } if (find_row != -1) { clearSelections(); // caller.clearSelection(); // func_item.clearSelection(); // callee.clearSelection(); next_table.setSelectedRow(find_row); // NM table = next_table; //NM is it needed? break; } if (next_table == caller) { next_table = func_item; } else if (next_table == func_item) { next_table = callee; } else if (next_table == callee) { next_table = caller; } } return find_row; } // Sort @Override public void sort(final int index) { caller.sort(index); callee.sort(index); } // Check if "Back" action is available @Override public boolean isBackActionAvailable() { if (cc_callstack == null) { return false; } return cc_callstack.isBackActionAvailable(); } // Check if "Forward" action is available @Override public boolean isForwardActionAvailable() { if (cc_callstack == null) { return false; } return cc_callstack.isForwardActionAvailable(); } // Get function item data // private Object[] getFuncItem() { // return getFuncList(DSP_SELF, 0); // } // Get callers data list // private Object[] getCallerList() { // return getFuncList(DSP_CALLER, 0); // } // Get callees data list // private Object[] getCalleeList() { // return getFuncList(DSP_CALLEE, 0); // } // Get table data private Object[] getTableData( final String mlistStr, final String modeStr, final String typeStr, final String subtypeStr, final long[] cstack) { // long t = System.currentTimeMillis(); Object[] data = window.getTableDataV2(mlistStr, modeStr, typeStr, subtypeStr, cstack); // t = System.currentTimeMillis() - t; // System.out.println("DEBUG: CallerCalleesDisp.getTableData(): time="+t+" mls."); return data; } class LocalProcessData { final String AccessToMaximumValues = "AccessToMaximumValues"; private Object[][] LocalMaximumValues = null; // MaximumValues[0][col] = Total[col], MaximumValues[1][col] = Maximum[col] Object[][] total_max = null; private Object[] raw_data; private Object[][] data; private long[] ids; private int[] types; LocalProcessData(final Object[] raw_data_with_ids) { raw_data = raw_data_with_ids; final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); data = localProcessData(mlist, raw_data); ids = (long[]) raw_data[raw_data_with_ids.length - 1]; // types = (int[]) raw_data[raw_data_with_ids.length - 2]; types = null; // Is not needed ? total_max = AnObject.updateMaxValues(data, null); } public long[] get_ids() { return ids; } public int[] get_types() { return types; } public Object[][] get_data() { return data; } /* * Returns MaximumValues (Total and Max values), calculated by processData() */ public Object[] getTotalMax() { synchronized (AccessToMaximumValues) { return MaximumValues; } } /* * Returns local Maximum Values (Total and Max values), calculated by processData() */ public Object[] getLocalTotalMax() { synchronized (AccessToMaximumValues) { return LocalMaximumValues; } } /* * Returns Total values */ public Object[] getTotal() { Object[] total = null; Object[] raw_data_with_ids = getTableData(mlistStr, stab_callees, typeStrFunc, subtypeStr, null /*cstack*/); if (null == raw_data_with_ids) { return total; } final AnMetric[] mlist = getSettings().getMetricsSetting().getMetricListByDType(type); Object[][] processed_data = localProcessData(mlist, raw_data_with_ids); int len = processed_data.length; if (len > 0) { total = new Object[len]; for (int i = 0; i < len; i++) { total[i] = processed_data[i][0]; } } return total; } } // Listener for updating table private final class TableHandler implements AnListener { @Override public void valueChanged(final AnEvent event) { final AnTable src = (AnTable) event.getSource(); final int loc, from, to, column, width; boolean doubleClick = false; int index = event.getValue(); switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting changeSelection(src, index); break; case AnEvent.EVT_COPY_ALL: // Copy copyAll(); break; case AnEvent.EVT_RESET: // Reset cc_callstack.reset(); computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_SET: // Set (re-center) if (src == caller) { if ((index >= 0) && (ids_callers.length - 1 >= index)) { cc_callstack.replace(ids_callers, index); } } else if (src == callee) { if ((index >= 0) && (ids_callees.length - 1 >= index)) { cc_callstack.replace(ids_callees, index); } } else if (src == func_item) { if ((index >= 0) && (ids_cstack.length - 1 >= index)) { cc_callstack.replace(ids_cstack, index); } } computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_SETHEAD: // Set new head cc_callstack.setHead(index); computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_SETTAIL: // Set new tail cc_callstack.setTail(index); computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_COMPUTE: // Compute and Update // Default action for double click // double_click = true; //OM doubleClick = false; // NM if (src == caller) { cc_callstack.prepend(index); if (doubleClick) { if (ids_cstack.length == 2) { cc_callstack.replace(ids_cstack, 0); } } } else if (src == callee) { cc_callstack.append(index); if (doubleClick) { if (ids_cstack.length == 2) { cc_callstack.replace(ids_cstack, 1); } } } else if (src == func_item) { cc_callstack.remove(index); if (doubleClick) { if (ids_cstack.length == 2) { cc_callstack.replace(ids_cstack, 1); } } } computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_UPDATE: // Updating if (index >= 0) { if (src == caller) { cc_callstack.prepend(index); if (doubleClick) { // OM if (ids_cstack.length == 2) { // OM cc_callstack.replace(ids_cstack, 0); // OM } // OM } // OM } else if (src == callee) { cc_callstack.append(index); if (doubleClick) { // OM if (ids_cstack.length == 2) { // OM cc_callstack.replace(ids_cstack, 1); // OM } // OM } // OM } else if (src == func_item) { if ((index == 0) && (ids_cstack.length > 1)) { cc_callstack.remove(index); } if ((index > 0) && (ids_cstack.length - 1 == index)) { cc_callstack.remove(index); } if ((index > 0) && (ids_cstack.length - 1 > index)) { // R1 cc_callstack.replace(ids_cstack, index); // do nothing break; } } computed = false; computeOnAWorkerThread(); // } else { // Keep selected object (src == func_item) } // NM window.showSummary(); break; case AnEvent.EVT_SORT: // Sorting getSettings() .getMetricsSetting() .setSortMetricByDType(this, ((Integer) event.getAux()).intValue(), type); break; case AnEvent.EVT_SCROLL: // Scrolling if (src == callee) { loc = event.getValue(); caller.setScroll(loc); func_item.setScroll(loc); } break; case AnEvent.EVT_SWITCH: // Column switching from = event.getValue(); to = ((Integer) event.getAux()).intValue(); if (src == caller) { func_item.moveColumn(from, to); callee.moveColumn(from, to); } getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, type); break; case AnEvent.EVT_RESIZE: // Column resizing if (src == caller) { column = event.getValue(); width = ((Integer) event.getAux()).intValue(); func_item.setColumnWidth(column, width); callee.setColumnWidth(column, width); } break; case AnEvent.EVT_BACK: // Go back cc_callstack.gotoCallStackFrame(cc_callstack.StackHistoryIndex - 1); computed = false; computeOnAWorkerThread(); break; case AnEvent.EVT_FORWARD: // Go forward cc_callstack.gotoCallStackFrame(cc_callstack.StackHistoryIndex + 1); computed = false; computeOnAWorkerThread(); break; } } } // Listener for call stack toolbar actions private final class CallStackToolbarHandler implements ActionListener { private CallerCalleesView cd; private JPanel tb; public JButton btn_add = new JButton(); public JButton btn_remove = new JButton(); public JButton btn_set_head = new JButton(); public JButton btn_set_center = new JButton(); public JButton btn_set_tail = new JButton(); public JButton btn_back = new JButton(); public JButton btn_forward = new JButton(); public boolean btn_append_enabled = false; public JPanel initCallStackToolbarHandler(CallerCalleesView calldisp) { cd = calldisp; tb = new JPanel(); // btn_back = new JButton("Back"); btn_back.setMnemonic(AnLocale.getString('B', "CallerCalleesBack")); btn_back.setIcon(AnUtility.goBackwardIcon); // btn_back.setText(AnLocale.getString("Back", "GO_BACK_IN_CALLSTACK_HISTORY")); btn_back.setToolTipText(AnLocale.getString("Go back in callstack history")); btn_back.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Go_Back(evt); } }); tb.add(btn_back); // btn_forward = new JButton("Forward"); btn_forward.setMnemonic(AnLocale.getString('o', "CallerCalleesForward")); btn_forward.setIcon(AnUtility.goForwardIcon); // btn_forward.setText(AnLocale.getString("Forward", "GO_FORWARD_IN_CALLSTACK_HISTORY")); btn_forward.setToolTipText(AnLocale.getString("Go forward in callstack history")); btn_forward.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Go_Forward(evt); } }); tb.add(btn_forward); JLabel action_group = new JLabel(" "); tb.add(action_group); // btn_add = new JButton("Add"); btn_add.setMnemonic(AnLocale.getString('A', "CallerCalleesAdd")); btn_add.setText(AnLocale.getString("Add", "ADD_SELECTED_FUNCTION_TO_CALLSTACK")); btn_add.setToolTipText(AnLocale.getString("Add selected function to the callstack")); btn_add.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Add_Function(evt); } }); tb.add(btn_add); // btn_remove = new JButton("Remove"); btn_remove.setMnemonic(AnLocale.getString('R', "CallerCalleesRemove")); btn_remove.setText(AnLocale.getString("Remove", "REMOVE_SELECTED_FUNCTION_FROM_CALLSTACK")); btn_remove.setToolTipText(AnLocale.getString("Remove selected function from the callstack")); btn_remove.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Remove_Function(evt); } }); tb.add(btn_remove); JLabel set_group = new JLabel(" "); tb.add(set_group); // btn_set_head = new JButton("Set Head"); btn_set_head.setMnemonic(AnLocale.getString('e', "CallerCalleesSetHead")); btn_set_head.setText( AnLocale.getString("Set Head", "SET_SELECTED_FUNCTION_AS_HEAD_OF_CALLSTACK")); btn_set_head.setToolTipText( AnLocale.getString("Set selected function as head of the callstack")); btn_set_head.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Set_Head(evt); } }); tb.add(btn_set_head); // btn_set_center = new JButton("Set Center"); btn_set_center.setMnemonic(AnLocale.getString('s', "CallerCalleesCenter")); btn_set_center.setText( AnLocale.getString("Set Center", "SET_SELECTED_FUNCTION_AS_CALLSTACK")); btn_set_center.setToolTipText(AnLocale.getString("Set selected function as new callstack")); btn_set_center.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Set_Center(evt); } }); tb.add(btn_set_center); // btn_set_tail = new JButton("Set Tail"); btn_set_tail.setMnemonic(AnLocale.getString('l', "CallerCalleesTail")); btn_set_tail.setText( AnLocale.getString("Set Tail", "SET_SELECTED_FUNCTION_AS_TAIL_OF_CALLSTACK")); btn_set_tail.setToolTipText( AnLocale.getString("Set selected function as tail of the callstack")); btn_set_tail.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { CS_Set_Tail(evt); } }); tb.add(btn_set_tail); return tb; } // Action performed @Override public void actionPerformed(final ActionEvent event) { final String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("Add"))) { System.out.println("Add"); } } // Actions public void CS_Add_Function(final ActionEvent event) { if (btn_append_enabled) { int index = cd.callee.getSelectedRow(); // if (index < 0) return; // cd.cc_callstack.last_selected_table = callee; cd.cc_callstack.append(index); computed = false; computeOnAWorkerThread(); } else { int index = cd.caller.getSelectedRow(); // if (index < 0) return; // cd.cc_callstack.last_selected_table = caller; cd.cc_callstack.prepend(index); computed = false; computeOnAWorkerThread(); } } /* * Remove */ public void CS_Remove_Function(final ActionEvent event) { int index = cd.func_item.getSelectedRow(); // if (0 == index) { // cd.cc_callstack.last_selected_table = caller; // } else { // cd.cc_callstack.last_selected_table = callee; // } cd.cc_callstack.remove(index); computed = false; computeOnAWorkerThread(); } /* * Set Head */ public void CS_Set_Head(final ActionEvent event) { int index = cd.func_item.getSelectedRow(); // if (index <= 0) return; cd.cc_callstack.setHead(index); computed = false; computeOnAWorkerThread(); } /* * Set Center */ public void CS_Set_Center(final ActionEvent event) { cd.cc_callstack.setCenter(); computed = false; computeOnAWorkerThread(); } /* * Set Tail */ public void CS_Set_Tail(final ActionEvent event) { int index = cd.func_item.getSelectedRow(); cd.cc_callstack.setTail(index); computed = false; computeOnAWorkerThread(); } /* * Back */ public void CS_Go_Back(final ActionEvent event) { cd.cc_callstack.gotoCallStackFrame(cd.cc_callstack.StackHistoryIndex - 1); computed = false; computeOnAWorkerThread(); } /* * Forward */ public void CS_Go_Forward(final ActionEvent event) { cd.cc_callstack.gotoCallStackFrame(cd.cc_callstack.StackHistoryIndex + 1); computed = false; computeOnAWorkerThread(); } /* * Enable Buttons */ public void CS_Enable_Buttons(final AnTable table) { if (table == cd.caller) { btn_add.setEnabled(true); btn_append_enabled = false; btn_remove.setEnabled(false); btn_set_head.setEnabled(false); btn_set_center.setEnabled(true); btn_set_tail.setEnabled(false); btn_back.setEnabled(cd.cc_callstack.isBackActionAvailable()); btn_forward.setEnabled(cd.cc_callstack.isForwardActionAvailable()); } if (table == cd.func_item) { int rows = table.getRowCount(); int selrow = table.getSelectedRow(); btn_add.setEnabled(false); btn_append_enabled = false; btn_remove.setEnabled(false); if (rows > 1) { if ((selrow + 1 == rows) || (0 == selrow)) { btn_remove.setEnabled(true); } } if (selrow > 0) { btn_set_head.setEnabled(true); } else { btn_set_head.setEnabled(false); } btn_set_center.setEnabled(true); if ((selrow + 1 != rows) && (rows > 1)) { btn_set_tail.setEnabled(true); } else { btn_set_tail.setEnabled(false); } btn_back.setEnabled(cd.cc_callstack.isBackActionAvailable()); btn_forward.setEnabled(cd.cc_callstack.isForwardActionAvailable()); } if (table == cd.callee) { btn_add.setEnabled(true); btn_append_enabled = true; btn_remove.setEnabled(false); btn_set_head.setEnabled(false); btn_set_center.setEnabled(true); btn_set_tail.setEnabled(false); btn_back.setEnabled(cd.cc_callstack.isBackActionAvailable()); btn_forward.setEnabled(cd.cc_callstack.isForwardActionAvailable()); } } } // end of class /* * Change selection */ @Override public void changeSelection(AnTable src, int index) { long ID = -1; if (index >= 0) { clearSelections(); if (src == caller) { if (index < ids_callers.length) { ID = ids_callers[index]; } } else if (src == callee) { if (index < ids_callees.length) { ID = ids_callees[index]; } } else if (src == func_item) { if (index < ids_cstack.length) { ID = ids_cstack[index]; } } if (ID > 0) { src.setSelectedRow(index); // AWT // cc_callstack.setSelectedObject(ID); //NM Hack // cc_callstack.saveSelection(ID, src, index); //NM Hack // window.computeFuncData(); //NM Update Summary // window.showSummary(); // AWT final long id = ID; final int ix = index; final AnTable at = src; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { cc_callstack.setSelectedObject(id); // NM Hack cc_callstack.saveSelection(id, at, ix); // NM Hack // window.computeFuncData(); // summary window.getSelectionManager().updateSelection(); AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { // window.showSummary(); // AWT CS_ControlPanel.CS_Enable_Buttons(at); // AWT } }); } }, "CallTree_thread"); } else { CS_ControlPanel.CS_Enable_Buttons(src); // AWT } } } // public CalledByCallsDisp getCallTab(final int ptype) { // FIXUP: REARCH // switch(ptype){ // case AnDisplay.DSP_SOURCE: // return call_tab_src; // case AnDisplay.DSP_DISASM: // return call_tab_dis; // case AnDisplay.DSP_FUNCTION: // return call_tab_func; // } // return null; // } // CallStack actions private final class CC_CallStack { long[] ids; String[] names; long selectionTime = 0; String lastFilter = null; long last_ID = -1; AnTable last_selected_table = null; int last_selected_row = -1; String API_V2_FUNCTION_Str = "FUNCTION"; Vector StackHistory = new Vector(0); int StackHistoryIndex = -1; private final class CC_CallStackFrame { long[] cstack; long selected_ID; AnTable selected_table; int selected_row; } public void append(int index) { // NM TODO: Replace ids_cstack with ids if (index >= ids_callees.length) { System.out.println("ERROR"); return; } long ID = ids_callees[index]; long[] new_cstack = new long[ids_cstack.length + 1]; for (int i = 0; i < ids_cstack.length; i++) { new_cstack[i] = ids_cstack[i]; } new_cstack[new_cstack.length - 1] = ID; ids_cstack = new_cstack; ids = new_cstack; String[] new_ids_names = new String[ids_names.length + 1]; for (int i = 0; i < ids_names.length; i++) { new_ids_names[i] = ids_names[i]; } new_ids_names[ids_names.length] = (String) callee_data[name_col][index]; ids_names = new_ids_names; names = new_ids_names; // Save selection saveSelection(ID, func_item, ids.length - 1); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } public void prepend(int index) { // NM TODO: Replace ids_cstack with ids if (index >= ids_callers.length) { System.out.println("ERROR"); return; } long ID = ids_callers[index]; // last_ID = ID; long[] new_cstack = new long[ids_cstack.length + 1]; new_cstack[0] = ID; for (int i = 1; i < new_cstack.length; i++) { new_cstack[i] = ids_cstack[i - 1]; } ids_cstack = new_cstack; ids = new_cstack; // NM TODO: Replace ids_names with names String[] new_ids_names = new String[ids_names.length + 1]; for (int i = 0; i < ids_names.length; i++) { new_ids_names[i + 1] = ids_names[i]; } new_ids_names[0] = (String) caller_data[name_col][index]; ids_names = new_ids_names; names = new_ids_names; // Save selection saveSelection(ID, func_item, 0); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } public void remove(int index) { if ((index == 0) && (ids.length > 1)) { // Remove top function long[] new_cstack = new long[ids.length - 1]; for (int i = 1; i < ids.length; i++) { new_cstack[i - 1] = ids[i]; } long ID = ids[0]; ids = new_cstack; ids_cstack = ids; // TEMPORARY String[] new_names = new String[names.length - 1]; for (int i = 1; i < names.length; i++) { new_names[i - 1] = names[i]; } names = new_names; ids_names = names; // TEMPORARY // Save selection saveSelection(ID, caller, -1); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } if ((index > 0) && (ids.length - 1 == index)) { // Remove bottom function long[] new_cstack = new long[ids.length - 1]; for (int i = 0; i < new_cstack.length; i++) { new_cstack[i] = ids[i]; } long ID = ids[ids.length - 1]; ids = new_cstack; ids_cstack = ids; // TEMPORARY String[] new_names = new String[names.length - 1]; for (int i = 0; i < new_names.length; i++) { new_names[i] = names[i]; } names = new_names; ids_names = names; // TEMPORARY // Save selection saveSelection(ID, callee, -1); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } } public void setHead(int index) { for (int i = 0; i < index; i++) { cc_callstack.remove(0); } long ID = ids[0]; // Save selection saveSelection(ID, func_item, 0); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } public void setTail(int index) { for (int i = ids.length - 1; i > index; i--) { cc_callstack.remove(i); } long ID = ids[ids.length - 1]; // Save selection saveSelection(ID, func_item, ids.length - 1); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } public void setCenter() { reset(); AnUtility.checkIPCOnWrongThread(false); getIDs(); AnUtility.checkIPCOnWrongThread(true); } public void replace(long[] stack, int index) { long ID = stack[index]; long[] new_cstack = new long[1]; new_cstack[0] = ID; ids = new_cstack; ids_cstack = ids; // TEMPORARY // Get name String fname = window.getObjNameV2(ID); String[] new_names = new String[1]; new_names[0] = fname; names = new_names; ids_names = names; // TEMPORARY // Save selection saveSelection(ID, func_item, 0); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } public void reset() { ids = null; names = null; // StackHistoryIndex = -1; // StackHistory = new Vector(0); } public Object[][] recreateStackTable(Object[] raw_data) { LocalProcessData func_data_new_lpd = new LocalProcessData(raw_data); Object[][] func_data_new = func_data_new_lpd.get_data(); LocalProcessData func_data_from_dbe_lpd = new LocalProcessData(raw_data); Object[][] func_data_from_dbe = func_data_from_dbe_lpd.get_data(); AnAddress[] anAddress; AnDouble[] anDouble; AnInteger[] anInteger; AnLong[] anLong; String[] anString = new String[ids.length]; names = window.getObjNamesV2(ids); for (int i = 0; i < ids.length; i++) { anString[i] = names[i]; // Better to get names from DBE } // Set names func_data_new[name_col] = anString; // Set values for (int i = 0; i < func_data_new.length; i++) { if (func_data_new[i] instanceof String[]) { // Name func_data_new[i] = anString; } else if (func_data_new[i] instanceof AnDouble[]) { anDouble = new AnDouble[ids.length]; for (int k = 0; k < ids.length; k++) { anDouble[k] = new AnDouble(0.0); anDouble[k].showZero(false); } func_data_new[i] = anDouble; if (func_data_from_dbe[i].length > 0) { func_data_new[i][ids.length - 1] = func_data_from_dbe[i][0]; ((AnDouble) func_data_new[i][ids.length - 1]).showZero(true); // } else { // No data - show empty metrics } } else if (func_data_new[i] instanceof AnLong[]) { anLong = new AnLong[ids.length]; for (int k = 0; k < ids.length; k++) { anLong[k] = new AnLong(0); anLong[k].showZero(false); } func_data_new[i] = anLong; if (func_data_from_dbe[i].length > 0) { func_data_new[i][ids.length - 1] = func_data_from_dbe[i][0]; ((AnLong) func_data_new[i][ids.length - 1]).showZero(true); // } else { // No data - show empty metrics } } else if (func_data_new[i] instanceof AnInteger[]) { anInteger = new AnInteger[ids.length]; for (int k = 0; k < ids.length; k++) { anInteger[k] = new AnInteger(0); anInteger[k].showZero(false); } func_data_new[i] = anInteger; if (func_data_from_dbe[i].length > 0) { func_data_new[i][ids.length - 1] = func_data_from_dbe[i][0]; ((AnInteger) func_data_new[i][ids.length - 1]).showZero(true); // } else { // No data - show empty metrics } } else if (func_data_new[i] instanceof AnAddress[]) { anAddress = new AnAddress[ids.length]; for (int k = 0; k < ids.length; k++) { anAddress[k] = new AnAddress(0); anAddress[k].showZero(false); } func_data_new[i] = anAddress; if (func_data_from_dbe[i].length > 0) { func_data_new[i][ids.length - 1] = func_data_from_dbe[i][0]; ((AnAddress) func_data_new[i][ids.length - 1]).showZero(true); // } else { // No data - show empty metrics } } } return func_data_new; } private long[] getIDs() { if (ids == null) { // Get ID long ID = window.getSelectedObject().getSelObjV2(API_V2_FUNCTION_Str); // IPC long[] new_cstack = new long[1]; new_cstack[0] = ID; ids = new_cstack; ids_cstack = ids; // TEMPORARY // Get name String fname = window.getObjNameV2(ID); // IPC String[] new_names = new String[1]; new_names[0] = fname; names = new_names; ids_names = names; // TEMPORARY // Get Filter lastFilter = window.getFilterStr(); // Save selection saveSelection(ID, func_item, 0); saveCallStackFrame(ids, last_ID, last_selected_table, last_selected_row); } return ids; } public void setIDs(long[] stack) { // NM TODO: Remove ids_cstack ids = stack; ids_cstack = ids; // TEMPORARY } public String[] getNames() { if (names == null) { getIDs(); } return names; } public void setNames(String[] names) { // NM TODO: Remove ids_names this.names = names; ids_names = names; // TEMPORARY } public void saveSelection(long ID, AnTable table, int index) { last_ID = ID; last_selected_table = table; last_selected_row = index; } /* * Call Stack History implementation */ /* * Saves Call Stack frame in StackHistory vector. * StackHistoryIndex points to current frame in StackHistory. * @Parameters: * cstack * */ public void saveCallStackFrame(long[] cstack, long ID, AnTable table, int index) { CC_CallStackFrame frame = new CC_CallStackFrame(); frame.cstack = new long[cstack.length]; for (int i = 0; i < cstack.length; i++) { frame.cstack[i] = cstack[i]; } frame.selected_ID = ID; frame.selected_table = table; frame.selected_row = index; StackHistoryIndex++; if (StackHistoryIndex >= 0) { if (StackHistoryIndex + 1 < StackHistory.size()) { for (int i = StackHistory.size() - 1; i > StackHistoryIndex; i--) { StackHistory.removeElementAt(i); } } } else { StackHistoryIndex = 0; } StackHistory.setSize(StackHistoryIndex + 1); boolean alreadySaved = false; if (StackHistory.elementAt(StackHistoryIndex) != null) { // Check if this frame is already saved CC_CallStackFrame f = (CC_CallStackFrame) StackHistory.elementAt(StackHistoryIndex); if (f.cstack != null) { int i = f.cstack.length; int j = frame.cstack.length; if (i == j) { alreadySaved = true; for (i = 0; i < j; i++) { if (f.cstack[i] != frame.cstack[i]) { alreadySaved = false; break; } } } } } if (!alreadySaved) { StackHistory.setElementAt(frame, StackHistoryIndex); } else { StackHistoryIndex--; StackHistory.setSize(StackHistoryIndex + 1); // ? } } /* * Implements "Back" and "Forward" actions. * StackHistoryIndex points to current frame in StackHistory. * - action "Back" goes to ( StackHistoryIndex - 1 ) frame * - action "Forward" goes to ( StackHistoryIndex + 1 ) frame * @parameters: * index of frame in StackHistory */ public void gotoCallStackFrame(int index) { CC_CallStackFrame frame; if (index < 0) { return; } if (index >= StackHistory.size()) { return; } frame = (CC_CallStackFrame) StackHistory.elementAt(index); setIDs(frame.cstack); StackHistoryIndex = index; setSelectedObject(frame.selected_ID); // ? last_ID = frame.selected_ID; last_selected_table = frame.selected_table; last_selected_row = frame.selected_row; // window.computeFuncData(); // summary window.getSelectionManager().updateSelection(); } public boolean isBackActionAvailable() { if (StackHistoryIndex > 0) { return true; } return false; } public boolean isForwardActionAvailable() { if (StackHistoryIndex >= 0) { if (StackHistoryIndex + 1 < StackHistory.size()) { if (StackHistory.elementAt(StackHistoryIndex + 1) != null) { return true; } } } return false; } /* * Quick and durty hack to set selected object */ public void setSelectedObject(long ID) { window.getSelectedObject().setSelObjV2(ID); selectionTime = window.getSelectedObject().getSelObjectSelectionTime(); // last_ID = ID; last_selected_table = null; last_selected_row = -1; } /* * Quick and durty hack to show selected object */ public void computeSelection() { long ID = window.getSelectedObject().getSelObjV2(API_V2_FUNCTION_Str); if (ID == last_ID) { if (last_selected_table != null) { if (last_selected_row >= 0) { try { last_selected_table.setSelectedRow(last_selected_row); clearSelections(); last_selected_table.setSelectedRow(last_selected_row); CS_ControlPanel.CS_Enable_Buttons(last_selected_table); return; } catch (Exception e) { // sorry, not a lucky day last_selected_table = null; last_selected_row = -1; } } else { last_selected_row = updateSelection(last_selected_table); if (last_selected_row >= 0) { CS_ControlPanel.CS_Enable_Buttons(last_selected_table); return; } last_selected_table = null; } } } String fname = window.getObjNameV2(ID); findName(fname, true, null, true); // NM Hack, need FindID function } /* * Quick and durty hack to show selected object */ public int updateSelection(AnTable table) { long ID = window.getSelectedObject().getSelObjV2(API_V2_FUNCTION_Str); String fname = window.getObjNameV2(ID); findName(fname, true, table, true); int index = table.getSelectedRow(); return index; } /* * Quick and durty hack to check if reset is needed */ public boolean needReset() { String fs = window.getFilterStr(); if (fs != null) { if (!fs.equals(lastFilter)) { // Filter changed return true; } } if (selectionTime != window.getSelectedObject().getSelObjectSelectionTime()) { // Selected Object was changed in another tab return true; } return false; } } @Override public boolean exportLimitSupported() { return false; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); list.add(window.getTimelineCallStackSubview()); list.add(window.getIoCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } } ������������������������������gprofng-gui-2.1/org/gprofng/mpmt/KeyboardShortcuts.java���������������������������������������������0000644�0001750�0001750�00000013251�14744453367�020274� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.KeyStroke; public class KeyboardShortcuts { // Focus shortcuts public static final KeyStroke viewsFocusShortCut = KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke mainViewFocusShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke subviewArea2CallerFocusShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke subviewArea2CalleeFocusShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke subviewArea1FocusShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_4, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke subviewArea3FocusShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_5, InputEvent.CTRL_DOWN_MASK); public static final KeyStroke statusAreaShortCut = KeyStroke.getKeyStroke(KeyEvent.VK_6, InputEvent.CTRL_DOWN_MASK); // Action shortcuts public static final KeyStroke helpActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); public static final KeyStroke contextMenuActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F10, InputEvent.SHIFT_DOWN_MASK); // Menu shortcuts public static final KeyStroke profileApplicationActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke profileRunningProcessActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke profileKernelActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke openExperimentActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke compareExperimentsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke aggregateExperimentsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke showErrorsWarningsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke connectActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke exportActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke viewsSettingsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke metricsSettingsShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke libraryVisibilityActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke functionColorsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke settingsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke exportSettingsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke importSettingsActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); // Next/Previous View shortcuts public static final KeyStroke nextViewActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0); public static final KeyStroke previousViewActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F7, InputEvent.SHIFT_DOWN_MASK); // Functions/Source/Disassembler/Source Disassembler views public static final KeyStroke forwardActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0); public static final KeyStroke backwardActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_DOWN_MASK); // Source/Disassembler/Source Disassembler views public static final KeyStroke sourceNextHotLineActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0); public static final KeyStroke sourcePreviousHotLineActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.SHIFT_DOWN_MASK); public static final KeyStroke sourceNextNonZeroLineActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0); public static final KeyStroke sourcePreviousNonZeroLineActionShortcut = KeyStroke.getKeyStroke(KeyEvent.VK_F5, InputEvent.SHIFT_DOWN_MASK); } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/LibraryVisibilityPanel.java����������������������������������������0000644�0001750�0001750�00000137316�15044710303�021236� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.picklist.StringPickList; import org.gprofng.mpmt.picklist.StringPickListElement; import org.gprofng.mpmt.settings.LibraryVisibilitySetting; import org.gprofng.mpmt.util.gui.AnCheckBox; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.AnUtility.AnRadioButton; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; public class LibraryVisibilityPanel extends JPanel implements AnChangeListener { private static final int maxEntries = 1000; private static final int fill1 = 80; private static int fill2 = 0; private enum SortState { NONE, UP, DOWN }; private SortState nameSortState = SortState.DOWN; private SortState pathSortState = SortState.NONE; private LibraryVisibilityDialog dialog; private JLabel pleaseWaitLabel = new JLabel(AnLocale.getString("Please wait...")); private List<GUIEntry> entryListOriginal; private List<GUIEntry> entryListSortedFiltered; private int noEntriesViewed = 0; private boolean initialized = false; private boolean anyJava; private AnCheckBox functionsCheckBox; private AnCheckBox apiCheckBox; private AnCheckBox CheckBox; public LibraryVisibilityPanel(LibraryVisibilityDialog dialog) { this.dialog = dialog; initComponents(); AnUtility.setTextAndAccessibleContext( infoLabel, AnLocale.getString( "Specify the visibility level of shared libraries and classes in data views.")); scrollPane.getVerticalScrollBar().setUnitIncrement(10); scrollPane.setBorder( BorderFactory.createMatteBorder(0, 0, 1, 0, AnEnvironment.SCROLLBAR_BORDER_COLOR)); nativeRadioButton.setText(AnLocale.getString("Native")); nativeRadioButton.setToolTipText(AnLocale.getString("Select native libraries")); nativeRadioButton.setMnemonic(AnLocale.getString('N', "MN_LIBRARYVISIBILITY_Native_PANEL")); AnUtility.setAccessibleContext( nativeRadioButton.getAccessibleContext(), nativeRadioButton.getText()); javaRadioButton.setText(AnLocale.getString("Java")); javaRadioButton.setToolTipText(AnLocale.getString("Select Java classes")); javaRadioButton.setMnemonic(AnLocale.getString('J', "MN_LIBRARYVISIBILITY_Java_PANEL")); AnUtility.setAccessibleContext( javaRadioButton.getAccessibleContext(), javaRadioButton.getText()); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(nativeRadioButton); buttonGroup.add(javaRadioButton); String includeTT = AnLocale.getString("Include entries that contain any of these text strings"); includeLabel.setText(AnLocale.getString("Include:")); includeLabel.setToolTipText(includeTT); includeLabel.setDisplayedMnemonic(AnLocale.getString('I', "HideFunctionsIncludeLabelMnemonic")); includeLabel.setLabelFor(includeComboBox); includeComboBox.setToolTipText(includeTT); String excludeTT = AnLocale.getString("Exclude entries that contain any of these text strings"); excludeLabel.setToolTipText(excludeTT); excludeLabel.setText(AnLocale.getString("Exclude:")); excludeLabel.setDisplayedMnemonic(AnLocale.getString('X', "HideFunctionsExcludeLabelMnemonic")); excludeLabel.setLabelFor(excludeComboBox); excludeComboBox.setToolTipText(excludeTT); filterPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); AnUtility.setTextAndAccessibleContext(filterLabel, " " + AnLocale.getString("Filters")); filterLabel.setLabelFor(includeComboBox); filterLabel.setOpaque(true); // filterLabel.setDisplayedMnemonic(AnLocale.getString('F', "HideFilterMnemonics")); refreshButton.setText(AnLocale.getString("Refresh")); refreshButton.setMnemonic(AnLocale.getString('R', "HideFunctionsRefreshButton")); refreshButton.setToolTipText(AnLocale.getString("Apply filters")); listLabelPanel.setOpaque(false); AnUtility.setTextAndAccessibleContext(listLabel, AnLocale.getString("List")); // listLabel.setDisplayedMnemonic(AnLocale.getString('L', "HideFunctionsListMnemonics")); functionsCheckBox = new AnCheckBox(); functionsCheckBox.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { functionsCheckBoxActionPerformed(evt); } }); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; outerListPanel.add(functionsCheckBox, gridBagConstraints); apiCheckBox = new AnCheckBox(); apiCheckBox.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { apiCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; outerListPanel.add(apiCheckBox, gridBagConstraints); CheckBox = new AnCheckBox(); CheckBox.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { libraryCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; outerListPanel.add(CheckBox, gridBagConstraints); listLabel.setLabelFor(functionsCheckBox); functionsLabel.setText(AnLocale.getString("Functions")); String showTT = AnLocale.getString("Show all library and class functions"); functionsLabel.setToolTipText(showTT); functionsLabel.setDisplayedMnemonic(AnLocale.getString('F', "MN_LibraryVisibility_Functions")); functionsLabel.setLabelFor(functionsCheckBox); functionsCheckBox.setToolTipText(showTT); libraryLabel.setText(AnLocale.getString("Library")); libraryLabel.setLabelFor(CheckBox); String hideTT = AnLocale.getString("Show only library or class name (Aggregate by library or class)"); libraryLabel.setToolTipText(hideTT); libraryLabel.setDisplayedMnemonic(AnLocale.getString('L', "MN_LibraryVisibility_Library")); CheckBox.setToolTipText(hideTT); apiLabel.setText(AnLocale.getString("API")); apiLabel.setLabelFor(apiCheckBox); apiLabel.setDisplayedMnemonic(AnLocale.getString('A', "MN_LibraryVisibility_API")); String apiTT = AnLocale.getString("Show only API entry points"); apiLabel.setToolTipText(apiTT); apiCheckBox.setToolTipText(apiTT); AnUtility.setTextAndAccessibleContext(nameButton, AnLocale.getString("Name")); nameButton.setMnemonic(AnLocale.getString('M', "HideFunctionsNameButton")); AnUtility.setTextAndAccessibleContext(pathButton, AnLocale.getString("Path")); pathButton.setMnemonic(AnLocale.getString('P', "HideFunctionsPathButton")); defaultsButton.setText(AnLocale.getString("Defaults")); defaultsButton.setMnemonic(AnLocale.getString('D', "HideFunctionsDefaultsButton")); defaultsButton.setToolTipText(AnLocale.getString("Reset selections to defaults")); outerListPanel.setBorder(BorderFactory.createLineBorder(AnEnvironment.BAR_BORDER_COLOR, 1)); includeComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); excludeComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); Dimension dim1 = new java.awt.Dimension(fill1, 0); filler1.setMinimumSize(dim1); filler1.setPreferredSize(dim1); filler1.setMaximumSize(dim1); filler2.setMinimumSize(dim1); filler2.setPreferredSize(dim1); filler2.setMaximumSize(dim1); filler3.setMinimumSize(dim1); filler3.setPreferredSize(dim1); filler3.setMaximumSize(dim1); Dimension dim2 = new java.awt.Dimension(fill2, 0); filler4.setMinimumSize(dim2); filler4.setPreferredSize(dim2); filler4.setMaximumSize(dim2); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); listPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); buttonPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); nameButton.setBorder(null); nameButton.setBorderPainted(false); nameButton.setBackground(Color.red); nameButton.setOpaque(false); pathButton.setBorder(null); pathButton.setBorderPainted(false); pathButton.setBackground(Color.red); pathButton.setOpaque(false); // Accept ENTER in combobox Action enterAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { String typedInclude = ((JTextField) includeComboBox.getEditor().getEditorComponent()).getText(); includeComboBox.setSelectedItem(typedInclude); String typedExclude = ((JTextField) excludeComboBox.getEditor().getEditorComponent()).getText(); excludeComboBox.setSelectedItem(typedExclude); applyFiltersAndUpdateGUI(); } }; ((JTextField) includeComboBox.getEditor().getEditorComponent()) .getInputMap() .put(KeyStroke.getKeyStroke("ENTER"), "enter"); ((JTextField) includeComboBox.getEditor().getEditorComponent()) .getActionMap() .put("enter", enterAction); ((JTextField) excludeComboBox.getEditor().getEditorComponent()) .getInputMap() .put(KeyStroke.getKeyStroke("ENTER"), "enter"); ((JTextField) excludeComboBox.getEditor().getEditorComponent()) .getActionMap() .put("enter", enterAction); setPreferredSize(new Dimension(1000, 600)); dialog.getOKButton().setEnabled(false); maxLabel.setForeground(Color.red); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("StatisticsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: initialized = false; break; case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case FILTER_CHANGING: case FILTER_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: case SETTING_CHANGED: break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } protected void debug() { System.out.println("HideFunctionsPanel: " + getClass().getName()); } private void updateSortState() { if (nameSortState == SortState.UP) { nameButton.setIcon(AnUtility.smallArrowDownIcon); } else if (nameSortState == SortState.DOWN) { nameButton.setIcon(AnUtility.smallArrowUpIcon); } else { nameButton.setIcon(null); } if (pathSortState == SortState.UP) { pathButton.setIcon(AnUtility.smallArrowUpIcon); } else if (pathSortState == SortState.DOWN) { pathButton.setIcon(AnUtility.smallArrowDownIcon); } else { pathButton.setIcon(null); } } class GUIEntry implements Comparable<GUIEntry>, ActionListener { private LibraryVisibilitySetting.Entry entry; public JRadioButton showRadioButton; public JRadioButton hideRadioButton; public JRadioButton apiRadioButton; public GUIEntry(LibraryVisibilitySetting.Entry entry) { this.entry = entry; showRadioButton = new AnRadioButton(); AnUtility.setAccessibleContext( showRadioButton.getAccessibleContext(), AnLocale.getString("Functions")); showRadioButton.setOpaque(false); showRadioButton.setActionCommand("SHOW"); showRadioButton.addActionListener(this); hideRadioButton = new AnRadioButton(); AnUtility.setAccessibleContext( hideRadioButton.getAccessibleContext(), AnLocale.getString("API")); hideRadioButton.setActionCommand("HIDE"); hideRadioButton.addActionListener(this); hideRadioButton.setOpaque(false); apiRadioButton = new AnRadioButton(); AnUtility.setAccessibleContext( apiRadioButton.getAccessibleContext(), AnLocale.getString("Library")); apiRadioButton.setActionCommand("API"); apiRadioButton.addActionListener(this); apiRadioButton.setOpaque(false); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(hideRadioButton); buttonGroup.add(showRadioButton); buttonGroup.add(apiRadioButton); if (entry.getState() == 0) { showRadioButton.setSelected(true); } else if (entry.getState() == 1) { hideRadioButton.setSelected(true); } else if (entry.getState() == 2) { apiRadioButton.setSelected(true); } } /** * @return the name */ public String getName() { return entry.getName(); } /** * @return the path */ public String getPath() { return entry.getPath(); } /** * @return the state */ public int getState() { return entry.getState(); } /** * @return the index */ public int getIndex() { return entry.getIndex(); } /** * @return the name */ public boolean isJava() { return entry.isJava(); } @Override public int compareTo(GUIEntry o) { if (nameSortState == SortState.UP) { return getName().compareTo(o.getName()); } else if (nameSortState == SortState.DOWN) { return o.getName().compareTo(getName()); } else if (pathSortState == SortState.UP) { return getPath().compareTo(o.getPath()); } else if (pathSortState == SortState.DOWN) { return o.getPath().compareTo(getPath()); } else { // Sort by index if (getIndex() < o.getIndex()) { return -1; } else if (getIndex() > o.getIndex()) { return 1; } else { return 0; } } } /** * @param state the state to set */ public void setState(int state) { entry.setState(state); if (state == 0) { showRadioButton.setSelected(true); } else if (state == 1) { hideRadioButton.setSelected(true); } else if (state == 2) { apiRadioButton.setSelected(true); } } @Override public void actionPerformed(ActionEvent e) { String ac = e.getActionCommand(); if (ac.equals("SHOW")) { setState(0); } else if (ac.equals("HIDE")) { setState(1); } else if (ac.equals("API")) { setState(2); } updateCheckBoxStates(); } } private void updateCheckBoxStates() { functionsCheckBox.setSelected(false); CheckBox.setSelected(false); apiCheckBox.setSelected(false); if (entryListSortedFiltered.size() > 0) { boolean allTheSame = true; int state = entryListSortedFiltered.get(0).getState(); for (GUIEntry entry : entryListSortedFiltered) { if (entry.getState() != state) { allTheSame = false; break; } } if (allTheSame) { if (state == 0) { functionsCheckBox.setSelected(true); } else if (state == 1) { CheckBox.setSelected(true); } else if (state == 2) { apiCheckBox.setSelected(true); } } } } public void reset() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { resetInternal(); } }); } private void resetInternal() { if (!initialized) { listPanel.removeAll(); listPanel.add(pleaseWaitLabel); includeComboBox.setSelectedItem(UserPref.getInstance().getLibraryVisibilityIncludeFilter()); initilize(); } else { includeComboBox.setSelectedItem(UserPref.getInstance().getLibraryVisibilityIncludeFilter()); List<LibraryVisibilitySetting.Entry> list = AnWindow.getInstance().getSettings().getLibraryVisibilitySetting().get(); for (int i = 0; i < list.size(); i++) { LibraryVisibilitySetting.Entry entry = list.get(i); GUIEntry guiEntry = entryListOriginal.get(i); guiEntry.setState(entry.getState()); if (guiEntry.getState() == 0) { guiEntry.showRadioButton.setSelected(true); } else if (guiEntry.getState() == 1) { guiEntry.hideRadioButton.setSelected(true); } else if (guiEntry.getState() == 2) { guiEntry.apiRadioButton.setSelected(true); } } updateCheckBoxStates(); } } public void save() { List<LibraryVisibilitySetting.Entry> list = new ArrayList<>(); for (GUIEntry guiEntry : entryListOriginal) { list.add(guiEntry.entry.copy()); } AnWindow.getInstance().getSettings().getLibraryVisibilitySetting().set(this, list); } // For persistance public void initStates( boolean java, StringPickList hideFuncsIncludePickList, String currentIncludeFilter, StringPickList hideFuncsExcludePickList, String currentExcludeFilter) { AnUtility.checkIfOnAWTThread(true); initialized = false; if (java) { javaRadioButton.setSelected(true); } else { nativeRadioButton.setSelected(true); } updateFilterComboBoxes( hideFuncsIncludePickList, currentIncludeFilter, hideFuncsExcludePickList, currentExcludeFilter); } private void enableControls(boolean val) { dialog.getOKButton().setEnabled(val); includeComboBox.setEnabled(val); excludeComboBox.setEnabled(val); refreshButton.setEnabled(val); defaultsButton.setEnabled(val); nativeRadioButton.setEnabled(val); javaRadioButton.setEnabled(val && anyJava); } private void initilize() { AnUtility.checkIfOnAWTThread(true); initialized = true; enableControls(false); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { anyJava = false; entryListOriginal = new ArrayList<>(); entryListSortedFiltered = new ArrayList<>(); List<LibraryVisibilitySetting.Entry> list = AnWindow.getInstance().getSettings().getLibraryVisibilitySetting().get(); for (LibraryVisibilitySetting.Entry entry : list) { GUIEntry guiEntry = new GUIEntry(entry.copy()); entryListOriginal.add(guiEntry); entryListSortedFiltered.add(guiEntry); if (entry.isJava()) { anyJava = true; } } if (!anyJava) { nativeRadioButton.setSelected(true); } javaRadioButton.setEnabled(anyJava); applyFiltersAndUpdateGUI(); enableControls(true); } }); } }, "LibraryVisibility"); } private void updateList() { AnUtility.checkIfOnAWTThread(true); enableControls(false); dialog.busyCursor(true); updateSortState(); Collections.sort(entryListSortedFiltered); listPanel.removeAll(); noEntriesViewed = 0; maxLabel.setText(""); maxListLabel.setText(""); for (GUIEntry entry : entryListSortedFiltered) { addEntry(noEntriesViewed++, entry); if (noEntriesViewed >= maxEntries) { addMaxEntry(noEntriesViewed); break; } } addLastEntry(noEntriesViewed); listPanel.validate(); listPanel.repaint(); dialog.busyCursor(false); enableControls(true); // if (noEntriesViewed != entryListOriginal.size()) { String labelText = String.format( AnLocale.getString("List (%d/%d)"), noEntriesViewed, entryListOriginal.size()); listLabel.setText(labelText); // } else { // listLabel.setText(AnLocale.getString("List:")); // } AnUtility.setTextAndAccessibleContext( listedLabel, AnLocale.getString("Number of entries viewed: ") + noEntriesViewed + "/" + entryListOriginal.size()); } private void addEntry(int no, GUIEntry entry) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); if (entry.getState() == 0) { entry.showRadioButton.setSelected(true); } else if (entry.getState() == 1) { entry.hideRadioButton.setSelected(true); } else if (entry.getState() == 2) { entry.apiRadioButton.setSelected(true); } gridBagConstraints.gridx = 0; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, fill1 / 2 - 10, 0, 0); listPanel.add(entry.showRadioButton, gridBagConstraints); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, fill1 / 2 + 19, 0, 0); listPanel.add(entry.apiRadioButton, gridBagConstraints); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, fill1 / 2 + 19, 0, 0); listPanel.add(entry.hideRadioButton, gridBagConstraints); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 45, 0, 0); JLabel label = new JLabel(entry.getName()); label.setToolTipText(entry.getName()); listPanel.add(label, gridBagConstraints); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(0, 12, 0, 0); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; label = new JLabel(entry.getPath()); label.setToolTipText(entry.getPath()); listPanel.add(label, gridBagConstraints); } private void addMaxEntry(int no) { String text = String.format( AnLocale.getString( "Maximum number (%d) of viewed entries reached. Use the filters to reduce the" + " number of entries"), maxEntries); // Add entry in list GridBagConstraints gridBagConstraints = new GridBagConstraints(); JLabel maxEntryLabel = new JLabel(); AnUtility.setTextAndAccessibleContext(maxEntryLabel, text); maxEntryLabel.setForeground(Color.red); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = no + 1; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new Insets(8, 12, 8, 0); listPanel.add(maxEntryLabel, gridBagConstraints); // Set the max list label AnUtility.setTextAndAccessibleContext(maxListLabel, " - " + text); maxListLabel.setForeground(Color.red); } private void addLastEntry(int no) { JLabel label = new JLabel(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = no; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weighty = 1.0; listPanel.add(label, gridBagConstraints); } private void updateFilterComboBoxes(String includeFilterString, String excludeFilterString) { String includeSelected = (String) includeComboBox.getSelectedItem(); UserPref.getInstance().getLibraryVisibilityIncludePickList().addElement(includeFilterString); String excludeSelected = (String) excludeComboBox.getSelectedItem(); UserPref.getInstance().getLibraryVisibilityExcludePickList().addElement(excludeFilterString); updateFilterComboBoxes( UserPref.getInstance().getLibraryVisibilityIncludePickList(), includeSelected, UserPref.getInstance().getLibraryVisibilityExcludePickList(), excludeSelected); } private void updateFilterComboBoxes( StringPickList includePicklist, String currentIncludeFilter, StringPickList excludePicklist, String currentExcludeFilter) { includeComboBox.removeAllItems(); includeComboBox.addItem(""); for (StringPickListElement elem : includePicklist.getStringElements()) { if (elem.getString().length() > 0) { includeComboBox.addItem(elem.getString()); } } if (currentIncludeFilter != null) { includeComboBox.setSelectedItem(currentIncludeFilter); } excludeComboBox.removeAllItems(); excludeComboBox.addItem(""); for (StringPickListElement elem : excludePicklist.getStringElements()) { if (elem.getString().length() > 0) { excludeComboBox.addItem(elem.getString()); } } if (currentExcludeFilter != null) { excludeComboBox.setSelectedItem(currentExcludeFilter); } } private void formatColumns() { int maxNameWidth = 0; for (GUIEntry entry : entryListSortedFiltered) { JLabel label = new JLabel(entry.getName()); int w = label.getPreferredSize().width; if (maxNameWidth < w) { maxNameWidth = w; } } fill2 = maxNameWidth + 28; // Dimension dim2 = new java.awt.Dimension(fill2, 0); filler4.setMinimumSize(dim2); filler4.setPreferredSize(dim2); filler4.setMaximumSize(dim2); } private void applyFiltersAndUpdateGUI() { String includeFilterString = (String) includeComboBox.getSelectedItem(); String excludeFilterString = (String) excludeComboBox.getSelectedItem(); if (includeFilterString == null) { includeFilterString = ""; } if (excludeFilterString == null) { excludeFilterString = ""; } entryListSortedFiltered = filterEntries(entryListOriginal, javaRadioButton.isSelected()); entryListSortedFiltered = filterEntries(entryListSortedFiltered, includeFilterString, false); entryListSortedFiltered = filterEntries(entryListSortedFiltered, excludeFilterString, true); includeComboBox.addItem(includeFilterString); excludeComboBox.addItem(excludeFilterString); formatColumns(); updateList(); updateCheckBoxStates(); updateFilterComboBoxes(includeFilterString, excludeFilterString); UserPref.getInstance().setLibraryVisibilityIncludeFilter(includeFilterString); UserPref.getInstance().setCurrentLibraryVisibilityExcludeFilter(excludeFilterString); } public boolean isJava() { return javaRadioButton.isSelected(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoLabel = new javax.swing.JLabel(); filterPanel = new javax.swing.JPanel(); filterLabel = new javax.swing.JLabel(); radioButtonPanel = new javax.swing.JPanel(); nativeRadioButton = new javax.swing.JRadioButton(); javaRadioButton = new javax.swing.JRadioButton(); includeLabel = new javax.swing.JLabel(); includeComboBox = new javax.swing.JComboBox(); excludeLabel = new javax.swing.JLabel(); excludeComboBox = new javax.swing.JComboBox(); refreshButton = new javax.swing.JButton(); listLabelPanel = new javax.swing.JPanel(); listLabel = new javax.swing.JLabel(); maxListLabel = new javax.swing.JLabel(); outerListPanel = new javax.swing.JPanel(); filler1 = new javax.swing.Box.Filler( new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0)); filler2 = new javax.swing.Box.Filler( new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0)); filler3 = new javax.swing.Box.Filler( new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0), new java.awt.Dimension(60, 0)); filler4 = new javax.swing.Box.Filler( new java.awt.Dimension(120, 0), new java.awt.Dimension(120, 0), new java.awt.Dimension(120, 0)); functionsLabel = new javax.swing.JLabel(); apiLabel = new javax.swing.JLabel(); libraryLabel = new javax.swing.JLabel(); nameButton = new javax.swing.JButton(); pathButton = new javax.swing.JButton(); scrollPane = new javax.swing.JScrollPane(); listPanel = new javax.swing.JPanel(); buttonPanel = new javax.swing.JPanel(); maxLabel = new javax.swing.JLabel(); defaultsButton = new javax.swing.JButton(); listedLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); infoLabel.setText("info..."); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(infoLabel, gridBagConstraints); filterPanel.setLayout(new java.awt.GridBagLayout()); filterLabel.setText("Filter:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipady = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; filterPanel.add(filterLabel, gridBagConstraints); radioButtonPanel.setOpaque(false); radioButtonPanel.setLayout(new java.awt.GridBagLayout()); nativeRadioButton.setText("Native"); nativeRadioButton.setOpaque(false); nativeRadioButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nativeRadioButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; radioButtonPanel.add(nativeRadioButton, gridBagConstraints); javaRadioButton.setText("Java"); javaRadioButton.setOpaque(false); javaRadioButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { javaRadioButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; radioButtonPanel.add(javaRadioButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); filterPanel.add(radioButtonPanel, gridBagConstraints); includeLabel.setText("Include"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0); filterPanel.add(includeLabel, gridBagConstraints); includeComboBox.setEditable(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0); filterPanel.add(includeComboBox, gridBagConstraints); excludeLabel.setText("and exclude"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 8, 4, 0); filterPanel.add(excludeLabel, gridBagConstraints); excludeComboBox.setEditable(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 0); filterPanel.add(excludeComboBox, gridBagConstraints); refreshButton.setText("Refresh"); refreshButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { refreshButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 8, 4, 0); filterPanel.add(refreshButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0); add(filterPanel, gridBagConstraints); listLabelPanel.setLayout(new java.awt.GridBagLayout()); listLabel.setText("List:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; listLabelPanel.add(listLabel, gridBagConstraints); maxListLabel.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; listLabelPanel.add(maxListLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(listLabelPanel, gridBagConstraints); outerListPanel.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; outerListPanel.add(filler1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; outerListPanel.add(filler2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; outerListPanel.add(filler3, gridBagConstraints); filler4.setAutoscrolls(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; outerListPanel.add(filler4, gridBagConstraints); functionsLabel.setText("Functions"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); outerListPanel.add(functionsLabel, gridBagConstraints); apiLabel.setText("API"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); outerListPanel.add(apiLabel, gridBagConstraints); libraryLabel.setText("Library"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); outerListPanel.add(libraryLabel, gridBagConstraints); nameButton.setText("Name"); nameButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nameButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 14, 0, 0); outerListPanel.add(nameButton, gridBagConstraints); pathButton.setText("Path"); pathButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pathButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; outerListPanel.add(pathButton, gridBagConstraints); scrollPane.setBorder(null); listPanel.setLayout(new java.awt.GridBagLayout()); scrollPane.setViewportView(listPanel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); outerListPanel.add(scrollPane, gridBagConstraints); buttonPanel.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(4, 12, 0, 12); buttonPanel.add(maxLabel, gridBagConstraints); defaultsButton.setText("Defaults"); defaultsButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { defaultsButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 12, 4, 0); buttonPanel.add(defaultsButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12); buttonPanel.add(listedLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; outerListPanel.add(buttonPanel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(outerListPanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void nameButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_nameButtonActionPerformed // TODO add your handling code here: if (nameSortState == SortState.NONE) { nameSortState = SortState.UP; } else if (nameSortState == SortState.UP) { nameSortState = SortState.DOWN; } else { nameSortState = SortState.UP; } pathSortState = SortState.NONE; updateList(); } // GEN-LAST:event_nameButtonActionPerformed private void pathButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_pathButtonActionPerformed // TODO add your handling code here: if (pathSortState == SortState.NONE) { pathSortState = SortState.UP; } else if (pathSortState == SortState.UP) { pathSortState = SortState.DOWN; } else { pathSortState = SortState.UP; } nameSortState = SortState.NONE; updateList(); } // GEN-LAST:event_pathButtonActionPerformed private void refreshButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_refreshButtonActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_refreshButtonActionPerformed private List<GUIEntry> filterEntries(List<GUIEntry> origList, boolean java) { List<GUIEntry> list = new ArrayList<>(); for (GUIEntry guiEntry : origList) { if (guiEntry.isJava() == java) { list.add(guiEntry); } } return list; } private List<GUIEntry> filterEntries( List<GUIEntry> origList, String rawIncludeFilterString, boolean exclude) { String[] substrings = rawIncludeFilterString.split(" "); // multiword match //FIXUP bypass escaped spaces? // String[] substrings = {raw_includeFilterString}; // exact text match List<String> clauses = new ArrayList<>(); for (int ii = 0; ii < substrings.length; ii++) { if (substrings[ii].isEmpty()) { continue; // strip out empty clauses caused by consecutive spaces } clauses.add(substrings[ii]); } final List<GUIEntry> newList; if (clauses.isEmpty()) { newList = new ArrayList<>(origList); } else { newList = new ArrayList<>(); for (GUIEntry entry : origList) { boolean pass = false; for (String clause : clauses) { if (entry.getName().contains(clause) || entry.getPath().contains(clause)) { pass = true; break; } } if (exclude) { if (!pass) { newList.add(entry); } } else { if (pass) { newList.add(entry); } } } } return newList; } private void functionsCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { for (GUIEntry entry : entryListSortedFiltered) { entry.setState(0); } updateCheckBoxStates(); } private void libraryCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { for (GUIEntry entry : entryListSortedFiltered) { entry.setState(1); } updateCheckBoxStates(); } private void apiCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { for (GUIEntry entry : entryListSortedFiltered) { entry.setState(2); } updateCheckBoxStates(); } private void defaultsButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_defaultsButtonActionPerformed for (GUIEntry entry : entryListSortedFiltered) { entry.setState(0); } updateCheckBoxStates(); } // GEN-LAST:event_defaultsButtonActionPerformed private void nativeRadioButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_nativeRadioButtonActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_nativeRadioButtonActionPerformed private void javaRadioButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_javaRadioButtonActionPerformed applyFiltersAndUpdateGUI(); } // GEN-LAST:event_javaRadioButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel apiLabel; private javax.swing.JPanel buttonPanel; private javax.swing.JButton defaultsButton; private javax.swing.JComboBox excludeComboBox; private javax.swing.JLabel excludeLabel; private javax.swing.Box.Filler filler1; private javax.swing.Box.Filler filler2; private javax.swing.Box.Filler filler3; private javax.swing.Box.Filler filler4; private javax.swing.JLabel filterLabel; private javax.swing.JPanel filterPanel; private javax.swing.JLabel functionsLabel; private javax.swing.JComboBox includeComboBox; private javax.swing.JLabel includeLabel; private javax.swing.JLabel infoLabel; private javax.swing.JRadioButton javaRadioButton; private javax.swing.JLabel libraryLabel; private javax.swing.JLabel listLabel; private javax.swing.JPanel listLabelPanel; private javax.swing.JPanel listPanel; private javax.swing.JLabel listedLabel; private javax.swing.JLabel maxLabel; private javax.swing.JLabel maxListLabel; private javax.swing.JButton nameButton; private javax.swing.JRadioButton nativeRadioButton; private javax.swing.JPanel outerListPanel; private javax.swing.JButton pathButton; private javax.swing.JPanel radioButtonPanel; private javax.swing.JButton refreshButton; private javax.swing.JScrollPane scrollPane; // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CalledByCallsDisp.java���������������������������������������������0000644�0001750�0001750�00000062060�15044710303�020051� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.metrics.MetricLabel; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.util.gui.AnSplitPane; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.accessibility.AccessibleContext; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.ListSelectionModel; public class CalledByCallsDisp extends FuncListDisp { private static final int CALLER_MIN_HEIGHT = 120; private static final int CALLEE_MIN_HEIGHT = 60; private AnTable caller, func_item, callee; private Object[][] caller_data, callee_data; private Object[][] caller_sort_data, callee_sort_data; private LocalProcessData caller_data_lpd; private LocalProcessData callee_data_lpd; private String acNameT1; private String acDescT1; private String acNameT3; private String acDescT3; private long[] ids_callers = null; private long[] ids_callees = null; private long[] ids_cstack = null; private String[] ids_names = null; // private CC_CallStack cc_callstack; private int sort_ind; JLabel calledByCallsLabel; String[] names_caller, names_callee; // private Object[][] MaximumValues = null; protected long sel_func; // Constructor public CalledByCallsDisp( final AnWindow awindow, final int type, final String help_id, final int ptype) { super(awindow, type, 0, help_id); caller_data = callee_data = null; parent_type = ptype; sel_func = 0; } private Object[] getTableData( final String mlistStr, final String modeStr, final String typeStr, final String subtypeStr, final long[] cstack) { // long t = System.currentTimeMillis(); Object[] data = window.getTableDataV2(mlistStr, modeStr, typeStr, subtypeStr, cstack); // t = System.currentTimeMillis() - t; // System.out.println("DEBUG: CallerCalleesDisp.getTableData(): time="+t+" mls."); return data; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { StringBuilder buf = new StringBuilder(); buf.append(calledByCallsLabel.getText()); buf.append(" "); buf.append(names_caller[1]); buf.append("\n"); buf.append(caller.printTableContents(null, 0)); buf.append(calledByCallsLabel.getText()); buf.append(" "); buf.append(names_callee[1]); buf.append("\n"); buf.append(callee.printTableContents(null, 0)); return buf.toString(); } public AnTable getCallerTable() { return caller; } public AnTable getCalleeTable() { return callee; } class LocalProcessData { final String AccessToMaximumValues = "AccessToMaximumValues"; // Process the raw data from mixed Primary/Object to pure Object array. // Creates or updates MaximumValues. public Object[][] localProcessData(final Object[] raw_data) { int i; // Default values for MaximumValues AnAddress aa = new AnAddress(0); AnDouble ad = new AnDouble(0.0); AnInteger ai = new AnInteger(0); AnLong al = new AnLong(0); AnString as = new AnString(""); final int nc = raw_data.length - 1; final Object[][] data = new Object[nc][]; synchronized (AccessToMaximumValues) { MaximumValues = new Object[2][nc]; for (i = 0; i < nc; i++) { if (raw_data[i] instanceof double[]) { data[i] = AnDouble.toArray((double[]) raw_data[i]); MaximumValues[1][i] = ad; } else if (raw_data[i] instanceof int[]) { data[i] = AnInteger.toArray((int[]) raw_data[i]); MaximumValues[1][i] = ai; } else if (raw_data[i] instanceof long[]) { if ((((long[]) raw_data[i]).length == 0) || !AnAddress.isAddress(((long[]) raw_data[i])[0])) { data[i] = AnLong.toArray((long[]) raw_data[i]); MaximumValues[1][i] = al; } else { data[i] = AnAddress.toArray((long[]) raw_data[i]); MaximumValues[1][i] = aa; } } else { data[i] = (Object[]) raw_data[i]; MaximumValues[1][i] = as; } this.updateTotalMax(data[i], i); } for (i = 0; i < nc; i++) { // make sure there are no null elements in MaximumValues[1] if (MaximumValues[0][i] == null) { MaximumValues[0][i] = ad; } if (MaximumValues[1][i] == null) { MaximumValues[1][i] = ad; } } } return data; } /* * Updates MaximumValues (Total and Max values) * Note: Total is not used, so only Maximum is updated. */ void updateTotalMax(Object[] table_column, int index) { synchronized (AccessToMaximumValues) { double d0 = 0; for (int i = 0; i < table_column.length; i++) { if (MaximumValues[0][index] != null) { d0 = ((AnDouble) (MaximumValues[0][index])).doubleValue(); } if ((table_column[i] instanceof AnDouble)) { double d = ((AnDouble) table_column[i]).doubleValue(); d = d + d0; MaximumValues[0][index] = new AnDouble(d); } if ((table_column[i] instanceof AnInteger)) { double d = ((AnInteger) table_column[i]).doubleValue(); d = d + d0; MaximumValues[0][index] = new AnDouble(d); } if ((table_column[i] instanceof AnLong)) { double d = ((AnLong) table_column[i]).doubleValue(); d = d + d0; MaximumValues[0][index] = new AnDouble(d); } if (MaximumValues[1][index] == null) { MaximumValues[1][index] = table_column[i]; continue; } int j = MaximumValues[1][index].toString().length(); int k = table_column[i].toString().length(); if (j < k) { MaximumValues[1][index] = table_column[i]; } } } } /* * Returns MaximumValues (Total and Max values), calculated by processData() */ public Object[] getTotalMax() { synchronized (AccessToMaximumValues) { return MaximumValues; } } } // Initialize GUI components @Override protected void initComponents() { final JPanel pcaller; final JPanel pcallee; final JSplitPane splitPane1; Dimension msize; setLayout(new BorderLayout()); // Create table names and descriptions acNameT1 = AnLocale.getString("Callers Table"); acDescT1 = AnLocale.getString("Callers Table (shows functions that call selected function)"); acNameT3 = AnLocale.getString("Callees Table"); acDescT3 = AnLocale.getString( "Callers Table (shows functions that are called from selected function)"); // Create lables calledByCallsLabel = new JLabel(); Font monoSpacedFont = new Font("Monospaced", Font.BOLD, calledByCallsLabel.getFont().getSize()); calledByCallsLabel.setFont(monoSpacedFont); AnUtility.setAccessibleContext( calledByCallsLabel.getAccessibleContext(), AnLocale.getString("Selected function")); // Create tables caller = new AnTable( DSP_MiniCaller, true, false, true, false, true, false, false, acNameT1, acDescT1, null); // HERE table = caller; caller.setParent((AnDisplay) this); AccessibleContext context = caller.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callers")); context.setAccessibleDescription(AnLocale.getString("Callers")); caller.addAnListener(new TabTableHandler()); caller.getTable().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); callee = new AnTable( DSP_MiniCallee, true, false, true, false, true, false, false, acNameT3, acDescT3, null); // HERE callee.setParent((AnDisplay) this); context = callee.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Callees")); context.setAccessibleDescription(AnLocale.getString("Callees")); callee.setHeader(caller); callee.addAnListener(new TabTableHandler()); callee.getTable().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Set header icons & tooltips pcaller = new JPanel(new BorderLayout()); pcaller.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 1, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); pcaller.add(caller, BorderLayout.CENTER); pcallee = new JPanel(new BorderLayout()); pcallee.setBorder( BorderFactory.createMatteBorder(1, 1, 0, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); pcallee.add(callee, BorderLayout.CENTER); // Set the split pane msize = pcaller.getMinimumSize(); msize.height = CALLER_MIN_HEIGHT; pcaller.setMinimumSize(msize); msize = pcallee.getMinimumSize(); msize.height = CALLEE_MIN_HEIGHT; pcallee.setMinimumSize(msize); msize.height = 100; msize.width = 50; splitPane1 = new AnSplitPane(JSplitPane.HORIZONTAL_SPLIT, pcaller, pcallee); splitPane1.setContinuousLayout(true); splitPane1.setResizeWeight(0.5); JPanel topPanel = new JPanel(); topPanel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = new Insets(3, 0, 2, 0); topPanel.add(calledByCallsLabel, gridBagConstraints); add(topPanel, BorderLayout.NORTH); add(splitPane1, BorderLayout.CENTER); this.setPreferredSize(msize); } // Compute & update function list table @Override public synchronized void doCompute() { AnUtility.checkIfOnAWTThread(false); final int sc_pos; int name_len, len, row_height, height, i, j; Object[] raw_data; Object[] raw_data_with_ids; final int[] caller_stype, callee_stype; MetricLabel[] caller_label, callee_label; MetricLabel[] caller_sort_label, callee_sort_label; final int[][] caller_width, callee_width; AnObject obj, max_obj; final String mlistStr = "MET_CALL"; final String typeStrCaller; switch (parent_type) { case AnDisplay.DSP_Source: case AnDisplay.DSP_Lines: typeStrCaller = "LINE"; break; case AnDisplay.DSP_Disassembly: case AnDisplay.DSP_PCs: typeStrCaller = "INSTR"; break; default: typeStrCaller = "FUNCTION"; break; } final String typeStr = "FUNCTION"; final String subtypeStr; switch (parent_type) { case AnDisplay.DSP_Lines: case AnDisplay.DSP_PCs: subtypeStr = "1"; break; default: subtypeStr = "0"; break; } final String stab_callers = "CALLERS"; final String stab_callees = "CALLEES"; final String stab_self = "SELF"; final long[] cstack; // Not selected if (!selected) { return; } caller_label = callee_label = null; long func_obj = window.getSelectedObject().getSelObj(DSP_Functions, 0); if (sel_func == 0 || sel_func != func_obj) { computed = false; sel_func = func_obj; } if (!computed) { // need re-compute // sel_func = getFuncObj(); // Required to initialize Functions list // setFuncData(sel_func, type, subtype); table = caller; table.setViewport(); // Update stack /* * The caller-callee display will honor selections * made in other displays. */ long ID = window.getSelectedObject().getSelObjV2("FUNCTION"); long[] new_cstack = new long[1]; new_cstack[0] = ID; cstack = new_cstack; ids_cstack = cstack; // TEMPORARY // Get name String fname = window.getObjNameV2(ID); String[] new_names = new String[1]; new_names[0] = fname; ids_names = new_names; // TEMPORARY // Update callers list raw_data_with_ids = /* window. */ getTableData(mlistStr, stab_callers, typeStrCaller, subtypeStr, cstack); raw_data = new Object[raw_data_with_ids.length]; for (i = 0; i < raw_data.length; i++) { raw_data[i] = raw_data_with_ids[i]; } raw_data[raw_data.length - 1] = null; ids_callers = (long[]) raw_data_with_ids[raw_data_with_ids.length - 1]; caller_data_lpd = new LocalProcessData(); caller_data = caller_data_lpd.localProcessData(raw_data); caller_stype = (int[]) raw_data[raw_data.length - 1]; caller_label = getSettings() .getMetricsSetting() .getLabel( caller_data, caller_data_lpd.getTotalMax(/*DSP_CALLER, subtype*/ ), type, caller); name_col = getSettings().getMetricsSetting().getNameColumnIndexByDType(getMetricMType()); names = getNames(type, 0); sort_ind = getSortCol(); if (sort_ind == name_col) { sort_ind = (name_col == 0) ? 1 : 0; } if (sort_ind >= caller_data.length) { sort_ind = 0; } if (caller_data.length > 1) { caller_sort_data = new Object[2][]; caller_sort_label = new MetricLabel[2]; caller_sort_data[0] = caller_data[sort_ind]; caller_sort_label[0] = caller_label[sort_ind]; caller_sort_data[1] = caller_data[name_col]; caller_sort_label[1] = caller_label[name_col]; } else { caller_sort_data = caller_data; caller_sort_label = caller_label; } // Update callees list raw_data_with_ids = /* window. */ getTableData(mlistStr, stab_callees, typeStr, subtypeStr, cstack); raw_data = new Object[raw_data_with_ids.length]; for (i = 0; i < raw_data.length; i++) { raw_data[i] = raw_data_with_ids[i]; } raw_data[raw_data.length - 1] = null; ids_callees = (long[]) raw_data_with_ids[raw_data_with_ids.length - 1]; callee_data_lpd = new LocalProcessData(); callee_data = callee_data_lpd.localProcessData(raw_data); callee_stype = (int[]) raw_data[raw_data.length - 1]; /* TEMPORARY changes to support percentage calculation */ // Have to do it here, because Total was not calculated earlier callee_label = getSettings() .getMetricsSetting() .getLabel( callee_data, callee_data_lpd.getTotalMax(/*DSP_CALLEE, subtype*/ ), type, callee); if (callee_data.length > 1) { callee_sort_data = new Object[2][]; callee_sort_label = new MetricLabel[2]; callee_sort_data[0] = callee_data[sort_ind]; callee_sort_label[0] = callee_label[sort_ind]; callee_sort_data[1] = callee_data[name_col]; callee_sort_label[1] = callee_label[name_col]; } else { callee_sort_data = callee_data; callee_sort_label = callee_label; } // Update function name String[] funcNames = ids_names; String funcName = AnLocale.getString("Selected function"); if (funcNames != null && funcNames.length > 0) { funcName = funcNames[0]; } // int index = funcName.indexOf('('); // if (index > 0) { // funcName = funcName.substring(0, index); // } calledByCallsLabel.setText(funcName); names_caller = new String[names.length]; names_callee = new String[names.length]; if (names.length > 1) { names_caller[0] = funcName; names_callee[0] = funcName; names_caller[1] = AnLocale.getString("is called by"); names_callee[1] = AnLocale.getString("calls"); } int sort_col = getSortCol(); if (sort_col == name_col) { sort_col = 1; } else { sort_col = 0; } // if (SwingUtilities.isEventDispatchThread()) { // caller.setData(caller_sort_label, caller_sort_data, names_caller, // caller_stype, // 0, (caller_data.length > 1) ? 1 : name_col, sort_col); // callee.setData(callee_sort_label, callee_sort_data, names_callee, // callee_stype, // 0, (callee_data.length > 1) ? 1 : name_col, sort_col); // caller.repaint(); // callee.repaint(); // } else { { // Use SwingUtilities to update tables final MetricLabel[] label1 = caller_sort_label; final MetricLabel[] label3 = callee_sort_label; // try { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { int sort_col = getSortCol(); if (sort_col == name_col) { sort_col = 1; } else { sort_col = 0; } getCallerTable() .setData( label1, caller_sort_data, names_caller, caller_stype, 0, (caller_data.length > 1) ? 1 : name_col, sort_col); getCalleeTable() .setData( label3, callee_sort_data, names_callee, callee_stype, 0, (callee_data.length > 1) ? 1 : name_col, sort_col); getCallerTable().repaint(); getCalleeTable().repaint(); } }); // } catch (Exception exc) { // System.out.println("CallDisp.recompute() exception: " + exc); // exc.printStackTrace(); // } } } // Set the column width if (caller_label != null) { // Find the 'name' object which has the maximum width max_obj = caller_label[name_col].getMaxAnObject(); name_len = caller.stringWidth(max_obj.toString()); obj = callee_label[name_col].getMaxAnObject(); len = callee.stringWidth(obj.toString()); if (name_len < len) { // name_len = len; // assignment is never used max_obj = obj; } caller_label[name_col].setMaxAnObject(max_obj); callee_label[name_col].setMaxAnObject(max_obj); // Find the maximum row height row_height = caller.getRowHeight(); height = callee.getRowHeight(); if (row_height < height) { row_height = height; } // Find the maximum width for each field caller_width = caller.getColumnWidth(); callee_width = callee.getColumnWidth(); for (i = 0; i < caller_width.length; i++) { for (j = 0; j < 4; j++) { if (caller_width[i][j] < callee_width[i][j]) { caller_width[i][j] = callee_width[i][j]; } } } // Set column height/width for caller/func/callee caller.setColumn(row_height); callee.setColumn(row_height); caller.clearSelectedRow(); callee.clearSelectedRow(); sc_pos = callee.getScroll(); caller.setScroll(sc_pos); } computed = true; } private int getSortCol() { int ret = -1; int func_sort_ind = getSettings().getMetricsSetting().getSortColumnByDType(AnDisplay.DSP_Functions); AnMetric[] func_mlist = getSettings().getMetricsSetting().getMetricListByMType(MetricsSetting.MET_NORMAL); AnMetric[] cc_mlist = getSettings().getMetricsSetting().getMetricListByMType(MetricsSetting.MET_CALL); for (int ind = 0; ind < cc_mlist.length; ind++) { if (cc_mlist[ind].getUserName().equals(func_mlist[func_sort_ind].getUserName())) { ret = ind; break; } } if (ret == -1) { ret = getSettings().getMetricsSetting().getSortColumnByDType(type); } return ret; } // Is current selected tab? public void setSelected(final boolean set) { selected = set; } // Listener for updating table private final class TabTableHandler implements AnListener { @Override public void valueChanged(final AnEvent event) { final AnTable src = (AnTable) event.getSource(); final int loc, from, to, column, width; boolean double_click = false; int index = event.getValue(); switch (event.getType()) { case AnEvent.EVT_SELECT: // Selecting // changeSelection(src, index); break; case AnEvent.EVT_COMPUTE: // Compute and Update changeSelection(src, index); break; case AnEvent.EVT_SORT: // Sorting getSettings() .getMetricsSetting() .setSortMetricByDType(this, getSortCol(), getMetricMType()); break; case AnEvent.EVT_COPY_ALL: // Copy all lines copyAll(); break; case AnEvent.EVT_COPY_SEL: // Copy selected lines copySelected(); break; case AnEvent.EVT_SCROLL: // Scrolling if (src == getCalleeTable()) { loc = event.getValue(); getCallerTable().setScroll(loc); func_item.setScroll(loc); } break; case AnEvent.EVT_SWITCH: // Column switching from = event.getValue(); to = ((Integer) event.getAux()).intValue(); getSettings().getMetricsSetting().setMetricOrderByDType(this, from, to, getMetricMType()); break; case AnEvent.EVT_RESIZE: // Column resizing if (src == getCallerTable()) { column = event.getValue(); width = ((Integer) event.getAux()).intValue(); func_item.setColumnWidth(column, width); getCalleeTable().setColumnWidth(column, width); } break; } } } @Override public void changeSelection(AnTable src, int index) { long ID = -1; if (index >= 0) { // clearSelections(); if (src == caller) { if (index < ids_callers.length) { ID = ids_callers[index]; } } else if (src == callee) { if (index < ids_callees.length) { ID = ids_callees[index]; } } if (ID > 0) { src.setSelectedRow(index); // AWT // cc_callstack.setSelectedObject(ID); //NM Hack // cc_callstack.saveSelection(ID, src, index); //NM Hack // window.computeFuncData(); //NM Update Summary // window.showSummary(); // AWT final long id = ID; final int ix = index; final AnTable at = src; AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { if (at == getCallerTable() && (parent_type == AnDisplay.DSP_Source || parent_type == AnDisplay.DSP_Disassembly)) { window.getSelectedObject().setSelObjWithEvent(id, DSP_MiniCaller, 0); } else { window.getSelectedObject().setSelObjV2WithEvent(id); } // //window.computeFuncData(); //NM Update Summary // switch (parent_type) { // case AnDisplay.DSP_SOURCE: // window.computeSrcData(); // break; // case AnDisplay.DSP_DISASM: // window.computeDisData(); // break; // case AnDisplay.DSP_FUNCTION: // window.computeFuncData(); // break; // default: // break; // } } }, "CallTree_thread"); } } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/DataObjectsView.java�����������������������������������������������0000644�0001750�0001750�00000007360�14744453367�017637� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import javax.swing.JPanel; public final class DataObjectsView extends FuncListDisp implements AnChangeListener { public DataObjectsView() { super(AnWindow.getInstance(), AnDisplay.DSP_DataObjects, 0, AnVariable.HELP_TabsDataObjects); setAccessibility(AnLocale.getString("Data Objects")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("DataObjectsView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public JPanel getToolbarPanel() { return null; } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015307� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/CheckBoxList.java�������������������������������������������0000644�0001750�0001750�00000005507�14744453367�020437� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.DefaultListModel; import javax.swing.JCheckBox; import javax.swing.JList; import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; public class CheckBoxList extends JList<JCheckBox> { private DefaultListModel<JCheckBox> model; public CheckBoxList() { model = new DefaultListModel<JCheckBox>(); setModel(model); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setCellRenderer(new CellRenderer()); addKeyListener( new KeyAdapter() { @Override public void keyTyped(KeyEvent evt) { super.keyTyped(evt); if (evt.getKeyChar() == ' ') { JCheckBox checkBox = getSelectedValue(); if (checkBox != null) { checkBox.setSelected(!checkBox.isSelected()); repaint(100); } } } }); addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent evt) { if (evt.getX() < 20) { int row = locationToIndex(evt.getPoint()); JCheckBox checkBox = model.getElementAt(row); if (checkBox != null) { checkBox.setSelected(!checkBox.isSelected()); repaint(100); } } } }); } private class CellRenderer implements ListCellRenderer<JCheckBox> { @Override public Component getListCellRendererComponent( JList<? extends JCheckBox> list, JCheckBox checkBox, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected) { checkBox.setBackground(getSelectionBackground()); checkBox.setForeground(getSelectionForeground()); } else { checkBox.setBackground(getBackground()); checkBox.setForeground(getForeground()); } return checkBox; } } public void addElement(JCheckBox checkBox) { model.addElement(checkBox); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/ConnectionPanel.java����������������������������������������0000644�0001750�0001750�00000030241�15044710303�021141� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Font; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JTextArea; import javax.swing.JTextField; public class ConnectionPanel extends JPanel { private final ConnectionDialog connectionDialog; /** Creates new form ConnectionPanel */ public ConnectionPanel(ConnectionDialog connectionDialog) { this.connectionDialog = connectionDialog; initComponents(); setOpaque(false); AnUtility.setAccessibleContext( messageTextArea.getAccessibleContext(), AnLocale.getString("Information Area")); messageTextArea.setBackground(AnEnvironment.DEFAULT_TEXT_PANE_RO_BACKGROUND); hostNameComboBox.setPrototypeDisplayValue("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); hostNameComboBox.setFont(hostNameComboBox.getFont().deriveFont(Font.PLAIN)); hostNameLabel.setText(AnLocale.getString("Remote Host:")); hostNameLabel.setToolTipText(AnLocale.getString("Name of the remote system")); hostNameLabel.setDisplayedMnemonic(AnLocale.getString('o', "RemoteDialogHostNameLabelMN")); hostNameLabel.setLabelFor(hostNameComboBox); connectCommandLabel.setText(AnLocale.getString("Connect Command:")); connectCommandLabel.setToolTipText( AnLocale.getString( "Connect command for gprofng remote system")); connectCommandLabel.setDisplayedMnemonic(AnLocale.getString('I', "RemoteDialogConnectCommandLabelMN")); connectCommandLabel.setLabelFor(connectCommandTextField); userNameLabel.setText(AnLocale.getString("User Name:")); userNameLabel.setToolTipText( AnLocale.getString("User name of the account to log in to the remote system")); userNameLabel.setDisplayedMnemonic(AnLocale.getString('u', "RemoteDialogUserNameLabelMN")); userNameLabel.setLabelFor(userNameTextField); solstudioPathLabel.setText(AnLocale.getString("Remote gprofng Path:")); solstudioPathLabel.setToolTipText( AnLocale.getString( "Full path to the gprofng installation accessible on the remote system")); solstudioPathLabel.setDisplayedMnemonic(AnLocale.getString('I', "RemoteDialogPathLabelMN")); solstudioPathLabel.setLabelFor(solstudioPathTextField); connectionStatusLabel.setText(AnLocale.getString("Connection Status:")); connectionStatusLabel.setToolTipText(AnLocale.getString("Status of connection")); connectionStatusValueLabel.setFont(connectionStatusValueLabel.getFont().deriveFont(Font.PLAIN)); AnUtility.setAccessibleContext( connectionStatusValueLabel.getAccessibleContext(), AnLocale.getString("Status of connection")); AnUtility.setAccessibleContext( connectionProgressBar.getAccessibleContext(), AnLocale.getString("Progress")); // For now userNameTextField.setText(AnUtility.getenv("USER")); } public void setLoginFieldsEnabled(boolean remote) { if (!remote) { // local host solstudioPathLabel.setEnabled(false); solstudioPathTextField.setEnabled(false); connectCommandLabel.setEnabled(false); connectCommandTextField.setEnabled(false); } else { solstudioPathLabel.setEnabled(true); solstudioPathTextField.setEnabled(true); connectCommandLabel.setEnabled(true); connectCommandTextField.setEnabled(true); } } public JProgressBar getConnectionProgressBar() { return connectionProgressBar; } public JTextArea getMessageTextArea() { return messageTextArea; } public JLabel getConnectionStatusValueLabel() { return connectionStatusValueLabel; } public JComboBox<String> getHostNameComboBox() { return hostNameComboBox; } public JTextField getSolstudioPathTextField() { return solstudioPathTextField; } public JTextField getConnectCommandTextField() { return connectCommandTextField; } public JTextField getUserNameTextField() { return userNameTextField; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; hostNameLabel = new javax.swing.JLabel(); hostNameComboBox = new javax.swing.JComboBox<>(); solstudioPathLabel = new javax.swing.JLabel(); solstudioPathTextField = new javax.swing.JTextField(); userNameLabel = new javax.swing.JLabel(); userNameTextField = new javax.swing.JTextField(); connectCommandLabel = new javax.swing.JLabel(); connectCommandTextField = new javax.swing.JTextField(); connectionStatusLabel = new javax.swing.JLabel(); connectionStatusValueLabel = new javax.swing.JLabel(); messageTextScrollPane = new javax.swing.JScrollPane(); messageTextArea = new javax.swing.JTextArea(); connectionProgressBar = new javax.swing.JProgressBar(); setLayout(new java.awt.GridBagLayout()); hostNameLabel.setText("Host name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(hostNameLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0); add(hostNameComboBox, gridBagConstraints); solstudioPathLabel.setText("Remote SolStudio Path:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(solstudioPathLabel, gridBagConstraints); solstudioPathTextField.setColumns(40); solstudioPathTextField.setMinimumSize(new java.awt.Dimension(64, 26)); solstudioPathTextField.setPreferredSize(new java.awt.Dimension(64, 26)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0); add(solstudioPathTextField, gridBagConstraints); userNameLabel.setText("User name:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(userNameLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0); add(userNameTextField, gridBagConstraints); connectCommandLabel.setText("Connect Cmd:"); connectCommandLabel.setMaximumSize(new java.awt.Dimension(152, 20)); connectCommandLabel.setMinimumSize(new java.awt.Dimension(152, 20)); connectCommandLabel.setPreferredSize(new java.awt.Dimension(152, 20)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(connectCommandLabel, gridBagConstraints); connectCommandLabel.getAccessibleContext().setAccessibleDescription(""); connectCommandTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { connectCommandTextFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(8, 4, 0, 0); add(connectCommandTextField, gridBagConstraints); connectionStatusLabel.setText("Connection Status:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); add(connectionStatusLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(8, 8, 0, 0); add(connectionStatusValueLabel, gridBagConstraints); messageTextArea.setEditable(false); messageTextArea.setLineWrap(true); messageTextArea.setRows(6); messageTextArea.setWrapStyleWord(true); messageTextScrollPane.setViewportView(messageTextArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(messageTextScrollPane, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_END; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(connectionProgressBar, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents private void connectCommandTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectCommandTextFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_connectCommandTextFieldActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel connectCommandLabel; private javax.swing.JTextField connectCommandTextField; private javax.swing.JProgressBar connectionProgressBar; private javax.swing.JLabel connectionStatusLabel; private javax.swing.JLabel connectionStatusValueLabel; private javax.swing.JComboBox<String> hostNameComboBox; private javax.swing.JLabel hostNameLabel; private javax.swing.JTextArea messageTextArea; private javax.swing.JScrollPane messageTextScrollPane; private javax.swing.JLabel solstudioPathLabel; private javax.swing.JTextField solstudioPathTextField; private javax.swing.JLabel userNameLabel; private javax.swing.JTextField userNameTextField; // End of variables declaration//GEN-END:variables } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/AuthenticationPanel.form������������������������������������0000644�0001750�0001750�00000017050�14744453367�022072� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,4,120,0,0,2,78"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JTextArea" name="infoTextArea"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="lineWrap" type="boolean" value="true"/> <Property name="wrapStyleWord" type="boolean" value="true"/> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="19" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="prefAutenticationsLabel"> <Properties> <Property name="text" type="java.lang.String" value="Preferred Authentications:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="10" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="authenticationsPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> <Container class="javax.swing.JPanel" name="buttonPanel"> <Properties> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="19" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JButton" name="upButton"> <Properties> <Property name="text" type="java.lang.String" value="Up"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="upButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="downButton"> <Properties> <Property name="text" type="java.lang.String" value="Down"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Component class="javax.swing.JLabel" name="errorLabel"> <Properties> <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Color blue="0" green="0" red="ff" type="rgb"/> </Property> <Property name="text" type="java.lang.String" value="Error dsadsa dsadsaldsa dsadsa "/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="25" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/AuthenticationPanel.java������������������������������������0000644�0001750�0001750�00000025647�14744453367�022063� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnDialog2; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; import javax.swing.JCheckBox; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class AuthenticationPanel extends javax.swing.JPanel { private AnDialog2 dialog; private List<Authentication> data; private CheckBoxList checkBoxList; public AuthenticationPanel(AnDialog2 dialog, List<Authentication> authentications) { this.dialog = dialog; this.data = authentications; initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); infoTextArea.setText( AnLocale.getString( "Select the preferred authentication methods and their order. At least one method must" + " be selected.")); AnUtility.setAccessibleContext(infoTextArea.getAccessibleContext(), AnLocale.getString("Info")); AnUtility.setTextAndAccessibleContext(upButton, AnLocale.getString("Up")); upButton.setMnemonic(AnLocale.getString('U', "AuthenticationPanel.UpButton")); AnUtility.setTextAndAccessibleContext(downButton, AnLocale.getString("Down")); downButton.setMnemonic(AnLocale.getString('D', "AuthenticationPanel.DownButton")); AnUtility.setTextAndAccessibleContext( prefAutenticationsLabel, AnLocale.getString("Preferred Authentication Methods:")); prefAutenticationsLabel.setDisplayedMnemonic( AnLocale.getString('P', "AuthenticationPanel.AutenticationsLabel")); checkBoxList = new CheckBoxList(); for (Authentication auth : authentications) { final Authentication authentication = auth; final JCheckBox checkBox = new JCheckBox(auth.getType().getName()); checkBox.setSelected(auth.isOn()); checkBoxList.addElement(checkBox); checkBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { authentication.setOn(checkBox.isSelected()); updateStates(); } }); } prefAutenticationsLabel.setLabelFor(checkBoxList); checkBoxList.setSelectedIndex(0); updateStates(); authenticationsPanel.add(checkBoxList); authenticationsPanel.setBorder( BorderFactory.createLineBorder(AnEnvironment.STATUS_PANEL_BORDER_COLOR)); setPreferredSize(new Dimension(400, 200)); checkBoxList .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateStates(); } }); } private void setErrorText(String text) { errorLabel.setText(text); } private void updateStates() { upButton.setEnabled(false); downButton.setEnabled(false); setErrorText(""); dialog.getOKButton().setEnabled(true); if (data != null && data.size() > 0) { if (checkBoxList.getSelectedIndex() > 0) { upButton.setEnabled(true); } if (checkBoxList.getSelectedIndex() < data.size() - 1) { downButton.setEnabled(true); } } boolean atLeastOneSelected = false; for (Authentication auth : data) { if (auth.isOn()) { atLeastOneSelected = true; break; } } if (!atLeastOneSelected) { setErrorText(AnLocale.getString("At least one authentication method needs to be selected.")); dialog.getOKButton().setEnabled(false); } } private void updateSelection(int selectedIndex) { if (selectedIndex >= 0 && selectedIndex <= data.size()) { checkBoxList.setSelectedIndex(selectedIndex); checkBoxList.ensureIndexIsVisible(selectedIndex); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoTextArea = new javax.swing.JTextArea(); prefAutenticationsLabel = new javax.swing.JLabel(); authenticationsPanel = new javax.swing.JPanel(); buttonPanel = new javax.swing.JPanel(); upButton = new javax.swing.JButton(); downButton = new javax.swing.JButton(); errorLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); infoTextArea.setEditable(false); infoTextArea.setLineWrap(true); infoTextArea.setWrapStyleWord(true); infoTextArea.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START; gridBagConstraints.weightx = 1.0; add(infoTextArea, gridBagConstraints); prefAutenticationsLabel.setText("Preferred Authentications:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0); add(prefAutenticationsLabel, gridBagConstraints); authenticationsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); add(authenticationsPanel, gridBagConstraints); buttonPanel.setOpaque(false); buttonPanel.setLayout(new java.awt.GridBagLayout()); upButton.setText("Up"); upButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; buttonPanel.add(upButton, gridBagConstraints); downButton.setText("Down"); downButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); buttonPanel.add(downButton, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(2, 6, 0, 0); add(buttonPanel, gridBagConstraints); errorLabel.setForeground(new java.awt.Color(255, 0, 0)); errorLabel.setText("Error dsadsa dsadsaldsa dsadsa "); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_START; add(errorLabel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void upButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_upButtonActionPerformed int selectedIndex = checkBoxList.getSelectedIndex(); if (selectedIndex > 0) { // Update data Authentication auth = data.get(selectedIndex); data.remove(selectedIndex); data.add(selectedIndex - 1, auth); // Update GUI JCheckBox checkBox = checkBoxList.getModel().getElementAt(selectedIndex); ((DefaultListModel) checkBoxList.getModel()).remove(selectedIndex); ((DefaultListModel) checkBoxList.getModel()).add(selectedIndex - 1, checkBox); updateSelection(selectedIndex - 1); } } // GEN-LAST:event_upButtonActionPerformed private void downButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_downButtonActionPerformed int selectedIndex = checkBoxList.getSelectedIndex(); if (selectedIndex < data.size()) { // Update data Authentication auth = data.get(selectedIndex); data.remove(selectedIndex); data.add(selectedIndex + 1, auth); // Update GUI JCheckBox checkBox = checkBoxList.getModel().getElementAt(selectedIndex); ((DefaultListModel) checkBoxList.getModel()).remove(selectedIndex); ((DefaultListModel) checkBoxList.getModel()).add(selectedIndex + 1, checkBox); updateSelection(selectedIndex + 1); } } // GEN-LAST:event_downButtonActionPerformed protected List<Authentication> getAuthentications() { return data; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel authenticationsPanel; private javax.swing.JPanel buttonPanel; private javax.swing.JButton downButton; private javax.swing.JLabel errorLabel; private javax.swing.JTextArea infoTextArea; private javax.swing.JLabel prefAutenticationsLabel; private javax.swing.JButton upButton; // End of variables declaration//GEN-END:variables } �����������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/CloseExperimentPanel.java�����������������������������������0000644�0001750�0001750�00000006143�14744453367�022200� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import javax.swing.JPanel; import javax.swing.border.MatteBorder; public class CloseExperimentPanel extends JPanel { public CloseExperimentPanel() { initComponents(); // setOpaque(false); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); setBorder(new MatteBorder(12, 12, 12, 12, (Color) null)); AnUtility.setTextAndAccessibleContext( label1, AnLocale.getString( "gprofng GUI cannot connect to a remote host when there are open" + " experiments.")); AnUtility.setTextAndAccessibleContext( label2, AnLocale.getString("Close the experiment(s) before continuing?")); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label1 = new javax.swing.JLabel(); label2 = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); label1.setText("jLabel1"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; add(label1, gridBagConstraints); label2.setText("jLabel2"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); add(label2, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel label1; private javax.swing.JLabel label2; // End of variables declaration//GEN-END:variables } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/Authentication.java�����������������������������������������0000644�0001750�0001750�00000011454�15044710303�021046� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.mpmt.persistence.UserPref; import java.util.ArrayList; import java.util.List; public class Authentication { public enum Type { PASSWORD("Password", "password"), PUBLIC_KEY("Public key", "publickey"), KEYBOARD_INTERACTIVE("Keyboard-interactive", "keyboard-interactive"); private String name; private String keyName; private Type(String name, String keyName) { this.name = name; this.keyName = keyName; } public String getName() { return name; } public String getKeyName() { return keyName; } protected static Type fromString(String s) { for (Type type : Type.values()) { if (type.toString().equals(s)) { return type; } } return null; } }; private Type type; private boolean on; public Authentication(Type type, boolean on) { this.on = on; this.type = type; } public Authentication copy() { return new Authentication(type, on); } public Type getType() { return type; } public boolean isOn() { return on; } public void setOn(boolean on) { this.on = on; } /** * @return the default set of authentication methods */ public static List<Authentication> getDefaultAuthentications() { List<Authentication> def = new ArrayList<>(); def.add(new Authentication(Authentication.Type.PUBLIC_KEY, true)); def.add(new Authentication(Authentication.Type.PASSWORD, true)); // def.add(new Authentication(Authentication.Type.KEYBOARD_INTERACTIVE, false)); // Don't // offer KEYBOARD_INTERACTIVE for now.... return def; } /* * @return "Public key, Password" * Used in dialog. Uses 'user names' and shows only those that are on */ public static String toString(List<Authentication> authentications) { StringBuilder buf = new StringBuilder(); boolean first = true; for (Authentication auth : authentications) { if (auth.isOn()) { if (first) { first = false; } else { buf.append(", "); } buf.append(auth.getType().getName()); } } return buf.toString(); } /** * @param authentications * @return "PUBLIC_KEY=true,PASSWORD=true,KEYBOARD_INTERACTIVE=false" Used in persistence */ public static String toXMLString(List<Authentication> authentications) { StringBuilder buf = new StringBuilder(); boolean first = true; for (Authentication auth : authentications) { if (first) { first = false; } else { buf.append(","); } buf.append(auth.getType() + "=" + auth.isOn()); } return buf.toString(); } /** * @param xmlString * @return Parses output from toXMLString(): * "PUBLIC_KEY=true,PASSWORD=true,KEYBOARD_INTERACTIVE=false" Used in persistence. */ public static List<Authentication> fromXMLString(String xmlString) { String[] auths = xmlString.split(","); List<Authentication> list = new ArrayList<>(); for (String auth : auths) { String[] s = auth.split("="); Authentication.Type type = Type.fromString(s[0]); if (type == Authentication.Type .KEYBOARD_INTERACTIVE) { // Don't offer KEYBOARD_INTERACTIVE for now.... continue; } if (s.length != 2) { // Abort return null; } boolean on = s[1].equals("true"); if (type != null) { list.add(new Authentication(type, on)); } else { // Abort, just return the default list... list = UserPref.getDefaultAuthentications(); } } return list; } /** * @param authentications * @return "publickey,password", only the keys for methods selected. Used when connecting. */ public static String toKeyString(List<Authentication> authentications) { StringBuilder buf = new StringBuilder(); boolean first = true; for (Authentication auth : authentications) { if (!auth.isOn()) { continue; } if (first) { first = false; } else { buf.append(","); } buf.append(auth.getType().getKeyName()); } return buf.toString(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/CloseExperimentPanel.form�����������������������������������0000644�0001750�0001750�00000006455�14744453367�022230� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-71"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="label1"> <Properties> <Property name="text" type="java.lang.String" value="jLabel1"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="label2"> <Properties> <Property name="text" type="java.lang.String" value="jLabel2"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/ConnectionManager.java��������������������������������������0000644�0001750�0001750�00000034236�15044710303�021464� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCLogger; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JDialog; import javax.swing.JOptionPane; /** * ConnectionManager thread creates and manages ConnectionChecker thread, which sends * "checkConnection" IPC calls. * * <p>Sets interface variables doCheck and defaultTimeOut. * * <p>Uses interface variables connectionStatus and connectionCheckerState. */ public class ConnectionManager extends Thread { int CC_defaultTimeOut = 2000; // 2 seconds int CM_defaultTimeOut = 10000; // 10 seconds int CONNECTION_UNKNOWN = 0; int CONNECTION_OK = 1; int CONNECTION_LOST = 2; int CONNECTION_CHECK = 3; volatile int connectionStatus = CONNECTION_UNKNOWN; int CM_NO_CHECK = 0; int CM_CHECK = 1; volatile int connectionManagerStatus = CM_CHECK; ConnectionChecker cc = null; Boolean doCheck = false; String threadName = "Connection Manager"; JDialog CM_warn_dialog = null; /** Default ConnectionManager constructor. */ public ConnectionManager() { this.setName(threadName); } /** Main method. */ public void run() { AnWindow anWindow = AnWindow.getInstance(); String err_cc_msg = "ERROR: Cannot create ConnectionChecker"; String warn_msg = AnLocale.getString("Lost connection to remote host "); String warn_title = AnLocale.getString("Warning: Connection is lost"); String conf_msg = AnLocale.getString("Are you sure you want to exit gprofng GUI"); String conf_title = AnLocale.getString("Exit gprofng GUI?"); // System.err.println("ConnectionManager started"); // DEBUG try { String str = AnUtility.getenv("SP_ANALYZER_HEARTBEAT_DISABLE"); if (str != null) { IPCLogger.logTrace("\n" + "analyzer: SP_ANALYZER_HEARTBEAT_DISABLE is set"); connectionManagerStatus = CM_NO_CHECK; } str = AnUtility.getenv("SP_ANALYZER_HEARTBEAT_MSEC"); if (str != null) { // set timeout value IPCLogger.logTrace("\n" + "analyzer: SP_ANALYZER_HEARTBEAT_MSEC=" + str); setTimeOut(Integer.valueOf(str)); } long ts_start_checking = 0; while (CC_defaultTimeOut > 0) { if ((connectionManagerStatus != CM_NO_CHECK) && (Analyzer.getInstance().isRemote())) { if (null != cc) { if (cc.connectionCheckerState == cc.CHECKER_FINISHED) { cc.join(); cc = new ConnectionChecker(); if (null == cc) { Logger.getLogger(ConnectionManager.class.getName()) .log(Level.SEVERE, null, err_cc_msg); return; } cc.start(); } } else { cc = new ConnectionChecker(); if (null == cc) { Logger.getLogger(ConnectionManager.class.getName()) .log(Level.SEVERE, null, err_cc_msg); // System.err.println(err_cc_msg); // DEBUG return; } cc.start(); // System.err.println("ConnectionChecker started"); // DEBUG } if (connectionStatus == CONNECTION_LOST) { if (cc.connectionCheckerState == cc.CHECKER_FINISHED) { // System.err.println("ConnectionChecker finished"); // DEBUG cc.join(); // System.err.println("ConnectionChecker joined"); // DEBUG cc = null; } // Show error dialog String sWait = AnLocale.getString("Wait"); String sExit = AnLocale.getString("Exit"); String host = Analyzer.getInstance().getRemoteHost(); int at = host.indexOf("@"); if (at >= 0) { host = host.substring(at + 1); } Object[] options = {sWait, sExit}; JOptionPane pane = new JOptionPane( warn_msg + host, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[0]); // Use CM_warn_dialog to allow ConnectionChecker thread to close it CM_warn_dialog = pane.createDialog(anWindow.getFrame(), warn_title); CM_warn_dialog.setVisible(true); Object selectedValue = pane.getValue(); CM_warn_dialog = null; // Sync with ConnectionChecker // There are 2 choices: "Wait" and "Exit" // System.err.println("selectedValue:" + selectedValue); // DEBUG int choice = 0; // Cancel means Wait if (selectedValue instanceof Integer) { choice = ((Integer) selectedValue).intValue(); if (choice != 1) choice = 0; // Wait } if (selectedValue instanceof String) { if (sExit.equals(selectedValue)) choice = 1; // Exit } // Exit - stop ConnectionChecker and exit if (sExit.equals(options[choice])) { // Show confirmation dialog selectedValue = JOptionPane.showConfirmDialog( anWindow.getFrame(), conf_msg, conf_title, JOptionPane.YES_NO_OPTION); // System.err.println("selectedValue:" + selectedValue); // DEBUG if (selectedValue instanceof Integer) { choice = ((Integer) selectedValue).intValue(); } if (choice == 0) { // YES stopChecking(); if (null != cc) { cc.interrupt(); cc.join(CC_defaultTimeOut * 2); // System.err.println("ConnectionChecker joined."); // DEBUG cc = null; } // System.err.println("Exiting..."); // DEBUG AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { AnWindow.getInstance().exitAction(); } }); return; } } // Restore connectionStatus to CONNECTION_CHECK connectionStatus = CONNECTION_CHECK; // Wait if (null == cc) { cc = new ConnectionChecker(); if (null == cc) { Logger.getLogger(ConnectionManager.class.getName()) .log(Level.SEVERE, null, err_cc_msg); // System.err.println(err_cc_msg); // DEBUG return; } cc.start(); } // Wait for next timeout ts_start_checking = System.currentTimeMillis(); // System.err.println("Waiting..."); // DEBUG startChecking(); } if (connectionStatus == CONNECTION_CHECK) { if (ts_start_checking != 0) { long ts = System.currentTimeMillis(); long dts = ts - ts_start_checking; if (dts > CM_defaultTimeOut) { connectionStatus = CONNECTION_LOST; continue; } } else { ts_start_checking = System.currentTimeMillis(); } } if (connectionStatus == CONNECTION_OK) { ts_start_checking = 0; } } try { sleep(CC_defaultTimeOut / 4); // Check more often } catch (InterruptedException ex) { // Logger.getLogger(ConnectionManager.class.getName()).log(Level.SEVERE, null, ex); } } if (null != cc) { // System.err.println("ConnectionChecker interrupted"); // DEBUG cc.interrupt(); cc.join(CC_defaultTimeOut * 2); cc = null; // System.err.println("ConnectionChecker joined"); // DEBUG } } catch (InterruptedException ex) { Logger.getLogger(ConnectionManager.class.getName()).log(Level.SEVERE, null, ex); } // System.err.println("ConnectionManager finished"); // DEBUG } /** * Sets default timeout value. Minimum: 100 milliseconds * * @param timeout * @return defaultTimeOut */ public int setTimeOut(int timeout) { if (timeout < 100) { timeout = 100; // not less than 100 milliseconds } CC_defaultTimeOut = timeout; return CC_defaultTimeOut; } /** * Gets default timeout value * * @return defaultTimeOut */ public int getTimeOut() { return CC_defaultTimeOut; } /** Sets "Start Checking" flag. */ public void startChecking() { // System.err.println("startChecking"); // DEBUG doCheck = true; } /** Sets "Stop Checking" flag. */ public void stopChecking() { // System.err.println("stopChecking"); // DEBUG doCheck = false; } /** * Thread ConnectionChecker sends "checkConnection" IPC calls. Uses interface variables doCheck * and defaultTimeOut. Sets interface variables connectionStatus and connectionCheckerState. */ private class ConnectionChecker extends Thread { int CHECKER_NOT_IN_IPC = 0; // Not in IPC call int CHECKER_IN_IPC = 1; // In IPC call int CHECKER_FINISHED = 2; volatile int connectionCheckerState = CHECKER_NOT_IN_IPC; String threadName = "Connection Checker"; /** Default ConnectionChecker constructor. */ public ConnectionChecker() { this.setName(threadName); } /** * Check Connection * * @return res */ private int checkConnection() { int res = 0; long ts0, ts1; long n = 1; AnWindow anWindow = AnWindow.getInstance(); while (CC_defaultTimeOut > 0) { ts0 = System.currentTimeMillis(); ts1 = ts0 + CC_defaultTimeOut; try { sleep(CC_defaultTimeOut); } catch (InterruptedException ex) { // Logger.getLogger(ConnectionManager.class.getName()).log(Level.SEVERE, null, ex); } if (doCheck != true) { continue; // Do not check connection } // Ping remote host - this thread can hang here String s = "Check:" + n; // System.err.println("ConnectionChecker sent ping: " + s + " ts=" + ts1); // DEBUG connectionStatus = CONNECTION_CHECK; connectionCheckerState = CHECKER_IN_IPC; String r = null; int ver = 2; if (1 == ver) { // use Sync IPC r = anWindow.checkConnection(s); // Sync IPC call } else { // use Async IPC // IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.NON_DBE); // ipcHandle.append("checkConnection"); // ipcHandle.append(s); // ipcHandle.append(0); // IPCResult ipcResult = ipcHandle.sendRequest(); // r = ipcResult.getString(); // blocking // Temporary use Handshake request - it is really async r = s; // fake reply IPCHandle ipcHandle = IPCHandle.newHandshakeIPCHandle(); IPCResult ipcResult = ipcHandle.sendRequest(); // no body IPCResult.CC cc = ipcResult.getCC(); // blocking } connectionCheckerState = CHECKER_NOT_IN_IPC; if (!s.equals(r)) { // System.err.println("ConnectionChecker got wrong reply: " + r + " instead of " + s); // // DEBUG res = 1; break; } n++; // Debugging code to simulate lost connection // int debug = 1; // if (debug > 0) { // File f = new File("/tmp/nm_remote_analyzer_check_100"); // DEBUG // if (f.exists()) { // f.delete(); // setTimeOut(100); // } // f = new File("/tmp/nm_remote_analyzer_check_2000"); // DEBUG // if (f.exists()) { // f.delete(); // setTimeOut(2000); // } // f = new File("/tmp/nm_remote_analyzer_stop_checking"); // DEBUG // if (f.exists()) { // f.delete(); // res = 2; // break; // } // f = new File("/tmp/nm_remote_analyzer_hang_checking"); // DEBUG // if (f.exists()) { // //f.delete(); // connectionStatus = CONNECTION_CHECK; // continue; // } // } connectionStatus = CONNECTION_OK; // Close warning dialog if necessary - HACK and NO SYNC final JDialog d = CM_warn_dialog; if (d != null) { // System.err.println("Closing dialog..."); // DEBUG AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { d.dispose(); } }); } } return res; } /** Main method Calls checkConnection() */ public void run() { int res = checkConnection(); if (res != 0) { connectionStatus = CONNECTION_LOST; } connectionCheckerState = CHECKER_FINISHED; // finished } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/CloseExperimentDialog.java����������������������������������0000644�0001750�0001750�00000002306�14744453367�022335� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnDialog2; import java.awt.Frame; public class CloseExperimentDialog extends AnDialog2 { public CloseExperimentDialog(Frame owner) { super(owner, owner, AnLocale.getString("Connect to Remote Host")); CloseExperimentPanel panel = new CloseExperimentPanel(); setCustomPanel(panel); getOKButton().setText(AnLocale.getString("Close")); getOKButton().setToolTipText(AnLocale.getString("Close experiment(s) before continuing")); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/ConnectionPanel.form����������������������������������������0000644�0001750�0001750�00000026504�15044710303�021172� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-31,0,0,2,103"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="hostNameLabel"> <Properties> <Property name="text" type="java.lang.String" value="Host name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="hostNameComboBox"> <AuxValues> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="solstudioPathLabel"> <Properties> <Property name="text" type="java.lang.String" value="Remote SolStudio Path:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="solstudioPathTextField"> <Properties> <Property name="columns" type="int" value="40"/> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[64, 26]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[64, 26]"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="userNameLabel"> <Properties> <Property name="text" type="java.lang.String" value="User name:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="userNameTextField"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="connectCommandLabel"> <Properties> <Property name="text" type="java.lang.String" value="Connect Cmd:"/> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[152, 20]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[152, 20]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[152, 20]"/> </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/> </AccessibilityProperties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JTextField" name="connectCommandTextField"> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="connectCommandTextFieldActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="connectionStatusLabel"> <Properties> <Property name="text" type="java.lang.String" value="Connection Status:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="connectionStatusValueLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="8" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="messageTextScrollPane"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="0" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Component class="javax.swing.JTextArea" name="messageTextArea"> <Properties> <Property name="editable" type="boolean" value="false"/> <Property name="lineWrap" type="boolean" value="true"/> <Property name="rows" type="int" value="6"/> <Property name="wrapStyleWord" type="boolean" value="true"/> </Properties> </Component> </SubComponents> </Container> <Component class="javax.swing.JProgressBar" name="connectionProgressBar"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="20" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/remote/ConnectionDialog.java���������������������������������������0000644�0001750�0001750�00000043375�15044710303�021315� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.remote; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDialog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.persistence.UserPref.ConnectionProperties; import org.gprofng.mpmt.picklist.StringPickListElement; import org.gprofng.mpmt.statuspanel.StatusLabelValueHandle; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JProgressBar; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; public final class ConnectionDialog extends AnDialog implements ItemListener { public static final String help_id = AnVariable.HELP_ConnectRemoteHost; private static String startDir = null; private JComboBox<String> hostNameComboBox; private JTextField file; private JTextField usernameTextField; private JTextField solstudioPathTextField; private JTextField connectCommandTextField; private JLabel statusValueLabel; private JTextArea messageTextArea; private AnWindow m_window; private JProgressBar progressBar = null; public boolean cancelRequest = false; private final StatusLabelValueHandle connectedStatusHandle; private Thread threadConnector = null; private JButton was_ok, was_apply, was_close; private static final String connecting = AnLocale.getString("connecting..."); private static final String connected = AnLocale.getString("connected"); protected static final String notConnected = AnLocale.getString("not connected"); private static final String disconnected = AnLocale.getString("connection failed"); private static final String local_host = "localhost"; private ConnectionPanel connectionPanel; private String defaultSolstudioPath = null; private DocumentListener comboboxDocumentListener = null; private List<Authentication> authentications = null; // Constructor public ConnectionDialog(final AnWindow window, final Frame frame, StatusLabelValueHandle connectedStatusHandle) { super(window, frame, AnLocale.getString("Connect to Remote Host"), false, null, null, help_id, false); this.connectedStatusHandle = connectedStatusHandle; m_window = window; initComponents(); updateStatus(); } // Initialize GUI components private void initComponents() { getContentPane().setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); connectionPanel = new ConnectionPanel(this); hostNameComboBox = connectionPanel.getHostNameComboBox(); String os_name = Analyzer.getInstance().os_name; String lh = local_host; if (null != os_name) { if ((!os_name.equals("SunOS")) && (!os_name.equals("Linux"))) { lh = ""; } } hostNameComboBox.addItem(lh); int count = 0; for (StringPickListElement hostElement : UserPref.getInstance().getHostNamePicklist().getStringElements()) { hostNameComboBox.addItem(hostElement.getString()); count = count + 1; } if (count > 0) { hostNameComboBox.setSelectedIndex(1); } else { hostNameComboBox.setSelectedIndex(0); } hostNameComboBox.setEditable(true); ((JTextField) hostNameComboBox.getEditor().getEditorComponent()) .getDocument() .addDocumentListener(comboboxDocumentListener = new ComboBoxDocumentListener()); usernameTextField = connectionPanel.getUserNameTextField(); solstudioPathTextField = connectionPanel.getSolstudioPathTextField(); connectCommandTextField = connectionPanel.getConnectCommandTextField(); statusValueLabel = connectionPanel.getConnectionStatusValueLabel(); statusValueLabel.setForeground(Color.BLACK); messageTextArea = connectionPanel.getMessageTextArea(); String status = notConnected; Analyzer an = Analyzer.getInstance(); if (an.IPC_started) { if (an.remoteConnection == null) { status = an.localHost; } else { status = an.remoteHost; } } statusValueLabel.setText(status); progressBar = connectionPanel.getConnectionProgressBar(); connectCommandTextField.setText(an.remoteShell); // Change buttons JButton[] buttons = getDefaultButtons(); if (buttons.length > 2) { was_ok = buttons[0]; was_ok.setText(AnLocale.getString("Connect")); was_ok.setEnabled(true); close_on_enter = false; was_apply = buttons[1]; was_apply.setText(AnLocale.getString("Cancel")); was_apply.setEnabled(false); was_close = buttons[2]; was_close.setEnabled(true); was_close.setMnemonic(AnLocale.getString('l', "RemoteConnectDialogCloseButtonMN")); } setAccessory(connectionPanel); } protected List<Authentication> getAuthenticationsCopy() { List<Authentication> copy = new ArrayList<>(); for (Authentication auth : authentications) { Authentication authCopy = auth.copy(); copy.add(authCopy); } return copy; } protected void setAuthentications(List<Authentication> authentications) { this.authentications = authentications; } class ComboBoxDocumentListener implements DocumentListener { @Override public void changedUpdate(DocumentEvent e) { updateStatus(); } @Override public void insertUpdate(DocumentEvent e) { updateStatus(); } @Override public void removeUpdate(DocumentEvent e) { updateStatus(); } } private void updateStatus() { AnUtility.checkIfOnAWTThread(true); String hostName = ((JTextField) hostNameComboBox.getEditor().getEditorComponent()).getText(); String ssh_cmd = window.getAnalyzer().remoteShell; String install_dir = "/usr/bin"; String user_name = AnUtility.getenv("USER"); if (user_name == null) { user_name = ""; } ConnectionProperties connectionProperties = UserPref.getInstance().getConnectionPropertiesMap().get(hostName); if (connectionProperties != null) { String s = connectionProperties.getConnectCommand(); if (s != null && s.length() > 0) { ssh_cmd = s; } s = connectionProperties.getPath(); if (s != null && s.length() > 0) { install_dir = s; } s = connectionProperties.getUserName(); if (s != null && s.length() > 0) { user_name = s; } } connectionPanel.setLoginFieldsEnabled(!hostName.equals(local_host)); connectCommandTextField.setText(ssh_cmd); solstudioPathTextField.setText(install_dir); } // Set visible public void setVisible(final boolean set, final int active_id) { super.setVisible(set); } /* * Listener to switch between file/printer */ @Override public void itemStateChanged(final ItemEvent event) { // final Object source = event.getItemSelectable(); } /* * Connect to remote host */ public String connectToRemoteHost(int timeout) { try { if (!isVisible()) { setVisible(true); // progressBar.setIndeterminate(true); } String host = hostNameComboBox.getSelectedItem().toString(); if (host != null) { host = host.trim(); } if ((host == null) || (host.length() < 1)) { return (AnLocale.getString("Error: Remote Host Name is not specified.")); } String un = usernameTextField.getText(); if (un != null) { un = un.trim(); } char[] p = null; /* char[] p = passwordField.getPassword(); if (p.length <= 0) { p = null; } */ String connectCommand = connectCommandTextField.getText().trim(); if (connectCommand.length() < 1) { return (AnLocale.getString("Error: connection command is not specified.")); } connectCommand += " -o PasswordAuthentication=no " + "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"; String path = solstudioPathTextField.getText().trim(); if (path.length() < 1) { return (AnLocale.getString("Error: remote gprofng path is not specified.")); } String appName = Analyzer.DisplayAppName; if (!path.endsWith("/" + appName)) { if (path.endsWith("/bin")) { path = path + "/" + appName; } else if (path.endsWith("/bin/")) { path = path + appName; } else if (path.endsWith("/")) { path = path + "bin/" + appName; } else { path = path + "/bin/" + appName; } } window.getAnalyzer().remoteGprofngPath = path.substring(0, path.length() - 16); String s = m_window.getAnalyzer().createNewIPC(this, host, un, p, connectCommand, path); if (s != null) { return (s); } } catch (Exception e) { return ("Exception during connecting."); // Cancel } return null; // Successfully connected } /** * Action performed * * @param event */ @Override public void actionPerformed(final ActionEvent event) { final String str_file; String cmd = event.getActionCommand(); if (cmd.equals(AnLocale.getString("Browse..."))) { if ((str_file = getFile()) != null) { file.setText(str_file); } return; } if (cmd.equals(AnLocale.getString("OK")) || cmd.equals(AnLocale.getString("Connect"))) { String hostName = hostNameComboBox.getSelectedItem().toString(); hostName = hostName.trim().toLowerCase(); final ConnectionProperties connectionProperties; // if (hostName.equals(local_host)) { Map<String, ConnectionProperties> map = UserPref.getInstance().getConnectionPropertiesMap(); connectionProperties = new ConnectionProperties( solstudioPathTextField.getText(), connectCommandTextField.getText(), usernameTextField.getText(), authentications); map.put(hostName, connectionProperties); if (!(hostName.equals(local_host))) { UserPref.getInstance().getHostNamePicklist().addElement(hostName); } // System.out.println("Connect to host: " + hostName); if (comboboxDocumentListener != null) { ((JTextField) hostNameComboBox.getEditor().getEditorComponent()) .getDocument() .removeDocumentListener(comboboxDocumentListener); } hostNameComboBox.removeAllItems(); if (Analyzer.getInstance().os_name.contains("Linux")) { hostNameComboBox.addItem(local_host); } for (StringPickListElement hostElement : UserPref.getInstance().getHostNamePicklist().getStringElements()) { hostNameComboBox.addItem(hostElement.getString()); } hostNameComboBox.setSelectedItem(hostName); if (comboboxDocumentListener != null) { ((JTextField) hostNameComboBox.getEditor().getEditorComponent()) .getDocument() .addDocumentListener(comboboxDocumentListener); } connectionStarted(); // Connect to remote host Thread worker = new Thread("Connection_thread") { final int timeout = 3; @Override public void run() { /* synchronized (AnVariable.worker_lock) */ { threadConnector = this; cancelRequest = false; String res = connectToRemoteHost(timeout); if (cancelRequest) { cancelRequest = false; res += ". Connection canceled"; } connectionFinished(res); } } }; worker.start(); } else if (cmd.equals(AnLocale.getString("Apply")) || cmd.equals(AnLocale.getString("Cancel"))) { if (connectedStatusHandle.get().equals(connecting)) { cancelRequest = true; if (threadConnector != null) { try { threadConnector.interrupt(); connectionFinished("Connection canceled"); } catch (Exception e) { // thread may already had gone } threadConnector = null; } } else { setVisible(false); } } } /** Sets buttons and fields states as they should be during connecting */ private void connectionStarted() { Analyzer.getInstance().connectingToRemoteHost = true; // progressBar.setVisible(true); connectedStatusHandle.update(connecting); progressBar.setIndeterminate(true); was_ok.setEnabled(false); was_apply.setEnabled(true); hostNameComboBox.setEditable(false); // passwordField.setEditable(false); usernameTextField.setEditable(false); solstudioPathTextField.setEditable(false); connectCommandTextField.setEditable(false); // fld_status.setFont() // bold statusValueLabel.setForeground(Color.black); statusValueLabel.setText(connecting); messageTextArea.setText(AnLocale.getString("Connecting...")); // pack(); } /** Sets buttons and fields states as they should be after connecting */ private void connectionFinished(String result) { // progressBar.setMaximum(10); progressBar.setValue(0); progressBar.setIndeterminate(false); // progressBar.setVisible(false); was_ok.setEnabled(true); was_apply.setEnabled(false); hostNameComboBox.setEditable(true); // passwordField.setEditable(true); usernameTextField.setEditable(true); solstudioPathTextField.setEditable(true); connectCommandTextField.setEditable(true); if (result == null) { String hostName = hostNameComboBox.getSelectedItem().toString(); // if (hostName.equals(local_host)) { // connectedStatusHandle.update(hostName, StatusLabelValueHandle.Mode.DEFAULT); // statusValueLabel.setForeground(Color.BLACK); // statusValueLabel.setText(local_host); // statusValueLabel.setToolTipText(local_host); // } else { connectedStatusHandle.update( AnUtility.getShortString(hostName, 30), StatusLabelValueHandle.Mode.SET); statusValueLabel.setForeground(new Color(44, 121, 6)); result = connected + " to " + hostName; statusValueLabel.setText(result); statusValueLabel.setToolTipText(result); // } setVisible(false); messageTextArea.setText(""); } else { connectedStatusHandle.update( AnLocale.getString("connection failed"), StatusLabelValueHandle.Mode.ERROR); statusValueLabel.setForeground(Color.red); // statusValueLabel.setText(disconnected); statusValueLabel.setText(result); statusValueLabel.setToolTipText(result); // setVisible(true); // Show error messageTextArea.append("\n"); messageTextArea.append(AnLocale.getString("Connection failed: ")); String s = Analyzer.getInstance().explainConnectionProblem(result, usernameTextField.getText()); messageTextArea.append(AnLocale.getString(s)); // Check if this is CR 22373059: // Is it MacOS? // Do we use java 7? // If "yes" and "yes" show a message and restart remote analyzer client with another java } Analyzer.getInstance().connectingToRemoteHost = false; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { AnWindow.getInstance().enableSessionActions(false, false); } }); // pack(); } /** * Updates Connection Status * * @param status */ public void updateConnectionStatus(String status) { statusValueLabel.setForeground(Color.black); statusValueLabel.setText(status); messageTextArea.append("\n"); messageTextArea.append(AnLocale.getString(status)); } /** Set file name by interpreting ~ */ private static String getFullPath(final String fname) { String fullpath = null; if (fname != null) { if (fname.startsWith("~/")) { fullpath = fname.replaceFirst("~/", Analyzer.home_dir + "/"); } else if (fname.startsWith("~")) { fullpath = fname.replaceFirst("~", "/home/"); } else { fullpath = fname; } } return fullpath; } /** Get file name from the file chooser */ private String getFile() { final JFileChooser filechooser; final File prn_file; final String path; if (startDir == null) { startDir = Analyzer.getInstance().getWorkingDirectory(); } filechooser = new JFileChooser(startDir); filechooser.setFileHidingEnabled(false); filechooser.setDialogTitle(AnLocale.getString("SolStudio Location")); filechooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if ((filechooser.showDialog(dialog, AnLocale.getString("Set")) == JFileChooser.APPROVE_OPTION) && ((prn_file = filechooser.getSelectedFile()) != null)) { path = prn_file.getAbsolutePath(); } else { path = null; } startDir = filechooser.getCurrentDirectory().getAbsolutePath(); return path; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/IExtTreeModel.java�������������������������������������������������0000644�0001750�0001750�00000001673�14744453367�017274� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import javax.swing.tree.TreeModel; /** * @author nd159473 */ public interface IExtTreeModel extends TreeModel { public IExtTreeModel getTreeModel(IDispToModel disp); public void setRoot(Object root); public Object createNewRootFrom(Object from); } ���������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/DualSourceView.java������������������������������������������������0000644�0001750�0001750�00000023471�15044710303�017477� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import static org.gprofng.mpmt.event.AnChangeEvent.Type.SETTING_CHANGED; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnSplitPaneInternal; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.JSplitPane; public final class DualSourceView extends AnDisplay implements ExportSupport, AnChangeListener { private FuncListDisp upperSourcePanel; private FuncListDisp lowerSourcePanel; private JSplitPane splitPane; private int focusedPart; DualSourceView() { super(AnWindow.getInstance(), AnDisplay.DSP_DualSource, AnVariable.HELP_TabsRaceDualSrc); focusedPart = 0; setAccessibility(AnLocale.getString("Dual Sources")); AnEventManager.getInstance().addListener(this); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("DualSourceView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; clear(); clearHistory(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.FORMAT || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override protected boolean supportsFindText() { return true; } // Find @Override public int find(final String str, final boolean next, boolean caseSensitive) { int value = -1; if (focusedPart == 1) { value = upperSourcePanel.find(str, next, caseSensitive); } else if (focusedPart == 2) { value = lowerSourcePanel.find(str, next, caseSensitive); } return value; } public void focusInHalf(int ahalf) { focusedPart = ahalf; } protected void initComponents() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); upperSourcePanel = new SourceDisp( window, AnDisplay.DSP_Source, 1, null, AnDisplay.DSP_DualSource); // AnVariable.HELP_TabsSource); lowerSourcePanel = new SourceDisp( window, AnDisplay.DSP_Source, 2, null, AnDisplay.DSP_DualSource); // AnVariable.HELP_TabsSource); lowerSourcePanel.table.setWrapMetricNames(false); // make the both parts to be 0ed Dimension minDim = new Dimension(0, 0); upperSourcePanel.setMinimumSize(minDim); lowerSourcePanel.setMinimumSize(minDim); splitPane = new AnSplitPaneInternal(JSplitPane.VERTICAL_SPLIT, upperSourcePanel, lowerSourcePanel); // the both parts are equals splitPane.setResizeWeight(0.5); // put the split bar in the middle splitPane.setDividerLocation(0.5); add(splitPane); } @Override public void doCompute() { long sel_obj; final long sel_func = 0; AnUtility.checkIfOnAWTThread(false); // Not selected if (!selected) { return; } if (focusedPart == 0) { splitPane.setDividerLocation(0.5); focusedPart = 1; } boolean selObjWasChanged = false; boolean wasPreviousSel = window.getSelectedObject().wasASelDone(); int savedSelType = window.getSelectedObject().getSelType(); int savedSelSubType = window.getSelectedObject().getSelSubType(); long savedSelInd = window.getSelectedObject().getSelIndex(); if (wasRaceAccessUpdated(2)) { if ((getSelPC(2) != 0) && (sel_obj = window.getSelectedObject().getObject(getSelPC(2), sel_func)) != 0L) { lowerSourcePanel.setSelected(true); window.getSelectedObject().setSelObj(sel_obj, DSP_Races /*type*/, subtype); selObjWasChanged = true; lowerSourcePanel.doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } } if (wasRaceAccessUpdated(1)) { if ((getSelPC(1) != 0) && (sel_obj = window.getSelectedObject().getObject(getSelPC(1), sel_func)) != 0L) { upperSourcePanel.setSelected(true); window.getSelectedObject().setSelObj(sel_obj, DSP_Races /*type*/, subtype); selObjWasChanged = true; upperSourcePanel.doCompute(); // inside doCompute, on worker thread and synchronized // (AnVariable.mainFlowLock) } } if (wasPreviousSel && selObjWasChanged) { window.getSelectedObject().setSelObj(savedSelInd, savedSelType, savedSelSubType); } computed = true; } private boolean wasRaceAccessUpdated_1 = false; private boolean wasRaceAccessUpdated_2 = false; private long pc_1; private long pc_2; public boolean wasRaceAccessUpdated(int aHalf) { boolean retValue = false; if (aHalf == 1) { retValue = wasRaceAccessUpdated_1; wasRaceAccessUpdated_1 = false; } else if (aHalf == 2) { retValue = wasRaceAccessUpdated_2; wasRaceAccessUpdated_2 = false; } return retValue; } public void setWasRaceAccessUpdated(int id, boolean value) { if (id == 1) { wasRaceAccessUpdated_1 = value; } else { wasRaceAccessUpdated_2 = value; } } public void setSelPC(int id, long value) { if (id == 1) { pc_1 = value; } else { pc_2 = value; } } public long getSelPC(int id) { if (id == 1) { return pc_1; } else { return pc_2; } } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { String upperText = upperSourcePanel.exportAsText(limit, format, delimiter); String lowerText = lowerSourcePanel.exportAsText(limit, format, delimiter); return upperText + lowerText; } @Override public java.util.List<ExportFormat> getSupportedExportFormats() { java.util.List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.TEXT); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } private static JPanel toolbarPanel = null; // Fixup: pass it to SourceDisp instead of being static!!!! public static JPanel getToolbarPanelInternal() { if (toolbarPanel == null) { toolbarPanel = new JPanel(); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); toolbarPanel.setLayout(new BorderLayout()); } return toolbarPanel; } @Override public JPanel getToolbarPanel() { return getToolbarPanelInternal(); } // Update view specific tool bar public void updateToolBar() { if (focusedPart == 1 && upperSourcePanel != null) { upperSourcePanel.updateToolBar(); } else if (focusedPart == 2 && lowerSourcePanel != null) { lowerSourcePanel.updateToolBar(); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/����������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�015662� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TurnerLabelPanel.java�������������������������������������0000644�0001750�0001750�00000006103�14744453367�021660� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.util.gui.AnUtility; public class TurnerLabelPanel extends javax.swing.JPanel { /** Creates new form TurnerLabellPanel */ public TurnerLabelPanel(String label1Text, String label2Text) { initComponents(); setOpaque(false); label1.setFont(Overview.defaultBoldFont); label2.setFont(Overview.defaultPlainFont); label1.setText(label1Text); AnUtility.setAccessibleContext(label1.getAccessibleContext(), label1.getText()); AnUtility.setAccessibleContext(label2.getAccessibleContext(), " "); AnUtility.setAccessibleContext(hyphenLabel.getAccessibleContext(), " "); if (label2Text != null) { label2.setText(label2Text); } else { hyphenLabel.setVisible(false); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label1 = new javax.swing.JLabel(); hyphenLabel = new javax.swing.JLabel(); label2 = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; add(label1, gridBagConstraints); hyphenLabel.setText(":"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6); add(hyphenLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; add(label2, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel hyphenLabel; private javax.swing.JLabel label1; private javax.swing.JLabel label2; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/Overview.java���������������������������������������������0000644�0001750�0001750�00000002343�14744453367�020271� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import java.awt.Color; import java.awt.Font; import javax.swing.JLabel; public class Overview { protected static final Color STATUS_BACKGROUND = Color.WHITE; // new Color(223,238,215); public static final Color METRICS_BACKGROUND = Color.WHITE; // new Color(241,237,186); protected static final Color VIEWS_BACKGROUND = Color.WHITE; // new Color(225,230,237); public static final Font defaultBoldFont = new JLabel().getFont().deriveFont(Font.BOLD); public static final Font defaultPlainFont = defaultBoldFont.deriveFont(Font.PLAIN); } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/CheckBoxBarPanel.form�������������������������������������0000644�0001750�0001750�00000003747�14744453367�021611� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> �������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/BarPanel.form���������������������������������������������0000644�0001750�0001750�00000003747�14744453367�020202� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Form> �������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/OverviewPanel.form����������������������������������������0000644�0001750�0001750�00000017202�14744453367�021273� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-4,0,0,2,-78"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="innerPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="statusLabel"> <Properties> <Property name="text" type="java.lang.String" value="Experiment(s)"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="statusPanel"> <Properties> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Color blue="ff" green="ff" red="ff" type="rgb"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> <Component class="javax.swing.JLabel" name="metricsLabel"> <Properties> <Property name="text" type="java.lang.String" value="Metrics"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="metricsPanel"> <Properties> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"> <LineBorder/> </Border> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="23" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> <Component class="javax.swing.JLabel" name="viewsLabel"> <Properties> <Property name="text" type="java.lang.String" value="Shown Metrics"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="viewsPanel"> <Properties> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"> <LineBorder/> </Border> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="23" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> </SubComponents> </Container> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/OverviewPanel.java����������������������������������������0000644�0001750�0001750�00000076054�15044710303�021237� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.analyzer.AnLog; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.ipc.IPCContext; import org.gprofng.mpmt.ipc.IPCHandle; import org.gprofng.mpmt.ipc.IPCResult; import org.gprofng.mpmt.metrics.IPCMetricsAPI; import org.gprofng.mpmt.metrics.MetricAttr; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.metrics.MetricValue; import org.gprofng.mpmt.metrics.MetricsGUI; import org.gprofng.mpmt.metrics.SelectableMetricNode; import org.gprofng.mpmt.metrics.ValueMetricNode; import org.gprofng.mpmt.settings.MetricAttributes; import org.gprofng.mpmt.settings.MetricState; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPane; import org.gprofng.mpmt.util.gui.AnSplitPaneFixedRightSize; import org.gprofng.mpmt.util.gui.AnUtility; import org.gprofng.mpmt.util.gui.ToolTipPopup; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.util.ArrayList; import java.util.List; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.ScrollPaneConstants; import javax.swing.border.LineBorder; import javax.swing.border.MatteBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class OverviewPanel extends javax.swing.JPanel { private static OverviewPanel instance = null; protected static final Color borderColor = AnEnvironment.SPLIT_PANE_BORDER_COLOR; private final AnWindow window; private OverviewView overviewDisp; private OuterPanel statusOuterPanel = null; private TurnerPanel statusTurnerPanel = null; private JLabel statusTopLabel = null; private JTextPane statusBottomTextPane = null; private JScrollPane statusBottomScrollPane = null; private ProgressBarPanel metricsProgressBarPanel; private OuterPanel metricsOuterPanel = null; private JPanel metricsOuterPanel2 = null; // private ProgressBarPanel viewsProgressBarPanel; // private JPanel viewsTurnerPanel = null; // private OuterPanel viewsOuterPanel = null; // private MetricNode metricsRootNode = null; private ToolTipPopup previewToolTipPopup = null; private boolean previewToolTipPopupNew = true; private JPanel outerScrollPanePanel; private AnSplitPane splitPane; private JPanel previewPanel; /** Creates new form WelcomePanel */ public OverviewPanel(final AnWindow window, OverviewView overviewDisp) { instance = this; this.window = window; this.overviewDisp = overviewDisp; initComponents(); statusLabel.setText(AnLocale.getString("Experiment(s)")); statusLabel.setDisplayedMnemonic(AnLocale.getString('E', "MN_Overview_Experiments")); AnUtility.setAccessibleContext(statusLabel.getAccessibleContext(), statusLabel.getText()); metricsLabel.setText(AnLocale.getString("Metrics")); // metricsLabel.setDisplayedMnemonic(AnLocale.getString('s', "MN_Overview_Metrics")); AnUtility.setAccessibleContext(metricsLabel.getAccessibleContext(), metricsLabel.getText()); viewsLabel.setText(AnLocale.getString("Shown Metrics")); AnUtility.setAccessibleContext(viewsLabel.getAccessibleContext(), viewsLabel.getText()); statusLabel.setFont(statusLabel.getFont().deriveFont(Font.BOLD)); metricsLabel.setFont(metricsLabel.getFont().deriveFont(Font.BOLD)); innerPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); metricsPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); viewsPanel.setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); // Status statusTopLabel = new JLabel(); AnUtility.setAccessibleContext( statusTopLabel.getAccessibleContext(), AnLocale.getString("Status")); statusTopLabel.setOpaque(false); statusBottomTextPane = new JTextPane(); statusBottomTextPane.setBackground(Color.WHITE); statusBottomTextPane.setEditable(false); statusBottomScrollPane = new AnJScrollPane(); statusBottomScrollPane.setHorizontalScrollBarPolicy( ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); statusBottomScrollPane.setVerticalScrollBarPolicy( ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); statusBottomScrollPane.setPreferredSize(new Dimension(100, 80)); statusBottomScrollPane.setViewportView(statusBottomTextPane); statusBottomScrollPane.setBorder(null); statusTurnerPanel = new TurnerPanel( statusTopLabel, statusBottomScrollPane, 4, true, false, Overview.STATUS_BACKGROUND); statusLabel.setLabelFor(statusTurnerPanel.getTurnerButton()); statusOuterPanel = new OuterPanel(); statusOuterPanel.add(statusTurnerPanel, BorderLayout.CENTER); statusPanel.add(statusOuterPanel); statusPanel.setBorder(new LineBorder(borderColor)); statusTurnerPanel.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Dimension dim = statusPanel.getPreferredSize(); // System.out.println("statusPanel: " + dim); statusPanel.setMinimumSize(dim); innerPanel.validate(); innerPanel.repaint(); } }); // Metrics metricsOuterPanel = new OuterPanel(); metricsProgressBarPanel = new ProgressBarPanel(); metricsOuterPanel.add(metricsProgressBarPanel, BorderLayout.WEST); metricsPanel.add(metricsOuterPanel, BorderLayout.CENTER); metricsPanel.setBorder(new LineBorder(borderColor)); // Views // viewsOuterPanel = new OuterPanel(); // viewsProgressBarPanel = new ProgressBarPanel(); // viewsOuterPanel.add(viewsProgressBarPanel, BorderLayout.WEST); // viewsPanel.add(viewsOuterPanel, BorderLayout.CENTER); // viewsPanel.setBorder(new LineBorder(borderColor)); // // FIXUP: make Views tables invisible for now viewsLabel.setVisible(false); viewsPanel.setVisible(false); } @Override public void requestFocus() { statusTurnerPanel .getTurnerButton() .requestFocus(); // To change body of generated methods, choose Tools | Templates. } private void constructMetricsPanel() { CheckBoxBarPanel.resetCheckBoxBarPanelList(); if (metricsOuterPanel2 != null) { metricsOuterPanel.remove(metricsOuterPanel2); } metricsOuterPanel2 = new JPanel(); metricsOuterPanel2.setBackground(Color.WHITE); metricsOuterPanel2.setLayout(new BorderLayout()); JPanel metricsOuterPanel2a = new JPanel(); metricsOuterPanel2a.setBackground(Color.WHITE); metricsOuterPanel2a.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); int gridy = 0; String infoTxt = AnLocale.getString( "Select the metrics to display in the data views, then click a data view in the" + " navigation panel on the left."); JLabel infoLabel = new JLabel(infoTxt); AnUtility.setAccessibleContext(infoLabel.getAccessibleContext(), infoLabel.getText()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy++; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(0, 4, 0, 4); metricsOuterPanel2a.add(infoLabel, gridBagConstraints); MetricsGUI metricsGUI = new MetricsGUI( window.getSettings().getMetricsSetting().getMetricStates().getMetricsRootNode(), window); if (MetricsGUI.SHOW_ATTRIBUTES_IN_OVERVIEW) { JPanel buttonPanel = metricsGUI.createButtonPanel(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = gridy++; gridBagConstraints.insets = new Insets(12, 4, 0, 4); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; metricsOuterPanel2a.add(buttonPanel, gridBagConstraints); } JPanel metricsBarPanel = metricsGUI.createAvailableMetricsPanel(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(12, 4, 0, 4); gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.gridy = gridy++; metricsOuterPanel2a.add(metricsBarPanel, gridBagConstraints); JScrollPane availableMetrcisScrollPane = new AnJScrollPane(); availableMetrcisScrollPane.getVerticalScrollBar().setUnitIncrement(16); availableMetrcisScrollPane.getHorizontalScrollBar().setUnitIncrement(16); availableMetrcisScrollPane.setBorder(null); availableMetrcisScrollPane.setViewportView(metricsOuterPanel2a); outerScrollPanePanel = new JPanel(); outerScrollPanePanel.setBackground(Color.WHITE); outerScrollPanePanel.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 4, 0); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; outerScrollPanePanel.add(availableMetrcisScrollPane, gridBagConstraints); previewPanel = constructPreviewPanel(); previewPanel.setBorder(new MatteBorder(1, 0, 0, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); int fontSize = previewPanel.getFont().getSize(); int previewPanelSize = 60 + 4 * fontSize; splitPane = new AnSplitPaneFixedRightSize( AnSplitPane.VERTICAL_SPLIT, outerScrollPanePanel, previewPanel, previewPanelSize, previewPanelSize); splitPane.setDividerSize(1); splitPane.setOneTouchExpandable(false); metricsOuterPanel2.add(splitPane, BorderLayout.CENTER); // metricsOuterPanel2.add(previewPanel, BorderLayout.SOUTH); metricsOuterPanel.add(metricsOuterPanel2, BorderLayout.CENTER); } private JPanel constructPreviewPanel() { // overviewDisp.getMiniFuncListDisp().computeOnWorkerThread(); JPanel miniFuncListPanel = new JPanel(); miniFuncListPanel.setOpaque(false); miniFuncListPanel.setBorder(new MatteBorder(1, 1, 1, 0, AnEnvironment.SPLIT_PANE_BORDER_COLOR)); miniFuncListPanel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; miniFuncListPanel.add(overviewDisp.getMiniFuncListDisp(), gridBagConstraints); JPanel previewPanel = new JPanel(); previewPanel.setBackground(Color.WHITE); previewPanel.setLayout(new GridBagLayout()); JLabel titleLabel = new JLabel(AnLocale.getString("Metrics Preview")); AnUtility.setAccessibleContext(titleLabel.getAccessibleContext(), titleLabel.getText()); titleLabel.setToolTipText(AnLocale.getString("Preview of Functions and other views")); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 4, 0, 4); previewPanel.add(titleLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(0, 4, 0, 4); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; previewPanel.add(miniFuncListPanel, gridBagConstraints); JPanel ttPanel = new JPanel(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); ttPanel.setOpaque(false); JLabel ttLabel1 = new JLabel(AnLocale.getString("Metrics Preview")); AnUtility.setAccessibleContext(ttLabel1.getAccessibleContext(), ttLabel1.getText()); // ttLabel1.setForeground(AnEnvironment.TOOLTIP_POPUP_FOREGROUND_COLOR); ttLabel1.setForeground(Color.BLACK); ttLabel1.setFont(ttLabel1.getFont().deriveFont(Font.BOLD)); gridBagConstraints.gridx = 0; ttPanel.add(ttLabel1, gridBagConstraints); JLabel ttLabel2 = new JLabel(AnLocale.getString(" changed")); AnUtility.setAccessibleContext(ttLabel2.getAccessibleContext(), ttLabel2.getText()); ttLabel2.setForeground(AnEnvironment.TOOLTIP_POPUP_FOREGROUND_COLOR); gridBagConstraints.gridx = 1; ttPanel.add(ttLabel2, gridBagConstraints); previewToolTipPopup = new ToolTipPopup(miniFuncListPanel, ttPanel, ToolTipPopup.Location.NORTH, true); previewToolTipPopupNew = true; return previewPanel; } public void previewChanged() { if (previewToolTipPopupNew) { previewToolTipPopupNew = false; } else if (previewToolTipPopup != null) { previewToolTipPopup.show(0, 3000); } } /* * Called from presentation with updates to attributes */ protected void updateMetricTree(List<MetricState> metricStateList) { for (MetricState metricSetting : metricStateList) { if (metricSetting.getAnMetric().isNameMetric()) { continue; } String metricName = metricSetting.getAnMetric().getComd(); boolean selected = metricSetting.getSelection().isSelected(); MetricAttributes metricAttributes = metricSetting.getSelection().getAttributes(); if (window.getSettings().getMetricsSetting().getMetricStates().getMetricsRootNode() == null) { AnLog.log("Error: updateMetricTree: " + " metricsRootNode == null"); return; } List<MetricNode> nodes = window .getSettings() .getMetricsSetting() .getMetricStates() .getMetricsRootNode() .findByName(metricName); if (nodes.isEmpty()) { AnLog.log("Error: updateMetricTree: " + metricName + " not found under metricsRootNode"); return; } for (MetricNode node : nodes) { if (node != null && node instanceof SelectableMetricNode) { // Update data SelectableMetricNode selectableMetricNode = (SelectableMetricNode) node; boolean isHidden = !selected; selectableMetricNode .getExclusive() .setSelected( new MetricAttr( isHidden, metricAttributes.isETime(), metricAttributes.isEValue(), metricAttributes.isEPercent())); selectableMetricNode .getInclusive() .setSelected( new MetricAttr( isHidden, metricAttributes.isITime(), metricAttributes.isIValue(), metricAttributes.isIPercent())); if (!selectableMetricNode.hasSelections()) { // should un-select metric in overview // FIXUP } // Update GUI selectableMetricNode.fireChange(); } } } } // private TurnerPanel dummyViewsPanel() { // GridBagConstraintsnew JLabel gridBagConstraints; // // JComponent viewsTopComponent; // JPanel viewsBottomComponent; // // TurnerPanel view1TurnerPanel; // JComponent view1TopComponent; // JComponent view1BottomComponent; // TurnerPanel view2TurnerPanel; // JComponent view2TopComponent; // JComponent view2BottomComponent; // // view1TopComponent = new JLabel("Functions"); // view1TopComponent.setOpaque(false); // view1BottomComponent = new JLabel(); // view1TurnerPanel = new TurnerPanel(view1TopComponent, view1BottomComponent, false, true, // Overview.VIEWS_BACKGROUND); // // // view2TopComponent = new JLabel("Lines"); // view2TopComponent.setOpaque(false); // view2BottomComponent = new JLabel(); // view2TurnerPanel = new TurnerPanel(view2TopComponent, view2BottomComponent, false, true, // Overview.VIEWS_BACKGROUND); // // // viewsTopComponent = new TopButtonPanel("Selected Views", "All Views...", new // ActionListener() { //// @Override // @Override // public void actionPerformed(ActionEvent e) { // window.getSettings().showDialog(7); // } // }); // viewsTopComponent.setOpaque(false); // viewsBottomComponent = new JPanel(); // viewsBottomComponent.setOpaque(false); // viewsBottomComponent.setLayout(new GridBagLayout()); // gridBagConstraints = new GridBagConstraints(); // gridBagConstraints.gridx = 0; // gridBagConstraints.gridy = 0; // gridBagConstraints.weightx = 1; // gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; // viewsBottomComponent.add(view1TurnerPanel, gridBagConstraints); // gridBagConstraints.gridx = 0; // gridBagConstraints.gridy = 1; // gridBagConstraints.weightx = 1; // gridBagConstraints.insets = new java.awt.Insets(4, 0, 6, 0); // gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; // viewsBottomComponent.add(view2TurnerPanel, gridBagConstraints); // // TurnerPanel turnerPanel = new TurnerPanel(viewsTopComponent, viewsBottomComponent, true, // true, Overview.VIEWS_BACKGROUND); // return turnerPanel; // } private void initExperimentInfo(String[][] groups) { if (groups == null || groups.length == 0 || groups[0] == null) { return; } StringBuilder buf = new StringBuilder(); int got = 0; outer: for (int i = 0; i < groups.length; i++) { for (int j = 0; j < groups[i].length; j++) { if (groups[i][j] != null) { if (got > 0) { buf.append(", "); } if (got >= 2) { buf.append("..."); break outer; } buf.append(AnUtility.basename(groups[i][j])); got++; } } } String labelText = buf.toString(); statusTopLabel.setText(labelText); statusBottomTextPane.setText(AnLocale.getString("Calculating...")); statusOuterPanel.setMinimumSize( statusOuterPanel.getPreferredSize()); // <=== ugly, but what else to do? } /** * Ready to load new experiments * * @param expList experiments list */ protected void initLoadingExperiments(final String[][] groups, final boolean newExperiment) { // this.groups = groups; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { // if (newExperiment) { // metricsRootNode = null; // } // Status initExperimentInfo(groups); innerPanel.remove(metricsPanel); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); innerPanel.add(metricsPanel, gridBagConstraints); // Metrics if (metricsOuterPanel2 != null) { metricsOuterPanel.remove(metricsOuterPanel2); metricsOuterPanel2 = null; } metricsProgressBarPanel.setVisible(true); // Views // if (viewsTurnerPanel != null) { // viewsOuterPanel.remove(viewsTurnerPanel); // viewsTurnerPanel = null; // } // viewsProgressBarPanel.setVisible(true); } }); } /** Loading of new experiments completed Always called from AWT thread */ private void completedLoadingExperiments() { AnUtility.checkIfOnAWTThread(true); innerPanel.remove(metricsPanel); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); innerPanel.add(metricsPanel, gridBagConstraints); constructMetricsPanel(); metricsProgressBarPanel.setVisible(false); // metricsBarPanel.setVisible(true); // constructViews(); // viewsProgressBarPanel.setVisible(false); // viewsTurnerPanel.setVisible(true); } public static OverviewPanel getInstance() { return instance; } /* * Should be called if there are changes to the tree */ protected void refreshMetricTree() { AnUtility.checkIfOnAWTThread(false); // Don't do this on AWT thread createAndUpdateMetricTree(); // IPC final String[] preview = getOverviewText(0); // IPC AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { fillStatusPanel(preview); completedLoadingExperiments(); } }); } private void createAndUpdateMetricTree() { if (window.getSettings().getMetricsSetting().getMetricStates().getMetricsRootNode() != null) { List<ValueMetricNode> nodeList = getAllValueMetricNodes( window.getSettings().getMetricsSetting().getMetricStates().getMetricsRootNode(), new ArrayList<>()); IPCMetricsAPI.updateMetricValues(0, nodeList); window .getSettings() .getMetricsSetting() .getMetricStates() .getMetricsRootNode() .postProcessRoot(); } } private List<ValueMetricNode> getAllValueMetricNodes( MetricNode parentNode, List<ValueMetricNode> list) { if (parentNode instanceof ValueMetricNode) { list.add((ValueMetricNode) parentNode); } for (MetricNode childNode : parentNode.getChildren()) { getAllValueMetricNodes(childNode, list); // recursive } return list; } /** Always executed on AWT thread */ private void fillStatusPanel(String[] preview) { AnUtility.checkIfOnAWTThread(true); // dumpExpStatus(preview); if (preview != null) { StringBuilder buf = new StringBuilder(); for (String s : preview) { buf.append(s); buf.append("\n"); } // Use Monospaced font to make the info more readable Font f = statusBottomTextPane.getFont(); Font mf = new Font("Monospaced", Font.PLAIN, f.getSize()); statusBottomTextPane.setFont(mf); statusBottomTextPane.setText(buf.toString()); statusBottomTextPane.setCaretPosition(0); } else { statusBottomTextPane.setText(AnLocale.getString("Cancelled or error...")); } } private void dumpExpStatus(String[] preview) { if (false) { return; } for (int ii = 0; ii < preview.length; ii++) { System.out.printf("%s\n", preview[ii]); // DUMP } } /** * Get experiments preview. Use system progressbar and make it cancellable. * * @param expName * @return */ private static String[] getOverviewText(int dbevindex) { IPCContext ipcContext = new IPCContext( AnLocale.getString("Experiment Preview"), IPCContext.Scope.SESSION, true, true, IPCContext.Request.SINGLE, 1, null); IPCHandle ipcHandle = new IPCHandle(IPCHandle.RequestKind.DBE, ipcContext); ipcHandle.append("getOverviewText"); ipcHandle.append(dbevindex); IPCResult ipcResult = ipcHandle.sendRequest(); if (ipcResult.getCC() == IPCResult.CC.SUCCESS) { // blocking String[] result = (String[]) ipcResult.getObject(); return result; } else if (ipcResult.getCC() == IPCResult.CC.CANCELED) { return null; } return null; } public String dump() { return dump(window.getSettings().getMetricsSetting().getMetricStates().getMetricsRootNode()); } public static String dump(MetricNode metricsRootNode) { StringBuffer buf = new StringBuffer(); buf.append("metricsRootNode dump:\n"); if (metricsRootNode != null) { dumpMetricTree(buf, metricsRootNode); } return buf.toString(); } private static void dumpMetricTree(StringBuffer buf, MetricNode node) { dumpMetricTree(buf, node, 0); } private static void dumpMetricTree(StringBuffer buf, MetricNode node, int level) { buf.append(" ".substring(0, 2 * level)); // DUMP if (node instanceof SelectableMetricNode) { SelectableMetricNode sMetricNode = (SelectableMetricNode) node; if (sMetricNode.isSelected()) { buf.append("[X]"); // DUMP } else { buf.append("[ ]"); // DUMP } } if (node.isHiddenInOverview()) { buf.append("HIDDEN "); // DUMP } buf.append(node.getMetricBasic().getDisplayName() + " - " + node.getMetricType()); // DUMP if (node instanceof ValueMetricNode) { ValueMetricNode valueMetricNode = (ValueMetricNode) node; List<MetricValue> mvals = valueMetricNode.getValues(); if (!mvals.isEmpty()) { MetricValue mval0 = mvals.get(0); buf.append(" " + mval0.getLabel() + " Unit=" + mval0.getUnit() + ":"); for (MetricValue mval : mvals) { String hilite = mval.getHighlight() ? "*" : ""; buf.append(" [" + hilite + mval.formatValue() + "]"); } } } buf.append("\n"); String short_desc = node.getMetricBasic().getShortDescription(); if (short_desc != null) { buf.append(" -'" + short_desc + "'\n"); } // DUMP if (!node.getChildren().isEmpty()) { level++; for (MetricNode child : node.getChildren()) { dumpMetricTree(buf, child, level); } } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; innerPanel = new javax.swing.JPanel(); statusLabel = new javax.swing.JLabel(); statusPanel = new javax.swing.JPanel(); metricsLabel = new javax.swing.JLabel(); metricsPanel = new javax.swing.JPanel(); viewsLabel = new javax.swing.JLabel(); viewsPanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); innerPanel.setLayout(new java.awt.GridBagLayout()); statusLabel.setText("Experiment(s)"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 12); innerPanel.add(statusLabel, gridBagConstraints); statusPanel.setBackground(new java.awt.Color(255, 255, 255)); statusPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); innerPanel.add(statusPanel, gridBagConstraints); metricsLabel.setText("Metrics"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 12); innerPanel.add(metricsLabel, gridBagConstraints); metricsPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); metricsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); innerPanel.add(metricsPanel, gridBagConstraints); viewsLabel.setText("Shown Metrics"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 12); innerPanel.add(viewsLabel, gridBagConstraints); viewsPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); viewsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); innerPanel.add(viewsPanel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(innerPanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel innerPanel; private javax.swing.JLabel metricsLabel; private javax.swing.JPanel metricsPanel; private javax.swing.JLabel statusLabel; private javax.swing.JPanel statusPanel; private javax.swing.JLabel viewsLabel; private javax.swing.JPanel viewsPanel; // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TurnerPanel.java������������������������������������������0000644�0001750�0001750�00000015300�15044710303�020673� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.AnIconButton; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import javax.swing.Box.Filler; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class TurnerPanel extends javax.swing.JPanel { private boolean expanded = true; private Filler filler; private static final int fillerWith = 14; private List<ChangeListener> changeListeners = new ArrayList<>(); private JButton turnerButton; public TurnerPanel( JComponent topComponent, JComponent bottomComponent, int turnerButtonInset, boolean align, boolean expanded, Color background) { initComponents(); turnerButton = new AnIconButton(AnUtility.hollowArrowRightIcon); turnerButton.setBorder(null); turnerButton.setBorderPainted(false); // turnerButton.addActionListener(new java.awt.event.ActionListener() { // @Override // public void actionPerformed(java.awt.event.ActionEvent evt) { // TurnerPanel.this.expanded = !TurnerPanel.this.expanded; // updateState(); // } // }); turnerButton.addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { TurnerPanel.this.expanded = !TurnerPanel.this.expanded; updateState(); } }); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, turnerButtonInset, 0, 1); add(turnerButton, gridBagConstraints); topComponent.setFont(topComponent.getFont().deriveFont(Font.BOLD)); setBackground(background); turnerButton.setBackground(background); turnerButton.setOpaque(false); topPanel.setOpaque(false); topPanel.add(topComponent); bottomPanel.setOpaque(false); if (bottomComponent != null) { bottomPanel.add(bottomComponent); Dimension dim = new Dimension(align ? fillerWith : 3, 0); filler = new javax.swing.Box.Filler(dim, dim, dim); bottomPanel.add(filler, BorderLayout.WEST); } this.expanded = expanded; updateState(); turnerButton.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { // System.out.println("turnerButton: " + e); if (e.getKeyCode() == KeyEvent.VK_RIGHT) { TurnerPanel.this.expanded = true; updateState(); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { TurnerPanel.this.expanded = false; updateState(); } } }); } public void setBottomPanelComponent(JComponent bottomComponent) { bottomPanel.add(bottomComponent); Dimension dim = new Dimension(18, 0); filler = new javax.swing.Box.Filler(dim, dim, dim); bottomPanel.add(filler, BorderLayout.WEST); } public JButton getTurnerButton() { return turnerButton; } private void updateState() { if (expanded) { turnerButton.setToolTipText(AnLocale.getString("Collapse")); turnerButton.setIcon(AnUtility.hollowArrowDownIcon); } else { turnerButton.setToolTipText(AnLocale.getString("Expand")); turnerButton.setIcon(AnUtility.hollowArrowRightIcon); } bottomPanel.setVisible(expanded); fireChange(); } public boolean isExpanded() { return expanded; } public void addChangeListener(ChangeListener changeListener) { changeListeners.add(changeListener); } public void removeChangeListener(ChangeListener changeListener) { changeListeners.remove(changeListener); } private void fireChange() { ChangeEvent changeEvent = new ChangeEvent(this); for (ChangeListener changeListener : changeListeners) { changeListener.stateChanged(changeEvent); } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; topPanel = new javax.swing.JPanel(); bottomPanel = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); topPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(topPanel, gridBagConstraints); bottomPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; add(bottomPanel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel bottomPanel; private javax.swing.JPanel topPanel; // End of variables declaration//GEN-END:variables } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/GradientPanel.form����������������������������������������0000644�0001750�0001750�00000003314�14744453367�021221� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Form> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/ProgressBarPanel.form�������������������������������������0000644�0001750�0001750�00000005713�14744453367�021722� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JProgressBar" name="progressBar"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[32767, 10]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[10, 10]"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="0" insetsRight="8" anchor="23" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> �����������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/ProgressBarPanel.java�������������������������������������0000644�0001750�0001750�00000004457�14744453367�021704� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; public class ProgressBarPanel extends javax.swing.JPanel { public ProgressBarPanel() { initComponents(); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); progressBar.setFont( progressBar.getFont().deriveFont((float) progressBar.getFont().getSize() - 2)); progressBar.setString(AnLocale.getString("Calculating...")); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; progressBar = new javax.swing.JProgressBar(); setLayout(new java.awt.GridBagLayout()); progressBar.setMaximumSize(new java.awt.Dimension(32767, 10)); progressBar.setMinimumSize(new java.awt.Dimension(10, 10)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 8); add(progressBar, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JProgressBar progressBar; // End of variables declaration//GEN-END:variables } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TopButtonPanel.form���������������������������������������0000644�0001750�0001750�00000005057�14744453367�021430� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JButton" name="button"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="8" anchor="12" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/OuterPanel.form�������������������������������������������0000644�0001750�0001750�00000003746�14744453367�020573� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Form> ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/CheckBoxBarPanel.java�������������������������������������0000644�0001750�0001750�00000030116�15044710303�021531� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.metrics.MetricsGUI; import org.gprofng.mpmt.metrics.SelectableMetricNode; import org.gprofng.mpmt.settings.MetricNameSelected; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.Box; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class CheckBoxBarPanel extends javax.swing.JPanel { private static final int BAR_PANEL_HEIGHT = 16; private final JCheckBox checkBox; private final MetricNode metricNode; private Insets insets = null; private String toolTipText; private static int checkboxFixedPosition = -1; private static List<CheckBoxBarPanel> checkBoxBarPanelList; private static Object selectionsLock = new Object(); private static Thread selectionsThread; private boolean hasFocus; public CheckBoxBarPanel( final MetricNode metricNode, boolean isSelected, boolean hot, String text, String toolTipText, Bar bar, int maxLength, List<Color> keyColorList, int treeLevel, int nodeLevel) { if (metricNode != null) { // System.out.println(metricNode.getMetricBasic().getName() + ": " + isSelected); checkBoxBarPanelList.add(this); } this.metricNode = metricNode; this.toolTipText = toolTipText; initComponents(); setOpaque(false); setLayout(new GridBagLayout()); checkBox = new BarCheckBox(hot); checkBox.setSelected(isSelected); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // metricNodeClicked(false); // AnWindow.getInstance().getSettings().getMetricsSetting().set(this, // metricNode.getMetricBasic().getName(), isSelected()); // // AnWindow.getInstance().getSettings().getMetricsSetting().set(AnWindow.getInstance().getOverviewView(), metricNode.getMetricBasic().getName(), isSelected()); // System.out.println("----------------------------------"); ((SelectableMetricNode) metricNode).setSelected(checkBox.isSelected(), false); processSelections(); // List<MetricNameSelected> metricNameSelected = new // ArrayList<MetricNameSelected>(); // for (CheckBoxBarPanel cbbp : checkBoxBarPanelList) { //// System.out.println(cbbp.metricNode.getMetricBasic().getName() + // " " + cbbp.checkBox.isSelected()); // metricNameSelected.add(new // MetricNameSelected(cbbp.metricNode.getMetricBasic().getName(), // cbbp.checkBox.isSelected())); // } // // AnWindow.getInstance().getSettings().getMetricsSetting().setList(AnWindow.getInstance().getOverviewView(), metricNameSelected); } }); JLabel label = new JLabel(text); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(Overview.defaultPlainFont); label.setOpaque(false); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); int x = 0; gridBagConstraints.gridy = 0; if (keyColorList != null) { Component colorKeyComponent = new BarColorKey(keyColorList); gridBagConstraints.gridx = x++; gridBagConstraints.insets = new Insets(0, 0, 0, 4); add(colorKeyComponent, gridBagConstraints); } else { maxLength += BarColorKey.barWidth + 4; // make up for not painting color key } gridBagConstraints.gridx = x++; gridBagConstraints.insets = new Insets(1, 0, 0, 0); add(label, gridBagConstraints); int labelLength = getCheckboxFixedPosition(); if (treeLevel >= 1) { labelLength -= 14; labelLength -= treeLevel * 20; } if (nodeLevel >= 3) { labelLength -= (nodeLevel - 2) * 14; } if (bar != null) { labelLength -= Bar.barWidth; } if (keyColorList != null) { labelLength -= (BarColorKey.barWidth + 4); } text = text + " "; label.setText(text); while (label.getPreferredSize().width < labelLength - 20) { text += " ."; label.setText(text); } int w = label.getPreferredSize().width; int hwMetricOffset = 0; if (metricNode != null && metricNode.getMetricBasic() != null) { if (metricNode.getMetricType() == MetricNode.MetricType.PLAIN_ROOT || metricNode.getMetricType() == MetricNode.MetricType.PLAIN_CHILD) { hwMetricOffset = 4; } } Dimension dim = new Dimension(labelLength - w - hwMetricOffset, BAR_PANEL_HEIGHT); Box.Filler filler = new Box.Filler(dim, dim, dim); gridBagConstraints.gridx = x++; add(filler, gridBagConstraints); setToolTip(); if (bar != null && bar.getValue() >= 0) { gridBagConstraints.gridx = x++; add(bar, gridBagConstraints); } gridBagConstraints.gridx = x++; int offSet = 10; if (bar != null && bar.noCompareBars() > 0) { offSet = Bar.BAR_MAX_PERCENT * Bar.barWidth / 100 - bar.getPanelWidth() + 10; } gridBagConstraints.insets = new Insets(0, offSet, 0, 0); JLabel hotMarker = new JLabel(); AnUtility.setAccessibleContext(hotMarker.getAccessibleContext(), AnLocale.getString("Hot")); if (hot) { hotMarker.setIcon(AnUtility.hot_icon); } else { hotMarker.setPreferredSize( new Dimension(AnUtility.hot_icon.getIconWidth(), AnUtility.hot_icon.getIconHeight())); } add(hotMarker, gridBagConstraints); gridBagConstraints.gridx = x++; gridBagConstraints.insets = new Insets(0, 2, 0, 5); add(checkBox, gridBagConstraints); if (metricNode != null && metricNode instanceof SelectableMetricNode) { ((SelectableMetricNode) metricNode) .addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Object o = e.getSource(); if (o instanceof SelectableMetricNode) { boolean selected = ((SelectableMetricNode) o).isSelected(); getCheckBox().setSelected(selected); } } }); } addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { checkBox.doClick(); } } }); } private static void processSelections() { synchronized (selectionsLock) { if (selectionsThread != null && selectionsThread.isAlive()) { selectionsThread.interrupt(); } selectionsThread = AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { boolean interrupted = false; try { Thread.sleep(1000); } catch (InterruptedException ie) { interrupted = true; } ; if (!interrupted) { List<MetricNameSelected> metricNameSelected = new ArrayList<>(); for (CheckBoxBarPanel cbbp : checkBoxBarPanelList) { metricNameSelected.add( new MetricNameSelected( cbbp.metricNode.getMetricBasic().getName(), cbbp.checkBox.isSelected())); } AnWindow.getInstance() .getSettings() .getMetricsSetting() .setList(AnWindow.getInstance().getOverviewView(), metricNameSelected); } } }, "processSelections"); } } protected static void resetCheckBoxBarPanelList() { checkBoxBarPanelList = new ArrayList<>(); } /** * @return the checkboxFixedPosition */ public static int getCheckboxFixedPosition() { if (checkboxFixedPosition < 0) { int fontSize = new JLabel().getFont().getSize(); if (fontSize <= 12) { checkboxFixedPosition = MetricsGUI.getInstance().getMetricDisplayNameBaseWidth(); } else { checkboxFixedPosition = MetricsGUI.getInstance().getMetricDisplayNameBaseWidth() + (fontSize - 12) * 25; } } // System.out.println(checkboxFixedPosition); return checkboxFixedPosition; } private void setToolTip() { if (toolTipText != null) { if (metricNode.getMetricBasic().getShortDescription() != null) { StringBuilder buf = new StringBuilder(); buf.append("<html>"); buf.append(toolTipText); buf.append("<br>"); buf.append(metricNode.getMetricBasic().getShortDescription()); buf.append("<html>"); setToolTipText(buf.toString()); } else { setToolTipText(toolTipText); } } } @Override public Insets getInsets() { if (insets != null) { return insets; } else { return super.getInsets(); } } public void setInsets(Insets insets) { this.insets = insets; } /** * @return the checkBox */ public JCheckBox getCheckBox() { return checkBox; } public boolean isSelected() { return checkBox.isSelected(); } public void setSelected(boolean selected) { checkBox.setSelected(selected); setToolTip(); } /** * @param hasFocus the hasFocus to set */ public void setHasFocus(boolean hasFocus) { this.hasFocus = hasFocus; } /** * @return the hasFocus */ public boolean isHasFocus() { return hasFocus; } class BarCheckBox extends JCheckBox { public BarCheckBox(boolean hot) { setOpaque(false); setMargin(new Insets(0, 0, 0, 0)); setBorder(null); setPreferredSize(new Dimension(17, 17)); AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Metric selector")); } @Override public Insets getInsets() { return new Insets(0, 2, 0, 0); } @Override public void paint(Graphics g) { super.paint(g); if (isFocusOwner() || hasFocus) { // For a11y... g.setColor(new Color(122, 138, 153)); g.drawLine(16, 2, 16, 14); } } } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/AnBarTree.java��������������������������������������������0000644�0001750�0001750�00000032377�15044710303�020254� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.metrics.MetricsGUI; import org.gprofng.mpmt.metrics.SelectableMetricNode; import org.gprofng.mpmt.overview.Bar.ValueColor; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.EventObject; import java.util.List; import java.util.Vector; import javax.swing.AbstractCellEditor; import javax.swing.JTree; import javax.swing.JTree.DynamicUtilTreeNode; import javax.swing.ToolTipManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellEditor; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; public class AnBarTree extends JTree { private static int CHECKBOX_WIDTH = 20; // FIXUP: can this be calculated? private CheckBoxBarPanel[] checkBoxBarPanels = new CheckBoxBarPanel[20]; public AnBarTree(Vector<Object> rootVector) { super(rootVector); AnUtility.setAccessibleContext(getAccessibleContext(), AnLocale.getString("Metrics Tree")); TreeCellRenderer anCellRenderer = new CellRenderer(); setCellRenderer(anCellRenderer); CellEditor anCellEditor = new CellEditor(this); setCellEditor(anCellEditor); setEditable(true); setOpaque(false); // setRootVisible(true); ToolTipManager.sharedInstance().registerComponent(this); addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { for (CheckBoxBarPanel cbp : checkBoxBarPanels) { if (cbp != null) { if (cbp.isHasFocus()) { cbp.getCheckBox().doClick(); break; } } } } } }); } public void setTreeNodeStateSelected( SelectableMetricNode selectableMetricNode, boolean selected) { CellEditor cellEditor = (CellEditor) getCellEditor(); cellEditor.setTreeNodeStateSelected(selectableMetricNode, selected); } public static class BarNode<E> extends Vector<E> { public MetricNode metricNode; private boolean selected; public String toolTipText; public Bar bar; public int maxLength; public int level; private CheckBoxBarPanel checkBoxBarPanel = null; public BarNode( MetricNode metricNode, boolean isSelected, String toolTipText, Bar bar, List<E> elements, int maxLength, int level) { this.metricNode = metricNode; this.selected = isSelected; this.toolTipText = toolTipText; this.bar = bar; if (elements != null) { for (int i = 0, n = elements.size(); i < n; i++) { add(elements.get(i)); } } this.maxLength = maxLength; this.level = level; if (metricNode instanceof SelectableMetricNode) { ((SelectableMetricNode) metricNode) .addChangeListener( new ChangeListener() { // @Override @Override public void stateChanged(ChangeEvent e) { Object o = e.getSource(); if (o instanceof SelectableMetricNode) { selected = ((SelectableMetricNode) o).hasSelections(); if (checkBoxBarPanel != null /*&& checkBoxBarPanel.isSelected() != selected*/) { checkBoxBarPanel.setSelected(selected); MetricsGUI.getInstance().refreshMetricsPanel(); } } } }); } } public BarNode( MetricNode metricNode, boolean isSelected, String toolTipText, Bar bar, int maxLength, int level) { this(metricNode, isSelected, toolTipText, bar, null, maxLength, level); } /** * @return the bar */ public Bar getBar() { return bar; } public String getName() { return metricNode.getMetricBasic().getName(); } public String getDisplayName() { return metricNode.getMetricBasic().getDisplayName(); } /** * @return the selected */ public boolean isSelected() { return selected; } /** * @param selected the selected to set */ public void setSelected(boolean selected) { this.selected = selected; } /** * @return the barCheckBox */ public CheckBoxBarPanel getCheckBoxBarPanel() { return checkBoxBarPanel; } /** * @param barCheckBox the barCheckBox to set */ public void setCheckBoxBarPanel(CheckBoxBarPanel checkBoxBarPanel) { this.checkBoxBarPanel = checkBoxBarPanel; } } class CellRenderer implements TreeCellRenderer { DefaultTreeCellRenderer defaultRenderer = new DefaultTreeCellRenderer(); Color backgroundSelectionColor = defaultRenderer.getBackgroundSelectionColor(); Color backgroundNonSelectionColor = defaultRenderer.getBackgroundNonSelectionColor(); public CellRenderer() {} @Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { CheckBoxBarPanel checkBoxBarPanel = null; boolean isSelected = false; String text = null; String toolTipText = null; Bar bar = null; int maxLength = 100; boolean hot = false; if ((value != null) && (value instanceof DynamicUtilTreeNode)) { Object userObject = ((DynamicUtilTreeNode) value).getUserObject(); if (userObject instanceof BarNode) { BarNode node = (BarNode) userObject; isSelected = node.isSelected(); text = node.getDisplayName(); toolTipText = node.toolTipText; bar = node.bar; maxLength = node.maxLength; int level = node.level; maxLength = maxLength - (level - 1) * CHECKBOX_WIDTH; hot = node.metricNode.isHot(); checkBoxBarPanel = node.getCheckBoxBarPanel(); if (checkBoxBarPanel == null) { List<Color> keyColorList = null; if (bar != null && bar.getValueColor() != null && bar.getValueColor().size() <= 3) { keyColorList = new ArrayList<>(); for (ValueColor valueColor : bar.getValueColor()) { keyColorList.add(valueColor.getColor()); } } checkBoxBarPanel = new CheckBoxBarPanel( node.metricNode, isSelected, hot, text, toolTipText, bar, maxLength, keyColorList, level, -1); // <=== checkBoxBarPanel.setInsets(new Insets(2, 0, 2, 0)); node.setCheckBoxBarPanel(checkBoxBarPanel); } else { checkBoxBarPanel.setSelected(isSelected); } } } if (checkBoxBarPanel == null) { checkBoxBarPanel = new CheckBoxBarPanel( null, isSelected, hot, text, toolTipText, bar, maxLength, null, 0, -1); } for (CheckBoxBarPanel cbp : checkBoxBarPanels) { if (cbp != null) { cbp.setHasFocus(false); } } if (hasFocus) { checkBoxBarPanel.setHasFocus(true); } if (row >= 0 && row < checkBoxBarPanels.length) { checkBoxBarPanels[row] = checkBoxBarPanel; } return checkBoxBarPanel; } } class CellEditor extends AbstractCellEditor implements TreeCellEditor { ChangeEvent changeEvent = null; JTree tree; ActionListener actionListener = null; public CellEditor(JTree tree) { this.tree = tree; } @Override public Object getCellEditorValue() { return null; // FIXUP: ?????? } @Override public boolean isCellEditable(EventObject event) { return true; } @Override public Component getTreeCellEditorComponent( final JTree tree, final Object value, boolean selected, boolean expanded, boolean leaf, int row) { Component editor = tree.getCellRenderer() .getTreeCellRendererComponent(tree, value, true, expanded, leaf, row, true); final CheckBoxBarPanel checkBoxBarPanel = (CheckBoxBarPanel) editor; ActionListener[] al = checkBoxBarPanel.getCheckBox().getActionListeners(); if (al.length == 1) { // FIXUP: Hack: we only want to add this listener ONCE and we get here many // times!!!!!!!!! checkBoxBarPanel .getCheckBox() .addActionListener( new ActionListener() { // @Override @Override public void actionPerformed(ActionEvent e) { checkBoxClicked(tree, checkBoxBarPanel, value); } }); } return editor; } private List<TreeNode> findNodesInTreeByName(String name) { List<TreeNode> list = new ArrayList<>(); Object root = getModel().getRoot(); TreeNode rootNode = (TreeNode) root; findNodesInTreeByName(rootNode, list, name); return list; } private void findNodesInTreeByName(TreeNode treeNode, List<TreeNode> list, String name) { if (treeNode instanceof DynamicUtilTreeNode) { DynamicUtilTreeNode dynamicTreeNode = (DynamicUtilTreeNode) treeNode; Object uo = dynamicTreeNode.getUserObject(); if (uo instanceof BarNode) { BarNode bn = (BarNode) uo; String bnName = bn.metricNode.getMetricBasic().getName(); if (bnName.equals(name)) { list.add(treeNode); } } } for (int i = 0; i < treeNode.getChildCount(); i++) { findNodesInTreeByName(treeNode.getChildAt(i), list, name); } } /** Checkbox clicked.... */ private void checkBoxClicked(JTree tree, CheckBoxBarPanel barPanel, final Object value) { if ((value != null) && (value instanceof DynamicUtilTreeNode)) { DynamicUtilTreeNode dynamicUtilTreeNode = (DynamicUtilTreeNode) value; Object userObject = dynamicUtilTreeNode.getUserObject(); if (userObject instanceof BarNode) { BarNode barNode = (BarNode) userObject; MetricNode metricNode = barNode.metricNode; if (metricNode instanceof SelectableMetricNode) { SelectableMetricNode selectableMetricNode = (SelectableMetricNode) metricNode; // selectableMetricNode.setSelected(barPanel.isSelected(), // false); barNode.setSelected(barPanel.isSelected()); // ??? // synchronize selection with outher node representing same metric (same metric name) List<TreeNode> nodeList = findNodesInTreeByName(selectableMetricNode.getMetricBasic().getName()); for (int i = 0; i < nodeList.size(); i++) { TreeNode treeNode = nodeList.get(i); if (treeNode instanceof DynamicUtilTreeNode) { DynamicUtilTreeNode child = (DynamicUtilTreeNode) treeNode; Object uo = child.getUserObject(); if (uo instanceof BarNode) { BarNode bn = (BarNode) uo; if (bn != barNode) { bn.setSelected(barPanel.isSelected()); } } } } } } } } /** Set internal state in barnode to selected */ protected void setTreeNodeStateSelected( SelectableMetricNode selectableMetricNode, boolean selected) { List<TreeNode> nodeList = findNodesInTreeByName(selectableMetricNode.getMetricBasic().getName()); for (int i = 0; i < nodeList.size(); i++) { TreeNode treeNode = nodeList.get(i); if (treeNode instanceof DynamicUtilTreeNode) { DynamicUtilTreeNode child = (DynamicUtilTreeNode) treeNode; Object uo = child.getUserObject(); if (uo instanceof BarNode) { BarNode bn = (BarNode) uo; bn.setSelected(selected); } } } } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/Bar.java��������������������������������������������������0000644�0001750�0001750�00000020430�15044710303�017140� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.metrics.CompareBarData; import org.gprofng.mpmt.metrics.MetricValue; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.JPanel; public class Bar extends JPanel { protected static final int BAR_MAX_PERCENT = 150; public static final Color[] BAR_COMPARE_COLORS = new Color[] {AnEnvironment.BAR_COMPARE_COLOR1, AnEnvironment.BAR_COMPARE_COLOR2}; protected static final int barWidth = 200; public static final int barHeight = 13; private int panelWidth = barWidth; private int panelHeight = barHeight; private Font smallFont; private boolean showBorder = true; private boolean showFillColor = true; private boolean paintNumber = true; private CompareBarData[] compareValues = null; private List<ValueColor> valueColor; private int value; public Bar(Color color, int value, CompareBarData[] compareValues) { List<ValueColor> vc = new ArrayList<>(); vc.add(new ValueColor(value, color)); init(vc, value, compareValues); // paintNumber = false; // showBorder = false; } public Bar(ValueColor[] valueColor, int value, CompareBarData[] compareValues) { init(new ArrayList<>(Arrays.asList(valueColor)), value, compareValues); } public Bar(List<ValueColor> valueColor, int value, CompareBarData[] compareValues) { init(valueColor, value, compareValues); } private void init(List<ValueColor> valueColor, int value, CompareBarData[] compareValues) { if (compareValues == null) { panelHeight = barHeight; panelWidth = barWidth; } else { panelHeight = barHeight + compareValues.length * barHeight - 2; panelWidth = calculateBarWidth(compareValues); } setPreferredSize(new Dimension(panelWidth, panelHeight)); // smallFont = getFont().deriveFont((float) getFont().getSize() - 2); smallFont = getFont().deriveFont((float) 10); // Always use size 10 font to paint numbers (for now!) this.valueColor = valueColor; this.value = value; this.compareValues = compareValues; setOpaque(false); } private int calculateBarWidth(CompareBarData[] compareValues) { int maxX = barWidth; if (compareValues != null) { for (int compareBarNo = 0; compareBarNo < compareValues.length; compareBarNo++) { // ValueColor compareValueColor = // compareValues[compareBarNo].getValueColors().get(0); // << FIXUP int value = compareValues[compareBarNo].getPercentOfTotal(); if (value == MetricValue.PERCENT_NAN || value >= BAR_MAX_PERCENT) { value = BAR_MAX_PERCENT; } int vbarValue = (barWidth * value) / 100; int fillValue = vbarValue; if (fillValue <= 1) { fillValue = 1; } maxX = ((1 + fillValue) > maxX ? (1 + fillValue) : maxX); } } return maxX; } public int noCompareBars() { if (compareValues == null) { return 0; } else { return compareValues.length; } } // @Override @Override public void paint(Graphics g) { paint(g, 0, 0); } public void paint(Graphics g, int xOffset, int yOffset) { super.paint(g); int maxX = barWidth; int x = xOffset; int y = yOffset; if (showFillColor) { g.setColor(AnEnvironment.BAR_BACKGROUND_COLOR); g.fillRect(x, y, barWidth - 1, barHeight - 1); } if (showBorder) { g.setColor(AnEnvironment.BAR_BORDER_COLOR); g.drawRect(x, y, barWidth - 1, barHeight - 1); } x = x + 1; for (ValueColor vc : getValueColor()) { int vbarValue; // is value of main bar 0? if (noCompareBars() > 0 && compareValues[0].getPercentOfTotal() == MetricValue.PERCENT_NAN) { vbarValue = 0; // YXXX For now, show zero value for main bar (Thomas: TBD) } else { vbarValue = (barWidth * vc.getValue()) / 100; } g.setColor(vc.getColor()); int fillValue = vbarValue; if (fillValue <= 1) { fillValue = 1; } g.fillRect(x, y + 1, fillValue, barHeight - 2); x += vbarValue; } for (int compareBarNo = 0; compareBarNo < noCompareBars(); compareBarNo++) { int combinedValue = 0; int compareX = xOffset + 1; for (ValueColor compareValueColor : compareValues[compareBarNo].getValueColors()) { g.setColor(compareValueColor.color); int value; boolean maxReached = false; if (compareValues[compareBarNo].getPercentOfTotal() == MetricValue.PERCENT_NAN) { maxReached = true; value = BAR_MAX_PERCENT - combinedValue; } else { value = compareValueColor.value * compareValues[compareBarNo].getPercentOfTotal() / 100; combinedValue += value; if (value == MetricValue.PERCENT_NAN || combinedValue >= BAR_MAX_PERCENT) { maxReached = true; value = BAR_MAX_PERCENT - (combinedValue - value); } } int vbarValue = (barWidth * value) / 100; int borderOffset = 1; if (showBorder) { g.setColor(AnEnvironment.BAR_BORDER_COLOR); g.drawRect(xOffset, y + barHeight + compareBarNo * (barHeight - 2), 0, barHeight - 3); borderOffset = 0; } g.setColor(compareValueColor.color); int fillValue = vbarValue; if (fillValue <= 1) { fillValue = 1; } g.fillRect( compareX, y + barHeight + compareBarNo * (barHeight - 1) - borderOffset, fillValue, barHeight - 2); if (maxReached) { int nearEnd = BAR_MAX_PERCENT * barWidth / 100; nearEnd -= 15; g.setColor(Color.WHITE); for (int i = 0; i < 5; i++) { compareX = xOffset + 1 + nearEnd; int yy = y + barHeight + compareBarNo * (barHeight - 2) - 1; g.drawLine(compareX + i, yy, compareX - 20 + i, yy + yy + barHeight - 2); } } maxX = ((compareX + fillValue) > maxX ? (compareX + fillValue) : maxX); compareX += vbarValue; } } // panelWidth = maxX; // Dimension dim = getPreferredSize(); // dim = new Dimension(panelWidth, dim.height); // setPreferredSize(dim); if (paintNumber) { g.setFont(smallFont); String valueString = "" + getValue() + "%"; int valueWidthInPixels = pixelWidth(g, valueString); g.setClip(0, 0, x, y + barHeight); g.setColor(Color.WHITE); g.drawString(valueString, xOffset + barWidth - valueWidthInPixels - 2, y + 10); g.setClip(x, 0, x + barWidth, y + barHeight); g.setColor(Color.BLACK); g.drawString(valueString, xOffset + barWidth - valueWidthInPixels - 2, y + 10); } } private int pixelWidth(Graphics g, String s) { FontMetrics fontMetrics = g.getFontMetrics(); return fontMetrics.stringWidth(s); } /** * @return the value */ public int getValue() { return value; } public int getPanelWidth() { return panelWidth; } /** * @return the valueColor */ public List<ValueColor> getValueColor() { return valueColor; } public static class ValueColor { private int value; private Color color; public ValueColor(int value, Color color) { this.value = value; this.color = color; } /** * @return the value */ public int getValue() { return value; } /** * @return the color */ public Color getColor() { return color; } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/OuterPanel.java�������������������������������������������0000644�0001750�0001750�00000003224�14744453367�020540� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.analyzer.AnEnvironment; import java.awt.BorderLayout; /** * @author tpreisle */ public class OuterPanel extends javax.swing.JPanel { /** Creates new form OuterPanel */ public OuterPanel() { initComponents(); add(new GradientPanel(true), BorderLayout.NORTH); add(new GradientPanel(false), BorderLayout.SOUTH); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.BorderLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/BarPanel.java���������������������������������������������0000644�0001750�0001750�00000010252�14744453367�020145� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import static org.gprofng.mpmt.overview.CheckBoxBarPanel.getCheckboxFixedPosition; import org.gprofng.mpmt.metrics.MetricNode; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.Box; import javax.swing.JLabel; public class BarPanel extends javax.swing.JPanel { private final MetricNode metricNode; private Insets insets = null; private String toolTipText; public BarPanel( final MetricNode metricNode, boolean isSelected, boolean hot, String text, String toolTipText, Bar bar, int maxLength, Color keyColor, int treeLevel, int nodeLevel) { // System.out.println("BarPanel " + text); this.metricNode = metricNode; this.toolTipText = toolTipText; initComponents(); setOpaque(false); setOpaque(false); setLayout(new GridBagLayout()); JLabel label = new JLabel(text); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setFont(Overview.defaultPlainFont); label.setOpaque(false); setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); int x = 0; gridBagConstraints.gridy = 0; if (keyColor != null) { Component colorKeyComponent = new BarColorKey(keyColor); gridBagConstraints.gridx = x++; gridBagConstraints.insets = new Insets(0, 0, 0, 4); add(colorKeyComponent, gridBagConstraints); } else { maxLength += BarColorKey.barWidth + 4; // make up for not painting color key } gridBagConstraints.gridx = x++; gridBagConstraints.insets = new Insets(0, 0, 0, 0); add(label, gridBagConstraints); int labelLength = getCheckboxFixedPosition() + 14; if (treeLevel >= 1) { labelLength -= 14; labelLength -= treeLevel * 20; } if (nodeLevel >= 3) { labelLength -= (nodeLevel - 2) * 14; } if (bar != null) { labelLength -= Bar.barWidth; } if (keyColor != null) { labelLength -= (BarColorKey.barWidth + 4); } int w = label.getPreferredSize().width; Dimension dim = new Dimension(labelLength - w, 20); Box.Filler filler = new Box.Filler(dim, dim, dim); gridBagConstraints.gridx = x++; add(filler, gridBagConstraints); setToolTip(); if (bar != null && bar.getValue() >= 0) { gridBagConstraints.gridx = x++; add(bar, gridBagConstraints); } } private void setToolTip() { if (toolTipText != null) { StringBuilder txt = new StringBuilder(); txt.append(toolTipText); setToolTipText(txt.toString()); } } @Override public Insets getInsets() { if (insets != null) { return insets; } else { return super.getInsets(); } } public void setInsets(Insets insets) { this.insets = insets; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.GridBagLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TopButtonPanel.java���������������������������������������0000644�0001750�0001750�00000006365�14744453367�021411� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionListener; import javax.swing.JLabel; public class TopButtonPanel extends javax.swing.JPanel { public TopButtonPanel(String labelText, String buttonText, ActionListener actionListener) { initComponents(); setBackground(Color.WHITE); JLabel label = new JLabel(labelText); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); // JTextArea textArea = new JTextArea(); // textArea.setText(labelText); // textArea.setFont(textArea.getFont().deriveFont(Font.PLAIN)); // textArea.setLineWrap(true); // textArea.setWrapStyleWord(true); // textArea.setBorder(null); // textArea.setOpaque(false); // textArea.setMinimumSize(new Dimension(10, 10)); // textArea.setPreferredSize(new Dimension(10, 40)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 0, 3, 0); add(label, gridBagConstraints); button.setText(buttonText); button.addActionListener(actionListener); button.setFont(Overview.defaultPlainFont); button.setMargin(new Insets(0, 4, 0, 4)); button.setBackground(new Color(237, 240, 244)); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; button = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); add(button, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton button; // End of variables declaration//GEN-END:variables } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TurnerPanel.form������������������������������������������0000644�0001750�0001750�00000006403�14744453367�020745� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="topPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> <Container class="javax.swing.JPanel" name="bottomPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> </Container> </SubComponents> </Form> �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/GradientPanel.java����������������������������������������0000644�0001750�0001750�00000004253�14744453367�021202� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import java.awt.Color; import java.awt.Dimension; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; /** * @author tpreisle */ public class GradientPanel extends javax.swing.JPanel { private final Color color1 = Color.WHITE; private final Color color2 = new Color(235, 235, 235); private static final int height = 12; private boolean top; public GradientPanel(boolean top) { this.top = top; initComponents(); setPreferredSize(new Dimension(height, height)); } // @Override public void paint(Graphics g) { int width = getWidth(); // int height = getHeight(); Graphics2D g2d = (Graphics2D) g; GradientPaint gp; if (top) { gp = new GradientPaint(0, 0, color2, 0, height, color1); } else { gp = new GradientPaint(0, 0, color1, 0, height, color2); } g2d.setPaint(gp); g2d.fillRect(0, 0, width, height); setOpaque(false); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.BorderLayout()); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/TurnerLabelPanel.form�������������������������������������0000644�0001750�0001750�00000007340�14744453367�021706� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="label1"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="hyphenLabel"> <Properties> <Property name="text" type="java.lang.String" value=":"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="6" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="label2"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/overview/BarColorKey.java������������������������������������������0000644�0001750�0001750�00000003760�15044710303�020617� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.analyzer.AnEnvironment; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; public class BarColorKey extends JPanel { protected static final int barWidth = 9; protected static final int barHeight = 14; private List<Color> keyColorList; public BarColorKey(Color keyColor) { List<Color> fillColorList = new ArrayList<>(); fillColorList.add(keyColor); this.keyColorList = fillColorList; init(); } public BarColorKey(List<Color> keyColorList) { this.keyColorList = keyColorList; init(); } private void init() { Dimension dim = new Dimension(barWidth, barHeight); setMinimumSize(dim); setMaximumSize(dim); setPreferredSize(dim); setBackground(Color.WHITE); } @Override public void paint(Graphics g) { super.paint(g); if (keyColorList != null) { int x = 0; int y = 1; // Fill int yStep = (barHeight - 2) / keyColorList.size(); for (Color color : keyColorList) { g.setColor(color); g.fillRect(x, y, barWidth - 1, barHeight - 1); y += yStep; } // Border g.setColor(AnEnvironment.BAR_BORDER_COLOR); g.drawRect(0, 0, barWidth - 1, barHeight - 1); } } } ����������������gprofng-gui-2.1/org/gprofng/mpmt/overview/OverviewView.java�����������������������������������������0000644�0001750�0001750�00000024071�15044710303�021102� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.overview; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.MiniFuncListDisp; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; import javax.accessibility.AccessibleContext; import javax.swing.ToolTipManager; public final class OverviewView extends AnDisplay implements ExportSupport, AnChangeListener { private MiniFuncListDisp miniFuncListDisp = null; private String lastSortMetrics = null; private OverviewPanel overviewPanel; private boolean metricsHaveChanged = false; private int defaultToolTipDismissDelay = 0; private static final int ToolTipDismissDelay = 10000; private Thread miniFuncListDispComputeThread; private Object miniFuncListDispComputeThreadLock = new Object(); // Constructor public OverviewView() { super(AnWindow.getInstance(), AnDisplay.DSP_Overview, AnVariable.HELP_Overview); setAccessibility(AnLocale.getString("Overview")); AnEventManager.getInstance().addListener(this); miniFuncListDisp = constructMiniFuncListDisp(); defaultToolTipDismissDelay = ToolTipManager.sharedInstance().getDismissDelay(); } @Override public void requestFocus() { overviewPanel.requestFocus(); // To change body of generated methods, choose Tools | Templates. } public String getShortDescr() { return "Overview short description..."; } public String getLongDescr() { return "<HTML><b>Overview View</b><br>Overview long" + " description......<br>..............................................<br>..............................................</HTML>"; } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("OverviewView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: setComputed(false); clear(); clearHistory(); String[][] groups = (String[][]) e.getSource(); if (groups.length > 0) { overviewPanel.initLoadingExperiments(groups, true); } break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: setComputed(false); if (selected) { computeOnAWorkerThread(); } miniFuncListDisp.setComputed(false); if (selected) { computeMiniFuncListDisp(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.COMPARE_MODE) { setComputed(false); if (selected) { computeOnAWorkerThread(); } miniFuncListDisp.setComputed(false); if (selected) { computeMiniFuncListDisp(); } } if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { if (anSettingChangeEvent.getOriginalSource() != this) { metricsHaveChanged = true; if (selected) { computeOnAWorkerThread(); } } miniFuncListDisp.setComputed(false); if (selected) { computeMiniFuncListDisp(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } private void computeMiniFuncListDisp() { synchronized (miniFuncListDispComputeThreadLock) { if (miniFuncListDispComputeThread != null && miniFuncListDispComputeThread.isAlive()) { miniFuncListDispComputeThread.interrupt(); } miniFuncListDispComputeThread = AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { boolean interrupted = false; try { Thread.sleep(100); } catch (InterruptedException ie) { interrupted = true; } ; if (!interrupted) { miniFuncListDisp.computeOnAWorkerThread(); } } }, "computeMiniFuncListDisp"); } } private MiniFuncListDisp constructMiniFuncListDisp() { MiniFuncListDisp miniFLD = new MiniFuncListDisp(window, AnDisplay.DSP_Functions, AnVariable.HELP_Overview); // Dimension dim = new java.awt.Dimension(100, overviewPanel.getFont().getSize() * 4 + 20); miniFLD.setPreferredSize(dim); AccessibleContext context = miniFLD.getAccessibleContext(); context.setAccessibleName(AnLocale.getString("Functions")); context.setAccessibleDescription(AnLocale.getString("List of functions")); return miniFLD; } public MiniFuncListDisp getMiniFuncListDisp() { return miniFuncListDisp; } private void saveLastSortMetrics() { lastSortMetrics = AnWindow.getInstance().getSettings().getMetricsSetting().getSortColumnMetricDisplayName(0); } private void restoreLastSortMetrics() { if (lastSortMetrics != null) { String sortMetrics = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getSortColumnMetricDisplayName(0); if (sortMetrics != null && !sortMetrics.equals(lastSortMetrics)) { AnWindow.getInstance() .getSettings() .getMetricsSetting() .setSortColumnName(lastSortMetrics, 0); } } } @Override public void setSelected(boolean set) { if (isSelected() == set) { return; } super.setSelected(set); if (set) { saveLastSortMetrics(); ToolTipManager.sharedInstance().setDismissDelay(ToolTipDismissDelay); } else { restoreLastSortMetrics(); ToolTipManager.sharedInstance().setDismissDelay(defaultToolTipDismissDelay); } miniFuncListDisp.setSelected(set); } @Override public void setComputed(boolean set) { super.setComputed(set); miniFuncListDisp.setComputed(set); } // Initialize GUI components @Override protected void initComponents() { setLayout(new BorderLayout()); overviewPanel = new OverviewPanel(window, this); add(overviewPanel, BorderLayout.CENTER); } // Compute & update Statistics display @Override public void doCompute() { AnUtility.checkIfOnAWTThread(false); if (!selected) { return; } if (computed) { if (metricsHaveChanged) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { overviewPanel.updateMetricTree( AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricStates() .getMetricStateList()); } }); metricsHaveChanged = false; } } if (!computed) { overviewPanel.initLoadingExperiments(AnWindow.getInstance().getExperimentGroups(), false); overviewPanel.refreshMetricTree(); saveLastSortMetrics(); } computeMiniFuncListDisp(); computed = true; } @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { StringBuilder buf = new StringBuilder(); buf.append(overviewPanel.dump()); buf.append(miniFuncListDisp.exportAsText(0, format, delimiter)); return buf.toString(); } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/CalledByCallsSourceView.java���������������������������������������0000644�0001750�0001750�00000001765�14744453367�021276� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; public final class CalledByCallsSourceView extends CalledByCallsDisp { public CalledByCallsSourceView() { super( AnWindow.getInstance(), AnDisplay.DSP_Callers, AnVariable.HELP_TabsSource, AnDisplay.DSP_Source); setAccessibility(AnLocale.getString("Called By Calls")); } } �����������gprofng-gui-2.1/org/gprofng/mpmt/LibraryVisibilityPanel.form����������������������������������������0000644�0001750�0001750�00000063444�14744453367�021304� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="infoLabel"> <Properties> <Property name="text" type="java.lang.String" value="info..."/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="filterPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="14" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="filterLabel"> <Properties> <Property name="text" type="java.lang.String" value="Filter:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="6" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JPanel" name="radioButtonPanel"> <Properties> <Property name="opaque" type="boolean" value="false"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JRadioButton" name="nativeRadioButton"> <Properties> <Property name="text" type="java.lang.String" value="Native"/> <Property name="opaque" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nativeRadioButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JRadioButton" name="javaRadioButton"> <Properties> <Property name="text" type="java.lang.String" value="Java"/> <Property name="opaque" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="javaRadioButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Component class="javax.swing.JLabel" name="includeLabel"> <Properties> <Property name="text" type="java.lang.String" value="Include"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="includeComboBox"> <Properties> <Property name="editable" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="excludeLabel"> <Properties> <Property name="text" type="java.lang.String" value="and exclude"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JComboBox" name="excludeComboBox"> <Properties> <Property name="editable" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="refreshButton"> <Properties> <Property name="text" type="java.lang.String" value="Refresh"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="4" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="8" insetsBottom="4" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="listLabelPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="8" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="listLabel"> <Properties> <Property name="text" type="java.lang.String" value="List:"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="maxListLabel"> <Properties> <Property name="text" type="java.lang.String" value="jLabel1"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="outerListPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="3" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.Box$Filler" name="filler1"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.Box$Filler" name="filler2"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.Box$Filler" name="filler3"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[60, 0]"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.Box$Filler" name="filler4"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[120, 0]"/> </Property> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[120, 0]"/> </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[120, 0]"/> </Property> <Property name="autoscrolls" type="boolean" value="true"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="functionsLabel"> <Properties> <Property name="text" type="java.lang.String" value="Functions"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="apiLabel"> <Properties> <Property name="text" type="java.lang.String" value="API"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="libraryLabel"> <Properties> <Property name="text" type="java.lang.String" value="Library"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="nameButton"> <Properties> <Property name="text" type="java.lang.String" value="Name"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nameButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="3" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="14" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="pathButton"> <Properties> <Property name="text" type="java.lang.String" value="Path"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pathButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="4" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Container class="javax.swing.JScrollPane" name="scrollPane"> <Properties> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Border info="null"/> </Property> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="4" gridWidth="5" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="23" weightX="1.0" weightY="1.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="listPanel"> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> </Container> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="buttonPanel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="5" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="maxLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="22" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="defaultsButton"> <Properties> <Property name="text" type="java.lang.String" value="Defaults"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="defaultsButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="4" insetsLeft="12" insetsBottom="4" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JLabel" name="listedLabel"> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="22" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Container> </SubComponents> </Container> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnMetric.java������������������������������������������������������0000644�0001750�0001750�00000023056�15044710303�016277� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.settings.CompareModeSetting.CompareMode; import java.awt.Color; import java.util.Hashtable; import java.util.List; // See BaseMetric.h and Metric.h for definitions of members public final class AnMetric { // BaseMetric.h: public String expr_spec, aux, legend; private final String comd, user_name, data_type_name, data_type_uname; // private final int id private final int valtype, clock, type, flavors; private final int value_styles; private int sub_type, vis_bits; // Metric.h: private final String name, abbr, unit /*aka abbr_unit*/; // MetricList.h::get_sort_ref_index() private final String short_desc; // one-liner description of metric. May be NULL private boolean sorted; public static final Color defaultBackground = new Color(0xef, 0xef, 0xef); private static final Color[] compareColors = { new Color(0xce, 0xce, 0xce), defaultBackground, Color.WHITE, new Color(0xd0, 0xfc, 0xff), new Color(0xff, 0xfa, 0xd0), new Color(0xea, 0xd0, 0xff), }; private final Color backgroundColor; private boolean hot = false; // Constructor public AnMetric(AnMetric bm) { type = bm.type; sub_type = bm.sub_type; clock = bm.clock; flavors = bm.flavors; value_styles = bm.value_styles; user_name = bm.user_name; legend = bm.legend; expr_spec = bm.expr_spec; aux = bm.aux; name = bm.name; abbr = bm.abbr; comd = bm.comd; unit = bm.unit; vis_bits = bm.vis_bits; valtype = bm.valtype; data_type_name = bm.data_type_name; data_type_uname = bm.data_type_uname; sorted = false; backgroundColor = getMetricBackgroundInternal(expr_spec); short_desc = bm.short_desc; } public AnMetric( int type, int sub_type, int clock, int flavors, int value_styles, String user_name, String expr_spec, String aux, String name, String abbr, String comd, String unit, String legend, int vis_bits, boolean sorted, int valtype, String data_type_name, String data_type_uname, String short_desc) { this.type = type; this.sub_type = sub_type; this.clock = clock; this.flavors = flavors; this.value_styles = value_styles; this.user_name = user_name; this.legend = legend; this.expr_spec = expr_spec; this.aux = aux; this.name = name; this.abbr = abbr; this.comd = comd; this.unit = unit; this.vis_bits = vis_bits; this.sorted = sorted; this.valtype = valtype; this.data_type_name = data_type_name; this.data_type_uname = data_type_uname; this.short_desc = short_desc; backgroundColor = getMetricBackgroundInternal(expr_spec); } // public int get_id() { return id; } public int getType() { return type; } public String getName() { return name; } public String getUserName() { return user_name == null ? name : user_name; } public String getDataTypeName() { return data_type_name; } public String getDataTypeUserName() { return data_type_uname; } public String getShortDesc() { return short_desc; } public String getAbbr() { return abbr; } public String getComd() { return comd; } public String getAux() { return aux; } public String getUnit() { return unit; } public int getSubType() { return sub_type; } public int get_valtype() { return valtype; } public int getClock() { return clock; } public int get_vis_bits() { return vis_bits; } public boolean isSorted() { return sorted; } public boolean isTimeMetric() { return (value_styles & VAL_TIMEVAL) != 0; } public boolean isValMetric() { return (value_styles & VAL_VALUE) != 0; } public boolean isNameMetric() { return (type == METRIC_TYPE_ONAME); } public boolean isStatic() { return (flavors & STATIC) != 0; } public boolean canExclusive() { return (flavors & EXCLUSIVE) != 0; } public boolean canInclusive() { return (flavors & INCLUSIVE) != 0; } public boolean canPercent() { return (value_styles & VAL_PERCENT) != 0; } @Override public String toString() { return getUserName(); } // public void set_id(int _id) { id = _id; } public void setSubType(int t) { sub_type = t; } public void setSorted(boolean set) { sorted = set; } public boolean isHidden() { return (vis_bits & VAL_HIDE_ALL) != 0; } public void set_hidden(boolean hide_all) { vis_bits &= ~(VAL_HIDE_ALL); if (hide_all) { vis_bits |= VAL_HIDE_ALL; } } public boolean isPVisible() { if (isHidden()) { return false; } return (vis_bits & VAL_PERCENT) != 0; } public boolean isVVisible() { if (isHidden()) { return false; } if (is_time_val()) { return (vis_bits & VAL_VALUE) != 0; } else if (isValMetric()) { return (vis_bits & (VAL_VALUE | VAL_TIMEVAL)) != 0; } return false; } public boolean isTVisible() { if (isHidden()) { return false; } if (is_time_val()) { return (vis_bits & VAL_TIMEVAL) != 0; } else if (isTimeMetric()) { return (vis_bits & (VAL_VALUE | VAL_TIMEVAL)) != 0; } return false; } public void set_vis_bits(boolean tvis, boolean vvis, boolean pvis) { int v = 0; if (is_time_val()) { if (tvis) { v |= VAL_TIMEVAL; } if (vvis) { v |= VAL_VALUE; } } else if ((vvis || tvis)) { v |= VAL_VALUE; } if (pvis && canPercent()) { v |= VAL_PERCENT; } vis_bits &= ~(VAL_VALUE | VAL_TIMEVAL | VAL_PERCENT); vis_bits |= v; } public boolean is_time_val() { final int v = VAL_TIMEVAL | VAL_VALUE; return (value_styles & v) == v; } private static Hashtable<String, Integer> simulatedGroupIds = new Hashtable<String, Integer>(); private Color getMetricBackgroundInternal( String expr_spec) { // YXXX should use group id value from dbe if (expr_spec == null) { return defaultBackground; } Integer simulatedGroupId; if (!simulatedGroupIds.containsKey(expr_spec)) { simulatedGroupId = simulatedGroupIds.size() + 1; simulatedGroupIds.put(expr_spec, simulatedGroupId); } else { simulatedGroupId = simulatedGroupIds.get(expr_spec); } return getMetricBackground(simulatedGroupId); } public Color getMetricBackground() { return backgroundColor; } public static Color getMetricBackground(int groupId) { if (groupId < 1) { return defaultBackground; } int ii = (groupId - 1) % compareColors.length; return compareColors[ii]; } private int compareTo(String a, String b) { if (a == null) { return b == null ? 0 : -1; } else { return b == null ? 1 : a.compareTo(b); } } public boolean equals(AnMetric m) { if (m == null) { return false; } return (getType() == m.getType()) && (getSubType() == m.getSubType()) && (compareTo(getUserName(), m.getUserName()) == 0) && (compareTo(expr_spec, m.expr_spec) == 0); } public int indexIn(List<AnMetric> mlist) { for (int i = 0; i < mlist.size(); i++) { if (equals(mlist.get(i))) { return i; } } return -1; } public CompareMode getCompareMode() { if ((expr_spec == null) || expr_spec.equalsIgnoreCase("EXPGRID==1")) { return CompareMode.CMP_DISABLE; } CompareMode mode = AnWindow.getInstance().getSettings().getCompareModeSetting().get(); return mode; } // flavors bits: (should match BaseMetric.h) public static final int STATIC = 1; public static final int EXCLUSIVE = 2; public static final int INCLUSIVE = 4; // ValueTag (should match dbe_structs.h and AnVariable.java) // public final static int VT_SHORT = 1; // unused public static final int VT_INT = 2; public static final int VT_LLONG = 3; // public final static int VT_FLOAT = 4; // unused public static final int VT_DOUBLE = 5; // public final static int VT_HRTIME = 6; // unused public static final int VT_LABEL = 7; public static final int VT_ADDRESS = 8; // unused // public final static int VT_OFFSET = 9; // unused public static final int VT_ULLONG = 10; // vis_bits (should match enums.h) public static final int VAL_NA = 0; public static final int VAL_TIMEVAL = 1; public static final int VAL_VALUE = 2; public static final int VAL_PERCENT = 4; public static final int VAL_DELTA = 8; public static final int VAL_RATIO = 16; public static final int VAL_HIDE_ALL = 64; // metric types (should match BaseMetric.h) //YXXX TBR, yuck public static final int METRIC_TYPE_ONAME = 1; public static final int METRIC_TYPE_USER_CPU_TIME = 9; public static final int METRIC_TYPE_LOCK_WAIT_TIME = 19; // aka "LWT" public boolean isHot() { return hot; } public void setHot(boolean hot) { this.hot = hot; } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/��������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�016153� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ViewPanel.form������������������������������������������0000644�0001750�0001750�00000005450�14744453367�020672� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <NonVisualComponents> <Component class="javax.swing.ButtonGroup" name="buttonGroup1"> </Component> </NonVisualComponents> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="nameLabel"> <Properties> <Property name="text" type="java.lang.String" value="Functions"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="6" insetsBottom="6" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/NavigationPanel.java������������������������������������0000644�0001750�0001750�00000012464�14744453367�022040� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.compare.CompareNavigationPanel; import org.gprofng.mpmt.filter.FilterNavigationPanel; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.util.gui.AnJScrollPane; import org.gprofng.mpmt.util.gui.AnSplitPane; import org.gprofng.mpmt.util.gui.AnSplitPaneFixedRightSize; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JScrollPane; public class NavigationPanel extends JPanel { private static boolean compareStatusPanelShowing = false; private static int heightOfCompareStatusPanel = 0; private AnWindow anWindow; private AnJScrollPane scrollPane; private ViewsPanel viewsPanel; private TopNavigationPanel topNavigationPanel; private AnSplitPaneFixedRightSize navigationSplitPane; private FilterNavigationPanel filterNavigationPanel; private CompareNavigationPanel compareNavigationPanel; public NavigationPanel(AnWindow anWindow) { this.anWindow = anWindow; setLayout(new GridBagLayout()); setBackground(AnEnvironment.DEFAULT_BACKGROUND_COLOR); JPanel viewsNavigationPanel = new JPanel(); viewsNavigationPanel.setBorder( BorderFactory.createMatteBorder(0, 0, 0, 1, AnEnvironment.NAVIGATION_PANEL_BORDER_COLOR)); viewsNavigationPanel.setLayout(new BorderLayout()); // Top Navigation area topNavigationPanel = new TopNavigationPanel(anWindow); viewsNavigationPanel.add(topNavigationPanel, BorderLayout.NORTH); // View Panels scrollPane = new AnJScrollPane(); viewsPanel = new ViewsPanel(scrollPane); // viewPanels.setViewPanelOrderList(UserPref.getInstance().getViewPanelOrder()); scrollPane.setBorder(null); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(viewsPanel); scrollPane.setMinimumSize(new Dimension(0, 50)); scrollPane.getVerticalScrollBar().setUnitIncrement(16); viewsNavigationPanel.add(scrollPane, BorderLayout.CENTER); filterNavigationPanel = new FilterNavigationPanel(anWindow); compareNavigationPanel = new CompareNavigationPanel(); JPanel filterCompareNavigationPanel = new JPanel(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; filterCompareNavigationPanel.add(filterNavigationPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; filterCompareNavigationPanel.add(compareNavigationPanel, gridBagConstraints); navigationSplitPane = new AnSplitPaneFixedRightSize( AnSplitPane.VERTICAL_SPLIT, viewsNavigationPanel, filterCompareNavigationPanel, UserPref.getInstance().getNavigationFilterSplitPane().getSize(), UserPref.getInstance().getNavigationFilterSplitPane().getDefaultSize()); navigationSplitPane.setOneTouchExpandable(false); navigationSplitPane.setDividerSize(2); navigationSplitPane.setBackground(AnEnvironment.NAVIGATION_SPLIT_PANE_DIVIDER_COLOR); // filterPanel.setBackground(Color.red); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(navigationSplitPane, gridBagConstraints); setMinimumSize(new Dimension(5, 5)); // so the divider can be moved all the way to the left } public void adjustCompareNavigationPanelHeightChanged(int diff) { int now = navigationSplitPane.getDividerLocation(); navigationSplitPane.setDividerLocationInternal(now - diff); } /** * @return the panel holding all the views */ public ViewsPanel getViewsPanel() { return viewsPanel; } public int getNavigationSplitPaneSizeInPixels() { int sizeInPixels = navigationSplitPane.getSizeInPixels(); sizeInPixels -= compareNavigationPanel.getDiffFromInitialHeight(); return sizeInPixels; } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/PanelDropTargetListener.java����������������������������0000644�0001750�0001750�00000004434�14744453367�023520� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; public class PanelDropTargetListener implements DropTargetListener { private ViewsPanel sidePanel = null; public PanelDropTargetListener(ViewsPanel sidePanel) { this.sidePanel = sidePanel; } // @Override @Override public void dragEnter(DropTargetDragEvent dtde) {} // @Override @Override public void dragOver(DropTargetDragEvent dtde) {} // @Override @Override public void dropActionChanged(DropTargetDragEvent dtde) {} // @Override @Override public void dragExit(DropTargetEvent dte) {} @Override public void drop(DropTargetDropEvent dtde) { DataFlavor dadPanelFlavor = null; Object transferableObj = null; Component targetComponent = null; Transferable transferable = null; try { dadPanelFlavor = ViewPanel.getDADDataFlavor(); transferable = dtde.getTransferable(); DropTargetContext c = dtde.getDropTargetContext(); targetComponent = c.getComponent(); if (transferable.isDataFlavorSupported(dadPanelFlavor)) { transferableObj = dtde.getTransferable().getTransferData(dadPanelFlavor); } } catch (Exception e) { } if (transferableObj == null) { return; } ViewPanel droppedPanel = (ViewPanel) transferableObj; sidePanel.dropPanelTo(droppedPanel, targetComponent); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ViewsPanel.java�����������������������������������������0000644�0001750�0001750�00000101117�15044710303�021004� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.AnWindow.AnDispTab; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.persistence.UserPref.ViewPanelOrder; import org.gprofng.mpmt.settings.ViewsSetting; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BasicStroke; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Rectangle; import java.awt.dnd.DragSource; import java.awt.dnd.DragSourceDragEvent; import java.awt.dnd.DragSourceDropEvent; import java.awt.dnd.DragSourceEvent; import java.awt.dnd.DragSourceListener; import java.awt.dnd.DropTarget; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import java.util.Stack; import javax.swing.AbstractAction; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JToolTip; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public class ViewsPanel extends javax.swing.JPanel { private List<ViewPanel> viewPanelList = new ArrayList<>(); private List<ViewPanel> viewPanelOriginalOrder = new ArrayList<>(); private int dropLine = -1; private static final int dropLineOffset = 0; private int gridY = 2; private JDialog viewsSelectorDialog = null; private JPopupMenu viewsSelectorpopup = null; private Point cancelPoint = null; // private List<ViewPanelOrder> viewPanelOrderList = null; private ViewPanel defaultViewPanel = null; private JScrollPane scrollPane; private ActionPanel moreViewsPanel; private static Integer maxMenus = null; private int keyboardFocusIndex = 0; private Stack<String> viewStack = new Stack<String>(); private int viewStackPointer = -1; public String dumpAvailableViews() { StringBuilder buf = new StringBuilder(); buf.append("--------------------------available views"); buf.append("\n"); for (ViewPanel viewPanel : viewPanelList) { buf.append((viewPanel.isShown() ? "*" : " ") + viewPanel.getView().getDisplayName()); buf.append("\n"); } return buf.toString(); } public ViewsPanel(JScrollPane scrollPane) { this.scrollPane = scrollPane; initComponents(); moreViewsPanel = new ActionPanel( AnLocale.getString("More..."), AnLocale.getString("Add more views..."), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source instanceof MouseEvent) { // Mouse click MouseEvent me = (MouseEvent) e.getSource(); AnWindow.getInstance() .getViewsPanel() .showViewsConfigurationPopup( moreViewsPanel, me.getPoint().x + 5, me.getPoint().y + 5); } else if (source instanceof JComponent) { // Keyboard JComponent component = (JComponent) source; AnWindow.getInstance() .getViewsPanel() .showViewsConfigurationPopup( moreViewsPanel, component.getX() + component.getWidth() - 5, component.getY() - 5); } } }); setBackground( AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR /*AnEnvironment.DEFAULT_PANEL_BACKGROUND*/); setDropTarget(new DropTarget(this, new PanelDropTargetListener(this))); DragSource.getDefaultDragSource() .addDragSourceListener( new DragSourceListener() { // @Override @Override public void dragDropEnd(DragSourceDropEvent dsde) { // System.out.println("DragSource:dragDropEnd: " + // dsde.getDragSourceContext().getComponent()); if (dsde.getDragSourceContext().getComponent() instanceof ViewPanel) { dropLine = -1; repaint(); } } // @Override @Override public void dragExit(DragSourceEvent dse) { // System.out.println("DragSource:dragExit: " + dse); if (dse.getDragSourceContext().getComponent() instanceof ViewPanel) { dropLine = -1; repaint(); } } // @Override @Override public void dragEnter(DragSourceDragEvent dsde) { // System.out.println("DragSource:dragEnter: " + dsde); if (dsde.getDragSourceContext().getComponent() instanceof ViewPanel) { // This is the right kind of drop object int y1 = 0; int y2 = 0; for (int i = 0; i < viewPanelList.size(); i++) { ViewPanel viewPanel = viewPanelList.get(i); if (!viewPanel.isShown()) { continue; } y1 = viewPanelList.get(i).getLocationOnScreen().y; y2 = y1 + viewPanelList.get(i).getHeight(); if (dsde.getLocation().y >= y1 && dsde.getLocation().y <= y2) { dropLine = y1 - getYLocationOnScreenOfFirstShownView(); break; } } if (dropLine < 0) { dropLine = y2 - getYLocationOnScreenOfFirstShownView(); } repaint(); } } private int getYLocationOnScreenOfFirstShownView() { int y = 0; for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.isShowing()) { y = viewPanel.getLocationOnScreen().y; break; } } return y; } @Override public void dragOver(DragSourceDragEvent dsde) {} @Override public void dropActionChanged(DragSourceDragEvent dsde) {} }); addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { showViewsConfigurationPopup(ViewsPanel.this, e.getPoint().x + 5, e.getPoint().y + 5); } } }); // A11Y KeyStroke keyStroke = KeyboardShortcuts.contextMenuActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap() .put( keyStroke, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { final Point loc1 = MouseInfo.getPointerInfo().getLocation(); final Point loc2 = getLocationOnScreen(); showViewsConfigurationPopup( ViewsPanel.this, loc1.x - loc2.x + 5, loc1.y - loc2.y + 5); } }); getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getInputMap(JComponent.WHEN_FOCUSED) .put(KeyboardShortcuts.helpActionShortcut, KeyboardShortcuts.helpActionShortcut); getActionMap() .put( KeyboardShortcuts.helpActionShortcut, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { ViewPanel viewPanel = getHasKeyboardFocus(); if (viewPanel != null) { // Show help for current keyboard focus String name = viewPanel.getView().getName(); ViewsSetting.View view = AnWindow.getInstance().getSettings().getViewsSetting().findView(name); if (view != null) { view.getAnDispTab().getTComp().showHelp(); return; } } // Show help for current showing AnWindow.getInstance().getViews().getCurrentViewDisplay().showHelp(); } }); addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { handleKeyEvent(e); } }); addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { keyboardFocusIndex = getSelected(); makeVisible(keyboardFocusIndex); viewPanelList.get(keyboardFocusIndex).setKeyboardFocused(true); viewPanelList.get(keyboardFocusIndex).repaint(); } @Override public void focusLost(FocusEvent e) { resetKeyboardFocus(); } }); } void handleKeyEvent(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP) { if (keyboardFocusIndex >= 0 && keyboardFocusIndex < viewPanelList.size()) { viewPanelList.get(keyboardFocusIndex).setKeyboardFocused(false); viewPanelList.get(keyboardFocusIndex).repaint(); } else { moreViewsPanel.setKeyboardFocused(false); moreViewsPanel.repaint(); } if (e.getKeyCode() == KeyEvent.VK_DOWN) { keyboardFocusIndex = nextKeyboardFocused(keyboardFocusIndex); } else if (e.getKeyCode() == KeyEvent.VK_UP) { keyboardFocusIndex = previousKeyboardFocused(keyboardFocusIndex); } if (keyboardFocusIndex >= 0 && keyboardFocusIndex < viewPanelList.size()) { viewPanelList.get(keyboardFocusIndex).setKeyboardFocused(true); viewPanelList.get(keyboardFocusIndex).repaint(); } else { moreViewsPanel.setKeyboardFocused(true); moreViewsPanel.repaint(); } e.consume(); makeVisible(keyboardFocusIndex); } else if (e.getKeyCode() == KeyEvent.VK_SPACE || e.getKeyCode() == KeyEvent.VK_ENTER) { if (keyboardFocusIndex < viewPanelList.size()) { ViewPanel viewPanel = viewPanelList.get(keyboardFocusIndex); String name = viewPanel.getView().getName(); AnWindow.getInstance().setSelectedView(name); } else { moreViewsPanel.performAction(); } e.consume(); } } private int getRelativeYLocation(int index) { int y = 0; for (int i = 0; i < index; i++) { ViewPanel viewPanel = viewPanelList.get(i); if (viewPanel.isShowing()) { y += viewPanel.getHeight(); } } return y; } private void makeVisible(int index) { int y = getRelativeYLocation(index); Rectangle rectangle = new Rectangle(0, y - 5, 10, ViewPanel.getPanelHeight() + 10); scrollRectToVisible(rectangle); } private int previousKeyboardFocused(int currentKeyboardFocusIndex) { int n = currentKeyboardFocusIndex - 1; while (n >= 0 && !viewPanelList.get(n).isShown()) { n--; } if (n >= 0) { return n; } else { return currentKeyboardFocusIndex; } } private int nextKeyboardFocused(int currentKeyboardFocusIndex) { int n = currentKeyboardFocusIndex + 1; while (n < viewPanelList.size() && !viewPanelList.get(n).isShown()) { n++; } if (n < viewPanelList.size()) { return n; } else { return viewPanelList.size(); } } private void resetKeyboardFocus() { for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.hasKeyboardFocus()) { viewPanel.setKeyboardFocused(false); viewPanel.repaint(); } } if (moreViewsPanel.hasKeyboardFocus()) { moreViewsPanel.setKeyboardFocused(false); moreViewsPanel.repaint(); } keyboardFocusIndex = -1; } public ViewPanel getHasKeyboardFocus() { for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.hasKeyboardFocus()) { return viewPanel; } } return null; } public ViewPanel getIsFocused() { for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.isFocused()) { return viewPanel; } } return null; } public ViewPanel getIsSelected() { for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.isSelected()) { return viewPanel; } } return null; } @Override public void paint(Graphics g) { super.paint(g); if (dropLine >= 0) { g.setColor(AnEnvironment.DROP_LINE_COLOR); Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(2)); g.drawLine(0, dropLine + dropLineOffset, getSize().width, dropLine + dropLineOffset); } int i; for (i = viewPanelList.size() - 1; i >= 0; i--) { ViewPanel viewPanel = viewPanelList.get(i); if (viewPanel.isShown()) { break; } } } private JComponent addViewPanelInternal(JComponent viewPanel) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = gridY++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weightx = 1.0; add(viewPanel, gridBagConstraints); return viewPanel; } private void removeAllPanel() { for (ViewPanel vp : viewPanelList) { remove(vp); } remove(moreViewsPanel); } // API begin ---------------------------------------------------- public void removeAllViews() { removeAllPanel(); viewPanelList.clear(); viewPanelOriginalOrder.clear(); relayout(); defaultViewPanel = null; emptyViewStack(); } public void createView(AnWindow anWindow, AnDispTab anDispTab, View.Type type) { // System.out.println("ViewPanels:createView: " + anDispTab.getTCmd()); if (findIndexViewPanel(anDispTab.getTCmd()) >= 0) { // Already there... return; } View view = new View( anDispTab.getTCmd(), anDispTab.getTName(), anDispTab.getShortDescr(), anDispTab.getLongDesc(), anWindow, type, null /*View.generateIconPath()*/); int oldPosition = -1; int thisPostion = 0; // anWindow.presentation may be null if IPC is not started yet boolean showTab = false; if (Analyzer.getInstance().IPC_started) { showTab = anWindow.getSettings().getViewsSetting().isAvailableAndShowing(anDispTab.getTCmd()); } if (getSavedViewPanelOrderList() != null && !getSavedViewPanelOrderList().isEmpty()) { int index = 0; for (ViewPanelOrder cpo : getSavedViewPanelOrderList()) { if (cpo.getName().equals(anDispTab.getTCmd())) { oldPosition = index; showTab = cpo.isShown(); break; } index++; } for (; thisPostion < viewPanelList.size(); thisPostion++) { if (viewPanelList.get(thisPostion).getPosition() > oldPosition) { break; } } } if (oldPosition == -1) { oldPosition = viewPanelList.size(); thisPostion = viewPanelList.size(); } ViewPanel viewPanel = new ViewPanel(view); viewPanel.setPosition(oldPosition); viewPanel.setSidePanel(this); viewPanel.setShown(showTab); viewPanelList.add(thisPostion, viewPanel); viewPanelOriginalOrder.add(viewPanel); // Make the first standard tab the default view to select. if (defaultViewPanel == null && type == View.Type.STANDARD) { defaultViewPanel = viewPanel; } } public ViewPanel getDefaultViewPanel() { return defaultViewPanel; } public void resetAllViews() { removeAllPanel(); for (ViewPanel viewPanel : viewPanelList) { viewPanel.setShown(false); } relayout(); } public void showView(AnDispTab anDispTab) { ViewPanel viewPanel = findViewPanel(anDispTab.getTCmd()); if (viewPanel != null) { viewPanel.setShown(true); } } public void refresh() { // int i = getSelected(); // if (i < 0 || !viewPanelList.get(i).isShown()) { // for (ViewPanel viewPanel : viewPanelList) { // if (viewPanel.isShown()) { // setSelected(viewPanel, true); // break; // } // } // } relayout(); getScrollPane().setVisible(viewPanelList.size() > 1); } public void setSelectedComponent(String cmd) { // System.out.println("ViewsPanel setSelectedComponent " + cmd); for (int i = 0; i < viewPanelList.size(); i++) { ViewPanel viewPanel = viewPanelList.get(i); if (viewPanel.getView().getName().equals(cmd)) { if (!viewPanel.isSelected()) { setSelected(i); } makeVisible(i); if (viewStackPointer >= 0 && viewStackPointer < viewStack.size() && viewStack.elementAt(viewStackPointer).equals(cmd)) { // nothing, just moving up or down the stack } else { // start a 'new' stack pushViewToViewStack(cmd); } break; } } } public void moveViewStackPointer(int x) { viewStackPointer = viewStackPointer + x; } private void emptyViewStack() { viewStack.removeAllElements(); viewStackPointer = -1; } private void pushViewToViewStack(String cmd) { if (viewStackPointer != (viewStack.size() - 1)) { for (int index = viewStack.size() - 1; index > viewStackPointer; index--) { viewStack.remove(index); } } viewStack.push(cmd); viewStackPointer++; } public String nextViewName() { String nextViewName = null; if (viewStack.size() > 0 && (viewStackPointer + 1) >= 0 && (viewStackPointer + 1) < viewStack.size()) { nextViewName = viewStack.elementAt(viewStackPointer + 1); } return nextViewName; } public String previousViewName() { String previousViewName = null; if (viewStack.size() > 0 && (viewStackPointer - 1) >= 0 && (viewStackPointer - 1) < viewStack.size()) { previousViewName = viewStack.elementAt(viewStackPointer - 1); } return previousViewName; } public boolean hasNextViewName() { String nextViewName = nextViewName(); return nextViewName != null; } public boolean hasPreviousViewName() { String previousViewName = previousViewName(); return previousViewName != null; } /** * Called when saving to user pref * * @return */ public List<ViewPanelOrder> getViewPanelOrderPref() { if (viewPanelList == null || viewPanelList.isEmpty()) { return getSavedViewPanelOrderList(); // from user pref. } List<ViewPanelOrder> list = new ArrayList<>(); for (ViewPanel viewPanel : viewPanelList) { list.add(new ViewPanelOrder(viewPanel.getView().getName(), viewPanel.isShown())); } return list; } public boolean onlyStaticViews() { boolean ret = true; for (ViewPanel viewPanel : viewPanelList) { if (viewPanel.getView().getType() != View.Type.STATIC_VIEW) { ret = false; break; } } return ret; } public boolean onlyWelcomeView() { boolean ret = true; for (ViewPanel viewPanel : viewPanelList) { if (!viewPanel.getView().getName().equals("welcome")) { ret = false; break; } } return ret; } // API end ---------------------------------------------------- private void relayout() { gridY = 2; for (ViewPanel vp : viewPanelList) { if (vp.isShown()) { addViewPanelInternal(vp); } } addViewPanelInternal(moreViewsPanel); refreshInternal(); } private void refreshInternal() { validate(); repaint(100); } private int findViewPanel(ViewPanel viewPanel) { int i = 0; for (i = 0; i < viewPanelList.size(); i++) { if (viewPanelList.get(i) == viewPanel) { return i; } } return -1; } private ViewPanel findViewPanel(String name) { for (int i = 0; i < viewPanelList.size(); i++) { if (viewPanelList.get(i).getView().getName().equals(name)) { return viewPanelList.get(i); } } return null; } private int findIndexViewPanel(String name) { for (int i = 0; i < viewPanelList.size(); i++) { if (viewPanelList.get(i).getView().getName().equals(name)) { return i; } } return -1; } public void addViewPanelAt(int index, ViewPanel viewPanel) { viewPanel.setSidePanel(this); viewPanelList.add(index, viewPanel); removeAllPanel(); relayout(); } public void removeViewPanel(ViewPanel viewPanel) { viewPanel.setShown(false); removeAllPanel(); relayout(); if (viewPanel.isSelected()) { for (ViewPanel vp : viewPanelList) { if (vp.isShown() && vp != viewPanel) { setSelected(vp, true); break; } } } } protected void setSelected(ViewPanel viewPanel, boolean performAction) { if (viewsSelectorDialog != null && viewsSelectorDialog.isVisible()) { viewsSelectorDialog.setVisible(false); viewsSelectorDialog = null; } for (ViewPanel vp : viewPanelList) { vp.setSelected(vp == viewPanel); if (performAction && vp == viewPanel) { View view = viewPanel.getView(); viewPanel.getView().getAnWindow().setSelectedView(view.getName()); } } } public int getSelected() { int sel = -1; int i = 0; for (ViewPanel vp : viewPanelList) { if (vp.isSelected()) { sel = i; } i++; } return sel; } public ViewPanel getSelectedViewPanel() { ViewPanel sel = null; for (ViewPanel vp : viewPanelList) { if (vp.isSelected()) { sel = vp; break; } } return sel; } private void setSelected(int panelNo) { ViewPanel vp = viewPanelList.get(panelNo); setSelected(vp, false); } protected void dropPanelTo(ViewPanel dropViewPanel, Component dropTargetComponent) { int moveFromIndex = findViewPanel(dropViewPanel); int moveToIndex; if (dropTargetComponent instanceof ViewPanel) { ViewPanel targetPanel = (ViewPanel) dropTargetComponent; moveToIndex = findViewPanel(targetPanel); } else { moveToIndex = viewPanelList.size(); while (moveToIndex > 0 && !viewPanelList.get(moveToIndex - 1).isShown()) { moveToIndex--; } } if (moveToIndex < 0) { // something is wrong return; } if (moveFromIndex == moveToIndex) { return; } if (moveFromIndex >= 0) { viewPanelList.remove(moveFromIndex); } if (moveFromIndex < moveToIndex) { moveToIndex--; } addViewPanelAt(moveToIndex, dropViewPanel); refreshInternal(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; filler1 = new javax.swing.Box.Filler( new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 100; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.weighty = 1.0; add(filler1, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents public void toggleViewsConfigurationPopup(Component component, int x, int y) { Point mouseLocation = MouseInfo.getPointerInfo().getLocation(); if (cancelPoint != null && mouseLocation.x == cancelPoint.x && mouseLocation.y == cancelPoint.y) { cancelPoint = null; return; } showViewsConfigurationPopup(component, x, y); cancelPoint = null; } public void showViewsConfigurationPopup(Component component, int x, int y) { ViewPanel viewPanel; viewPanel = getHasKeyboardFocus(); if (viewPanel == null) { viewPanel = getIsFocused(); } if (viewPanel == null) { viewPanel = getIsSelected(); } viewsSelectorpopup = getViewSelectorPopup(viewPanel != null ? viewPanel.getView() : null); viewsSelectorpopup.show(component, x, y); } private int maxMenus() { if (maxMenus == null) { JPopupMenu popup = new JPopupMenu(); for (int i = 0; i < 10; i++) { popup.add(new JMenu("XXX")); } int height = popup.getPreferredSize().height; maxMenus = AnVariable.SCREEN_SIZE.height / height * 10 - 5; } return maxMenus; } private JPopupMenu getViewSelectorPopup(final View view) { JPopupMenu popup = new JPopupMenu(); JMenu moreMenu = new JMenu(AnLocale.getString("More...")); if (view != null) { String txt = String.format(AnLocale.getString("Help %s View"), view.getDisplayName()); JMenuItem helpMenuItem = new JMenuItem(txt); helpMenuItem.setMnemonic(AnLocale.getString('H', "HelpMenuInViewContextMenu")); helpMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ViewsSetting.View view2 = AnWindow.getInstance().getSettings().getViewsSetting().findView(view.getName()); if (view2 != null) { view2.getAnDispTab().getTComp().showHelp(); } } }); popup.add(helpMenuItem); popup.add(new JSeparator()); } int count = 0; for (ViewPanel viewPanel : viewPanelList) { if (count > maxMenus()) { moreMenu.add(addViewSelector(viewPanel)); } else { popup.add(addViewSelector(viewPanel)); } count++; } if (moreMenu.getSubElements().length > 0) { // popup.addSeparator(); popup.add(moreMenu); } popup.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} @Override public void popupMenuCanceled(PopupMenuEvent e) { cancelPoint = MouseInfo.getPointerInfo().getLocation(); } }); return popup; } private JCheckBoxMenuItem addViewSelector(final ViewPanel viewPanel) { JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(viewPanel.getView().getDisplayName()); checkBox.setSelected(viewPanel.isShown()); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String preferredViewName; if (viewPanel.isShown()) { preferredViewName = AnWindow.getInstance().getViews().getCurrentViewName(); } else { preferredViewName = viewPanel.getView().getName(); } AnWindow.getInstance() .getSettings() .getViewsSetting() .toggleTab(viewPanel.getView().getName(), preferredViewName); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { refreshInternal(); } }); } }); return checkBox; } private class MenuItem extends JMenuItem { public MenuItem(String text) { super(text); } @Override public JToolTip createToolTip() { JToolTip toolTip = super.createToolTip(); toolTip.setBackground(AnEnvironment.TOOLTIP_VIEW_BACKGROUND_COLOR); return toolTip; } } public void createViewsMenu(JMenu viewsMenu) { int count = 0; JMenu moreMenu = new JMenu(AnLocale.getString("More...")); viewsMenu.removeAll(); if (!viewPanelOriginalOrder.isEmpty()) { View.Type type = viewPanelOriginalOrder.get(0).getView().getType(); for (ViewPanel viewPanel : viewPanelOriginalOrder) { JMenuItem menuItem = new MenuItem(viewPanel.getView().getDisplayName()); // menuItem.setToolTipText(viewPanel.getView().getLongDescr()); menuItem.addActionListener(new ViewMenuActionListener(viewPanel)); if (count > maxMenus()) { moreMenu.add(menuItem); } else { if (viewPanel.getView().getType() != type) { viewsMenu.addSeparator(); } viewsMenu.add(menuItem); type = viewPanel.getView().getType(); } count++; } if (moreMenu.getSubElements().length > 0) { // viewsMenu.addSeparator(); viewsMenu.add(moreMenu); } } viewsMenu.add(new JSeparator(SwingConstants.HORIZONTAL)); JMenuItem previousViewMenuItem = AnWindow.getInstance().getPreviousViewAction().getMenuItem(); previousViewMenuItem.setIcon(null); viewsMenu.add(previousViewMenuItem); JMenuItem nextViewMenuItem = AnWindow.getInstance().getNextViewAction().getMenuItem(); nextViewMenuItem.setIcon(null); viewsMenu.add(nextViewMenuItem); for (JComponent component : AnWindow.getInstance().getSettings().getViewsSetting().createViewsSettingsSelector()) { viewsMenu.add(component); } } /** * @return the scrollPane */ public JScrollPane getScrollPane() { return scrollPane; } public void selectView(String name) { ViewPanel viewPanel = findViewPanel(name); if (viewPanel != null) { selectView(viewPanel); } } private void selectView(ViewPanel viewPanel) { if (!viewPanel.isShown()) { AnWindow.getInstance() .getSettings() .getViewsSetting() .toggleTab(viewPanel.getView().getName(), viewPanel.getView().getName()); } else { setSelected(viewPanel, true); } } /** * @return the viewPanelOrderList */ public List<ViewPanelOrder> getSavedViewPanelOrderList() { return AnWindow.getInstance().getSettings().getViewsSetting().getSavedViewOrderList(); } class ViewMenuActionListener implements ActionListener { private ViewPanel viewPanel; public ViewMenuActionListener(ViewPanel viewPanel) { this.viewPanel = viewPanel; } @Override public void actionPerformed(ActionEvent e) { selectView(viewPanel); } } class MoreViewsPanel extends JPanel { public MoreViewsPanel() { setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); JLabel label = new JLabel("More Views..."); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); gridBagConstraints.insets = new Insets(4, 4, 4, 4); add(label, gridBagConstraints); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.Box.Filler filler1; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/TopNavigationPanel.java���������������������������������0000644�0001750�0001750�00000015403�14744453367�022517� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.event.MouseInputAdapter; public class TopNavigationPanel extends javax.swing.JPanel { private AnWindow anWindow; private JButton previousViewButton; private JButton nextViewButton; /** Creates new form TopNavigationPanel */ public TopNavigationPanel(final AnWindow anWindow) { this.anWindow = anWindow; initComponents(); previousViewButton = AnWindow.getInstance().getPreviousViewAction().createActionButton(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.LINE_END; add(previousViewButton, gridBagConstraints); nextViewButton = AnWindow.getInstance().getNextViewAction().createActionButton(); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(0, 2, 0, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_END; add(nextViewButton, gridBagConstraints); label.setFont(label.getFont().deriveFont(Font.BOLD)); setBackground(AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); // seperator.setForeground(AnEnvironment.VIEW_SELECTED_BORDER_COLOR); setBorder( BorderFactory.createMatteBorder( 0, 0, 1, 0, AnEnvironment.NAVIGATION_SPLIT_PANE_DIVIDER_COLOR)); label.setText(AnLocale.getString("Views")); AnUtility.setAccessibleContext(label.getAccessibleContext(), label.getText()); label.setDisplayedMnemonic(AnLocale.getString('W', "MainPanelViewsMN")); label.setLabelFor(showTabConfigurationButton); // label.setFont(label.getFont().deriveFont(((float)label.getFont().getSize()+1))); showTabConfigurationButton.setBackground( AnEnvironment.NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR); showTabConfigurationButton.setToolTipText(AnLocale.getString("More views...")); showTabConfigurationButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { anWindow .getViewsPanel() .toggleViewsConfigurationPopup(showTabConfigurationButton, 15, 15); } }); showTabConfigurationButton.addMouseListener( new MouseInputAdapter() { @Override public void mouseEntered(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(true); btn.setContentAreaFilled(true); } } @Override public void mouseExited(MouseEvent evt) { JButton btn = (JButton) evt.getSource(); if (btn.isEnabled()) { btn.setBorderPainted(false); btn.setContentAreaFilled(false); } } }); addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { anWindow .getViewsPanel() .showViewsConfigurationPopup( TopNavigationPanel.this, e.getPoint().x + 5, e.getPoint().y + 5); } } }); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; label = new javax.swing.JLabel(); showTabConfigurationButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); label.setText("NOI18N"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); add(label, gridBagConstraints); showTabConfigurationButton.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/gprofng/mpmt/icons/more_icon.png"))); showTabConfigurationButton.setBorderPainted(false); showTabConfigurationButton.setMargin(new java.awt.Insets(1, 1, 1, 1)); showTabConfigurationButton.setOpaque(false); showTabConfigurationButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showTabConfigurationButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; add(showTabConfigurationButton, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void showTabConfigurationButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_showTabConfigurationButtonActionPerformed // showTabConfigurationActionPerformed(true, // showTabConfigurationButton.getLocation().x+10, // showTabConfigurationButton.getLocation().y+10); } // GEN-LAST:event_showTabConfigurationButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel label; private javax.swing.JButton showTabConfigurationButton; // End of variables declaration//GEN-END:variables } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ActionPanel.form����������������������������������������0000644�0001750�0001750�00000005237�14744453367�021200� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="nameLabel"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="6" insetsBottom="6" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ViewsPanel.form�����������������������������������������0000644�0001750�0001750�00000005626�14744453367�021062� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.Box$Filler" name="filler1"> <Properties> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[0, 32767]"/> </Property> </Properties> <AuxValues> <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalGlue"/> </AuxValues> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="100" gridWidth="1" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> ����������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ViewPanel.java������������������������������������������0000644�0001750�0001750�00000040746�14744453367�020657� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MouseInfo; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionListener; import java.net.URL; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JToolTip; import javax.swing.KeyStroke; import javax.swing.TransferHandler; public class ViewPanel extends javax.swing.JPanel implements MouseListener, MouseMotionListener, Transferable { private static Image removeImage = null; private static Image removeImageFocused = null; private Image buttonImage = null; private Image selectedArrowImage = null; private static int removeImageWidth = 0; private static int removeImageHeight = 0; private int removeImageXOffset = 4; private int removeImageYOffset = 8; private static int selectedArrowImageWidth = 0; private static int selectedArrowImageHeight = 0; private int selectedArrowXOffset = 4; private int selectedArrowYOffset = 8; private static int scrollbarWidth = 0; private View view; private ViewsPanel sidePanel; private boolean focused = false; private boolean selected = false; private boolean keyboardFocus = false; private boolean shown; private int position; private static Integer panelHeight = null; public ViewPanel(View view) { initComponents(); this.view = view; setBorder(null); nameLabel.setText(view.getDisplayName()); nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD)); AnUtility.setAccessibleContext(nameLabel.getAccessibleContext(), nameLabel.getText()); // nameLabel.setIcon(new javax.swing.ImageIcon(view.getImage())); setBackground( AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR /*AnEnvironment.DEFAULT_PANEL_BACKGROUND*/); addMouseListener(this); addMouseMotionListener(this); addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { final Point loc1 = MouseInfo.getPointerInfo().getLocation(); final Point loc2 = getLocationOnScreen(); sidePanel.showViewsConfigurationPopup( ViewPanel.this, loc1.x - loc2.x + 5, loc1.y - loc2.y + 5); } } }); // A11Y KeyStroke keyStroke = KeyboardShortcuts.contextMenuActionShortcut; getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(keyStroke, keyStroke); getActionMap() .put( keyStroke, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { final Point loc1 = MouseInfo.getPointerInfo().getLocation(); final Point loc2 = getLocationOnScreen(); sidePanel.showViewsConfigurationPopup( ViewPanel.this, loc1.x - loc2.x + 5, loc1.y - loc2.y + 5); } }); this.shown = false; if (panelHeight == null) { panelHeight = getPreferredSize().height; } } public View getView() { return view; } public void setSidePanel(ViewsPanel sidePanel) { this.sidePanel = sidePanel; addMouseMotionListener(new MouseDraggedListener()); setTransferHandler(new DADTransferHandler()); setDropTarget(new DropTarget(this, new PanelDropTargetListener(sidePanel))); } // @Override @Override public void mouseClicked(MouseEvent me) {} // @Override @Override public void mouseDragged(MouseEvent me) {} // @Override @Override public void mouseEntered(MouseEvent me) { focused = true; refresh(); } // @Override @Override public void mouseExited(MouseEvent me) { focused = false; refresh(); } // @Override @Override public void mouseReleased(MouseEvent me) {} public void setSelected(boolean selected) { this.selected = selected; refresh(); } private void refresh() { // Set background Color backgroundColor; if (isSelected()) { backgroundColor = AnEnvironment.VIEW_SELECTED_BACKGROUND_COLOR; } else if (focused) { backgroundColor = AnEnvironment.VIEW_FOCUSED_BACKGROUND_COLOR; } else { backgroundColor = AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR; } setBackground(backgroundColor); repaint(); } // @Override @Override public void mousePressed(MouseEvent me) { if (me.getButton() == MouseEvent.BUTTON1) { int scrollbarOffset = 0; // getScrollbarOffset(); int x = me.getPoint().x; int y = me.getPoint().y; if (x >= getSize().width - removeImageWidth - removeImageXOffset - scrollbarOffset && x <= getSize().width - removeImageXOffset - scrollbarOffset && y >= removeImageYOffset && y <= removeImageHeight + removeImageYOffset) { closeButtonActionPerformed(null); } else { sidePanel.setSelected(this, true); } } } @Override public JToolTip createToolTip() { JToolTip toolTip = super.createToolTip(); toolTip.setBackground(AnEnvironment.TOOLTIP_VIEW_BACKGROUND_COLOR); return toolTip; } // @Override @Override public void mouseMoved(MouseEvent me) { Image newButtonImage; int scrollbarOffset = 0; // getScrollbarOffset(); int x = me.getPoint().x; int y = me.getPoint().y; if (x >= getSize().width - removeImageWidth - removeImageXOffset - scrollbarOffset && x <= getSize().width - removeImageXOffset - scrollbarOffset && y >= removeImageYOffset && y <= removeImageHeight + removeImageYOffset) { newButtonImage = getRemoveTabFocusedImage(); setToolTipText(AnLocale.getString("Remove this view")); } else { newButtonImage = getRemoveTabImage(); // setToolTipText(getView().getLongDescr()); } if (newButtonImage != getRemoveButtonImage()) { buttonImage = newButtonImage; repaint(); } } // private boolean isScrollbarShowing() { // return sidePanel.getScrollPane().getVerticalScrollBar().isShowing(); // } // private int getScrollbarWidth() { // if (scrollbarWidth == 0) { // scrollbarWidth = sidePanel.getScrollPane().getVerticalScrollBar().getWidth(); // } // return scrollbarWidth; // } // private int getScrollbarOffset() { // if (isScrollbarShowing()) { // return getScrollbarWidth(); // } // else { // return 0; // } // } @Override public void paint(Graphics g) { if (selected || focused) { Graphics2D g2d = (Graphics2D) g; // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_ON); Color topColor = selected ? AnEnvironment.VIEW_SELECTED_TOP_COLOR : AnEnvironment.VIEW_FOCUSED_TOP_COLOR; Color bottomColor = selected ? AnEnvironment.VIEW_SELECTED_BOTTOM_COLOR : AnEnvironment.VIEW_FOCUSED_BOTTOM_COLOR; GradientPaint gp = new GradientPaint(0, 0, topColor, 0, getHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight()); // Set border Color borderColor; if (selected || focused) { borderColor = AnEnvironment.VIEW_SELECTED_BORDER_COLOR; } else { borderColor = AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR; } g.setColor(borderColor); g.drawLine(0, 0, getWidth(), 0); g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); setOpaque(false); } else { setOpaque(true); } super.paint(g); int scrollbarOffset = 0; // getScrollbarOffset(); // FIXUP: doesn't affect rendering here anymore ? if (focused) { g.drawImage( getRemoveButtonImage(), getSize().width - removeImageWidth - removeImageXOffset - scrollbarOffset, removeImageYOffset, this); } else if (selected) { g.drawImage( getSelectedArrowImage(), getSize().width - selectedArrowImageWidth - selectedArrowXOffset - scrollbarOffset, selectedArrowYOffset, this); } String labelText = displayText(g, view.getDisplayName(), true); nameLabel.setText(labelText); setToolTipText(null); if (labelText.endsWith("...")) { setToolTipText(view.getDisplayName()); } if (keyboardFocus) { g.setColor(new Color(180, 180, 180)); g.drawRect(3, 3, getWidth() - 7, getHeight() - 7); } // int w = getWidth(); // int h = getHeight(); // g.setColor(/*selected ? AnEnvironment.DEFAULT_PANEL_BACKGROUND : */selectedBorder); // g.drawLine(w-1, 0, w-1, h); } private String displayText(Graphics g, String name, boolean shortName) { int maxTextWidth = getWidth(); maxTextWidth -= 20; // make room for spaces around text // if (shortName) { // maxTextWidth -= 15; // make room for '>' arrow or 'x' // } // if (isScrollbarShowing()) { // maxTextWidth -= getScrollbarWidth(); // } FontMetrics fontMetrics = g.getFontMetrics(nameLabel.getFont()); int nameWidth = fontMetrics.stringWidth(name); String ret = name; if (nameWidth > maxTextWidth) { ret = shortenText(fontMetrics, name, maxTextWidth); } return ret; } private String shortenText(FontMetrics fontMetrics, String name, int maxTextWidth) { String ret = name; for (int newLength = name.length(); newLength > 0; newLength--) { ret = name.substring(0, newLength) + "..."; ; if (fontMetrics.stringWidth(ret) < maxTextWidth) { break; } } return ret; } private Image getRemoveButtonImage() { if (buttonImage == null) { buttonImage = getRemoveTabImage(); } return buttonImage; } private Image getRemoveTabImage() { if (removeImage == null) { removeImage = AnUtility.removeIcon.getImage(); removeImageWidth = removeImage.getWidth(this); removeImageHeight = removeImage.getHeight(this); } return removeImage; } private Image getRemoveTabFocusedImage() { if (removeImageFocused == null) { removeImageFocused = AnUtility.removeFocusedIcon.getImage(); } return removeImageFocused; } private Image getSelectedArrowImage() { if (selectedArrowImage == null) { URL url = this.getClass().getResource("/org/gprofng/mpmt/icons/nav_bar_arrow.png"); if (url != null) { ImageIcon imageIcon = new ImageIcon(url); selectedArrowImage = imageIcon.getImage(); selectedArrowImageWidth = selectedArrowImage.getWidth(this); selectedArrowImageHeight = selectedArrowImage.getHeight(this); } } return selectedArrowImage; } protected static int getPanelHeight() { if (panelHeight != null) { return panelHeight; } else { return 27; } } /** * @return the shown */ public boolean isShown() { return shown; } /** * @param shown the shown to set */ public void setShown(boolean shown) { this.shown = shown; } /** * @return the position */ public int getPosition() { return position; } /** * @param position the position to set */ public void setPosition(int position) { this.position = position; } class MouseDraggedListener extends MouseMotionAdapter { // @Override @Override public void mouseDragged(MouseEvent e) { JComponent c = (JComponent) e.getSource(); TransferHandler handler = c.getTransferHandler(); handler.exportAsDrag(c, e, TransferHandler.COPY); } } private static DataFlavor dadDataFlavor = null; public static DataFlavor getDADDataFlavor() throws Exception { if (dadDataFlavor == null) { dadDataFlavor = new DataFlavor( DataFlavor.javaJVMLocalObjectMimeType + ";class=org.gprofng.mpmt.navigation.ViewPanel"); } return dadDataFlavor; } // @Override @Override public Object getTransferData(DataFlavor flavor) { DataFlavor thisFlavor; try { thisFlavor = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return null; } if (thisFlavor != null && flavor.equals(thisFlavor)) { return ViewPanel.this; } return null; } // @Override @Override public DataFlavor[] getTransferDataFlavors() { DataFlavor[] flavors = {null}; try { flavors[0] = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return null; } return flavors; } // @Override @Override public boolean isDataFlavorSupported(DataFlavor flavor) { DataFlavor[] flavors = {null}; try { flavors[0] = getDADDataFlavor(); } catch (Exception ex) { ex.printStackTrace(System.err); return false; } for (DataFlavor f : flavors) { if (f.equals(flavor)) { return true; } } return false; } class DADTransferHandler extends TransferHandler { public DADTransferHandler() { super(); } // @Override() @Override public Transferable createTransferable(JComponent c) { if (c instanceof ViewPanel) { Transferable tip = (ViewPanel) c; return tip; } return null; } // @Override() @Override public int getSourceActions(JComponent c) { if (c instanceof ViewPanel) { return TransferHandler.COPY; } return TransferHandler.NONE; } } // @Override @Override public String toString() { return nameLabel.getText(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); nameLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); nameLabel.setText("Functions"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 0); add(nameLabel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) { AnWindow.getInstance() .getSettings() .getViewsSetting() .toggleTab(getView().getName(), AnWindow.getInstance().getViews().getCurrentViewName()); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JLabel nameLabel; // End of variables declaration//GEN-END:variables public boolean isSelected() { return selected; } public boolean isFocused() { return focused; } public boolean hasKeyboardFocus() { return keyboardFocus; } public void setKeyboardFocused(boolean keyboardFocused) { this.keyboardFocus = keyboardFocused; } } ��������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/View.java�����������������������������������������������0000644�0001750�0001750�00000006364�14744453367�017675� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.mpmt.AnWindow; import java.awt.Image; public class View { public enum Type { STATIC_VIEW, VIEW, STANDARD, INDEX, MEMORY }; private String name; private String displayName; private AnWindow anWindow; private String imagePath; private Image image = null; private Type type; private String shortDescr; private String longDescr; public View( String name, String displayName, String shortDescr, String longDescr, AnWindow anWindow, Type type, String imagePath) { this.name = name; this.displayName = displayName; this.anWindow = anWindow; this.imagePath = imagePath; this.type = type; this.shortDescr = shortDescr; this.longDescr = longDescr; } /** * @return the name */ public String getName() { return name; } /** * @return the type */ public Type getType() { return type; } /** * @return the displayName */ public String getDisplayName() { return displayName; } // /** // * @return the imagePath // */ // public String getImagePath() { // if (imagePath == null) { // imagePath = generateIconPath(); // } // return imagePath; // } // /** // * @return the image // */ // public Image getImage() { // if (image == null) { // URL url = this.getClass().getResource(getImagePath()); // if (url != null) { // ImageIcon imageIcon = new ImageIcon(url); // image = imageIcon.getImage(); // } // } // return image; // } /** * @return the anWindow */ public AnWindow getAnWindow() { return anWindow; } // private static int iconNameIndex = 0; // public static String generateIconPath() { // if (iconNameIndex > 12) { // iconNameIndex = 0; // } // return "/org/gprofng/mpmt/icons/" + "dummy" + iconNameIndex++ + ".png"; // } /** * @return the shortDescr */ public String getShortDescr() { return shortDescr; } /** * @return the longDescr */ public String getLongDescr() { if (longDescr == null) { return "<html><b>" + displayName + " " + "View" + " </b><br>" + displayName + " long" + " description......<br>..............................................<br>..............................................</html>"; } else { return longDescr; } } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/ActionPanel.java����������������������������������������0000644�0001750�0001750�00000013610�14744453367�021150� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.navigation; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; public class ActionPanel extends javax.swing.JPanel implements MouseListener, MouseMotionListener { private ActionListener actionListener; private boolean focused = false; private boolean selected = false; private boolean keyboardFocus = false; public ActionPanel(String name, String tooltip, ActionListener actionListener) { initComponents(); nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD)); nameLabel.setText(name); AnUtility.setAccessibleContext(nameLabel.getAccessibleContext(), nameLabel.getText()); setToolTipText(tooltip); setBorder(null); setBackground( AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR /*AnEnvironment.DEFAULT_PANEL_BACKGROUND*/); addMouseListener(this); addMouseMotionListener(this); this.actionListener = actionListener; } // @Override @Override public void mouseClicked(MouseEvent me) { ActionEvent ae = new ActionEvent(me, 0, null); actionListener.actionPerformed(ae); } // @Override @Override public void mouseDragged(MouseEvent me) {} // @Override @Override public void mouseEntered(MouseEvent me) { focused = true; refresh(); } // @Override @Override public void mouseExited(MouseEvent me) { focused = false; refresh(); } // @Override @Override public void mouseReleased(MouseEvent me) { selected = false; refresh(); } // @Override @Override public void mousePressed(MouseEvent me) { selected = true; refresh(); } // @Override @Override public void mouseMoved(MouseEvent me) {} public void setSelected(boolean selected) { this.selected = selected; refresh(); } private void refresh() { // Set background Color backgroundColor; if (isSelected()) { backgroundColor = AnEnvironment.VIEW_SELECTED_BACKGROUND_COLOR; } else if (focused) { backgroundColor = AnEnvironment.VIEW_FOCUSED_BACKGROUND_COLOR; } else { backgroundColor = AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR; } setBackground(backgroundColor); repaint(); } @Override public void paint(Graphics g) { if (selected || focused) { Graphics2D g2d = (Graphics2D) g; Color topColor = selected ? AnEnvironment.VIEW_SELECTED_TOP_COLOR : AnEnvironment.VIEW_FOCUSED_TOP_COLOR; Color bottomColor = selected ? AnEnvironment.VIEW_SELECTED_BOTTOM_COLOR : AnEnvironment.VIEW_FOCUSED_BOTTOM_COLOR; GradientPaint gp = new GradientPaint(0, 0, topColor, 0, getHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight()); // Set border Color borderColor; if (selected || focused) { borderColor = AnEnvironment.VIEW_SELECTED_BORDER_COLOR; } else { borderColor = AnEnvironment.NAVIGATION_PANEL_BACKGROUND_COLOR; } g.setColor(borderColor); g.drawLine(0, 0, getWidth(), 0); g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); setOpaque(false); } else { setOpaque(true); } super.paint(g); if (keyboardFocus) { g.setColor(new Color(180, 180, 180)); g.drawRect(3, 3, getWidth() - 7, getHeight() - 7); } } public void performAction() { actionListener.actionPerformed(new ActionEvent(this, 0, null)); } /** * @return the keyboardFocus */ public boolean hasKeyboardFocus() { return keyboardFocus; } /** * @param keyboardFocused the keyboardFocus to set */ public void setKeyboardFocused(boolean keyboardFocused) { this.keyboardFocus = keyboardFocused; } // @Override @Override public String toString() { return nameLabel.getText(); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; nameLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); nameLabel.setText("NOI18N"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 6, 6, 0); add(nameLabel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel nameLabel; // End of variables declaration//GEN-END:variables /** * @return the selected */ public boolean isSelected() { return selected; } } ������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/navigation/TopNavigationPanel.form���������������������������������0000644�0001750�0001750�00000007713�14744453367�022546� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8" ?> <!-- Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. --> <Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <SubComponents> <Component class="javax.swing.JLabel" name="label"> <Properties> <Property name="text" type="java.lang.String" value="NOI18N"/> </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="21" weightX="1.0" weightY="0.0"/> </Constraint> </Constraints> </Component> <Component class="javax.swing.JButton" name="showTabConfigurationButton"> <Properties> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Image iconType="3" name="/org/gprofng/mpmt/icons/more_icon.png"/> </Property> <Property name="borderPainted" type="boolean" value="false"/> <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> <Insets value="[1, 1, 1, 1]"/> </Property> <Property name="opaque" type="boolean" value="false"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showTabConfigurationButtonActionPerformed"/> </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <GridBagConstraints gridX="10" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> </SubComponents> </Form> �����������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ExperimentPickListElement.java�������������������������������������0000644�0001750�0001750�00000004110�14744453367�021704� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.picklist.PickListElement; public class ExperimentPickListElement implements PickListElement { private String path; private String workingDirectory; private String confPath; public ExperimentPickListElement(String path, String workingDirectory, String confPath) { this.path = path; this.workingDirectory = workingDirectory; this.confPath = confPath; } public String getPath() { return path; } public String getWorkingDirectory() { return workingDirectory; } public String getConfPath() { return confPath; } public String getToolTip() { String tt = getPath(); if (getWorkingDirectory() != null) { StringBuilder sb = new StringBuilder(); sb.append("<html>"); sb.append(AnLocale.getString("Path: ")); sb.append(getPath()); sb.append("<br>"); sb.append(AnLocale.getString("Working Directory: ")); sb.append(getWorkingDirectory()); if (confPath != null) { sb.append("<br>"); sb.append(AnLocale.getString("Configuration: ")); sb.append(getConfPath()); } sb.append("<html>"); tt = sb.toString(); } return tt; } /** Compares two PicklistElement for equality. Returns true if equal, otherwise false. */ @Override public boolean equals(PickListElement elem) { return ((ExperimentPickListElement) elem).getPath().equals(this.path); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/�������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015077� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlameView.java�����������������������������������������������0000644�0001750�0001750�00000130213�15044710303�017532� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnAction; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnEvent; import org.gprofng.mpmt.AnListener; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnVariable; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.IPC; import org.gprofng.mpmt.KeyboardShortcuts; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnChangeListener; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.export.ExportSupport; import org.gprofng.mpmt.filter.CustomFilterAction; import org.gprofng.mpmt.filter.FilterClause; import org.gprofng.mpmt.filter.RedoFilterAction; import org.gprofng.mpmt.filter.RemoveAllFilterAction; import org.gprofng.mpmt.filter.UndoFilterAction; import org.gprofng.mpmt.mainview.Subview; import org.gprofng.mpmt.settings.AnSettingChangeEvent; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.MetricsSetting.MetricCheckBox; import org.gprofng.mpmt.settings.Settings; import org.gprofng.mpmt.settings.ViewModeSetting; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.statecolors.StateColorMap; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; public class FlameView extends AnDisplay implements ExportSupport, AnChangeListener, AnListener { private static final String ADD_FILTER = AnLocale.getString("Add Filter: "); private static final String FILTER_SELECTED_BRANCH_LONG_NAME = AnLocale.getString("Include only stacks containing the selected branch"); private static final String FILTER_SELECTED_BRANCH_SHORT_NAME = AnLocale.getString("Selected Branch"); private static final String FILTER_NOT_SELECTED_BRANCH_LONG_NAME = AnLocale.getString("Include only stacks not containing the selected branch"); private static final String FILTER_NOT_SELECTED_BRANCH_SHORT_NAME = AnLocale.getString("Not Selected Branch"); private static final String FILTER_SELECTED_FUNCTION_LONG_NAME = AnLocale.getString("Include only stacks containing the selected function"); private static final String FILTER_SELECTED_FUNCTION_SHORT_NAME = AnLocale.getString("Selected Function"); private static final String FILTER_SELECTED_LEAF_LONG_NAME = AnLocale.getString("Include only stacks with the selected function as leaf"); private static final String FILTER_SELECTED_LEAF_SHORT_NAME = AnLocale.getString("Selected Leaf"); private static final String STR_ACTION_UNDO_FILTER = AnLocale.getString("Undo Filter Action"); private static final String STR_ACTION_REDO_FILTER = AnLocale.getString("Redo Filter Action"); private static final String STR_ACTION_REMOVE_ALL_FILTERS = AnLocale.getString("Remove All Filters"); private static final String STR_ACTION_CUSTOM_FILTER = ADD_FILTER + AnLocale.getString("Advanced Custom Filter..."); // Data private int rowCount = -1; private FlameData flameData = null; private Object flameDataLock = new Object(); private MainThread mainThread = null; // GUI private FlamePanel flamePanel; private JScrollPane mainScrollPane; private JPanel mainToolbarPanel; private FlameToolBar flameToolBar; private JPanel detailsPanel; private JLabel detailsLabel; // States private boolean mainThreadKilled = false; private AnMetric anMetricToBeUsed = null; private boolean supportedExperiments = true; // Actions private AnAction undoSetBaseAction; private AnAction redoSetBaseAction; private AnAction resetBaseAction; private AnAction setBaseAction; private AnAction upOneAction; private AnAction downOneAction; private AnAction leftOneAction; private AnAction rightOneAction; // Debug // private static Date beginDate = new Date(); // Constructor public FlameView() { super(AnWindow.getInstance(), AnDisplay.DSP_CallFlame, AnVariable.HELP_CallFlameChart); setAccessibility(AnLocale.getString("Flame Graph")); AnEventManager.getInstance().addListener(this); AnWindow.getInstance().getColorChooser().getColorMap().addAnListener(this); KeyStroke ks = KeyboardShortcuts.contextMenuActionShortcut; getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, ks); getActionMap() .put( ks, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { flamePanel.showPopup(getFlameData().getSelectedFlameBlock()); } }); } /** * AnChangeEvent handler. Events are always dispatched on AWT thread. Requirements to an event * handler like this one: o When it done handling the event and returns, all it's states need to * be *consistent* and *well-defined*. It cannot dispatch that or part of that work to a different * (worker) thread and not wait for it to finish. o It cannot spend significant time handling the * event. Significant work like doCompute needs to be dispatched to a worker thread. * * @param e the event */ @Override public void stateChanged(AnChangeEvent e) { // System.out.println("CallTreeView stateChanged: " + e.getType()); switch (e.getType()) { case EXPERIMENTS_LOADING_ADDED_OR_REMOVED: case EXPERIMENTS_LOADING_NEW: computed = false; initView(); break; case EXPERIMENTS_LOADED_FAILED: // Nothing break; case EXPERIMENTS_LOADED: handleSupportedExperiments(); if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGED: interruptMainThread(); computed = false; if (selected) { computeOnAWorkerThread(); } break; case FILTER_CHANGING: case REMOTE_CONNECTION_CHANGING: case REMOTE_CONNECTION_CANCELLED_OR_FAILED: case REMOTE_CONNECTION_CHANGED: case MOST_RECENT_EXPERIMENT_LIST_CHANGED: case SOURCE_FINDING_CHANGING: case SOURCE_FINDING_CHANGED: case SETTING_CHANGING: case SELECTED_OBJECT_CHANGED: case SELECTION_CHANGING: case SELECTION_CHANGED: case SELECTION_UPDATE: // Nothing break; case SETTING_CHANGED: AnSettingChangeEvent anSettingChangeEvent = (AnSettingChangeEvent) e.getSource(); if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.VIEW_MODE || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.LIBRARY_VISIBILITY || anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { if (anSettingChangeEvent.getType() == AnSettingChangeEvent.Type.METRICS) { Object o = anSettingChangeEvent.getOriginalSource(); if (o instanceof MetricsSetting.MetricCheckBox) { anMetricToBeUsed = ((MetricCheckBox) o).getAnMetric(); } else { anMetricToBeUsed = null; } } computed = false; if (selected) { computeOnAWorkerThread(); } } break; case DEBUG: debug(); break; default: System.err.println("AnChanged event " + e.getType() + " not handled: " + this); break; } } @Override public void valueChanged(AnEvent e) { flamePanel.functionColorsChanged(); } @Override public JPopupMenu getFilterPopup() { if (getFlameData() != null) { JPopupMenu popup = new JPopupMenu(); for (JComponent jmi : getFilterMenuList(getFlameData().getSelectedFlameBlock())) { popup.add(jmi); } return popup; } else { return null; } } protected FlameToolBar getFlameToolBar() { return flameToolBar; } private void initActions() { undoSetBaseAction = new AnAction( AnLocale.getString("Undo Set As Base"), AnUtility.undo_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (undoSetBaseAction.isEnabled()) { flameToolBar.undoSetBaseStack(); } } }); undoSetBaseAction.setKeyboardShortCut( this, "FLAME_BACKSPACE", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); redoSetBaseAction = new AnAction( AnLocale.getString("Redo Set As Base"), AnUtility.redo_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (redoSetBaseAction.isEnabled()) { flameToolBar.redoSetBaseStack(); } } }); redoSetBaseAction.setKeyboardShortCut( this, "FLAME_SHIFT_BACKSPACE", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, InputEvent.SHIFT_DOWN_MASK)); resetBaseAction = new AnAction( AnLocale.getString("Reset Base"), AnUtility.base2Icon, AnLocale.getString("Reset Base to <Total>"), null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (resetBaseAction.isEnabled()) { flamePanel.resetBase(); } } }); resetBaseAction.setKeyboardShortCut( this, "FLAME_SHIFT_ENTER", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)); setBaseAction = new AnAction( AnLocale.getString("Set As Base"), AnUtility.base1Icon, AnLocale.getString("Set Base to Selected Function"), null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (setBaseAction.isEnabled()) { flamePanel.setAsBase(); } } }); setBaseAction.setKeyboardShortCut( this, "FLAME_ENTER", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false)); upOneAction = new AnAction( AnLocale.getString("Up One"), AnUtility.up_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (upOneAction.isEnabled()) { flamePanel.upOne(); } } }); upOneAction.setKeyboardShortCut( this, "FLAME_UP", KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false)); // String ks_string = "FLAME_UP"; ;;; // KeyStroke ks_def = KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0, false); // this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks_def, // ks_string); // this.getActionMap().put(ks_string, new AbstractAction() { // @Override // public void actionPerformed(ActionEvent ev) { // upOneAction.actionPerformed(ev); // } // }); downOneAction = new AnAction( AnLocale.getString("Down One"), AnUtility.down_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (downOneAction.isEnabled()) { flamePanel.downOne(); } } }); downOneAction.setKeyboardShortCut( this, "FLAME_DOWN", KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, false)); leftOneAction = new AnAction( AnLocale.getString("Left One"), AnUtility.back_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (leftOneAction.isEnabled()) { flamePanel.leftOne(); } } }); leftOneAction.setKeyboardShortCut( this, "FLAME_LEFT", KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false)); rightOneAction = new AnAction( AnLocale.getString("Right One"), AnUtility.forw_icon, null, null, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (rightOneAction.isEnabled()) { flamePanel.rightOne(); } } }); rightOneAction.setKeyboardShortCut( this, "FLAME_RIGHT", KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0, false)); } protected AnAction getUndoSetBaseAction() { return undoSetBaseAction; } protected AnAction getRedoSetBaseAction() { return redoSetBaseAction; } protected AnAction getResetBaseAction() { return resetBaseAction; } protected AnAction getSetBaseAction() { return setBaseAction; } protected AnAction getUpOneAction() { return upOneAction; } protected AnAction getDownOneAction() { return downOneAction; } protected AnAction getLeftOneAction() { return leftOneAction; } protected AnAction getRightOneAction() { return rightOneAction; } protected void updateActionsEnableStatus() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { getFlameToolBar().setControilsEnabled(true); getUndoSetBaseAction().setEnabled(flameToolBar.canUndoSetBaseStack()); getRedoSetBaseAction().setEnabled(flameToolBar.canRedoSetBaseStack()); getResetBaseAction().setEnabled(flamePanel.canResetBase()); getSetBaseAction().setEnabled(flamePanel.canSetBase()); getUpOneAction().setEnabled(flamePanel.canUpOne()); getDownOneAction().setEnabled(flamePanel.canDownOne()); getLeftOneAction().setEnabled(flamePanel.canLeftOne()); getRightOneAction().setEnabled(flamePanel.canRightOne()); } }); } protected void resetActionsEnableStatus() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { getFlameToolBar().setControilsEnabled(false); getUndoSetBaseAction().setEnabled(false); getRedoSetBaseAction().setEnabled(false); getResetBaseAction().setEnabled(false); getSetBaseAction().setEnabled(false); getUpOneAction().setEnabled(false); getDownOneAction().setEnabled(false); getLeftOneAction().setEnabled(false); getRightOneAction().setEnabled(false); } }); } @Override protected void initComponents() { initActions(); setLayout(new BorderLayout()); JPanel toolbarPanel = new JPanel(); toolbarPanel.setBackground(AnEnvironment.TOOLBAR_BACKGROUND_COLOR); toolbarPanel.add(flameToolBar = new FlameToolBar(this)); mainToolbarPanel = new JPanel(new BorderLayout()); mainToolbarPanel.add(toolbarPanel, BorderLayout.NORTH); add(mainToolbarPanel, BorderLayout.NORTH); flamePanel = new FlamePanel(this); mainScrollPane = new JScrollPane(flamePanel); mainScrollPane.setBorder(null); mainScrollPane.getVerticalScrollBar().setUnitIncrement(32); mainScrollPane.getVerticalScrollBar().setBlockIncrement(32); mainScrollPane.getVerticalScrollBar().setValueIsAdjusting(true); add(mainScrollPane, BorderLayout.CENTER); detailsPanel = new JPanel(); detailsPanel.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, AnEnvironment.TABBED_PANE_BORDER_COLOR)); detailsPanel.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints; detailsLabel = new JLabel(); // detailsLabel.setFont(detailsLabel.getFont().deriveFont(Font.BOLD)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(4, 4, 0, 0); detailsPanel.add(detailsLabel, gridBagConstraints); detailsPanel.setMinimumSize(new Dimension(10, 10)); add(detailsPanel, BorderLayout.SOUTH); resetActionsEnableStatus(); } protected void updateSelection() { if (getFlameData() != null) { updateSelection(getFlameData().getSelectedFlameBlock()); } else { updateSelection(null); } } protected void updateSelection(final FlameBlock selectedFlameBlock) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (selectedFlameBlock != null) { detailsLabel.setText(selectedFlameBlock.getDetailsTextHTML()); } else { detailsLabel.setText(FlameBlock.getDetailsEmptyTextHTML()); } detailsLabel.setToolTipText(detailsLabel.getText()); } }); } protected void updateGUI(final AnMetric anMetric) { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { flamePanel.setPanelSize(rowCount); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { flameToolBar.resetZoom(); flameToolBar.resetMetrics(anMetric); scrollToRow(0); } }); } }); } protected void scrollToRow(final int row) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { int extraPixels = 10; // System.out.println(height + " " + (height - (row + 1) * // flamePanel.getRowHeight() + 2)); flamePanel.scrollRectToVisible( new Rectangle( 0, flamePanel.getSize().height - (row + 1) * flamePanel.getRowHeight() - flamePanel.getOuterGap() - flamePanel.getInnerGap() - extraPixels / 2, 10, flamePanel.getRowHeight() + 1 + extraPixels)); mainScrollPane.revalidate(); } }); } protected void setMetric(AnMetric anMetric) { anMetricToBeUsed = anMetric; computed = false; if (selected) { computeOnAWorkerThread(); } } private final long getFuncObj() { final long funcObj; funcObj = AnWindow.getInstance().getSelectedObject().getSelObjV2("FUNCTION"); // API V2 return funcObj; } @Override public void doCompute() { if (!supportedExperiments) { // Some not suppoted conditions (compare) return; } long selectedFunction = getFuncObj(); // Synchronize selected function from Functions and other views. if (!computed) { resetActionsEnableStatus(); if (mainThreadKilled) { if (mainThread != null) { try { mainThread.join(); } catch (InterruptedException ie) { System.err.println("mainThread.join() interrupted..."); } mainThread = null; } mainThreadKilled = false; } if (mainThread != null) { // being computed return; } // Do compute // beginDate = new Date(); AnMetric anMetric; if (anMetricToBeUsed != null) { anMetric = anMetricToBeUsed; } else { anMetric = AnWindow.getInstance().getSettings().getMetricsSetting().getSortColumnMetric(0); } resetView(); rowCount = getCallTreeNumLevelsIPC(); updateGUI(anMetric); if (rowCount > 0) { flameData = new FlameData(this, anMetric, rowCount); mainThread = new MainThread(anMetric.getComd(), selectedFunction); mainThread.start(); } else { initView(); // ??? } } else { FlameBlock selectedFlameBlock = flameData.findFunctionFlameBlock(selectedFunction); if (selectedFlameBlock != null) { flameData.setSelectedFlameBlock(selectedFlameBlock); updateActionsEnableStatus(); } } } @Override protected boolean supportsFindText() { return true; } @Override public int find(String str, boolean forward, boolean caseSensitive) { FlameBlock selectedFlameBlock = getFlameData().getSelectedFlameBlock(); FlameBlock fb = getFlameData().nextFlameBlock(selectedFlameBlock, forward); while (fb != null) { boolean match = false; if (caseSensitive) { match = fb.getFunctionDisplayName().contains(str); } else { match = fb.getFunctionDisplayName().toLowerCase().contains(str.toLowerCase()); } if (match) { flamePanel.setSelectedFlameBlock(fb); return 1; } if (fb == selectedFlameBlock) { return -1; } fb = getFlameData().nextFlameBlock(fb, forward); } return -1; } @Override public List<ExportFormat> getSupportedExportFormats() { List<ExportFormat> formats = new ArrayList<>(); formats.add(ExportFormat.JPG); return formats; } @Override public boolean exportLimitSupported() { return false; } /* * For GUI testing */ @Override public String exportAsText( Integer limit, ExportSupport.ExportFormat format, Character delimiter) { return getFlameData().dump(limit); } @Override public List<Subview> getVisibleSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); // list.add(window.getTimelineCallStackSubview()); // list.add(window.getIoCallStackSubview()); return list; } @Override public List<Subview> getSelectedSubviews() { List<Subview> list = new ArrayList<>(); list.add(window.getSelectedDetailsSubview()); return list; } private void handleSupportedExperiments() { if (window.getSettings().getCompareModeSetting().comparingExperiments()) { // Not supported remove(mainToolbarPanel); remove(mainScrollPane); JLabel errorLabel = new JLabel(); errorLabel.setHorizontalAlignment(JLabel.CENTER); errorLabel.getAccessibleContext().setAccessibleName(AnLocale.getString("Error message")); errorLabel .getAccessibleContext() .setAccessibleDescription(AnLocale.getString("Error message")); String msg = AnLocale.getString("Not available when comparing experiments"); errorLabel.setText(msg); add(errorLabel, BorderLayout.CENTER); supportedExperiments = false; } else { // Supported if (!supportedExperiments) { add(mainToolbarPanel, BorderLayout.NORTH); add(mainScrollPane, BorderLayout.CENTER); } supportedExperiments = true; } } /** Called when new experiment loaded */ private void initView() { mainThread = null; flameData = null; flamePanel.initView(); resetActionsEnableStatus(); } /** Called before everything is recomputed (doCompute) */ private void resetView() { mainThread = null; flameData = null; flamePanel.resetView(); } private void interruptMainThread() { if (mainThread != null) { mainThread.kill(); mainThreadKilled = true; } } class MainThread extends Thread { String metricName; long selectedFunction; RowThread[] rowThreads = null; boolean killed = false; private MainThread(String metricName, long selectedFunction) { this.metricName = metricName; this.selectedFunction = selectedFunction; } @Override public void run() { killed = false; rowThreads = new RowThread[rowCount]; for (int row = 0; row < rowCount; row++) { rowThreads[row] = new RowThread(this, metricName, row); rowThreads[row].start(); } // Wait till all rows are filled (or thred is killed) synchronized (this) { try { wait(); } catch (InterruptedException ie) { } } if (!killed) { computed = true; FlameBlock selectedFlameBlock = flameData.findFunctionFlameBlock(selectedFunction); if (selectedFlameBlock != null) { flameData.setSelectedFlameBlock(selectedFlameBlock); } updateActionsEnableStatus(); } mainThread = null; } private void rowIsComplete(FlameRow flameRow) { getFlameData().rowDone(flameRow); // FIXUP: NPE rowThreads[flameRow.getRow()] = null; flamePanel.rowIsComplete(flameRow.getRow()); // Check if all rows are done boolean allDone = true; for (RowThread rowThread : rowThreads) { if (rowThread != null) { allDone = false; break; } } if (allDone) { interrupt(); } } private void kill() { for (RowThread rowThread : rowThreads) { if (rowThread != null) { rowThread.kill(); } } killed = true; interrupt(); } } protected FlamePanel getFlamePanel() { return flamePanel; } class RowThread extends Thread { MainThread mainThread; private int row; private String metricName; private boolean killed = false; private RowThread(MainThread mainThread, String metricName, int row) { this.mainThread = mainThread; this.metricName = metricName; this.row = row; } @Override public void run() { killed = false; List<FlameRow> flameRows = getRowDataIPC(metricName, row); if (!killed && !isInterrupted()) { for (FlameRow flameRow : flameRows) { mainThread.rowIsComplete(flameRow); } } } private void kill() { killed = true; interrupt(); } } protected List<JComponent> getFilterMenuList(FlameBlock flameBlock) { String text; JMenuItem menuItem; List<JComponent> list = new ArrayList<>(); text = ADD_FILTER + FILTER_SELECTED_BRANCH_LONG_NAME; menuItem = new JMenuItem(new FilterSelectedBranch(text, flameBlock)); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(flameBlock != null); list.add(menuItem); text = ADD_FILTER + FILTER_NOT_SELECTED_BRANCH_LONG_NAME; menuItem = new JMenuItem(new FilterNotSelectedBranch(text, flameBlock)); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(flameBlock != null); list.add(menuItem); text = ADD_FILTER + FILTER_SELECTED_FUNCTION_LONG_NAME; menuItem = new JMenuItem(new FilterSelectedFunction(text, flameBlock)); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(flameBlock != null); list.add(menuItem); text = ADD_FILTER + FILTER_SELECTED_LEAF_LONG_NAME; menuItem = new JMenuItem(new FilterSelectedLeaf(text, flameBlock)); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(flameBlock != null); list.add(menuItem); text = STR_ACTION_CUSTOM_FILTER; menuItem = new JMenuItem(new CustomFilterAction()); menuItem.getAccessibleContext().setAccessibleDescription(text); list.add(menuItem); list.add(new JSeparator()); text = STR_ACTION_UNDO_FILTER; menuItem = new JMenuItem(new UndoFilterAction()); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(window.getFilters().canUndoLastFilter()); list.add(menuItem); text = STR_ACTION_REDO_FILTER; menuItem = new JMenuItem(new RedoFilterAction()); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(window.getFilters().canRedoLastFilter()); list.add(menuItem); text = STR_ACTION_REMOVE_ALL_FILTERS; menuItem = new JMenuItem(new RemoveAllFilterAction()); menuItem.getAccessibleContext().setAccessibleDescription(text); menuItem.setEnabled(window.getFilters().canRemoveAllFilters()); list.add(menuItem); if (window.getFilters().anyFilters()) { list.add(window.getFilters().removeFilterMenuItem()); } return list; } private class FilterSelectedBranch extends AbstractAction { private FlameBlock flameBlock; private FilterSelectedBranch(String text, FlameBlock flameBlock) { super(text); this.flameBlock = flameBlock; } @Override public void actionPerformed(ActionEvent e) { StringBuilder buf = new StringBuilder(); buf.append("(("); String buf2 = ""; FlameBlock fb = flameBlock; while (fb != null) { if (!buf2.isEmpty()) { buf2 = "," + buf2; } buf2 = fb.getFunctionID() + buf2; fb = fb.getNextFlameBlock(FlameBlock.DOWN); } buf.append(buf2); buf.append(") ORDERED IN " + getStack() + ")"); String clause = buf.toString(); setFilterClause(FILTER_SELECTED_BRANCH_SHORT_NAME, FILTER_SELECTED_BRANCH_LONG_NAME, clause); } } private class FilterNotSelectedBranch extends AbstractAction { private FlameBlock flameBlock; private FilterNotSelectedBranch(String text, FlameBlock flameBlock) { super(text); this.flameBlock = flameBlock; } @Override public void actionPerformed(ActionEvent e) { StringBuilder buf = new StringBuilder(); buf.append("(!(("); String buf2 = ""; FlameBlock fb = flameBlock; while (fb != null) { if (!buf2.isEmpty()) { buf2 = "," + buf2; } buf2 = fb.getFunctionID() + buf2; fb = fb.getNextFlameBlock(FlameBlock.DOWN); } buf.append(buf2); buf.append(") ORDERED IN " + getStack() + "))"); String clause = buf.toString(); setFilterClause( FILTER_NOT_SELECTED_BRANCH_SHORT_NAME, FILTER_NOT_SELECTED_BRANCH_LONG_NAME, clause); } } private class FilterSelectedFunction extends AbstractAction { private FlameBlock flameBlock; private FilterSelectedFunction(String text, FlameBlock flameBlock) { super(text); this.flameBlock = flameBlock; } @Override public void actionPerformed(ActionEvent e) { StringBuilder buf = new StringBuilder(); buf.append("(("); buf.append("" + flameBlock.getFunctionID()); buf.append(") IN " + getStack() + ")"); String clause = buf.toString(); setFilterClause( FILTER_SELECTED_FUNCTION_SHORT_NAME, FILTER_SELECTED_FUNCTION_LONG_NAME, clause); } } private class FilterSelectedLeaf extends AbstractAction { private FlameBlock flameBlock; private FilterSelectedLeaf(String text, FlameBlock flameBlock) { super(text); this.flameBlock = flameBlock; } @Override public void actionPerformed(ActionEvent e) { StringBuilder buf = new StringBuilder(); buf.append("((" + getStack() + "+0) IN ("); buf.append("" + flameBlock.getFunctionID()); buf.append("))"); String clause = buf.toString(); setFilterClause(FILTER_SELECTED_LEAF_SHORT_NAME, FILTER_SELECTED_LEAF_LONG_NAME, clause); } } private String getStack() { String stack = "USTACK"; Settings settings = AnWindow.getInstance().getSettings(); if (settings.getViewModeEnabledSetting().isViewModeEnabled()) { ViewModeSetting viewModeSetting = settings.getViewModeSetting(); if (viewModeSetting.get() == ViewModeSetting.ViewMode.USER) { stack = "USTACK"; } else if (viewModeSetting.get() == ViewModeSetting.ViewMode.EXPERT) { stack = "XSTACK"; } else if (viewModeSetting.get() == ViewModeSetting.ViewMode.MACHINE) { stack = "MSTACK"; } } return stack; } private void setFilterClause(String shortName, String longName, String clause) { window .getFilters() .addClause( getAnDispTab().getTName() + ": " + shortName, longName, clause, FilterClause.Kind.STANDARD); } // **************** Public ************************ protected FlameData getFlameData() { return flameData; } protected Object getFlameDataLock() { return flameDataLock; } // **************** IPC ************************ private int getCallTreeNumLevelsIPC() { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { anWindow.IPC().send("getCallTreeNumLevels"); anWindow.IPC().send(0); return anWindow.IPC().recvInt(); } } private Object[] getCallTreeFuncsIPC(int startLevel, int endLevel) { AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { // Date start = new Date();//YXXX timing debug (delete-me later) anWindow.IPC().send("getCallTreeLevelFuncs"); anWindow.IPC().send(0); anWindow.IPC().send(startLevel); anWindow.IPC().send(endLevel); Object[] res = (Object[]) anWindow.IPC().recvObject(); // {//YXXX timing debug (delete-me later) // Date now = new Date(); // long duration = now.getTime() - start.getTime(); // int nfuncs = (res == null) ? 0 : ((long[]) res[0]).length; // System.out.println("getCallTreeFuncsIPC duration=" + duration + "ms // funcCount=" + nfuncs); // System.out.flush(); // } return res; } } private Object[] getCallTreeLevelsIPC(String metricName) { // get all rows AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { // Date start = new Date();//YXXX timing debug (delete-me later) anWindow.IPC().send("getCallTreeLevels"); anWindow.IPC().send(0); anWindow.IPC().send(metricName); Object[] res = (Object[]) anWindow.IPC().recvObject(); // {//YXXX timing debug (delete-me later) // Date now = new Date(); // long duration = now.getTime() - start.getTime(); // int row_count = res.length; // System.out.println("getRowDataIPC duration=" + duration + "ms total_rows=" + // row_count); // System.out.flush(); // } return res; } } private static long YXXXduration = 0; private static long YXXXnode_total = 0; private Object[] getCallTreeLevelIPC(String metricName, int row) { // get one row AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { Date start = new Date(); // YXXX timing debug (delete-me later) anWindow.IPC().send("getCallTreeLevel"); anWindow.IPC().send(0); anWindow.IPC().send(metricName); anWindow.IPC().send(row); Object[] res = (Object[]) anWindow.IPC().recvObject(); { // YXXX timing debug (delete-me later) Date now = new Date(); long duration = now.getTime() - start.getTime(); YXXXduration += duration; int item_cnt = (res != null) ? ((int[]) res[0]).length : 0; YXXXnode_total += item_cnt; System.out.printf( "getRowDataIPC row=%d items=%d sum_items=%d duration=%dms sum_duration=%dms\n", row, item_cnt, YXXXnode_total, duration, YXXXduration); System.out.flush(); } return res; } } private Object[] getCallTreeChildrenIPC( String metricName, int row, int[] parentNodeIds) { // get node children AnWindow anWindow = AnWindow.getInstance(); synchronized (IPC.lock) { Date start = new Date(); // YXXX timing debug (delete-me later) anWindow.IPC().send("getCallTreeChildren"); anWindow.IPC().send(0); anWindow.IPC().send(metricName); anWindow.IPC().send(parentNodeIds); Object[] res = (Object[]) anWindow.IPC().recvObject(); { // YXXX timing debug (delete-me later) Date now = new Date(); long duration = now.getTime() - start.getTime(); YXXXduration += duration; int parent_cnt = 0; int node_cnt = 0; if (res != null) { parent_cnt = res.length; for (int ii = 0; ii < parent_cnt; ii++) { Object[] tmp = (Object[]) res[ii]; if (tmp != null) { int tmp2[] = (int[]) tmp[0]; node_cnt += tmp2 != null ? tmp2.length : 0; } } } YXXXnode_total += node_cnt; System.out.printf( "getCallTreeChildrenIPC row=%d parents=%d items=%d sum_items=%d duration=%dms" + " sum_duration=%dms\n", row, parent_cnt, node_cnt, YXXXnode_total, duration, YXXXduration); System.out.flush(); } return res; } } // processing of processCallTree*IPC() data for one set of blocks private List<FlameBlock> processCallTreeNodeIPC(Object[] blockInfo) { List<FlameBlock> flameBlocks = new ArrayList<>(); if (blockInfo == null) { return flameBlocks; } int[] blockIDs = (int[]) blockInfo[0]; int[] parentIDs = (int[]) blockInfo[1]; long[] functionIDs = (long[]) blockInfo[2]; Object metricObjs = blockInfo[3]; // could be double, int, long if (blockIDs == null || blockIDs.length == 0) { return flameBlocks; } final double metricValues[]; { if (metricObjs instanceof int[]) { int objv[] = (int[]) metricObjs; metricValues = new double[objv.length]; for (int kk = 0; kk < objv.length; kk++) { metricValues[kk] = objv[kk]; } } else if (metricObjs instanceof long[]) { long objv[] = (long[]) metricObjs; metricValues = new double[objv.length]; for (int kk = 0; kk < objv.length; kk++) { metricValues[kk] = objv[kk]; } } else if (metricObjs instanceof double[]) { double objv[] = (double[]) metricObjs; metricValues = new double[objv.length]; for (int kk = 0; kk < objv.length; kk++) { metricValues[kk] = objv[kk]; } } else { return flameBlocks; // weird } } for (int kk = 0; kk < blockIDs.length; kk++) { int id = blockIDs[kk]; int parentId = parentIDs[kk]; long functionId = functionIDs[kk]; double exclusiveValue = 0; double attributedValue = metricValues[kk]; if (kk < (blockIDs.length - 1) && functionId == functionIDs[kk + 1] && parentId == parentIDs[kk + 1]) { // Combine exclusive and attributed into one block id = blockIDs[kk + 1]; exclusiveValue = metricValues[kk]; attributedValue = metricValues[kk + 1]; kk++; } flameBlocks.add(new FlameBlock(id, parentId, functionId, exclusiveValue, attributedValue)); } Collections.sort(flameBlocks, new FlameBlockComrator()); // Sort by value return flameBlocks; } class FlameBlockComrator implements Comparator<FlameBlock> { @Override public int compare(FlameBlock o1, FlameBlock o2) { if (o1.getParentID() == o2.getParentID()) { double v1 = o1.getInclusiveValue(); double v2 = o2.getInclusiveValue(); if (v1 == v2) { return 0; } else if (v1 < v2) { return 1; } else { return -1; } } else { return 0; // keep parent order unchanged } } } private boolean XXXgetRowByLevel = false; private boolean XXXallRowsAtOnce = true; private void updateColorMapIPC(int row) { int level_start = 0, level_end = -1; if (XXXgetRowByLevel) { level_start = level_end = row; } else if (row != 0) { return; } Object[] res = getCallTreeFuncsIPC(level_start, level_end); if (res != null) { AnWindow anWindow = AnWindow.getInstance(); StateColorMap colorMap = anWindow.getColorChooser().getColorMap(); long[] ids = (long[]) res[0]; String[] names = (String[]) res[1]; long[] functions = (long[]) res[2]; List<StackState> states = new ArrayList<>(); HashMap<Long, StackState> functionIdNameMap = new HashMap<Long, StackState>(); for (int ii = 0; ii < ids.length; ii++) { // Colors if (names[ii] == null) { continue; } StackState state = new StackState(names[ii], functions[ii]); // name, Histable::Function* states.add(state); // Function names functionIdNameMap.put(ids[ii], state); } colorMap.addStates(states); getFlameData().setFunctionIdNameMap(functionIdNameMap); // FIXUP: NPE } } /** returns row data */ private List<FlameRow> getRowDataIPC(String metricName, int row) { // examples of three methods. updateColorMapIPC(row); List<FlameRow> flameRows = new ArrayList<>(); if (XXXgetRowByLevel) { Object[] tmp = getCallTreeLevelIPC(metricName, row); List<FlameBlock> blocks = processCallTreeNodeIPC(tmp); flameRows.add(new FlameRow(getFlameData(), row, blocks)); return flameRows; } if (row != 0) { // only return multi-row values on thread 0 return flameRows; } int row_count = 0; int totalBlockCount = 0; if (XXXallRowsAtOnce) { // get all levels with single IPC Object[] tmp = getCallTreeLevelsIPC(metricName); if (tmp != null) { row_count = tmp.length; for (int tmpRow = 0; tmpRow < row_count; tmpRow++) { List<FlameBlock> blocks = processCallTreeNodeIPC((Object[]) tmp[tmpRow]); flameRows.add(new FlameRow(getFlameData(), tmpRow, blocks)); totalBlockCount += blocks.size(); // YXXX sanity checking node counts } } } else { // get each level by querying list of nodes row_count = getCallTreeNumLevelsIPC(); int node_idxs[] = {0}; // 0 will fetch the root node for (int tmpRow = 0; tmpRow < row_count; tmpRow++) { List<FlameBlock> blocks = new ArrayList<>(); // get children of nodes in list Object[] res = getCallTreeChildrenIPC(metricName, tmpRow, node_idxs); // get results ArrayList<Integer> children = new ArrayList<>(); // nodes for next query if (res != null) { for (int jj = 0; jj < res.length; jj++) { // should match node_idxs.length Object[] tmp = (Object[]) res[jj]; List<FlameBlock> nodeBlocks = processCallTreeNodeIPC(tmp); for (FlameBlock block : nodeBlocks) { children.add(block.getID()); blocks.add(block); // addall? // children of a given node_idxs[] } } } flameRows.add(new FlameRow(getFlameData(), tmpRow, blocks)); // build node list for next query int level_total = children.size(); if (level_total > 0) { totalBlockCount += level_total; // just for sanity checking node_idxs = new int[level_total]; for (int kk = 0; kk < level_total; kk++) { node_idxs[kk] = children.get(kk); } } else if (tmpRow != row_count - 1) { int ii = 0; // weird!; break; } } } // System.out.printf("getRowDataIPC rows=%d blocks=%d\n", row_count, totalBlockCount); return flameRows; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlameBlock.java����������������������������������������������0000644�0001750�0001750�00000031234�14744453367�017701� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; public class FlameBlock { protected static final int UP = 0; protected static final int DOWN = 1; protected static final int LEFT = 2; protected static final int RIGHT = 3; protected static final int LAST_UP = 4; private int id; private int parentID; private long functionID; private double exclusiveValue; private double attributedValue; private PaintDetails paintDetails; // Only available (!= null) if block shuld be painted. class PaintDetails { private FlameRow flameRow; private boolean paintBlock; private int xPos; // relative to FlamePanel private int xWidth; private Color color; private String functionName; private FlameBlock[] next; private PaintDetails() { next = new FlameBlock[5]; } private FlameRow getFlameRow() { return flameRow; } private void setFlameRow(FlameRow flameRow) { this.flameRow = flameRow; } private int getXPos() { return xPos; } private void setXPos(int xPos) { this.xPos = xPos; } private int getXWidth() { return xWidth; } private void setXWidth(int xWidth) { this.xWidth = xWidth; } private Color getColor() { Color returnColor = null; if (flameRow.getFlameData().getBaseFlameBlock() == FlameBlock.this) { // Special case returnColor = AnEnvironment.FLAME_BLOCK_BASE_BACKGROUND; } if (color == null) { if (xWidth >= 1) { StackState state = flameRow.getFlameData().getFunctionIdNameMap().get(getFunctionID()); if (state != null) { long function = state.getNumber(); // Histable::Function* color = AnWindow.getInstance().getColorChooser().getColorMap().getFuncColor(function); } else { returnColor = Color.LIGHT_GRAY; // weird } } } if (returnColor == null) { returnColor = color; } if (flameRow.getFlameData().getSelectedFlameBlock() == FlameBlock.this && flameRow.getFlameData().getBaseFlameBlock() != FlameBlock.this) { returnColor = AnEnvironment.FLAME_BLOCK_SELECTED_BACKGROUND; } if (flameRow.getFlameData().getMouseOverFlameBlock() == FlameBlock.this) { returnColor = returnColor.brighter(); } return returnColor; } protected void resetColor() { color = null; } private String getFunctionName() { if (functionName == null) { StackState state = flameRow.getFlameData().getFunctionIdNameMap().get(getFunctionID()); if (state != null) { functionName = state.getName(); } if (functionName == null && flameRow.getRow() == 0) { // YLM: not sure if this still can happen, keeping it: // Special case functionName = "<Total>"; } if (functionName == null) { functionName = "" + getFunctionID(); } } return functionName; } private String getFunctionDisplayName() { String fn = getFunctionName(); String prefix = ""; // if (getFlameRow().getFlameData().getBaseFlameBlock() == FlameBlock.this) { // prefix = AnLocale.getString("Base: "); // } return prefix + fn; } private FlameBlock[] getNext() { return next; } private void setNextFlameBlock(int direction, FlameBlock flameBlock) { next[direction] = flameBlock; } private FlameBlock getNextFlameBlock(int direction) { return next[direction]; } private boolean paintBlock() { return paintBlock; } private void setPaintBlock(boolean paintBlock) { this.paintBlock = paintBlock; } } protected FlameBlock( int id, int parentID, long functionID, double exclusiveValue, double attributedValue) { this.id = id; this.parentID = parentID; this.functionID = functionID; this.exclusiveValue = exclusiveValue; this.attributedValue = attributedValue; } protected int getID() { return id; } protected int getParentID() { return parentID; } protected long getFunctionID() { return functionID; } protected double getInclusiveValue() { return exclusiveValue + attributedValue; } protected double getExclusiveValue() { return exclusiveValue; } protected double getAttributedValue() { return attributedValue; } protected String getInclusiveValueFormatted() { return getValueFormatted(getInclusiveValue()); } protected String getExclusiveValueFormatted() { return getValueFormatted(getExclusiveValue()); } protected String getAttributedValueFormatted() { return getValueFormatted(getAttributedValue()); } private String getValueFormatted(double value) { // FIXUP: This logic is not always correct. AnMetric anMetric = getFlameRow().getFlameData().getAnMetric(); if (anMetric.isTimeMetric()) { return String.format("%.3f", value); } else { // // YXXX Format with '@' to indicate half-spaces between digits // AnLong anLong = new AnLong((long) value); // return anLong.toFormString(); return "" + (long) value; } } protected Color getColor() { return paintDetails.getColor(); } protected void resetColor() { if (paintDetails != null) { paintDetails.resetColor(); } } protected void setXPosAndWidth(int xPos, int xWidth) { paintDetails.setXPos(xPos); paintDetails.setXWidth(xWidth); } protected int getXPos() { return paintDetails.getXPos(); } protected int getXWidth() { return paintDetails.getXWidth(); } protected boolean paintBlock() { return paintDetails != null && paintDetails.paintBlock(); } protected void setPaintBlock(boolean paintBlock) { paintDetails.setPaintBlock(paintBlock); } protected void resetPaintBlock() { paintDetails = new PaintDetails(); } protected String getFunctionName() { return paintDetails.getFunctionName(); } protected String getFunctionDisplayName() { return paintDetails.getFunctionDisplayName(); } protected FlameRow getFlameRow() { return paintDetails.getFlameRow(); } protected void setFlameRow(FlameRow flameRow) { paintDetails.setFlameRow(flameRow); } protected FlameBlock[] getNext() { return paintDetails.getNext(); } protected void setNextFlameBlock(int direction, FlameBlock flameBlock) { paintDetails.setNextFlameBlock(direction, flameBlock); } protected FlameBlock getNextFlameBlock(int direction) { if (paintDetails != null) { return paintDetails.getNextFlameBlock(direction); } else { return null; } } protected String getToolTipTextHTML() { String toolTipText = ""; if (getFlameRow() != null && getFlameRow().getFlameData() != null) { double totalValue = getFlameRow().getFlameData().getTotalValue(); StringBuilder buf = new StringBuilder(); buf.append("<html>"); buf.append("<font " + "face=\"monospaced\">"); buf.append("<b>"); buf.append("<nobr>"); buf.append(AnUtility.escapeSpecialHTMLCharacters(getFunctionName())); buf.append("</b>"); String inclExclText; if (getNextFlameBlock(UP) == null) { inclExclText = AnLocale.getString("Exclusive"); } else { inclExclText = AnLocale.getString("Inclusive"); } buf.append("<br>"); buf.append("<nobr>"); buf.append( formatValueHTML( inclExclText, totalValue, getInclusiveValue(), getInclusiveValueFormatted())); if (getExclusiveValue() > 0) { buf.append("<br>"); buf.append("<nobr>"); buf.append( formatValueHTML( AnLocale.getString("Exclusive"), totalValue, getExclusiveValue(), getExclusiveValueFormatted())); buf.append("<br>"); buf.append("<nobr>"); buf.append( formatValueHTML( AnLocale.getString("Calls"), totalValue, getAttributedValue(), getAttributedValueFormatted())); } else { buf.append("<br>"); buf.append("< "); buf.append("<br>"); buf.append("< "); } buf.append("</html>"); toolTipText = buf.toString(); } return toolTipText; } private String formatValueHTML( String what, double totalValue, double value, String formattedValue) { String percentText = ""; if (totalValue != 0) { double percent = value / totalValue * 100; percentText = String.format("%.2f", percent); } String text = String.format( "%-9s: %7s%% %10s %s", what, percentText, formattedValue, getFlameRow().getFlameData().getAnMetric().getUnit()); text = text.replaceAll(" ", " "); return text; } protected String getDetailsTextHTML() { return getToolTipTextHTML(); } protected static String getDetailsEmptyTextHTML() { String text; StringBuilder buf = new StringBuilder(); buf.append("<html>"); buf.append("< "); buf.append("<br>"); buf.append("< "); buf.append("<br>"); buf.append("< "); buf.append("<br>"); buf.append("< "); buf.append("<br>"); buf.append("</html>"); text = buf.toString(); return text; } protected String getValueText() { String text = ""; if (getFlameRow() != null && getFlameRow().getFlameData() != null) { double totalValue = getFlameRow().getFlameData().getTotalValue(); StringBuilder buf = new StringBuilder(); String percentText = null; if (totalValue != 0) { double percent = getInclusiveValue() / totalValue * 100; percentText = String.format("%.2f", percent); } if (percentText != null) { buf.append(percentText); buf.append("%"); } buf.append(" "); buf.append(getInclusiveValueFormatted()); buf.append(getFlameRow().getFlameData().getAnMetric().getUnit()); text = buf.toString(); } return text; } protected void initNext() { setNextFlameBlock(FlameBlock.UP, null); setNextFlameBlock(FlameBlock.DOWN, null); setNextFlameBlock(FlameBlock.LEFT, null); setNextFlameBlock(FlameBlock.RIGHT, null); } protected String dump() { StringBuilder buf = new StringBuilder(); buf.append("-------------------"); buf.append("id=" + id); buf.append("\n"); buf.append("parentID=" + parentID); buf.append("\n"); buf.append("functionID=" + functionID); buf.append("\n"); // buf.append("function name=" + // AnWindow.getInstance().getFlameView().getFlameData().getFunctionIdNameMap().get(functionID).getName()); StackState state = AnWindow.getInstance() .getFlameView() .getFlameData() .getFunctionIdNameMap() .get(getFunctionID()); final String name; if (state != null) { name = state.getName(); } else { name = null; } buf.append("function name=" + name); buf.append("\n"); buf.append("unformatted metric value=" + String.format("%.3f", exclusiveValue)); buf.append("\n"); buf.append("block width=" + (paintDetails != null ? paintDetails.getXWidth() : "")); buf.append("\n"); buf.append( "block next=" + " " + dumpNext(UP) + " " + dumpNext(DOWN) + " " + dumpNext(LEFT) + " " + dumpNext(RIGHT)); buf.append("\n"); return buf.toString(); } private String dumpNext(int direction) { FlameBlock fb = getNextFlameBlock(direction); if (fb != null) { return "" + fb.getID(); } else { return "-"; } } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlameToolBar.java��������������������������������������������0000644�0001750�0001750�00000024115�15044710303�020165� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.settings.MetricsSetting.MetricCheckBox; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Stack; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPopupMenu; import javax.swing.JSeparator; import javax.swing.JSpinner; import javax.swing.JToolBar; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; public class FlameToolBar extends JToolBar { private final FlameView flameView; private AnMetric[] availableMetrics; private JComboBox metricComboBox; private JSpinner zoomSpinner; private final int defaultZoomLevel; private JPopupMenu metricsSelectorpopup = null; private Stack<FlameBlock> setBaseStack = new Stack<FlameBlock>(); private int setBaseStackpointer = -1; private int comboboxSelectedIndex = -1; protected FlameToolBar(final FlameView flameView) { this.flameView = flameView; setOpaque(false); setBorder(null); defaultZoomLevel = getFont().getSize(); zoomSpinner = new JSpinner(new SpinnerNumberModel(0, -defaultZoomLevel - 3, 99, 1)); zoomSpinner.setBorder(BorderFactory.createLineBorder(new Color(122, 138, 153), 1)); JLabel zoomSpinnerlabel = new JLabel(AnLocale.getString("Zoom:")); zoomSpinnerlabel.setToolTipText(AnLocale.getString("Vertical zoom")); zoomSpinnerlabel.setDisplayedMnemonic(AnLocale.getString('Z', "FlameToolBar_ZoomLabel")); zoomSpinnerlabel.setLabelFor(zoomSpinner); zoomSpinner.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int zoomLevel = (int) zoomSpinner.getValue(); flameView.getFlamePanel().setZoomLevel(zoomLevel); } }); add(zoomSpinnerlabel); add(zoomSpinner); add(getFiller(6)); add(new JSeparator(JSeparator.VERTICAL)); add(getFiller(4)); add(flameView.getUndoSetBaseAction().createActionButton()); add(flameView.getRedoSetBaseAction().createActionButton()); add(flameView.getResetBaseAction().createActionButton()); add(flameView.getSetBaseAction().createActionButton()); add(getFiller(4)); add(new JSeparator(JSeparator.VERTICAL)); add(getFiller(4)); add(flameView.getUpOneAction().createActionButton()); add(flameView.getDownOneAction().createActionButton()); add(flameView.getLeftOneAction().createActionButton()); add(flameView.getRightOneAction().createActionButton()); add(getFiller(4)); add(new JSeparator(JSeparator.VERTICAL)); add(getFiller(4)); add(AnWindow.getInstance().getFunctionColorsAction().createActionButton()); add(getFiller(4)); add(new JSeparator(JSeparator.VERTICAL)); add(getFiller(8)); JLabel metricLabel = new JLabel(AnLocale.getString("Metric: ")); metricLabel.setToolTipText(AnLocale.getString("Selected metric")); metricLabel.setDisplayedMnemonic(AnLocale.getString('e', "FlameViewMetricLabel")); add(metricLabel); metricComboBox = new JComboBox<AnMetric>(); metricLabel.setLabelFor(metricComboBox); metricComboBox.setToolTipText(AnLocale.getString("Selected metric")); metricComboBox.addPopupMenuListener( new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { comboboxSelectedIndex = metricComboBox.getSelectedIndex(); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (metricComboBox.getSelectedItem() instanceof AnMetric) { flameView.setMetric((AnMetric) metricComboBox.getSelectedItem()); } else { if (comboboxSelectedIndex >= 0 && comboboxSelectedIndex < metricComboBox.getItemCount()) { metricComboBox.setSelectedIndex(comboboxSelectedIndex); } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { showMetricsConfigurationPopup( metricComboBox, 0, metricComboBox.getHeight(), AnDisplay.DSP_CallFlame); } }); } } @Override public void popupMenuCanceled(PopupMenuEvent e) {} }); add(metricComboBox); setMinimumSize(new Dimension(10, 10)); getAccessibleContext().setAccessibleName(AnLocale.getString("Flame Chart Toolbar")); getAccessibleContext().setAccessibleDescription(AnLocale.getString("Flame Chart Toolbar")); } public void showMetricsConfigurationPopup(Component component, int x, int y, int dtype) { metricsSelectorpopup = getmetricsSelectorPopup(dtype); metricsSelectorpopup.show(component, x, y); } private JPopupMenu getmetricsSelectorPopup(int dtype) { JPopupMenu popup = new JPopupMenu(); AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricsPopupSelector(popup, dtype, false); // Customize: Slecting an already enabled metric will just use that metric (and not unselect // it). for (Component component : popup.getComponents()) { if (component instanceof MetricCheckBox) { final MetricCheckBox metricCheckBox = (MetricCheckBox) component; if (metricCheckBox.isSelected()) { // component.setEnabled(false); ActionListener[] als = metricCheckBox.getActionListeners(); for (ActionListener al : als) { metricCheckBox.removeActionListener(al); } metricCheckBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { flameView.setMetric(metricCheckBox.getAnMetric()); } }); } } } return popup; } protected void resetZoom() { zoomSpinner.setValue(0); } protected void resetMetrics(AnMetric anMetric) { metricComboBox.removeAllItems(); availableMetrics = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricListByMType(MetricsSetting.MET_CALL_AGR); if (availableMetrics != null) { int selectedIndex = -1; int index = 0; for (AnMetric am : availableMetrics) { if (am.isNameMetric() || am.isStatic()) { continue; } metricComboBox.addItem(am); if (anMetric.getUserName().equals(am.getUserName())) { selectedIndex = index; } index++; } if (selectedIndex >= 0) { metricComboBox.setSelectedIndex(selectedIndex); } else { metricComboBox.addItem(null); metricComboBox.setSelectedIndex(metricComboBox.getItemCount() - 1); } metricComboBox.addItem(AnLocale.getString("More Metrics...")); } } private JComponent getFiller(int x) { Dimension dim = new Dimension(x, 0); Box.Filler filler = new Box.Filler(dim, dim, dim); return filler; } protected void initSetBaseStack() { setBaseStack = new Stack<FlameBlock>(); setBaseStackpointer = -1; } protected void pushToSetBaseStack(FlameBlock fb) { while (setBaseStack.size() > 0 && (setBaseStack.size() - 1) > setBaseStackpointer) { setBaseStack.pop(); } if (setBaseStack.empty() || setBaseStack.peek() != fb) { setBaseStack.push(fb); setBaseStackpointer = setBaseStack.size() - 1; } } protected void undoSetBaseStack() { if (canUndoSetBaseStack()) { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); setBaseStackpointer--; FlameBlock flameBlock = setBaseStack.get(setBaseStackpointer); flameView.getFlamePanel().setBaseFlameBlock(flameBlock, false); flameView.getFlameData().setSelectedFlameBlock(selectedFlameBlock); } flameView.updateActionsEnableStatus(); } protected void redoSetBaseStack() { if (canRedoSetBaseStack()) { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); setBaseStackpointer++; FlameBlock flameBlock = setBaseStack.get(setBaseStackpointer); flameView.getFlamePanel().setBaseFlameBlock(flameBlock, false); flameView.getFlameData().setSelectedFlameBlock(selectedFlameBlock); } flameView.updateActionsEnableStatus(); } protected boolean canUndoSetBaseStack() { return setBaseStackpointer > 0; } protected boolean canRedoSetBaseStack() { return setBaseStackpointer < setBaseStack.size() - 1; } protected boolean canZoom() { FlameData flameData = flameView.getFlameData(); return !(flameData.getFlameRows().length == 0 || flameData.getFlameRows()[0] == null || flameData.getFlameRows()[0].getFlameBlocks().isEmpty()); } protected void setControilsEnabled(boolean enabled) { if (enabled) { zoomSpinner.setEnabled(canZoom()); } else { zoomSpinner.setEnabled(false); } } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlamePanel.java����������������������������������������������0000644�0001750�0001750�00000055742�15044710303�017674� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.AnDisplay; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.filter.Filters; import org.gprofng.mpmt.settings.MetricsSetting; import org.gprofng.mpmt.util.gui.AnGradientPanel; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSeparator; import javax.swing.SwingUtilities; public class FlamePanel extends JPanel implements MouseListener, MouseMotionListener { private enum State { CLEAR, RESET, ROWS }; private final FlameView flameView; private State state; private final Object stateLock = new Object(); private int lastWidth = 0; private final DataPanel dataPanel; private int rowHeight; private Font font; private final int defaultFontSize; private static final int outerGap = 2; private static final int innerGap = 2; protected FlamePanel(FlameView flameView) { this.flameView = flameView; setOpaque(true); setBackground(AnEnvironment.SPLIT_PANE_DIVIDER_BACKGROUND_COLOR); font = getFont().deriveFont((float) (getFont().getSize() - 0)); defaultFontSize = font.getSize(); rowHeight = font.getSize() + 4; state = State.CLEAR; setLayout(new GridBagLayout()); dataPanel = new DataPanel(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new Insets(outerGap, outerGap, outerGap, outerGap); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; add(dataPanel, gridBagConstraints); dataPanel.addMouseListener(this); dataPanel.addMouseMotionListener(this); } @Override public void mouseClicked(MouseEvent e) { if (flameView.getFlameData() != null) { FlameBlock mouseOverFlameBlock = flameView.getFlameData().getMouseOverFlameBlock(); if (mouseOverFlameBlock != null) { if (SwingUtilities.isLeftMouseButton(e)) { setSelectedFlameBlock(mouseOverFlameBlock); if (e.getClickCount() >= 2) { // System.out.println("left mouse clicked " + e.getClickCount() + " " // + mouseOverFlameBlock.getFunctionName()); setBaseFlameBlock(mouseOverFlameBlock, true); } } } } } @Override public void mouseReleased(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) { if (flameView.getFlameData() == null) { return; } final FlameBlock mouseOverFlameBlock = flameView.getFlameData().getMouseOverFlameBlock(); if (SwingUtilities.isRightMouseButton(e)) { if (mouseOverFlameBlock != null) { setSelectedFlameBlock(mouseOverFlameBlock); } if (e.isPopupTrigger()) { JPopupMenu popup = new JPopupMenu("Popup"); FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); for (JComponent jmi : getMenuList(selectedFlameBlock)) { popup.add(jmi); } popup.show(dataPanel, e.getX(), e.getY()); } } } protected void showPopup(FlameBlock selectedFlameBlock) { // int row = flameBlock.getFlameRow().getRow(); // int x = flameBlock.getXPos(); // int y = dataPanel.getHeight() - (rowHeight * row); Point mousePoint = MouseInfo.getPointerInfo().getLocation(); // screen position Point panelPoint = dataPanel.getLocationOnScreen(); int x = mousePoint.x - panelPoint.x; int y = mousePoint.y - panelPoint.y; JPopupMenu popup = new JPopupMenu("Popup"); for (JComponent jmi : getMenuList(selectedFlameBlock)) { popup.add(jmi); } popup.show(dataPanel, x, y); } private List<JComponent> getMenuList(final FlameBlock selectedFlameBlock) { List<JComponent> list = new ArrayList<>(); JMenuItem showSource = new JMenuItem(AnLocale.getString("Show Source")); showSource.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().setSelectedView(AnDisplay.DSP_Source); } }); list.add(showSource); JMenuItem showDis = new JMenuItem(AnLocale.getString("Show Disassembly")); showDis.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AnWindow.getInstance().setSelectedView(AnDisplay.DSP_Disassembly); } }); list.add(showDis); list.add(new JSeparator()); for (JComponent jmi : flameView.getFilterMenuList(selectedFlameBlock)) { list.add(jmi); } list.add(new JSeparator()); JMenu setMetricMenu = new JMenu(AnLocale.getString("Set Metric")); AnMetric[] availableMetrics = AnWindow.getInstance() .getSettings() .getMetricsSetting() .getMetricListByMType(MetricsSetting.MET_CALL_AGR); if (availableMetrics != null) { for (AnMetric am : availableMetrics) { if (am.isNameMetric() || am.isStatic()) { continue; } final AnMetric am2 = am; JMenuItem metricMenuItem = new JMenuItem(am2.getUserName()); metricMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { flameView.setMetric(am2); } }); setMetricMenu.add(metricMenuItem); } // More metrics JMenu moreMetricMenu = new JMenu(AnLocale.getString("More Metrics")); AnWindow.getInstance() .getSettings() .getMetricsSetting() .addMetricMenuSelector(moreMetricMenu, AnDisplay.DSP_CallFlame, false); // Customize: diasble already enabled metrics (?) for (Component component : moreMetricMenu.getMenuComponents()) { if (component instanceof MetricsSetting.MetricCheckBox) { if (((MetricsSetting.MetricCheckBox) component).isSelected()) { component.setEnabled(false); } } } setMetricMenu.add(moreMetricMenu); } list.add(setMetricMenu); list.add(new JSeparator()); list.add(flameView.getUndoSetBaseAction().getMenuItem(false)); list.add(flameView.getRedoSetBaseAction().getMenuItem(false)); list.add(flameView.getSetBaseAction().getMenuItem(false)); list.add(flameView.getResetBaseAction().getMenuItem(false)); list.add(new JSeparator()); list.add(flameView.getUpOneAction().getMenuItem(false)); list.add(flameView.getDownOneAction().getMenuItem(false)); list.add(flameView.getLeftOneAction().getMenuItem(false)); list.add(flameView.getRightOneAction().getMenuItem(false)); if (selectedFlameBlock == null) { showSource.setEnabled(false); showDis.setEnabled(false); } return list; } protected void setAsBase() { FlameBlock newBaseFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); if (newBaseFlameBlock != null) { setBaseFlameBlock(newBaseFlameBlock, true); flameView.scrollToRow(newBaseFlameBlock.getFlameRow().getRow()); } flameView.updateActionsEnableStatus(); } protected boolean canSetBase() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getSelectedFlameBlock() != flameView.getFlameData().getBaseFlameBlock(); } protected void resetBase() { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); FlameBlock newBaseFlameBlock = flameView.getFlameData().getTotalFlameBlock(); if (newBaseFlameBlock != null) { setBaseFlameBlock(newBaseFlameBlock, true); flameView.scrollToRow(newBaseFlameBlock.getFlameRow().getRow()); } flameView.getFlameData().setSelectedFlameBlock(selectedFlameBlock); flameView.updateActionsEnableStatus(); } protected boolean canResetBase() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getBaseFlameBlock() != flameView.getFlameData().getTotalFlameBlock(); } protected void upOne() { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); FlameBlock newSelectedFlameBlock = selectedFlameBlock.getNextFlameBlock(FlameBlock.LAST_UP); if (newSelectedFlameBlock == null) { newSelectedFlameBlock = selectedFlameBlock.getNextFlameBlock(FlameBlock.UP); } if (newSelectedFlameBlock != null) { setSelectedFlameBlock(newSelectedFlameBlock); flameView.scrollToRow(newSelectedFlameBlock.getFlameRow().getRow()); } flameView.updateActionsEnableStatus(); } protected boolean canUpOne() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getSelectedFlameBlock() != null && flameView.getFlameData().getSelectedFlameBlock().getNextFlameBlock(FlameBlock.UP) != null; } protected void downOne() { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); FlameBlock newSelectedFlameBlock = selectedFlameBlock.getNextFlameBlock(FlameBlock.DOWN); if (newSelectedFlameBlock != null) { newSelectedFlameBlock.getNext()[FlameBlock.LAST_UP] = selectedFlameBlock; setSelectedFlameBlock(newSelectedFlameBlock); flameView.scrollToRow(newSelectedFlameBlock.getFlameRow().getRow()); } flameView.updateActionsEnableStatus(); } protected boolean canDownOne() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getSelectedFlameBlock() != null && flameView.getFlameData().getSelectedFlameBlock().getNextFlameBlock(FlameBlock.DOWN) != null; } protected void leftOne() { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); FlameBlock newSelectedFlameBlock = selectedFlameBlock.getNextFlameBlock(FlameBlock.LEFT); if (newSelectedFlameBlock != null) { setSelectedFlameBlock(newSelectedFlameBlock); } flameView.updateActionsEnableStatus(); } protected boolean canLeftOne() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getSelectedFlameBlock() != null && flameView.getFlameData().getSelectedFlameBlock().getNextFlameBlock(FlameBlock.LEFT) != null; } protected void rightOne() { FlameBlock selectedFlameBlock = flameView.getFlameData().getSelectedFlameBlock(); FlameBlock newSelectedFlameBlock = selectedFlameBlock.getNextFlameBlock(FlameBlock.RIGHT); if (newSelectedFlameBlock != null) { setSelectedFlameBlock(newSelectedFlameBlock); } flameView.updateActionsEnableStatus(); } protected boolean canRightOne() { return flameView != null && flameView.getFlameData() != null && flameView.getFlameData().getSelectedFlameBlock() != null && flameView.getFlameData().getSelectedFlameBlock().getNextFlameBlock(FlameBlock.RIGHT) != null; } protected void setBaseFlameBlock(FlameBlock baseFlameBlock, boolean pushToSetBaseStack) { // System.out.println("FlamePanel setBaseFlameBlock " + pushToSetBaseStack); if (pushToSetBaseStack) { flameView.getFlameToolBar().pushToSetBaseStack(baseFlameBlock); } flameView.getFlameData().setBaseFlameBlock(baseFlameBlock); flameView.getFlameData().recalculateFlameBlockWidths(dataPanel.getWidth() - 2 * innerGap); dataPanel.repaint(500); flameView.updateActionsEnableStatus(); flameView.requestFocus(); // so key events keep working! (???). } protected void setSelectedFlameBlock(FlameBlock selectedFlameBlock) { if (flameView.getFlameData().setSelectedFlameBlock(selectedFlameBlock)) { dataPanel.repaint(500); } flameView.updateActionsEnableStatus(); flameView.requestFocus(); // so key events keep working! (???). } @Override public void mouseExited(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseDragged(MouseEvent e) {} @Override public void mouseMoved(MouseEvent e) { if (flameView.getFlameData() == null) { return; } int panelHeight = dataPanel.getHeight(); int row = (panelHeight - innerGap - e.getY()) / rowHeight; FlameBlock flameBlock = flameView.getFlameData().findFlameBlock(row, e.getX() - innerGap); // System.out.println(e.getX() + " " + e.getY() + " " + row); if (flameView.getFlameData().setMouseOverFlameBlock(flameBlock)) { String toolTipText = null; if (flameBlock != null) { toolTipText = flameBlock.getToolTipTextHTML(); } dataPanel.setToolTipText(toolTipText); dataPanel.repaint(500); } } /** Called when new experiment loaded */ protected void initView() { synchronized (stateLock) { state = State.CLEAR; dataPanel.repaint(500); } } /** Called just before everything is recomputed (doCompute) */ protected void resetView() { synchronized (stateLock) { state = State.RESET; dataPanel.repaint(500); } } /** Called when function colors have changed */ protected void functionColorsChanged() { synchronized (stateLock) { if (flameView.getFlameData() != null) { flameView.getFlameData().resetBlockColors(); if (flameView.isSelected()) { dataPanel.repaint(500); } } } } /** Called when a row is complete */ protected void rowIsComplete(int newRow) { // System.out.println("rowIsComplete " + newRow); if (flameView.getFlameData().allRowsDone()) { flameView.getFlameData().calculateFlameBlockWidths(dataPanel.getSize().width); synchronized (stateLock) { state = State.ROWS; dataPanel.repaint(500); } } } protected int getRowHeight() { return rowHeight; } protected void setZoomLevel(int zoomLevel) { int newRowHeight = defaultFontSize + zoomLevel + 4; if (newRowHeight != this.rowHeight) { this.rowHeight = newRowHeight; font = getFont().deriveFont((float) (defaultFontSize + zoomLevel)); setPanelSize(flameView.getFlameData().getFlameRows().length); flameView.scrollToRow(0); repaint(); } } protected void setPanelSize(int rowCount) { int newHeight = rowCount * rowHeight + 2 * outerGap; // System.out.println("setPanelSize " + newHeight); setMinimumSize(new Dimension(10, newHeight)); setPreferredSize(new Dimension(10, newHeight)); revalidate(); } class DataPanel extends AnGradientPanel { private DataPanel() { super(AnEnvironment.FLAME_TOP_COLOR, AnEnvironment.FLAME_BOTTOM_COLOR); } @Override public void paint(Graphics g) { // System.out.println("paint() " + getSize()); super.paint(g); // Paints background synchronized (stateLock) { switch (state) { case CLEAR: paintClear(g); break; case RESET: paintClear(g); paintReset(g); break; case ROWS: paintClear(g); int width = getSize().width; FlameData flameData = flameView.getFlameData(); if (width != lastWidth) { flameData.recalculateFlameBlockWidths(width - 2 * innerGap); } lastWidth = width; // Date start = new Date(); paintRows(g, flameData); // System.out.println("paint() " + (new Date().getTime() - // start.getTime())); break; } } } private void paintClear(Graphics g) { // Nothing } private void paintReset(Graphics g) { int width = getSize().width; Rectangle ret = getVisibleRect(); g.setColor(AnEnvironment.FLAME_INFO_TEXT_COLOR); Font font = getFont().deriveFont((float) (getFont().getSize() + 3)); g.setFont(font); String msg = AnLocale.getString("Fetching data..."); int msgWidth = g.getFontMetrics().stringWidth(msg); g.drawString(msg, width / 2 - msgWidth / 2, ret.y + ret.height / 2 + 10); flameView.updateSelection(); } private void paintNoData(Graphics g) { setPanelSize(1); int width = getSize().width; Rectangle ret = getVisibleRect(); g.setColor(AnEnvironment.FLAME_INFO_TEXT_COLOR); Font font = getFont().deriveFont((float) (getFont().getSize() + 3)); g.setFont(font); String msg = String.format( AnLocale.getString("Data not available for this metric (%s)"), flameView.getFlameData().getAnMetric()); if (Filters.getInstance().anyFilters()) { msg += AnLocale.getString(" and filter selection"); } int msgWidth = g.getFontMetrics().stringWidth(msg); g.drawString(msg, width / 2 - msgWidth / 2, ret.y + ret.height / 2 + 10); flameView.updateSelection(); } private void paintRows(Graphics g, FlameData flameData) { if (flameData == null) { paintNoData(g); return; } if (flameData.getFlameRows().length == 0 || flameData.getFlameRows()[0] == null || flameData.getFlameRows()[0].getFlameBlocks().isEmpty()) { paintNoData(g); return; } FlameRow[] flameRows = flameData.getFlameRows(); if (flameRows != null) { int width = getSize().width; int height = getSize().height; Rectangle visibleRectangle = getVisibleRect(); g.setFont(font); for (int row = 0; row < flameRows.length; row++) { FlameRow flameRow = flameRows[row]; g.setClip(visibleRectangle); int blockTextYPos = height - (rowHeight * row) - 4 - innerGap; if (flameRow != null && flameRow.isReadyToPaint()) { int blockYPos = height - (rowHeight * row) - rowHeight - innerGap; FlameBlock flameBlock = flameRow.getFirstPaintedFlameBlock(); while (flameBlock != null) { if (flameBlock.paintBlock()) { int blockWidth = flameBlock.getXWidth(); int blockXPos = flameBlock.getXPos() + innerGap; if (blockWidth >= 2) { g.setColor(flameBlock.getColor()); g.fillRect(blockXPos, blockYPos, blockWidth, rowHeight); } g.setColor(AnEnvironment.FLAME_BLOCK_BORDER_COLOR); g.drawRect(blockXPos, blockYPos, blockWidth, rowHeight); if (blockWidth > 6) { Font font = g.getFont(); Font boldFont = font.deriveFont(Font.BOLD); g.setColor(Color.BLACK); if (flameBlock == flameData.getBaseFlameBlock()) { g.setFont(boldFont); } g.setClip(blockXPos, visibleRectangle.y, blockWidth, visibleRectangle.height); g.drawString(flameBlock.getFunctionDisplayName(), blockXPos + 2, blockTextYPos); if (flameBlock == flameData.getBaseFlameBlock()) { String valueText = flameBlock.getValueText(); g.setFont(boldFont); int valueWidth = g.getFontMetrics().stringWidth(valueText); g.setColor(flameBlock.getColor()); g.fillRect( blockXPos + blockWidth - valueWidth - 20, blockYPos, blockWidth, rowHeight); g.setColor(Color.BLACK); g.drawString(valueText, blockWidth - valueWidth, blockTextYPos + 0); g.setFont(font); } g.setFont(font); g.setClip(visibleRectangle); } } flameBlock = flameBlock.getNextFlameBlock(FlameBlock.RIGHT); } } else if (flameRow != null) { g.setColor(Color.GREEN.darker().darker()); g.drawString( String.format("%2s", row) + ": " + AnLocale.getString("Ready..."), width / 2 - 12, blockTextYPos); } else { g.setColor(AnEnvironment.FLAME_INFO_TEXT_COLOR); g.drawString( String.format("%2s", row) + ": " + AnLocale.getString("Fetching data..."), width / 2 - 12, blockTextYPos); } } FlameBlock selectedFlameBlock = flameData.getSelectedFlameBlock(); FlameBlock mouseOverFlameBlock = flameData.getMouseOverFlameBlock(); if (selectedFlameBlock != null) { drawXFlameBlock( g, selectedFlameBlock, AnEnvironment.FLAME_BLOCK_SELECTED_BORDER1, AnEnvironment.FLAME_BLOCK_SELECTED_BORDER2); } if (mouseOverFlameBlock != null) { drawXFlameBlock( g, mouseOverFlameBlock, AnEnvironment.FLAME_BLOCK_MOUSEOVER_BORDER1, null); } } } private void drawXFlameBlock(Graphics g, FlameBlock flameBlock, Color color1, Color color2) { if (flameBlock.paintBlock()) { int height = getSize().height; int blockWidth = flameBlock.getXWidth(); int blockXPos = flameBlock.getXPos() + innerGap; int blockYPos = height - (rowHeight * flameBlock.getFlameRow().getRow()) - rowHeight - innerGap; if (color1 != null) { g.setColor(color1); g.drawRect(blockXPos, blockYPos, blockWidth, rowHeight); g.drawRect(blockXPos - 1, blockYPos - 1, blockWidth + 2, rowHeight + 2); } if (color2 != null) { g.setColor(color2); g.drawRect(blockXPos + 1, blockYPos + 1, blockWidth - 2, rowHeight - 2); } } } } protected static int getOuterGap() { return outerGap; } protected static int getInnerGap() { return innerGap; } } ������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlameRow.java������������������������������������������������0000644�0001750�0001750�00000005176�14744453367�017424� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import java.util.HashMap; import java.util.List; import java.util.Map; public class FlameRow { private FlameData flameData; private int row; private List<FlameBlock> flameBlocks; private boolean readyToPaint; private FlameBlock firstPaintedFlameBlock; private Map<Integer, FlameBlock> idToBlockMap; protected FlameRow(FlameData flameData, int row, List<FlameBlock> flameBlocks) { this.flameData = flameData; this.row = row; this.flameBlocks = flameBlocks; readyToPaint = false; idToBlockMap = new HashMap<Integer, FlameBlock>(); if (flameBlocks != null) { for (FlameBlock flameBlock : flameBlocks) { idToBlockMap.put(flameBlock.getID(), flameBlock); } } } protected FlameBlock findFlameBlock(int id) { FlameBlock block = idToBlockMap.get(id); return block; } protected int getRow() { return row; } protected List<FlameBlock> getFlameBlocks() { return flameBlocks; } protected FlameData getFlameData() { return flameData; } protected boolean isReadyToPaint() { return readyToPaint; } protected void setReadyToPaint() { readyToPaint = true; } protected void resetReadyToPaint() { readyToPaint = false; } protected void resetBlockColors() { for (FlameBlock flameBlock : flameBlocks) { flameBlock.resetColor(); } } protected FlameBlock getFirstPaintedFlameBlock() { return firstPaintedFlameBlock; } protected void setFirstPaintedFlameBlock(FlameBlock firstPaintedFlameBlock) { this.firstPaintedFlameBlock = firstPaintedFlameBlock; } protected String dump() { StringBuilder buf = new StringBuilder(); buf.append("======================================== "); buf.append("row=" + row); buf.append(" "); buf.append("blocks=" + flameBlocks.size()); buf.append("\n"); for (FlameBlock flameBlock : flameBlocks) { buf.append(flameBlock.dump()); } return buf.toString(); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/flame/FlameData.java�����������������������������������������������0000644�0001750�0001750�00000036532�15044710303�017502� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt.flame; import org.gprofng.mpmt.AnMetric; import org.gprofng.mpmt.AnWindow; import org.gprofng.mpmt.statecolors.StackState; import org.gprofng.mpmt.util.gui.AnUtility; import java.util.List; import java.util.Map; public class FlameData { private final FlameView flameView; private AnMetric anMetric = null; private FlameRow[] flameRows = null; private Map<Long, StackState> functionIdNameMap = null; private FlameBlock baseFlameBlock = null; private FlameBlock mouseOverFlameBlock = null; private FlameBlock selectedFlameBlock = null; private static final Object selectedObjectLock = new Object(); private static UpdateSelectedObjectThread selectedObjectThread; protected FlameData(FlameView flameView, AnMetric anMetric, int rowCount) { this.flameView = flameView; this.anMetric = anMetric; flameRows = new FlameRow[rowCount]; } protected void rowDone(FlameRow flameRow) { flameRows[flameRow.getRow()] = flameRow; if (flameRow.getRow() == 0) { if (!flameRow.getFlameBlocks().isEmpty() && !flameRows[0].getFlameBlocks().isEmpty()) { baseFlameBlock = getTotalFlameBlock(); baseFlameBlock.resetPaintBlock(); baseFlameBlock.setPaintBlock(true); baseFlameBlock.setFlameRow(flameRow); flameRow.setFirstPaintedFlameBlock(baseFlameBlock); setBaseFlameBlock(baseFlameBlock); flameView.getFlameToolBar().initSetBaseStack(); flameView.getFlameToolBar().pushToSetBaseStack(baseFlameBlock); } } } protected FlameBlock getTotalFlameBlock() { if (flameRows[0].getFlameBlocks().isEmpty()) { return null; } else { return flameRows[0].getFlameBlocks().get(0); // Only one block here!!!!!! } } protected FlameRow[] getFlameRows() { return flameRows; } protected boolean allRowsDone() { boolean allDone = false; if (flameRows != null) { allDone = true; for (FlameRow flameRow : flameRows) { if (flameRow == null) { allDone = false; break; } } } return allDone; } protected void resetReadyToPaint() { for (FlameRow flameRow : flameRows) { if (flameRow != null) { flameRow.resetReadyToPaint(); } } } protected void resetBlockColors() { for (FlameRow flameRow : flameRows) { if (flameRow != null) { flameRow.resetBlockColors(); } } } protected void recalculateFlameBlockWidths(int width) { resetReadyToPaint(); calculateFlameBlockWidths(width); } protected void calculateFlameBlockWidths(int width) { FlameRow[] flameRows = getFlameRows(); FlameBlock baseFlameBlock = getBaseFlameBlock(); for (int row = 0; row < flameRows.length; row++) { if (flameRows[row] == null) { break; } if (flameRows[row].isReadyToPaint()) { continue; } FlameRow flameRow = flameRows[row]; if (flameRow == null) { break; } List<FlameBlock> flameBlocks = flameRow.getFlameBlocks(); if (flameBlocks.isEmpty()) { break; } if (row <= baseFlameBlock.getFlameRow().getRow()) { flameRow.setFirstPaintedFlameBlock(null); for (FlameBlock fb : flameRow.getFlameBlocks()) { if (fb == baseFlameBlock) { fb.setPaintBlock(true); fb.setXPosAndWidth(0, width - 1); fb.setFlameRow(flameRow); flameRow.setFirstPaintedFlameBlock(fb); fb.initNext(); int r = row; while (r > 0) { FlameRow fr = flameRows[r - 1]; FlameBlock pfb = fr.findFlameBlock(fb.getParentID()); pfb.setPaintBlock(true); pfb.setXPosAndWidth(0, width - 1); pfb.setFlameRow(fr); fr.setFirstPaintedFlameBlock(pfb); pfb.initNext(); pfb.setNextFlameBlock(FlameBlock.UP, fb); fb.setNextFlameBlock(FlameBlock.DOWN, pfb); fb = pfb; r--; } } else { fb.setPaintBlock(false); } flameRow.setReadyToPaint(); } } else { double xFactor = ((double) width) / baseFlameBlock.getInclusiveValue(); FlameRow parentFlameRow = flameRows[row - 1]; if (parentFlameRow == null || !parentFlameRow.isReadyToPaint()) { break; } int lastXPos = -1; int lastParentID = -1; int childOffset = 0; flameRow.setFirstPaintedFlameBlock(null); FlameBlock lastPaintedFlameBlock = null; for (int n = flameBlocks.size() - 1; n >= 0; n--) { FlameBlock flameBlock = flameBlocks.get(n); flameBlock.resetPaintBlock(); FlameBlock parentFlameBlock = parentFlameRow.findFlameBlock(flameBlock.getParentID()); if (parentFlameBlock == null) { System.out.println( "Error: can't find flameblock row: " + parentFlameRow.getRow() + " id=" + flameBlock.getParentID()); break; } if (!parentFlameBlock.paintBlock()) { flameBlock.setPaintBlock(false); continue; } if (flameBlock.getParentID() != lastParentID) { childOffset = 0; lastParentID = flameBlock.getParentID(); } int xWidth = (int) (flameBlock.getInclusiveValue() * xFactor + 0.5); // round up/down ???? int xPos = parentFlameBlock.getXPos() + parentFlameBlock.getXWidth() - xWidth - childOffset; // if (flameBlock.getInclusiveValue() < // (baseFlameBlock.getInclusiveValue() * 0.001)) { // <==== Threshold (0.001)! // flameBlock.setPaintBlock(false); // } // else if (xPos < parentFlameBlock.getXPos()) { // Because of accumulating rounding, we can end up with a block to the left of it's // parent. Just adjust it here..... xWidth -= parentFlameBlock.getXPos() - xPos; xPos = parentFlameBlock.getXPos(); } if (xWidth <= 0 && xPos == lastXPos) { // Don't paint blocks with zero width if one already painted at same x position flameBlock.setPaintBlock(false); } else { flameBlock.setPaintBlock(true); flameBlock.setXPosAndWidth(xPos, xWidth); flameBlock.setFlameRow(flameRow); lastXPos = xPos; childOffset = childOffset + xWidth; flameBlock.initNext(); parentFlameBlock.setNextFlameBlock(FlameBlock.UP, flameBlock); flameBlock.setNextFlameBlock(FlameBlock.DOWN, parentFlameBlock); if (lastPaintedFlameBlock != null) { lastPaintedFlameBlock.setNextFlameBlock(FlameBlock.LEFT, flameBlock); flameBlock.setNextFlameBlock(FlameBlock.RIGHT, lastPaintedFlameBlock); } // flameRow.setFirstPaintedFlameBlock(flameBlock); // XXX lastPaintedFlameBlock = flameBlock; } } // Update LEFT/RIGHT links. Up until here, only blocks with same parent are linked // correctly. Blocks with different // paraents are shuffled due to the sorting. FlameBlock fbChild = null; FlameBlock pfb = flameRows[row - 1].getFirstPaintedFlameBlock(); FlameBlock lastFBChild = null; while (pfb != null) { FlameBlock pfbFirstChild = pfb.getNextFlameBlock(FlameBlock.UP); if (pfbFirstChild != null) { if (fbChild == null) { flameRow.setFirstPaintedFlameBlock(pfbFirstChild); pfbFirstChild.setNextFlameBlock(FlameBlock.LEFT, null); } if (lastFBChild != null) { lastFBChild.setNextFlameBlock(FlameBlock.RIGHT, pfbFirstChild); pfbFirstChild.setNextFlameBlock(FlameBlock.LEFT, lastFBChild); } fbChild = pfbFirstChild; while (fbChild != null && fbChild.getNextFlameBlock(FlameBlock.RIGHT) != null && fbChild.getNextFlameBlock(FlameBlock.RIGHT).getParentID() == pfb.getID()) { fbChild = fbChild.getNextFlameBlock(FlameBlock.RIGHT); } if (fbChild != null) { fbChild.setNextFlameBlock(FlameBlock.RIGHT, null); } lastFBChild = fbChild; } pfb = pfb.getNextFlameBlock(FlameBlock.RIGHT); } flameRow.setReadyToPaint(); } } } private int getBlockCount() { int blockCount = 0; for (FlameRow flameRow : flameRows) { blockCount += flameRow.getFlameBlocks().size(); } return blockCount; } protected Map<Long, StackState> getFunctionIdNameMap() { return functionIdNameMap; } protected double getTotalValue() { if (baseFlameBlock != null) { return baseFlameBlock.getInclusiveValue(); } else { // FIXUP: Error!!!!! return 0; } } protected void setFunctionIdNameMap(Map<Long, StackState> functionIdNameMap) { this.functionIdNameMap = functionIdNameMap; } protected FlameBlock findFlameBlock(int row, int x) { FlameBlock fb = null; if (row >= 0 && row < flameRows.length) { FlameRow flameRow = flameRows[row]; if (flameRow != null) { for (FlameBlock flameBlock : flameRow.getFlameBlocks()) { if (flameBlock.paintBlock()) { if (x >= flameBlock.getXPos() && x <= flameBlock.getXPos() + flameBlock.getXWidth()) { fb = flameBlock; break; } } } } } return fb; } /** * Search all painted flame blocks for function id. * * @param functionID * @return */ protected FlameBlock findFunctionFlameBlock(long functionID) { for (FlameRow flameRow : flameRows) { for (FlameBlock flameBlock = flameRow.getFirstPaintedFlameBlock(); flameBlock != null; flameBlock = flameBlock.getNextFlameBlock(FlameBlock.RIGHT)) { if (flameBlock.getFunctionID() == functionID) { return flameBlock; } } } return null; } protected FlameBlock getSelectedFlameBlock() { return selectedFlameBlock; } protected boolean setSelectedFlameBlock(FlameBlock selectedFlameBlock) { if (selectedFlameBlock != null && selectedFlameBlock != this.selectedFlameBlock) { handleSelectedObject(selectedFlameBlock); this.selectedFlameBlock = selectedFlameBlock; flameView.updateSelection(selectedFlameBlock); return true; } else { return false; } } /* Setting selected object is slow so delay and interrupt if another selection follows within xxx ms. */ private static void handleSelectedObject(final FlameBlock selectedFlameBlock) { synchronized (selectedObjectLock) { if (selectedObjectThread != null /* && selectedObjectThread.isAlive()*/) { selectedObjectThread.doInterrupt(); } selectedObjectThread = new UpdateSelectedObjectThread(selectedFlameBlock); AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { selectedObjectThread.run(); } }, "handleSelectedObject"); } } static class UpdateSelectedObjectThread extends Thread { private FlameBlock flameBlock; private boolean interrupted = false; public UpdateSelectedObjectThread(FlameBlock flameBlock) { this.flameBlock = flameBlock; } @Override public void run() { int loops = 10; int n = 0; while (n < loops && !interrupted) { try { Thread.sleep(40); } catch (InterruptedException ie) { } ; n++; } if (!interrupted) { // System.out.println("select " + flameBlock.getFunctionDisplayName()); AnWindow.getInstance().getSelectedObject().setSelObjV2(flameBlock.getFunctionID()); AnWindow.getInstance().getSelectionManager().updateSelection(); } } public void doInterrupt() { interrupted = true; } } protected FlameBlock getMouseOverFlameBlock() { return mouseOverFlameBlock; } protected boolean setMouseOverFlameBlock(FlameBlock mouseOverFlameBlock) { if (mouseOverFlameBlock != this.mouseOverFlameBlock) { this.mouseOverFlameBlock = mouseOverFlameBlock; return true; } else { return false; } } protected FlameBlock getBaseFlameBlock() { return baseFlameBlock; } protected void setBaseFlameBlock(FlameBlock baseFlameBlock) { this.baseFlameBlock = baseFlameBlock; setSelectedFlameBlock(baseFlameBlock); flameView.updateSelection(baseFlameBlock); } protected AnMetric getAnMetric() { return anMetric; } protected FlameBlock nextFlameBlock(FlameBlock flameBlock, boolean forward) { FlameBlock nextFlameBlock = null; if (!forward) { nextFlameBlock = flameBlock.getNext()[FlameBlock.RIGHT]; if (nextFlameBlock == null) { int row = flameBlock.getFlameRow().getRow(); row++; if (row < getFlameRows().length) { nextFlameBlock = getFlameRows()[row].getFirstPaintedFlameBlock(); } } if (nextFlameBlock == null) { nextFlameBlock = getFlameRows()[0].getFirstPaintedFlameBlock(); } } else { nextFlameBlock = flameBlock.getNext()[FlameBlock.LEFT]; if (nextFlameBlock == null) { int row = flameBlock.getFlameRow().getRow(); row--; if (row >= 0) { nextFlameBlock = getFlameRows()[row].getFirstPaintedFlameBlock(); if (nextFlameBlock != null) { while (nextFlameBlock.getNext()[FlameBlock.RIGHT] != null) { nextFlameBlock = nextFlameBlock.getNext()[FlameBlock.RIGHT]; } } } } if (nextFlameBlock == null) { int row = getFlameRows().length - 1; nextFlameBlock = null; while (nextFlameBlock == null && row > 0) { nextFlameBlock = getFlameRows()[row].getFirstPaintedFlameBlock(); row--; } if (nextFlameBlock != null) { while (nextFlameBlock.getNext()[FlameBlock.RIGHT] != null) { nextFlameBlock = nextFlameBlock.getNext()[FlameBlock.RIGHT]; } } } } return nextFlameBlock; } protected String dump(int rows) { StringBuilder buf = new StringBuilder(); buf.append("metric=" + anMetric.getUserName()); buf.append("\n"); buf.append("rows=" + flameRows.length); buf.append("\n"); for (int i = 0; i < rows && i < flameRows.length; i++) { buf.append(flameRows[i].dump()); } return buf.toString(); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/SelectionManager.java����������������������������������������������0000644�0001750�0001750�00000004333�14744453367�020036� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.mpmt.event.AnChangeEvent; import org.gprofng.mpmt.event.AnEventManager; import org.gprofng.mpmt.event.AnSelectionEvent; public class SelectionManager { public void updateSelection(long[] selObjs, int type, int subtype, int version) { updateSummaryPanel(selObjs, type, subtype, version); } public void updateSelection(long selObj, int type, int subtype, int version) { long[] objs = new long[1]; objs[0] = selObj; updateSummaryPanel(objs, type, subtype, version); } public void updateSelection(int[] selObj, int type, int subtype, int version) { int len = selObj.length; long[] objs = new long[len]; for (int i = 0; i < len; i++) { objs[i] = (long) selObj[i]; } updateSummaryPanel(objs, type, subtype, version); } public void updateSelection() { AnChangeEvent anChangeEvent = new AnChangeEvent(this, AnChangeEvent.Type.SELECTION_UPDATE); AnEventManager.getInstance().fireAnChangeEvent(anChangeEvent); } private void updateSummaryPanel(long[] selObjs, int type, int subtype, int version) { // System.out.println("updateSummaryPanel: " + type + " " + subtype + " " + version); // for (long l : selObjs) { // System.out.println(" " + l); // } AnSelectionEvent anSelectionEvent = new AnSelectionEvent(this, selObjs, type, subtype, version); AnChangeEvent anChangeEvent = new AnChangeEvent(anSelectionEvent, AnChangeEvent.Type.SELECTION_CHANGED); AnEventManager.getInstance().fireAnChangeEvent(anChangeEvent); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/AnInteger.java�����������������������������������������������������0000644�0001750�0001750�00000004125�15044710303�016445� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; // Analyzer Integer object public final class AnInteger extends AnObject implements Comparable<AnInteger> { private final int value; private final Integer obj; // Constructor public AnInteger(int value) { this.value = value; obj = this.value; } // Analyzer int printing format @Override public String toString() { return obj.toString(); } // Analyzer formatted printing format public String toFormString() { if (value == 0) { if (!showZero) { return quote_space; } } return format_group_integer.format(value); } // Percent printing @Override public String toPercent(double total) { if (value == 0) { if (!showZero) { return quote_space; } return zero_percent; } return format_percent.format(value * total); } // To Integer public Integer toInteger() { return obj; } // To int public int intValue() { return value; } // To double @Override public double doubleValue() { return value; } // As int.compareTo @Override public int compareTo(AnInteger o) { return obj.compareTo(o.toInteger()); } // Convert int[] to AnInteger[] public static AnInteger[] toArray(int[] list) { int length = list.length; AnInteger[] new_list = new AnInteger[length]; for (int i = 0; i < length; i++) { new_list[i] = new AnInteger(list[i]); } return new_list; } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/mpmt/ResolveFilePathPanel.java������������������������������������������0000644�0001750�0001750�00000041746�14744453367�020643� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.mpmt; import org.gprofng.analyzer.AnEnvironment; import org.gprofng.mpmt.util.gui.AnUtility; import java.awt.Color; import java.io.File; import javax.swing.JFileChooser; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; public class ResolveFilePathPanel extends javax.swing.JPanel { private final ResolveFilePathDialog resolveFilePathDialog; private final String notFoundFilePath; private final String notFoundFileName; private String resolvedAsPath; private String filePath; private static boolean archiveCheckBoxState = true; private static boolean archiveThisFileOnlyState = true; private static String feed = ""; public ResolveFilePathPanel( ResolveFilePathDialog resolveFilePathDialog, String notFoundFilePath) { this.resolveFilePathDialog = resolveFilePathDialog; this.notFoundFilePath = notFoundFilePath; notFoundFileName = AnUtility.basename(notFoundFilePath); initComponents(); setBackground(AnEnvironment.DEFAULT_PANEL_BACKGROUND); infoLabel.setText(AnLocale.getString("Locate the source file below and click OK.")); AnUtility.setAccessibleContext(infoLabel.getAccessibleContext(), infoLabel.getText()); infoLabel.setDisplayedMnemonic(AnLocale.getString('L', "ResolvePanelLocateLabelMnemonic")); infoLabel.setLabelFor(pathTextField); AnUtility.setAccessibleContext( pathTextField.getAccessibleContext(), AnLocale.getString("Path")); String unResolvedTT = AnLocale.getString("Can not find source file") + " " + notFoundFilePath; unResolvedLabel.setIcon(AnUtility.fileUnResolved); unResolvedLabel.setText(""); unResolvedLabel.setToolTipText(unResolvedTT); AnUtility.setAccessibleContext( unResolvedLabel.getAccessibleContext(), AnLocale.getString("Unresolved Path")); unResolvedTextField.setText(notFoundFilePath + " " + AnLocale.getString("(not found)")); unResolvedTextField.setToolTipText(unResolvedTT); AnUtility.setAccessibleContext( unResolvedTextField.getAccessibleContext(), AnLocale.getString("Unresolved Path")); AnUtility.setAccessibleContext( resolvedTextField.getAccessibleContext(), AnLocale.getString("Rresolved Path")); browseButton.setMnemonic(AnLocale.getString('B', "ResolvePanelBrowseButtonMN")); browseButton.setToolTipText(AnLocale.getString("Browse for file (ALT B)")); thisFileOnlyCheckBox.setText(AnLocale.getString("Archive this file only")); thisFileOnlyCheckBox.setMnemonic(AnLocale.getString('R', "ResolvePanelThisFileOnly heckboxMN")); thisFileOnlyCheckBox.setToolTipText(AnLocale.getString("Only this file will be resolved")); thisFileOnlyCheckBox.setOpaque(false); thisFileOnlyCheckBox.setSelected(archiveThisFileOnlyState); archiveCheckBox.setText(AnLocale.getString("Archive source file(s) inside experiment")); archiveCheckBox.setToolTipText( AnLocale.getString( "Use Archive feature to save a copy of the file(s) inside the experiment")); archiveCheckBox.setMnemonic(AnLocale.getString('A', "ResolvePanelArchiveCheckkboxMN")); archiveCheckBox.setOpaque(false); archiveCheckBox.setSelected(archiveCheckBoxState); errorLabel.setForeground(Color.red); if (feed != null) { pathTextField.setText(feed); } pathTextField .getDocument() .addDocumentListener( new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { updateStates(); } @Override public void insertUpdate(DocumentEvent e) { updateStates(); } @Override public void removeUpdate(DocumentEvent e) { updateStates(); } }); updateStatesInternal(); } private void updateStates() { AnUtility.dispatchOnAWorkerThread( new Runnable() { @Override public void run() { updateStatesInternal(); } }, "updateStates"); } private void updateStatesInternal() { AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { errorLabel.setText(" "); resolveFilePathDialog.getOKButton().setEnabled(false); resolvedLabel.setIcon(null); resolvedTextField.setText(""); resolvedLabel.setToolTipText(null); resolvedTextField.setToolTipText(null); filePath = pathTextField.getText(); } }); if (filePath.equals("/net") || filePath.equals("/net/")) { return; // optimization } String fileName = AnUtility.basename(filePath); String error = null; resolvedAsPath = null; if (filePath.length() > 0 && !filePath.startsWith("/")) { error = AnLocale.getString("Use absolute path"); } if (error == null) { if (notFoundFilePath.startsWith("/")) { // Native absolute path File filePathFile = new AnFile(filePath); if (filePathFile.exists()) { if (filePathFile.isDirectory()) { String tryThis = filePathFile.getAbsoluteFile() + "/" + notFoundFileName; if (new AnFile(tryThis).exists()) { resolvedAsPath = tryThis; } } else if (notFoundFileName.equals(fileName)) { resolvedAsPath = filePath; } } else { if (fileName.equals(notFoundFileName)) { error = AnLocale.getString("File doesn't exists"); } } } else { // Java relative path File filePathFile = new AnFile(filePath); if (filePathFile.exists()) { if (filePathFile.isDirectory()) { String tryThis = filePathFile.getAbsoluteFile() + "/" + notFoundFilePath; if (new AnFile(tryThis).exists()) { resolvedAsPath = tryThis; } } else { // Compare file names String fName = AnUtility.basename(filePath); String nfName = AnUtility.basename(notFoundFilePath); if (nfName.equals(fName)) { resolvedAsPath = filePath; } } } else { if (fileName.equals(notFoundFileName)) { error = AnLocale.getString("File doesn't exists"); } } } } final String errorMsg = error; AnUtility.dispatchOnSwingThread( new Runnable() { @Override public void run() { if (errorMsg != null) { errorLabel.setText(errorMsg); } else if (resolvedAsPath != null) { resolveFilePathDialog.getOKButton().setEnabled(true); resolvedLabel.setIcon(AnUtility.fileResolved); resolvedTextField.setText(resolvedAsPath + " " + AnLocale.getString("(resolved)")); String tt = AnLocale.getString("File resolved as ") + resolvedAsPath; resolvedLabel.setToolTipText(tt); resolvedTextField.setToolTipText(tt); } } }); } private void updateCheckBoxStates() { thisFileOnlyCheckBox.setEnabled(archiveCheckBox.isSelected()); } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; infoLabel = new javax.swing.JLabel(); unResolvedLabel = new javax.swing.JLabel(); unResolvedTextField = new javax.swing.JTextField(); resolvedLabel = new javax.swing.JLabel(); resolvedTextField = new javax.swing.JTextField(); pathTextField = new javax.swing.JTextField(); browseButton = new javax.swing.JButton(); archiveCheckBox = new javax.swing.JCheckBox(); thisFileOnlyCheckBox = new javax.swing.JCheckBox(); errorLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); add(infoLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0); add(unResolvedLabel, gridBagConstraints); unResolvedTextField.setEditable(false); unResolvedTextField.setText("222"); unResolvedTextField.setBorder(null); unResolvedTextField.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(12, 4, 0, 0); add(unResolvedTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(resolvedLabel, gridBagConstraints); resolvedTextField.setEditable(false); resolvedTextField.setText("111"); resolvedTextField.setBorder(null); resolvedTextField.setOpaque(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(6, 4, 0, 0); add(resolvedTextField, gridBagConstraints); pathTextField.setColumns(50); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); add(pathTextField, gridBagConstraints); browseButton.setText("..."); browseButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 0); add(browseButton, gridBagConstraints); archiveCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { archiveCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); add(archiveCheckBox, gridBagConstraints); thisFileOnlyCheckBox.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { thisFileOnlyCheckBoxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(2, 17, 0, 0); add(thisFileOnlyCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; add(errorLabel, gridBagConstraints); } // </editor-fold>//GEN-END:initComponents private void browseButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_browseButtonActionPerformed // TODO add your handling code here: if (!Analyzer.getInstance().isRemote()) { // Local feed = pathTextField.getText(); File feedFile = new File(feed); if (!feedFile.exists()) { feed = Analyzer.getInstance().getWorkingDirectory(); feedFile = new File(feed); if (!feedFile.exists()) { feedFile = null; } } JFileChooser fileChooser = new JFileChooser(); // Always local file chooser fileChooser.setDialogTitle(AnLocale.getString("Resolve Source File")); if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { String filePath = fileChooser.getSelectedFile().getAbsolutePath(); pathTextField.setText(filePath); feed = pathTextField.getText(); } updateStates(); } else { // Remote feed = pathTextField.getText(); AnFile feedFile = new AnFile(feed); if (!feedFile.exists()) { feed = Analyzer.getInstance().getWorkingDirectory(); feedFile = new AnFile(feed); if (!feedFile.exists()) { feedFile = null; } } AnChooser fileChooser = AnWindow.getInstance() .getAnChooser( AnLocale.getString("Resolve Source File"), AnChooser.DIR_FILE_CHOOSER, feed); // JFileChooser fileChooser = new JFileChooser(); // Always local file chooser if (feedFile != null) { fileChooser.setCurrentDirectory(feedFile); } fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int ret = fileChooser.showOpenDialog(this); if (ret == JFileChooser.APPROVE_OPTION) { String filePath = fileChooser.getSelectedFile().getAbsolutePath(); pathTextField.setText(filePath); feed = pathTextField.getText(); } updateStates(); } } // GEN-LAST:event_browseButtonActionPerformed private void archiveCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_archiveCheckBoxActionPerformed archiveCheckBoxState = archiveCheckBox.isSelected(); if (archiveCheckBox.isSelected()) { thisFileOnlyCheckBox.setSelected(archiveThisFileOnlyState); } else { thisFileOnlyCheckBox.setSelected(false); } updateCheckBoxStates(); } // GEN-LAST:event_archiveCheckBoxActionPerformed private void thisFileOnlyCheckBoxActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_thisFileOnlyCheckBoxActionPerformed archiveThisFileOnlyState = thisFileOnlyCheckBox.isSelected(); updateCheckBoxStates(); } // GEN-LAST:event_thisFileOnlyCheckBoxActionPerformed protected String getResolvedPath() { return resolvedAsPath; } protected boolean resolveThisFileOnly() { return thisFileOnlyCheckBox.isSelected(); } protected boolean archiveFiles() { return archiveCheckBox.isSelected(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox archiveCheckBox; private javax.swing.JButton browseButton; private javax.swing.JLabel errorLabel; private javax.swing.JLabel infoLabel; private javax.swing.JTextField pathTextField; private javax.swing.JLabel resolvedLabel; private javax.swing.JTextField resolvedTextField; private javax.swing.JCheckBox thisFileOnlyCheckBox; private javax.swing.JLabel unResolvedLabel; private javax.swing.JTextField unResolvedTextField; // End of variables declaration//GEN-END:variables } ��������������������������gprofng-gui-2.1/org/gprofng/collector/��������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�015024� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/collector/CollectorAPI.java���������������������������������������������0000644�0001750�0001750�00000004527�14744453367�020114� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.collector; /** This class provides access to the gprofng GUI collector API. */ public class CollectorAPI { private static boolean inited = false; static { init(); } public static void init() { // Check if previously initialized if (inited) { return; } // Check if Java profiling is on if (!Boolean.getBoolean("collector.init")) { return; } try { System.loadLibrary("collector"); } catch (UnsatisfiedLinkError e) { System.err.println("CollectorAPI: " + e); return; } catch (SecurityException e) { System.err.println("CollectorAPI: " + e); return; } inited = true; } private static native void _sample(String name); public static void sample(String name) { if (inited) { _sample(name); } } public static void sample() { sample(null); } private static native void _pause(); public static void pause() { if (inited) { _pause(); } } private static native void _resume(); public static void resume() { if (inited) { _resume(); } } private static native void _threadPause(Thread thread); public static void threadPause(Thread thread) { if (inited) { _threadPause(thread); } } public static void threadPause() { threadPause(null); } private static native void _threadResume(Thread thread); public static void threadResume(Thread thread) { if (inited) { _threadResume(thread); } } public static void threadResume() { threadResume(null); } private static native void _terminate(); public static void terminate() { if (inited) { _terminate(); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/analyzer/���������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723234�014663� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/analyzer/AnMain.java����������������������������������������������������0000644�0001750�0001750�00000026207�15044710303�016611� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.analyzer; import org.gprofng.mpmt.AnLocale; import org.gprofng.mpmt.Analyzer; import org.gprofng.mpmt.ExperimentPickList; import org.gprofng.mpmt.ExperimentPickListElement; import org.gprofng.mpmt.ExperimentPickLists; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.persistence.UserPref; import org.gprofng.mpmt.persistence.UserPrefPersistence; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Map; import java.util.Set; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; /** Main class for standalone analyzer */ public final class AnMain { private static JOptionPane importOldSettingPane = null; private static final int JVM_MAJOR = 1; private static final int JVM_MINOR = 8; /* The size of the fonts in the UI - 0 pt. The value can be changed by command-line argument -fontsize <size> */ private static int uiFontSize = 0; /** * Parses the command line arguments * * @param args command line arguments * @return array of arguments without the fontsize flag and that value */ private static String[] processArgs(final String[] args) { ArrayList<String> argsExp = new ArrayList<>(); String argvOrig; for (int i = 0; i < args.length; i++) { argvOrig = args[i]; if (argvOrig.equals("-f") || argvOrig.equals("--fontsize")) { try { uiFontSize = Integer.parseInt(args[++i]); } catch (ArrayIndexOutOfBoundsException e) { System.out.println(AnLocale.getString("Font size expected, using default font size...")); } catch (NumberFormatException e2) { System.out.println( AnLocale.getString("Bad format of the font size, using default font size...")); } } else if (argvOrig.equals("-c") || argvOrig.equals("--compare")) { Analyzer.compareMode = true; } else if (argvOrig.equals("-u") || argvOrig.equals("--userdir")) { if (i >= (args.length - 1)) { System.out.println(AnLocale.getString("Not enough arguments, exiting...")); System.exit(1); } String userdir = args[++i]; UserPref.setUserDir(userdir); } else if (argvOrig.startsWith("--bindir=")) { UserPref.binDirFromCommandLine = argvOrig.substring(argvOrig.indexOf("=") + 1); } else if (argvOrig.startsWith("--datadir=")) { UserPref.dataDirFromCommandLine = argvOrig.substring(argvOrig.indexOf("=") + 1); } else if (argvOrig.startsWith("--gprofngdir=")) { UserPref.gprofngdir = argvOrig.substring(argvOrig.indexOf("=") + 1); } else if (argvOrig.equals("--verbose")) { UserPref.verbose = true; } else { argsExp.add(argvOrig); // This argument is an experiment name, or a name of a binary to profile // Don't parse target's options - pass them down for (int j = i + 1; j < args.length; j++) { argsExp.add(args[j]); } break; } } if (UserPref.verbose) { for (int i = 0; i < args.length; i++) { AnLog.log(String.format("%2d %s", i, args[i])); } } return argsExp.toArray(new String[argsExp.size()]); } // sets Fonts for the value of -fontsize key private static void setFontSize(int size) { // Set all font size to new size Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource font = (FontUIResource) value; UIManager.put(key, new FontUIResource(font.deriveFont((float) size))); } } } // Show Java version warning private static void warningVersion() { final String rec_ver, msg; final int sel; final Object[] options = new Object[] {AnLocale.getString("Continue"), AnLocale.getString("Exit")}; rec_ver = AnLocale.getString("J2SE[tm] ") + JVM_MAJOR + "." + JVM_MINOR; msg = AnLocale.getString("The J2SE[tm] ") + Analyzer.jvm_ver + AnLocale.getString(" found at ") + Analyzer.jvm_home + AnLocale.getString(" should not be used by the gprofng tools.\n") + rec_ver + AnLocale.getString(" is recommended.\n") + AnLocale.getString("Use the -j option to specify a path to ") + rec_ver + "."; sel = JOptionPane.showOptionDialog( null, msg, AnLocale.getString("Warning: Java Runtime Environment Version"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); if ((sel == JOptionPane.CLOSED_OPTION) || (sel == JOptionPane.NO_OPTION)) { System.exit(0); } } public static void main(final String[] args) { // AnMemoryManager.getInstance().checkMemoryUsage(); AnEnvironment.setLookAndFeel(); Analyzer analyzer = new Analyzer(); int major = 0; int minor = 0; int n1, n2; String ver = Analyzer.jvm_ver; if ((n1 = ver.indexOf('.')) != -1) { major = Integer.parseInt(ver.substring(0, n1)); if ((n2 = ver.indexOf('.', n1 + 1)) != -1) { minor = Integer.parseInt(ver.substring(n1 + 1, n2)); } } else { // Check if it is java 9 if (ver.startsWith("9")) { major = 1; minor = 9; } } if (major == 0 || (major == 1 && minor < 8) || (major > 1 && major < 8)) { warningVersion(); } ToolTipManager.sharedInstance().setInitialDelay(250); final String[] argsNew = processArgs(args); File fromDirFile = null; File toDirFile = null; if (!GUITesting.getInstance().isRunningUnderGUITesting()) { String actualUserDirPath = UserPref.getAnalyzerDirPath(); String actualInitFilePath = UserPref.getAnalyzerInitFilePath(); if (actualUserDirPath.equals(UserPref.getDefaultAnalyzerDirPath())) { if (!new File(actualInitFilePath).exists()) { for (String userDir : UserPref.getOldUserDirs()) { String userDirPath = UserPref.getAnalyzerDirPath(userDir); String initFilePath = UserPref.getAnalyzerInitFilePath(userDir); if (new File(initFilePath).exists()) { fromDirFile = new File(userDirPath); toDirFile = new File(actualUserDirPath); try { // FIXUP: should use copyDirectory from AnUtility but it doesn't run this early due // to class loader issue UserPref.copyDirectory(fromDirFile, toDirFile); } catch (IOException e) { e.printStackTrace(); // FIXUP: what to do? } String msg = AnLocale.getString( "Settings created by a previous version of gprofng were found on your system" + " at %s.\n" + "They have been imported into %s."); String formattedMsg = String.format(msg, userDirPath, actualUserDirPath); // JOptionPane.showMessageDialog(null, formattedMsg, // AnLocale.getString("Import Settings"), JOptionPane.PLAIN_MESSAGE); importOldSettingPane = new JOptionPane(formattedMsg, JOptionPane.PLAIN_MESSAGE); break; } } } } // Read user settings new UserPrefPersistence() .restoreSettings(UserPref.getAnalyzerInitFilePath(), UserPref.getInstance()); // Copy those config files that are beeing used (from the picklists) if (fromDirFile != null && toDirFile != null) { ExperimentPickLists pickLists = UserPref.getInstance().getExperimentsPicklists(); if (pickLists != null) { Map<String, ExperimentPickList> picklistMap = pickLists.getPicklistMap(); if (picklistMap != null) { Set<String> hosts = picklistMap.keySet(); if (hosts != null) { for (String host : hosts) { ExperimentPickList experimentPickList = picklistMap.get(host); if (experimentPickList != null) { List<ExperimentPickListElement> elements = experimentPickList.getRecentExperiments(); if (elements != null) { for (ExperimentPickListElement element : elements) { String mangledFileNameNoTimestamp = UserPref.getMangledFileName(element.getPath(), host, false) + UserPref.configurationSuffix; String fromConfigPath = fromDirFile + "/" + UserPref.configDirName + "/" + UserPref.configAsWhenClosedName + "/" + mangledFileNameNoTimestamp; String asClosedDir = toDirFile + "/" + UserPref.configDirName + "/" + UserPref.configAsWhenClosedName; new File(asClosedDir).mkdirs(); String toConfigPath = asClosedDir + "/" + mangledFileNameNoTimestamp; try { UserPref.copyFile(new File(fromConfigPath), new File(toConfigPath)); } catch (IOException ioe) { } } } } } } } } } } if (uiFontSize > 0) { setFontSize(uiFontSize); } analyzer.initMetricColors(); SwingUtilities.invokeLater( () -> { try { analyzer.initAnalyzer(argsNew); } catch (Exception e) { e.printStackTrace(); } }); } public static void showImportOldSettingsDialog() { if (importOldSettingPane != null) { final JDialog importOldSettingDialog = importOldSettingPane.createDialog(AnLocale.getString("Import Settings")); importOldSettingDialog.setModal(false); importOldSettingDialog.setVisible(true); importOldSettingDialog.requestFocus(); importOldSettingPane = null; } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/analyzer/AnEnvironment.java���������������������������������������������0000644�0001750�0001750�00000033445�15044710303�020233� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.analyzer; import org.gprofng.mpmt.guitesting.GUITesting; import org.gprofng.mpmt.util.gui.AnScrollBarUI; import java.awt.Color; import java.awt.Font; import java.util.Enumeration; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; public class AnEnvironment { public static final Color NIMBUS_PANEL_BACKGROUND = new Color(236, 236, 240); public static final Color NIMBUS_PANEL_LIGHT_BACKGROUND = new Color(249, 249, 251); public static final Color NIMBUS_TABLE_BACKGROUND = new Color(252, 253, 254); public static final Color NIMBUS_SCROLLPANE_BACKGROUND = NIMBUS_TABLE_BACKGROUND; public static final Color NIMBUS_TEXT_BACKGROUND = NIMBUS_TABLE_BACKGROUND; public static final Color NIMBUS_LIST_BACKGROUND = NIMBUS_TABLE_BACKGROUND; public static final Color NIMBUS_TREE_BACKGROUND = NIMBUS_TABLE_BACKGROUND; public static final Color NIMBUS_TABLE_HEADER_BACKGROUND = new Color(230, 230, 234); public static final Color NIMBUS_TABLE_SELECTION_BACKGROUND = new Color(190, 210, 229); public static final Color SCROLLPANE_BACKGROUND = Color.WHITE; public static final Color INVISIBLE_BACKGROUND = new Color(0, 0, 0, 0); public static final Color DEFAULT_BACKGROUND_COLOR = UIManager.getLookAndFeel().getDefaults().getColor("Panel.background"); public static final Color DEFAULT_PANEL_BACKGROUND = new Color(251, 251, 251); public static final Color DEFAULT_DIALOG_BACKGROUND = new Color(248, 248, 248); public static final Color DEFAULT_TEXT_PANE_RO_BACKGROUND = new Color(250, 250, 250); public static final Color NAVIGATION_PANEL_BACKGROUND_COLOR = new Color(221, 222, 227); public static final Color NAVIGATION_PANEL_SECTION_BACKGROUND_COLOR = new Color(199, 200, 205); public static final Color NAVIGATION_PANEL_BORDER_COLOR = new Color(179, 178, 178); public static final Color NAVIGATION_SPLIT_PANE_DIVIDER_COLOR = new Color(146, 146, 148); public static final Color VIEW_SELECTED_TOP_COLOR = new Color(209, 225, 239); public static final Color VIEW_SELECTED_BOTTOM_COLOR = new Color(176, 189, 201); public static final Color VIEW_FOCUSED_TOP_COLOR = new Color(239, 239, 239); public static final Color VIEW_FOCUSED_BOTTOM_COLOR = new Color(218, 218, 218); public static final Color VIEW_FOCUSED_BACKGROUND_COLOR = new Color(215, 220, 230); public static final Color VIEW_SELECTED_BACKGROUND_COLOR = new Color(183, 196, 220); public static final Color VIEW_SELECTED_BORDER_COLOR = new Color(190, 190, 200); public static final Color STATUS_SELECTED_BORDER_COLOR = new Color(150, 150, 160); public static final Color DROP_LINE_COLOR = new Color(255, 165, 0); public static final Color SUBVIEW_PANEL_BACKGROUND = new Color(242, 242, 244); public static final Color ABOUT_BOX_BORDER_COLOR = new Color(204, 204, 204); public static final Color SPLIT_PANE_BORDER_COLOR = new Color(206, 208, 210); public static final Color SPLIT_PANE_BORDER_COLOR_INSIDE = new Color(206 + 20, 208 + 20, 210 + 20); public static final Color SPLIT_PANE_DIVIDER_BACKGROUND_COLOR = new Color(249, 249, 251); public static final Color SPLIT_PANE_DIVIDER_BACKGROUND_COLOR_INSIDE = new Color(210, 210, 212); public static final Color SPLIT_PANE_ONE_TOUCH_BUTTON_COLOR = new Color(120, 120, 120); public static final Color SPLIT_PANE_ONE_TOUCH_BUTTON_FOCUSED_COLOR = new Color(10, 10, 10); public static final Color TABBED_PANE_BORDER_COLOR = new Color(206, 208, 210); public static final Color TABBED_PANE_BACKGROUND_COLOR = new Color(218, 218, 218); public static final Color TABBED_PANE_DEFAULT_COLOR = new Color(218, 218, 218); public static final Color TABBED_PANE_TAB_AREA_TOP_COLOR = new Color(244, 244, 245); public static final Color TABBED_PANE_TAB_AREA_BOTTOM_COLOR = new Color(218, 218, 218); public static final Color TABBED_PANE_DIVIDER_COLOR = new Color(163, 163, 163); public static final Color TABBED_PANE_LINE_COLOR = new Color(238, 238, 238); public static final Color TABBED_PANE_SELECTED_TAB_COLOR = new Color(238, 238, 238); public static final Color TABBED_PANE_FOCUSED_TAB_TOP_COLOR = new Color(221, 229, 236); public static final Color TABBED_PANE_FOCUSED_TAB_BOTTOM_COLOR = new Color(207, 215, 222); public static final Color TABBED_PANE_DESELECTED_TAB_TOP_COLOR = new Color(244, 244, 245); public static final Color TABBED_PANE_DESELECTED_TAB_BOTTOM_COLOR = new Color(218, 218, 218); public static final Color TABBED_PANE_DESELECTED_FORGROUND_COLOR = new Color(150, 150, 150); public static final Color TABBED_PANE_TAB_FOCUS_COLOR = new Color(180, 180, 180); public static final Color FILTER_FOREGROUND_COLOR = new Color(44, 121, 6); public static final Color FILTER_BACKGROUND1_COLOR = DEFAULT_TEXT_PANE_RO_BACKGROUND; public static final Color FILTER_BACKGROUND2_COLOR = new Color(251 - 4, 251 - 4, 251 - 4); public static final Color FILTER_BACKGROUND_SELECTED_COLOR = new Color(233, 238, 244); public static final Color FILTER_INFO_TEXT_COLOR = new Color(160, 160, 160); public static final Color FILTER_DIVIDER_BACKGROUND_COLOR = new Color(196 + 5, 197 + 5, 201 + 5); public static final Color FILTER_HEADER_COLOR = new Color(51, 51, 51); public static final Color FILTER_TOOLBAR_BACKGROUND1_COLOR = new Color(238, 238, 238); public static final Color FILTER_TOOLBAR_BACKGROUND2_COLOR = new Color(219, 219, 219); public static final Color FILTER_STATUS_BORDER_COLOR = new Color(182, 181, 186); public static final Color WELCOME_BUTTON_FOCUSED_COLOR = new Color(100, 130, 220); public static final Color WELCOME_BUTTON_DISABLED_COLOR = new Color(190, 190, 190); public static final Color WELCOME_BUTTON_ACTION_COLOR = new Color(125, 125, 125); public static final Color WELCOME_BUTTON_EXPERIMENT_COLOR = new Color(125, 125, 125); public static final Color WELCOME_MAIN_LABEL_COLOR = new Color(102, 102, 102); public static final Color STATUS_PANEL_BORDER_COLOR = new Color(179, 178, 178); public static final Color STATUS_PANEL_BACKGROUND_COLOR1 = new Color(228, 228, 228); public static final Color STATUS_PANEL_BACKGROUND_COLOR2 = new Color(191, 190, 191); public static final Color TOOLBAR_BACKGROUND_COLOR = new Color(178, 178, 178); public static final Color TOOLBAR_BORDER_COLOR = new Color(133 + 30, 133 + 30, 133 + 30); public static final Color MENUBAR_BACKGROUND_COLOR1 = new Color(228, 228, 228); public static final Color MENUBAR_BACKGROUND_COLOR2 = new Color(191, 190, 191); public static final Color MENUBAR_BORDER_COLOR = new Color(179, 178, 178); public static final Color MENUBAR_BACKGROUND_COLOR = new Color(207, 207, 207); public static final Color BAR_BORDER_COLOR = new Color(190, 190, 190); public static final Color BAR_BACKGROUND_COLOR = Color.WHITE; public static final Color BAR_COMPARE_COLOR1 = new Color(195, 195, 195); public static final Color BAR_COMPARE_COLOR2 = new Color(215, 215, 215); public static final Color METRIC_HOT_HIGHLIGHT = new Color(255, 200, 0); public static final Color TOOLTIP_POPUP_BACKGROUND_COLOR = new Color(223, 236, 243); public static final Color TOOLTIP_POPUP_FOREGROUND_COLOR = new Color(51, 77, 100); public static final Color TOOLTIP_POPUP_BORDER_COLOR = new Color(144, 145, 149); public static final Color TOOLTIP_VIEW_BACKGROUND_COLOR = new Color(247, 247, 255); // Scroll bars public static final Color SCROLLBAR_TRACK_COLOR = new Color(248, 248, 248); public static final Color SCROLLBAR_BORDER_COLOR = new Color(199, 200, 202); public static final Color SCROLLBAR_THUMB_COLOR = new Color(179, 178, 178); public static final Color SCROLLBAR_THUMB_FOCUSED_COLOR = new Color(129, 129, 129); public static final Color SCROLLBAR_INC_DEC_COLOR = new Color(129, 129, 129); public static final Color SCROLLBAR_INC_DEC_FOCUSED_COLOR = new Color(55, 55, 55); // Tables public static final Color TABLE_HEADER_FOREGROUND_COLOR = new Color(86, 101, 125); public static final Color TABLE_HEADER_BACKGROUND_COLOR_1 = new Color(248, 248, 251); public static final Color TABLE_HEADER_BACKGROUND_COLOR_2 = new Color(248 - 6, 248 - 6, 251 - 6); public static final Color TABLE_HEADER_SELECTED_COLOR = new Color(209, 225, 239); public static final Color TABLE_LINE_BACKGROUND_COLOR_2 = new Color(249, 249, 249); public static final Color TABLE_LINE_BACKGROUND_SELECTED_COLUMN_COLOR_1 = new Color(238, 244, 249); public static final Color TABLE_LINE_BACKGROUND_SELECTED_COLUMN_COLOR_2 = new Color(228, 233, 238); public static final Color TABLE_VERTICAL_GRID_COLOR = new Color(230 - 5, 230 - 5, 230 - 5); public static final Color TABLE_VERTICAL_GRID_METRIC_COLOR = new Color(200 - 20, 200 - 20, 200 - 20); public static final Color TABLE_VERTICAL_GRID_ATTRIBUTE_COMP_COLOR = new Color(210 - 20, 210 - 20, 210 - 20); public static final Color TABLE_VERTICAL_GRID_METRIC_COMP_COLOR = new Color(180 - 20, 180 - 20, 180 - 20); // Metric public static final Color METRIC_MENU_SECTION_COLOR = new Color(80, 80, 80); public static final Color METRIC_SELCTOR_MENU_SEPARATOR_COLOR = new Color(220, 220, 220); // Compare status panel public static final Color COMPARE_TOGGLE_ICON_BORDER_COLOR = new Color(150, 150, 150); public static final Color COMPARE_TOGGLE_ICON_BORDER_FOCUSED_COLOR = new Color(100, 100, 100); public static final Color COMPARE_TOGGLE_ICON_SELECTED_COLOR = new Color(209, 225, 239); public static final Color COMPARE_ICON_BORDER_COLOR = new Color(219, 219, 219); public static final Color COMPARE_ICON_MOUSE_PRESSED_BACKGROUND_COLOR = new Color(209 - 20, 225 - 20, 239 - 20); public static final Color COMPARE_ICON_TOGGLE_BACKGROUND_COLOR = new Color(217, 219, 224); public static final Color FLAME_TOP_COLOR = new Color(254, 254, 254); public static final Color FLAME_BOTTOM_COLOR = new Color(230, 230, 230); public static final Color FLAME_INFO_TEXT_COLOR = new Color(120, 120, 120); public static final Color FLAME_BLOCK_BORDER_COLOR = new Color(180, 180, 180); public static final Color FLAME_BLOCK_BASE_BACKGROUND = new Color(255, 157, 14); public static final Color FLAME_BLOCK_SELECTED_BACKGROUND = new Color(210, 210, 210); public static final Color FLAME_BLOCK_SELECTED_BORDER1 = new Color(35, 85, 135); public static final Color FLAME_BLOCK_SELECTED_BORDER2 = new Color(210, 210, 210); public static final Color FLAME_BLOCK_MOUSEOVER_BORDER1 = new Color(0, 102, 51); public static final String DefaultLFName = "Metal"; public enum LF { Metal, Nimbus, Windows, AppleAqua, Motif, GTK }; private static LF lf = null; public static void setLookAndFeel() { // Always set L&F to Metal, if available String lfName = UIManager.getLookAndFeel().getName(); if (!lfName.equals(DefaultLFName)) { try { UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo lookAndFeelInfo : installedLookAndFeels) { if (lookAndFeelInfo.getName().equals(DefaultLFName)) { javax.swing.UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); break; } } } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (javax.swing.UnsupportedLookAndFeelException ex) { } } lfName = UIManager.getLookAndFeel().getName(); if (lfName.equals("Metal")) { lf = LF.Metal; setAnalyzerMetalTheme(); } else if (lfName.equals("Nimbus")) { lf = LF.Nimbus; setAnalyzerNimbusTheme(); } else if (lfName.startsWith("Mac")) { lf = LF.AppleAqua; } else if (lfName.startsWith("Windows")) { lf = LF.Windows; } else if (lfName.equals("CDE/Motif")) { lf = LF.Motif; } else if (lfName.equals("GTK+")) { lf = LF.GTK; } else { lf = LF.Metal; } } /** * @return true if current L&F is Metal */ public static boolean isLFMetal() { return lf == LF.Metal; } /** * @return true if current L&F is Nimbus */ public static boolean isLFNimbus() { return lf == LF.Nimbus; } /** * @return the current L&F */ public static LF getLF() { return lf; } private static void setAnalyzerNimbusTheme() { UIManager.getLookAndFeel().getDefaults().put("FileChooser.background", NIMBUS_PANEL_BACKGROUND); UIManager.getLookAndFeel().getDefaults().put("Panel.background", NIMBUS_PANEL_BACKGROUND); } private static void setAnalyzerMetalTheme() { // Set all fonts to PLAIN Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { if (GUITesting.getInstance().isRunningUnderGUITesting()) { Font font = new Font("monospaced", Font.PLAIN, 12); FontUIResource fontResource = new FontUIResource(font); UIManager.put(key, fontResource); } else { FontUIResource font = (FontUIResource) value; UIManager.put(key, new FontUIResource(font.deriveFont(Font.PLAIN))); } } } // Install our own scroll bar UI UIManager.put("ScrollBarUI", AnScrollBarUI.class.getName()); UIManager.put("ScrollBar.width", 14); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/org/gprofng/analyzer/AnLog.java�����������������������������������������������������0000644�0001750�0001750�00000003544�15044710303�016445� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ package org.gprofng.analyzer; import org.gprofng.mpmt.persistence.UserPref; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class AnLog { private static final String logfileName = "log.text"; private static String logFilePath = null; private static FileWriter fileWriter = null; private static FileWriter getFileWriter() { if (fileWriter == null) { boolean ok = new File(getLogFileDir()).mkdirs(); File logFile = new File(getLogFilePath()); try { fileWriter = new FileWriter(logFile, false); } catch (IOException ioe) { } } return fileWriter; } public static String getLogFileDir() { return UserPref.getAnalyzerDirPath(); } public static String getLogFilePath() { if (logFilePath == null) { logFilePath = getLogFileDir() + "/" + logfileName; } return logFilePath; } public static void log(String text) { if (text == null) { return; } if (getFileWriter() == null) { System.err.println(text); return; } try { getFileWriter().write(text); getFileWriter().write("\n"); getFileWriter().flush(); } catch (IOException ioe) { } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/configure���������������������������������������������������������������������������0000755�0001750�0001750�00000445513�15044713765�012460� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for gprofng-gui 2.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gprofng-gui' PACKAGE_TARNAME='gprofng-gui' PACKAGE_VERSION='2.1' PACKAGE_STRING='gprofng-gui 2.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS BUILD_OSX_FALSE BUILD_OSX_TRUE BUILD_WINDOWS_FALSE BUILD_WINDOWS_TRUE BUILD_LINUX_FALSE BUILD_LINUX_TRUE host_os host_vendor host_cpu host build_os build_vendor build_cpu build MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE JAR JAVAC JAVA am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_maintainer_mode ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures gprofng-gui 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/gprofng-gui] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of gprofng-gui 2.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF gprofng-gui configure 2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by gprofng-gui $as_me 2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='gprofng-gui' VERSION='2.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi for ac_prog in java do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_JAVA+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$JAVA"; then ac_cv_prog_JAVA="$JAVA" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_JAVA="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVA=$ac_cv_prog_JAVA if test -n "$JAVA"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5 $as_echo "$JAVA" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVA" && break done test -n "$JAVA" || JAVA="no" for ac_prog in javac do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_JAVAC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$JAVAC"; then ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_JAVAC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAVAC=$ac_cv_prog_JAVAC if test -n "$JAVAC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5 $as_echo "$JAVAC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAVAC" && break done test -n "$JAVAC" || JAVAC="no" for ac_prog in jar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_JAR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$JAR"; then ac_cv_prog_JAR="$JAR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_JAR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi JAR=$ac_cv_prog_JAR if test -n "$JAR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5 $as_echo "$JAR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$JAR" && break done test -n "$JAR" || JAR="no" ac_config_files="$ac_config_files Makefile" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE if test "x$JAVA" = "xno"; then as_fn_error $? "java is needed to build gprofng-gui. Please install the JRE." "$LINENO" 5 fi if test "x$JAVAC" = "xno"; then as_fn_error $? "A java compiler is needed to build gprofng-gui. Please install the JDK." "$LINENO" 5 fi if test "x$JAR" = "xno"; then as_fn_error $? "JAR is needed to buidl gprofng-guil. Please install the JDK." "$LINENO" 5 fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac build_linux=no build_windows=no build_mac=no echo "host_os=${host_os}" case "${host_os}" in linux*) build_linux=yes ;; cygwin*|mingw*) build_windows=yes ;; darwin*) build_mac=yes ;; *) as_fn_error $? "\"OS $host_os is not supported\"" "$LINENO" 5 ;; esac if test "$build_linux" = "yes"; then BUILD_LINUX_TRUE= BUILD_LINUX_FALSE='#' else BUILD_LINUX_TRUE='#' BUILD_LINUX_FALSE= fi if test "$build_windows" = "yes"; then BUILD_WINDOWS_TRUE= BUILD_WINDOWS_FALSE='#' else BUILD_WINDOWS_TRUE='#' BUILD_WINDOWS_FALSE= fi if test "$build_mac" = "yes"; then BUILD_OSX_TRUE= BUILD_OSX_FALSE='#' else BUILD_OSX_TRUE='#' BUILD_OSX_FALSE= fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_LINUX_TRUE}" && test -z "${BUILD_LINUX_FALSE}"; then as_fn_error $? "conditional \"BUILD_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_WINDOWS_TRUE}" && test -z "${BUILD_WINDOWS_FALSE}"; then as_fn_error $? "conditional \"BUILD_WINDOWS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_OSX_TRUE}" && test -z "${BUILD_OSX_FALSE}"; then as_fn_error $? "conditional \"BUILD_OSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by gprofng-gui $as_me 2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ gprofng-gui config.status 2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' <conf$$subs.awk | sed ' /^[^""]/{ N s/\n// } ' >>$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/config.guess������������������������������������������������������������������������0000755�0001750�0001750�00000126373�15044713766�013072� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to <config-patches@gnu.org>. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include <features.h> #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include <sys/systemcfg.h> main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include <unistd.h> int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL" elif /bin/uname -X 2>/dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <<EOF NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize the system type. Please install a C compiler and try again. EOF ;; esac cat >&2 <<EOF This script (version $timestamp), has failed to recognize the operating system you are using. If your script is old, overwrite *all* copies of config.guess and config.sub with the latest versions from: https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub If $0 has already been updated, send the following data and any information you think might be pertinent to config-patches@gnu.org to provide the necessary information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/install-sh��������������������������������������������������������������������������0000755�0001750�0001750�00000035776�14517772130�012556� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ��gprofng-gui-2.1/aclocal.m4��������������������������������������������������������������������������0000644�0001750�0001750�00000125071�15044713753�012400� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# generated automatically by aclocal 1.16.3 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar <conftest.tar]) AM_RUN_LOG([cat conftest.dir/file]) grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/��������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�15044723235�011353� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/local.mk������������������������������������������������������������������������0000644�0001750�0001750�00000003525�15044710303�012713� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������## Process this file with automake to generate Makefile.in # # Copyright (C) 2012-2025 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. # AUTOMAKE_OPTIONS += info-in-builddir foreign no-texinfo.tex # Options to extract the man page MANCONF = -Dman TEXI2POD = perl $(srcdir)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="User Commands" \ --release="gprofng-gui-$(VERSION)" --section=1 info_TEXINFOS = %D%/gprofng-gui.texi gprofng_gui_TEXINFOS = gprofng-gui.texi gp-macros.texi TEXINFO_TEX = . MAKEINFOHTML = $(MAKEINFO) --html --no-split man_MANS = gprofng-display-gui.1 # Build the man page from the texinfo file # The sed command removes the no-adjust Nroff command so that # the man output looks standard. $(man_MANS): $(srcdir)/doc/gp-macros.texi $(AM_V_GEN)touch $@ $(AM_V_at)( nm=`basename $@ .1` ; \ $(TEXI2POD) $(MANCONF) < $(srcdir)/doc/$$nm.texi > $$nm.pod ; \ ($(POD2MAN) $$nm.pod | sed -e '/^.if n .na/d' > $@.tmp && \ mv -f $@.tmp $@) || (rm -f $@.tmp && exit 1) ; \ rm -f $$nm.pod ) gprofng-display-gui.1: $(srcdir)/doc/gprofng-gui.texi EXTRA_DIST += $(man_MANS) $(srcdir)/doc/gp-macros.texi $(srcdir)/doc/gprofng-display-gui.texi CLEANFILES += $(man_MANS) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/gp-macros.texi������������������������������������������������������������������0000644�0001750�0001750�00000002554�14552517476�014077� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@c -- Macro definitions ------------------------------------------------------- @c @c Since only letters can be used, we use capitalization to distinguish @c different words. @c ---------------------------------------------------------------------------- @macro CollectApp{} @command{gprofng collect app} @end macro @macro DisplayHTML{} @command{gprofng display html} @end macro @macro DisplayText{} @command{gprofng display text} @end macro @macro DisplaySRC{} @command{gprofng display src} @end macro @macro Archive{} @command{gprofng archive} @end macro @macro GUI{} @command{gprofng display gui} @end macro @macro Driver{} @command{gprofng} @end macro @macro ProductName{} gprofng @end macro @macro ToolName{} @command{gprofng} @end macro @macro IndexSubentry{label, string} @c -- @cindex \label\ @subentry \string\ @cindex \label\, \string\ @end macro @macro vspace {lines} @iftex @sp \lines\ @end iftex @end macro @c -- For some reason ending this macro with @noindent does not work out well. @macro OptionHeader {lines, option, description} @sp \lines\ @noindent @code{\option\} @ @emph{\description\} @c -- @sp 1 @end macro @macro gcctabopt{body} @code{\body\} @end macro @macro ManPageStart{headername} @ifclear man @sp 1 @noindent @b{\headername\} @indentedblock @end ifclear @end macro @macro ManPageEnd{} @ifclear man @end indentedblock @end ifclear @end macro ����������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/gprofng-gui.texi����������������������������������������������������������������0000644�0001750�0001750�00000163713�14744453367�014441� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������\input texinfo @c -*-texinfo-*- @c ---------------------------------------------------------------------------- @c This is the Texinfo source file for the GPROFNG manual. This manual @c includes the man pages for the various tools. @c @c Author: Ruud van der Pas @c ---------------------------------------------------------------------------- @c %**start of header @setfilename gprofng-gui.info @settitle The GNU gprofng GUI @c -- Set the indent for the @example command to 1 space, not 5 --------------- @exampleindent 1 @paragraphindent 3 @c %**end of header @c -- Start a new chapter on a new, odd numbered, page ------------------------ @c -- @setchapternewpage odd @c -- Start new chapters on new pages and to format page headers for @c -- single-sided printing. @c -- @setchapternewpage on @setchapternewpage odd @c -- Merge all index entries into the Concepts Index ------------------------- @syncodeindex fn cp @syncodeindex ky cp @syncodeindex pg cp @syncodeindex vr cp @c -- Macros specific to gprofng ---------------------------------------------- @include gp-macros.texi @c -- Get the version information --------------------------------------------- @c -- @include version-gui-ug.texi @include version.texi @c -- Entry for the Info dir structure ---------------------------------------- @ifnottex @dircategory Software development @direntry * gprofng-gui: (gprofng-gui). The GNU gprofng Graphical User Interface @end direntry @end ifnottex @c -- Copyright stuff --------------------------------------------------------- @copying This document is the manual for the GNU gprofng Graphical User Interface, last updated @value{UPDATED}. Copyright @copyright{} 2024-2025 Free Software Foundation, Inc. @c -- @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License.'' @c -- @end quotation @end copying @finalout @smallbook @c -- Define the title page --------------------------------------------------- @titlepage @title The GNU gprofng GUI @subtitle The graphical user interface for gprofng @subtitle version @value{VERSION} (last updated @value{UPDATED}) @author Ruud van der Pas @page @vskip 0pt plus 1filll @insertcopying @end titlepage @c -- Generate the Table of Contents ------------------------------------------ @contents @c -- The Top node ------------------------------------------------------------ @c Should contain a short summary, copying permissions and a master menu. @c ---------------------------------------------------------------------------- @ifnottex @node Top @top GNU gprofng GUI @insertcopying @end ifnottex @ifinfo @c -- The menu entries -------------------------------------------------------- @menu * Introduction:: About this manual. * Overview:: A brief overview of the GUI. * Prerequisites:: What is required to install and use the GUI. * How to Install the GUI:: Build and install the GUI. * Getting Started:: How get started with the GUI. * Create an Experiment:: Set up and run a performance experiment. * The Default Views:: The default views into the data. * The Additional Views:: The non-default views that are available. * The gprofng GUI Man Page:: The man page for the gprofng GUI. * Index:: The index. @detailmenu --- The Detailed Node Listing --- Introduction Overview Prerequisites * Build Requirements:: What is needed to build the GUI code? * Runtime Requirements:: What is needed when executing the GUI? How to Install the GUI * Prepare the Build from the Tar File:: Getting ready to build. * Prepare the Build from the Git Repository:: Getting ready to build. * Build and Install from Source:: Get ready to run the GUI. Getting Started * Start the GUI:: Different ways to invoke the GUI. * The Initial Screen:: What is shown initially? Create an Experiment The Default Views * Callers-Callees:: The calling relationships between the functions. * Call Tree:: A graphical representation of the call structure. * Disassembly:: Shows the metrics at the instruction level. * Experiments:: An overview of the experiments loaded. * Flame Graph:: A compact representation of the call tree. * Functions:: A function level overview where the time has been spent. * Processes:: Shows a list of the processes and their metrics. * Source/Disassembly:: Split window source and disassembly view. * Threads:: Show a list of the threads and their metrics. * Timeline:: A graphical representation of the program behaviour. * More ...:: Enable or disable views. The Additional Views * CPUs:: The CPUs used while executing the application, plus metrics. * Datasize:: Show data statistics for Heap and I/O tracing. * Duration:: Show durations for Heap, I/O and Synchronization tracing. * Experiment IDs:: List of processes created and metrics collected. * GCEvents:: List of Garbage Collection events. * Lines:: A sorted view with the source lines and their metric values. * PCs:: A sorted view with the Program Counters and their metrics. * Samples:: Show the samples plus the total CPU time. * Seconds:: Show the seconds plus the total CPU time. * Source:: Source listing with the metrics to the left of the lines. * Statistics:: Execution statistics for the application. The gprofng GUI Man Page Index @end detailmenu @end menu @end ifinfo @c -- A new node -------------------------------------------------------------- @node Introduction @chapter Introduction @c ---------------------------------------------------------------------------- The gprofng GUI is GNU project. It is a graphical tool to create, view, or both create as well as view, gprofng performance experiments. All the information about this project can be found at @url{https://savannah.gnu.org/projects/gprofng-gui, the gprofng GUI home page}. This tool, hereafter also referred to as ``the GUI'', provides multiple views into the data. While some views are similar to what is shown with the command line tools, there are also features that are unique to the GUI. Examples are the Timeline and Flame Chart. The experiments do not need to be created with the GUI though. Experiments generated using the @command{gprofng collect app} tool may also be analyzed and combined with experiments generated from within the GUI. In the remainder of this user guide, we first cover what is required in order to install and use the GUI. This is followed by a chapter how to invoke the GUI and load an experiment for subsequent analysis. The features and how to use them are the topics of the remainder of this guide. @c -- A new node -------------------------------------------------------------- @node Overview @chapter Overview @c ---------------------------------------------------------------------------- @noindent Before we cover this tool in quite some detail, we start with a brief overview of the main features of the GUI: @itemize @bullet @item One or more experiments created with the GUI, or through the @CollectApp{} tool, may be loaded into the GUI and analyzed. Within the GUI, experiments may be dropped, or additional experiments can be added by loading them into the GUI. @item Many of the GUI settings are customizable and preferences may be saved in a configuration file that is read upon starting the GUI. @item @cindex Aggregation mode If multiple experiments have been loaded, the data is aggregated by default, @cindex Comparison mode but the user can change this to instead compare the data. In this mode, the results are compared against the reference experiment, which is the first experiment loaded. The reference experiment can be changed by modifying the order of the experiments on the command line, or within the GUI. Alternatively, the @code{-c} option may be used to start the GUI in comparison mode. @item All the views available through various @DisplayText{} commands are supported. A subset of these commands is avaible through entries in the sidebar. The user can modify (and save) what is shown in the sidebar, but all features are available regardless of this. @item Through filters, the user may zoom in on an area of interest. @end itemize @c -- A new node -------------------------------------------------------------- @c -- @node Prerequisites @c -- @chapter Prerequisites @c ---------------------------------------------------------------------------- @c -- @cindex Prerequisites @c -- The GUI is a Java application. In order to use it, Java needs to be installed @c -- on the system used to execute the GUI. The minimum Java version required is 8. @c -- The GUI utilizes the Java Swing framework and needs the X Window System @c -- (@samp{X11}, or simply @samp{X}). It is @c -- commonly available for Linux systems, but may not be installed by default. @c -- Please make sure to install this before using the GUI. @c -- Since the GUI uses some of the tools that come with the core part of @c -- @code{gprofng}, it is necessary to also install this tool. Make sure to @c -- include these tools in the search path as set with environment variable @c -- @code{PATH}. @c -- @ifset OLDOC @c -- @include gp-install-gui-rpm.texi @c -- @end ifset @c -- @ifset UPSTREAM @c -- @include gp-install-gui-src.texi @c -- @end ifset @c -- A new node -------------------------------------------------------------- @node Prerequisites @chapter Prerequisites @c ---------------------------------------------------------------------------- @cindex Prerequisites In this chapter it is explained what is needed in order to build the GUI. After this we cover what is needed to execute the GUI. @menu * Build Requirements:: What is needed to build the GUI? * Runtime Requirements:: What is needed when executing the GUI? @end menu @c -- A new node -------------------------------------------------------------- @node Build Requirements @section Build Requirements @c ---------------------------------------------------------------------------- The GUI is a Java application. In order to build it, the @code{javac} Java compiler and developer classes are needed. The compiler reads the source files for the GUI and compiles them into bytecode class files. For this, the @code{java-devel} package needs to be installed in order to build and execute the GUI. The minimum Java version required is 8. If the git repository is used to build and install the GUI, the @command{autoconf} and @command{automake} tools need to be installed. This is @emph{not} needed when using the tar file. @c -- A new node -------------------------------------------------------------- @node Runtime Requirements @section Runtime Requirements @c ---------------------------------------------------------------------------- The GUI utilizes the Java Swing framework, and needs the X Window System (@samp{X11}, or simply @samp{X}). It is commonly available for Linux systems, but may not be installed by default. Please make sure that it is installed before using the GUI. There are two common scenarios regarding accessing a system remotely (e.g. a cloud instance) where the GUI is to be executed: @itemize @item If @command{ssh} is used to access the remote system, make sure to have the correct access permissions and to set environment variable @code{DISPLAY} accordingly. @item If a remote desktop like @command{vnc} is used, the GUI can be executed from within this desktop. No additional settings are needed. @end itemize Since the GUI uses some of the tools that come with the core part of @code{gprofng}, it is necessary to also install this tool. Make sure to include these tools in the search path as set with environment variable @code{PATH}. @c -- A new node -------------------------------------------------------------- @node How to Install the GUI @chapter How to Install the GUI @c ---------------------------------------------------------------------------- @IndexSubentry{Installation, Getting ready} The GUI can be built and installed from the Java source. The source code is available as a tar file, and as a git repository. A tar file based installation has the advantage that tools like @command{autoconf} and @command{automake} have already been applied. With an installation from the repository, these tools are used and therefore need to be installed. @noindent Below we explain how to get the source and build, as well as install, the GUI. @menu * Prepare the Build from the Tar File:: Getting ready to build. * Prepare the Build from the Git Repository:: Getting ready to build. * Build and Install from Source:: Get ready to run the GUI. @end menu @c -- A new node -------------------------------------------------------------- @node Prepare the Build from the Tar File @section Prepare the Build from the Tar File @c ---------------------------------------------------------------------------- @IndexSubentry{Installation, Use the tar file} In general it is recommended to use the most recent version, but there may be a reason to use an older release. This is why various releases of the GUI are available on @url{https://ftp.gnu.org/gnu/gprofng-gui, the GNU ftp site}. The files have been compressed and are available in different formats. From this web site, the code may be downloaded directly. Alternatively, the @command{wget} command can be used to download the tar file from the command line. To build the gprofng GUI from a released tar file, get your copy of the tar file first. In the example below we assume that version @code{1.1} has been selected, but the process is identical for other versions. @noindent Below we show how the @command{wget} command can be used to download a specific version. Below this, we show the output for a specific release. For lay-out reasons it has been slightly shortened and modified. @cartouche @smallexample $ wget https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz @end smallexample @end cartouche @smallexample @verbatim wget https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz --2024-03-19 https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz ... Proxy request sent, awaiting response... 200 OK Length: 1576556 (1.5M) [application/x-gzip] Saving to: 'gprofng-gui-1.1.tar.gz' gprofng-gui-1.1.tar.gz 100%[========================>] 1.50M 2.00MB/s in 0.8s 2024-03-19 (2.00 MB/s) - 'gprofng-gui-1.1.tar.gz' saved [1576556/1576556] @end verbatim @end smallexample The next step is to unpack the compressed tar file and go into the newly created directory with the name @file{gprofng-gui-1.1}. Make sure that the target directory name, @file{gprofng-gui-1.1} in this example, does not exist already. If so, remove it first. @noindent Unpack the tar file: @cartouche @smallexample $ tar xzvf gprofng-gui-1.1.tar.gz @end smallexample @end cartouche @noindent This is sample output from the command: @smallexample @verbatim gprofng-gui-1.1/ gprofng-gui-1.1/compile gprofng-gui-1.1/ChangeLog ... gprofng-gui-1.1/gprofng-gui.sh @end verbatim @end smallexample @noindent Next, go into the newly created directory: @cartouche @smallexample @verbatim $ cd gprofng-gui-1.1 @end verbatim @end smallexample @end cartouche This directory with the name @file{gprofng-gui-1.1} has everything needed to build and install the GUI. @xref{Build and Install from Source} how to proceed next. @c -- A new node -------------------------------------------------------------- @node Prepare the Build from the Git Repository @section Prepare the Build from the Git Repository @c ---------------------------------------------------------------------------- @IndexSubentry{Installation, Use the git repository} The development git repository contains the most recent version of the GUI. If this @IndexSubentry{Installation, @command{autoconf}} is used to build and installed the GUI, make sure that the @command{autoconf} @IndexSubentry{Installation, @command{automake}} and @command{automake} tools are installed and in the search path. Before cloning the git repository, make sure that a directory with the name @file{gprofng-gui} does not exist. If so, the clone command fails with an error message. The next step is to clone the git repository: @cartouche @smallexample @verbatim $ git clone https://git.savannah.gnu.org/git/gprofng-gui.git @end verbatim @end smallexample @end cartouche @noindent There should be diagnostic messages similar to what is shown below: @cartouche @smallexample @verbatim Cloning into 'gprofng-gui'... remote: Counting objects: 1334, done. remote: Compressing objects: 100% (605/605), done. remote: Total 1334 (delta 777), reused 1222 (delta 696) Receiving objects: 100% (1334/1334), 1.77 MiB | 4.29 MiB/s, done. Resolving deltas: 100% (777/777), done. @end verbatim @end smallexample @end cartouche @noindent The clone command succeeded and the newly created @file{gprofng-gui} directory should be present. The @command{ls} command may be used to verify this: @cartouche @smallexample @verbatim $ ls gprofng-gui @end verbatim @end smallexample @end cartouche Go into this directory and execute the @command{autoreconf} command: @cartouche @smallexample @verbatim $ cd gprofng-gui $ autoreconf -i -f @end verbatim @end smallexample @end cartouche @noindent The output from this command should be similar to this: @cartouche @smallexample @verbatim configure.ac:18: installing './compile' configure.ac:17: installing './install-sh' configure.ac:17: installing './missing' Makefile.am: installing './INSTALL' @end verbatim @end smallexample @end cartouche We are now ready to build and install the GUI. @xref{Build and Install from Source} how to proceed next. @c -- A new node -------------------------------------------------------------- @node Build and Install from Source @section Build and Install from Source @c ---------------------------------------------------------------------------- @IndexSubentry{Installation, Build from source} Whether the sources originate from a tar file, or a git repository, the steps to build and install the code are the same. They are covered in this section. By default, the GUI related files are installed in @file{/usr/local}, but through the @code{--prefix} option, this can be changed. As a first step, a build location needs to be selected. This is the directory where, among other files, the generated files like the Java classes and jar files will be placed. Before the code can be built, a configuration step is needed. This is handled by the @code{configure} tool that comes with the distribution. This is also where an alternate location for the installation needs to be specified. In the example below, it is assumed that the current directory is at the same level as where the source directory is located. This is where we create the build directory. It is called @file{build} in this example, but any other name may be chosen. In the next step, the @command{configure} tool is used to set up the configuration details. @emph{This tool is located in the source directory}, but is executed from the build directory. By default, the necessary files will be installed in @file{/usr/local}. In the example the @code{--prefix} option is used to change this and set the installation directory to @file{/home/demo/gui-install}. This is where the files needed to execute the @command{gprofng display gui} command will be installed. Make sure to set the correct permissions such that the installation process is allowed to write to directory @file{/home/demo}. As an example, below it is assumed that a tar file with version @code{1.1} has been used. The following commands create the build directory and configure the settings: @cartouche @smallexample @verbatim $ mkdir build $ cd build $ ../gprofng-gui-1.1/configure --prefix=/home/demo/gui-install @end verbatim @end smallexample @end cartouche The command for the git repository is nearly identical. The only difference is that the @command{configure} tool is executed from directory @file{gprofng-gui}: @cartouche @smallexample @verbatim $ ../gprofng-gui/configure --prefix=/home/demo/gui-install @end verbatim @end smallexample @end cartouche The @command{configure} command prints messages on the screen, but also produces a @file{config.log} file. It is strongly recommended to check this file to make sure the configuration phase was successful. Any error should be resolved and warnings need to be checked. If there are no errors and warnings, the next step is to build the code using the @command{make} command. If the build has been successful, the next thing to do is to use the @command{make install} command to install the files. Make sure that the correct write permissions are set on the installation directory, or use the @command{sudo} command when executing @command{make install}: @cartouche @smallexample @verbatim $ make $ make install @end verbatim @end smallexample @end cartouche The very last steps are to make sure that the @code{bin} directory in the installation directory is in the search path as set through the @code{PATH} environment variable and to adjust variable @code{MANPATH} to include the man page for the GUI. For example @file{/home/demo/gui-install/bin}. @cartouche @smallexample @verbatim $ export PATH=/home/demo/gui-install/bin:$PATH $ export MANPATH=/home/demo/gui-install/share/man:$MANPATH @end verbatim @end smallexample @end cartouche @IndexSubentry{Installation, Verify the installation} To verify that the GUI has been installed successfully, use the following command: @cartouche @smallexample $ gprofng display gui --version @end smallexample @end cartouche @noindent If the installation has been successful, a diagnostic message is printed. @c -- A new node -------------------------------------------------------------- @node Getting Started @chapter Getting Started @c ---------------------------------------------------------------------------- @cindex Getting started In this chapter the steps needed to start the GUI, load an experiment, and use some of the menus to provide a first view into the performance data, are explained. This is sufficient to get started. In subsequent chapters, more details on the features and the results displayed are prodvided. @menu * Start the GUI:: Different ways to invoke the GUI. * The Initial Screen:: What is shown initially? @end menu @c -- A new node -------------------------------------------------------------- @node Start the GUI @section Start the GUI @c ---------------------------------------------------------------------------- @cindex Start the GUI The details of the usage information and an overview of the options supported, can be found in the man page for the GUI. For convenience a brief description is provided here. For more details @xref{The gprofng GUI Man Page}. The GUI is invoked through the @command{gprofng display gui} command. Among other things, one or more experiments can be included on the command line. All experiments listed will be opened and loaded into the GUI. For example, this command starts the GUI and loads an experiment called @file{experiment_1.er}: @cartouche @smallexample @verbatim $ gprofng display gui experiment_1.er @end verbatim @end smallexample @end cartouche The GUI main window will be displayed. This includes a summary of the experiments loaded. Loading multiple experiments is very similar. Simply add the experiments on the command line. @IndexSubentry{Options, @code{-c}} @cindex Comparison mode By default, the data shown is aggregated across all the experiments that have been loaded, but with the @code{-c} option, the GUI starts up in comparison mode. For example, this command loads two experiments in comparison mode, where the first experiment is used as the reference. The data in the second experiment will be shown relative to this reference: @cartouche @smallexample @verbatim $ gprofng display gui -c experiment_1.er experiment_2.er @end verbatim @end smallexample @end cartouche Alternatively, the GUI may be started without experiments. This will cause a window to appear that shows previously loaded experiments. If none have been loaded in the past, the list is empty. Once the GUI is running and one or more experiments have been loaded, it is possible to remove or add experiments from within the GUI. @cindex Toggle the mode Under the @samp{File} menu, there are entries to manage the experiments. For example to load, or remove, one or more experiments, but also to toggle the mode from aggregation to comparison, and viceversa. If menu entry @samp{Aggregate Experiments @dots{}} is selected, a list with the currently loaded experiments is shown. This list may be modified by adding, or removing experiments. The comparison mode is enabled by selecting @samp{Compare Experiments @dots{}}. In this menu, the experiments loaded can be modified. The reference experiment may also be changed here. @c -- @image{images/gp-gui-opening-screen,,150pt,"opening screen"} @c -- @ifhtml @c -- @center @image{images/gp-gui-opening-screen-scaled,10pt,50pt,"opening"} @c -- @center @image{images/gp-gui-opening-screen-scaled,,,"image of opening screen"} @c -- @end ifhtml @c -- @ifnothtml @c -- @center @image{images/gp-gui-opening-screen-scaled,,150pt,"image of opening screen"} @c -- @center @image{images/gp-gui-opening-screen-scaled,,150pt,"image of opening screen"} @c -- @end ifnothtml @c -- A new node -------------------------------------------------------------- @node The Initial Screen @section The Initial Screen @c ---------------------------------------------------------------------------- @cindex Initial Screen This is the screen that is shown when the GUI is started. The top bar shows the menus that are available. Below this, there are icons that represent shortcuts to specific features. For example, adding or removing filters is activated by clicking on the funnel icon. Tooltips provide a brief description of each icon. This is followed by a window with a dashboard overview of the experiment(s) loaded. The top panel is titled @samp{Experiment(s)}, and shows a summary of the experiment(s). By clicking on the little black arrow, more information is displayed. This info panel is followed by a second panel titled @samp{Metrics} that provides a summary of the metrics collected. This includes the duration of the experiment, or the maximum duration if multiple experiments have been loaded, and the aggregated CPU time. In case hardware events have been collected, the total values will be displayed here too. The third panel, @samp{Metrics Preview}, shows how the metrics will look in the data views. The metrics that are displayed can also be configured. There is a menu entry called @samp{Metrics} at the top that is a shortcut to one of the settings. If selected, it shows a table with the metrics that should be enabled, or disabled. @IndexSubentry{Overview Window, Default views} The panel on the left hand side lists the various views that are available. For example there is a @samp{Functions} view that provides a function overview, or the @samp{Timeline} to get a color coded execution overview of the application. This panel also has a very useful entry at the very top. It is titled @samp{Views} and through green colored navigation errors, one can go back and forth between views that have been selected earlier. @IndexSubentry{Overview Window, Enable views} It is important to note that by default the list with the views shows a subset of the available views only. By clicking on the last entry (@samp{More @dots{}}), additional views may be enabled, or disabled, by clicking on the checkbox to the left of the view. The view(s) selected will be added to the list on the left. The (updated) list will be stored transparently as part of the settings for the experiment. In case the settings should be accessible to other experiments, they can be saved in a different location. For this, select @samp{Tools} in the top level menu bar. From there, the @samp{Export} feature can be used to select where the preferences need to be stored. Several choices for the location are supported. Earlier saved preferences may be imported through the @samp{Import} feature. The initial screen is meant to provide a quick overview and point at the first possible area(s) of interest. From there, further exploration is probably warranted. @c -- A new node -------------------------------------------------------------- @node Create an Experiment @chapter Create an Experiment @c ---------------------------------------------------------------------------- @cindex Create an experiment In many cases, the @command{gprofng collect app} tool will be used to generate the performance data, but it is also possible to set up an experiment and execute it from within the GUI. To access this feature, select the @samp{Profile Application @dots{}} menu item under the top level @samp{File} menu. This opens a separate window that is used to define and run the experiment. The first tab titled @samp{General} is used to specify the application to be profiled, options (if any), and environment variables. Below this, the details of the experiment directory, like the name, need to be set. The @samp{Preview command} field shows the generated command. The second tab (@samp{Data to Collect}) is used to define what kind of data needs to be collected. In this window, click on the @samp{Run} button to start the program and the performance data collection process. The third tab is titled @samp{Output}. It displays the output from the data collection process in the top window, and the program output in the window below. @c -- A new node -------------------------------------------------------------- @node The Default Views @chapter The Default Views @c ---------------------------------------------------------------------------- @cindex Default views Many views into the performance data are available. The panel on the lefthand side shows a selection. This list can be managed by clicking on the @samp{More @dots{}} entry at the bottom. There, additional views may be enabled, or existing views may be removed from the current list. @noindent Note that adding a view is persistent. It will stay there, until it has been deselected through the checkbox in the corresponding entry in the @samp{More @dots{}} view. @noindent In this chapter we list and briefly describe the default set of views. @menu * Callers-Callees:: The calling relationships between the functions. * Call Tree:: A graphical representation of the call structure. * Disassembly:: Shows the metrics at the instruction level. * Experiments:: An overview of the experiments loaded. * Flame Graph:: A compact representation of the call tree. * Functions:: A function level overview where the time has been spent. * Processes:: Shows a list of the processes and their metrics. * Source/Disassembly:: Split window source and disassembly view. * Threads:: Show a list of the threads and their metrics. * Timeline:: A graphical representation of the program behaviour. * More ...:: Enable or disable views. @end menu @c -- A new node -------------------------------------------------------------- @node Callers-Callees @section Callers-Callees @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Callers-callees} This view shows the calling relationships between the functions executed, along with the performance metrics. The selected function is shown in the center panel. The function(s) in the panel above (the @samp{callers}) are those that call the target function. The ones in the panel below (the @samp{callees}), are called by this function. On the righthand side, the @samp{Selection Details} window displays more details of the function selected. @c -- A new node -------------------------------------------------------------- @node Call Tree @section Call Tree @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Call tree} This view displays a dynamic call graph of the program as a tree. It is useful to see the details of branches in the call tree that have the greatest impact on the performance. Each function call is shown as a node that can be expanded, or collapsed, by clicking on the key-like icon to the left of the node. An expanded function node shows all the function calls made by the function, plus performance metrics for those function calls. @IndexSubentry{Call Tree, Selection details} When a function is selected, the @emph{Selection Details} window displays the metrics for the function call and its callees. The percentages given for attributed metrics are the percentages of the total program metrics. The default root of the tree is @code{<Total>}, which is a pseudo function that represents 100% of the performance metrics of all the functions executed. To easily find the branch that is consuming the most time, right-click any @IndexSubentry{Call Tree, Expand hottest branch} node and in the pulldown menu, select @samp{Expand Hottest Branch}. @IndexSubentry{Call Tree, Apply filters} In this menu, predefined filters are available to narrow down the view. @c -- A new node -------------------------------------------------------------- @node Disassembly @section Disassembly @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Disassembly} The instructions for the selected function are shown. The metrics that have been measured are displayed to the left. The source line number where an instruction originates from is shown in square brackets. @c -- A new node -------------------------------------------------------------- @node Experiments @section Experiments @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Experiments} This view displays more details on the experiment(s) and the load objects that have been used. For each experiment, a @samp{Notes} and @samp{Info} section are shown. The @samp{Notes} section allows text to be added, or modified. This may be used to annotate the experiment. Note that such comments can also be added by using the @code{-C} option on the @CollectApp{} tool. @c -- A new node -------------------------------------------------------------- @node Flame Graph @section Flame Graph @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Flame graph} The flame graph is a compact graphical representation of the call tree. The call stacks are organized vertically. Frames include the name a function and the width of the frame is a relative measure of the inclusive CPU time for that function. Just as with the call tree, right-clicking on a frame, shows a pulldown menu with filters and navigation controls. The zoom function at the top may be used to zoom in, or out. @c -- A new node -------------------------------------------------------------- @node Functions @section Functions @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Functions} @IndexSubentry{Function View, Function overview} One common view to explore is the function overview. By selecting the @samp{Functions} feature, a list with the functions that have been executed, as well as the metrics that have been recorded, is displayed. By default, the exclusive and inclusive CPU times are displayed, both as a number and a percentage. If hardware events have been collected, these will be shown as well. The data is sorted with respect to the exclusive timings. By clicking on a different column, the data is sorted according to that metric. @IndexSubentry{Function View, More details} Most likely more details are needed. To see more details for a function, select the function name shown under column @samp{Name}. This will show several characteristics of the function, including the metrics, in a window to the right. @IndexSubentry{Function View, Source information} By double clicking a function name, control is transferred and the view changes to display the source lines of the function, annotated with the performance metrics that are shown to the right. The most expensive source lines are highlighted. Colored markers to the right indicate where the expensive lines are. By clicking on one of those, the display is changed to show the source code fragment with the target line included. This action automatically adds the @emph{Source} view to the list in the righthand side panel. This is a persistent change. A next time the same experiment is loaded, this view is included in the list. The source view can also be selected by clicking on @emph{Source/Disassembly} in the panel on the lefthand side. This will show a split window with the source code at the top and the disassembly with the instructions underneath. In both windows the source lines and instructions are annotated with the performance metric(s). @c -- A new node -------------------------------------------------------------- @node Processes @section Processes @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Processes} This view shows a list of processes that were created by the application, along with their metrics. In this view, it is easy to find those processes that used the most resources. Filters may be used to select a particular set of processes. This selection is used in other views. The processes are represented by process ID (PID) numbers and show the Total CPU time metric by default. Other metrics might also be displayed if the metrics are present in the loaded experiment(s). If other metrics have been selected in the @samp{Overview} view, or by using the @samp{Settings} dialog, those metrics are also displayed. @c -- A new node -------------------------------------------------------------- @node Source/Disassembly @section Source/Disassembly @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Source/disassembly} This shows two windows, each with their own scrollbar. The top window shows the source code, annotated with the values for the metrics selected. The window below lists the instructions with the metrics to the left. In both cases, the expensive parts are highlighted. @c -- A new node -------------------------------------------------------------- @node Threads @section Threads @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Threads} This view shows a list of the threads that have been created together with their metrics. The threads are represented by a process plus thread pair and show the Total CPU time. Other metrics might also be displayed if the metrics are present in the loaded experiments. The filter button may be used to filter the data shown. @c -- A new node -------------------------------------------------------------- @node Timeline @section Timeline @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Timeline} The timeline view is shown by selecting @samp{Timeline} in the panel on the lefthandside. This displays the color coded dynamic behavior of the application as a function of time. @menu * The Default View:: Description of the main Timeline window and tabs. * More Details:: Expand the view and zoom in to get more details. * Customization:: Change some views. * Filters:: Apply filters to select a section of interest. @end menu @c -- A new node -------------------------------------------------------------- @node The Default View @subsection The Default View @c ---------------------------------------------------------------------------- The top line shows a color coded representation of the operating system (or OS for short). For example, a bright green color means the OS is in user mode. This data is sampled every second and each block represents one second of execution. By clicking on such a block in the top level bar, a legend is shown, plus a summary with the metrics and states for the selected block. The horizontal bar with the OS overview is followed by a bar for each thread that has been created when the program was running. Every function in the application has been assigned a unique color. What is shown in these bars is the color coded representation of the dynamic behaviour of the application. These vertical call stacks show all the functions that were executed by the top level function. In case no colors are shown for a period of time, it means that the thread was not active during that period. By clicking anywhere in the area with the horizontal bars, a point in time is selected. On the righthand side, details at this point are displayed. For example, if a thread was selected, the thread and CPU IDs are displayed. Below this information, the call stack is shown. Double clicking on a function in this list transfers the view to the source level view. To return to the timeline, click on the green arrow in the @samp{Views} tab in the panel on the left hand side. For a given point in time selected, the orange arrows shown at the top change the view to go to the next, or previous thread, or to select the next, or previous point in time. @c -- A new node -------------------------------------------------------------- @node More Details @subsection More Details @c ---------------------------------------------------------------------------- While the default view gives a good first impression of the behavior of the application, often more details are needed. Through the control part shown in the bar just above the timelines, it is possible to zoom in, or out, in both the vertical, as well as the horizontal direction. Next to the zoom controls there are two icons to undo or redo a zoom action. Repeated selection of these functions allows the view to be rolled back, or forward. @IndexSubentry{Timeline, Call stack depth} @IndexSubentry{Timeline, Vertical zoom} The vertical zoom increases the depth of the call stack. By default it is set to a specific limit. This may cause the call stack(s) to be truncated. By increasing the vertical zoom, more of the call stack is shown. @IndexSubentry{Timeline, Horizontal zoom} The horizontal zoom increases the space between the samples, up to the point that the individual samples are shown. This allows for a very detailed analysis of the runtime behavior. @IndexSubentry{Timeline, Select time window} Another way to see more details is to select a window of time. Position the cursor on the bar titled @samp{Time(sec)}. This bar shows the elapsed time, starting at zero. Select a region by selecting a range with the cursor and press return on the keyboard. This displays the selected region. @c -- A new node -------------------------------------------------------------- @node Customization @subsection Customization @c ---------------------------------------------------------------------------- @IndexSubentry{Timeline, CPU view} @IndexSubentry{Timeline, LWP view} @IndexSubentry{Timeline, Process view} By default the horizontal bars in the main display are thread based. To change this, use the pull down menu labelled @emph{Group Data by} to select @emph{LWP}, @emph{CPU}, or @emph{Process} instead. For example, by selecting @samp{CPU}, the view is adjusted to show which CPU(s) have been used. @IndexSubentry{Timeline, Change stack colors} Another feature that can be customized is the colors used for the call stacks. The top bar has an icon with three small colored circles that opens a new window titled @samp{Function Colors}. This window allows the user to change the colors of selected, or all of the, functions. One use for this is to select a light color, gray say, for all functions and then select specific colors for the function(s) of interest. In this way, it is often easier to see how the most time consuming functions behave over time. @c -- A new node -------------------------------------------------------------- @node Filters @subsection Filters @c ---------------------------------------------------------------------------- @IndexSubentry{Timeline, Filters} Filters provide a way to focus on a particular area of interest. For example, to select one or more threads, or to restrict the view to a specific window in time, or a combination of these two. The top level @samp{Tools} menu includes an entry for filters. Alternatively, the icon of a funnel can be used to directly access the filter part. Several filters have been preprogrammed and these can be used repeatedly to combine the various filters. @IndexSubentry{Timeline, Customize filters} Use entry @samp{Additional Filters} to go to @samp{Advanced Custom Filter}. Under this menu, customized filters can be defined and applied. Note that a filter action can be undone and existing filters can be removed. @c -- A new node -------------------------------------------------------------- @node More ... @section More ... @c ---------------------------------------------------------------------------- @IndexSubentry{Views, More} Several other views are available. Through this view, they can be enabled, or already visible views may be disabled. The choices available are documented in the next chapter. @c -- @include gp-gui-more.texi @c -- A new node -------------------------------------------------------------- @node The Additional Views @chapter The Additional Views @c ---------------------------------------------------------------------------- In addition to the default views, additional views are available. These may be enabled through the @samp{More @dots{}} entry. @menu * CPUs:: The CPUs used while executing the application, plus metrics. * Datasize:: Show data statistics for Heap and I/O tracing. * Duration:: Show durations for Heap, I/O and Synchronization tracing. * Experiment IDs:: List of processes created and metrics collected. * GCEvents:: List of Garbage Collection events. * Lines:: A sorted view with the source lines and their metric values. * PCs:: A sorted view with the Program Counters and their metrics. * Samples:: Show the samples plus the total CPU time. * Seconds:: Show the seconds plus the total CPU time. * Source:: Source listing with the metrics to the left of the lines. * Statistics:: Execution statistics for the application. @end menu @c -- A new node -------------------------------------------------------------- @node CPUs @section CPUs @c ---------------------------------------------------------------------------- @IndexSubentry{Views, CPUs} This view shows a list of CPUs that have been used while executing the application. This is shown along with the metrics that have been enabled for the data collection. The CPUs are represented by a CPU number. By default, the @samp{Total CPU time} is shown. Other metrics might also be displayed by default if the metrics are present in the loaded experiments. Filters may be applied to the data shown. @c -- A new node -------------------------------------------------------------- @node Datasize @section Datasize @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Datasize} @IndexSubentry{Tracing experiments, Heap} @IndexSubentry{Tracing experiments, I/O} This view is available for @samp{Heap Tracing}, and @samp{I/O Tracing} experiments. They contain data that has a size element, such as the number of bytes. The data is organized into ranges of data sizes. The metrics for the events whose data falls into a given range are shown. Data without a size element is attributed to data size 0. This view can be used to filter the data. For example, in an experiment that contains heap tracing data, you could select a size range line that has high metrics for @samp{Bytes Leaked} and add the filter @samp{Include only events with selected items}. In other data views, the data is then filtered to only show events that produced memory leaks of the size range that was selected. @c -- A new node -------------------------------------------------------------- @node Duration @section Duration @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Duration} @IndexSubentry{Tracing experiments, I/O} @IndexSubentry{Tracing experiments, Heap} @IndexSubentry{Tracing experiments, Synchronization} This view is available for @samp{Heap Tracing}, @samp{I/O Tracing}, and @samp{Synchronization Tracing} experiments. They contain data that has a duration. The data is organized into ranges of the duration time. The metrics for the events whose data falls into each range of duration time are shown. The duration of the function call is recorded for I/O and Synchronization tracing. For heap tracing, the duration is the time between the allocation and release of memory. Data without a duration element is attributed to duration 0. This view may be used to filter the data. For example, in an experiment that contains heap tracing data, you could select a duration range line that has high metrics for @samp{Bytes Allocated} and add the filter @samp{Include only events with selected items}. In other data views, the data is then filtered to show only events whose duration matched the range that was selected. This might reveal memory allocations that have a longer than expected duration. @c -- A new node -------------------------------------------------------------- @node Experiment IDs @section Experiment IDs @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Experiment IDs} This view shows a list of processes that were created by the application, along with its metrics. The @samp{IDs} are represented by process ID (@samp{PID}) numbers and show the @samp{Total CPU time} metric by default. Other metrics might also be displayed if the metrics are present in the experiment(s) loaded. If other metrics have been selected in the @samp{Overview} view, or by using the @samp{Settings} dialog, those metrics are also displayed. The metrics values reflect the states recorded at each sample point in the loaded experiment(s). The numbers reflect the value, or percentage, of the metrics that were recorded in each of the loaded experiments. @c -- A new node -------------------------------------------------------------- @node GCEvents @section GCEvents @c ---------------------------------------------------------------------------- @IndexSubentry{Views, GCEvents} This view shows a summary of the Garbage Collection (@samp{GC}) events that occurred while the program was executing. @c -- A new node -------------------------------------------------------------- @node Lines @section Lines @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Lines} This view shows a list consisting of source lines and their metrics. Source lines are labeled with the function from which they came, plus the line number and source file name. Selecting a line shows all the metrics for a given line in the @samp{Selection Details} tab. Selecting the @samp{Source} or @samp{Disassembly} view after selecting a line, positions the display at the appropriate line. If no line number information is available for a function, or if the source file for the function is not known, all of the function's Program Counters (@samp{PCs}) appear aggregated into a single entry for the functions. PCs from functions that are from load objects whose functions are hidden, appear aggregated as a single entry for the load object. @c -- A new node -------------------------------------------------------------- @node PCs @section PCs @c ---------------------------------------------------------------------------- @IndexSubentry{Views, PCs} This view is similar to the @emph{Lines} view, but instead of source lines, lists Program Counters (@samp{PCs}) and their metrics. Selecting a line shows all the metrics for that PC in the @emph{Summary} tab. Selecting the @samp{Source}, or @samp{Disassembly} view after selecting a line, positions the display at the appropriate line. PCs are labeled with the function from which they came and the offset within that function. PCs from functions that are from load objects whose functions are hidden appear aggregated as a single entry for the load object. @c -- TBD Expand @c -- See the section Call Stacks and Program Execution for more @c -- information about PCs. @c -- A new node -------------------------------------------------------------- @node Samples @section Samples @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Samples} This view shows a list of (Operating System) sample points and their metrics, which reflect the states recorded at each sample point in the loaded experiments. The samples are represented by sample numbers and by default show the @samp{Total CPU time}. Other metrics might also be displayed if they have been selected in the @samp{Overview} view, or in the @samp{Settings} dialog box. Filters may be applied to the data shown. @c -- A new node -------------------------------------------------------------- @node Seconds @section Seconds @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Seconds} This view shows each second of the program run that was captured in the experiment, along with metrics collected in that second. The @samp{Seconds} view lists the seconds of execution with the @samp{Total CPU time} by default. Other metrics might also be displayed if the metrics are present in the loaded experiments. If other metrics have been selected in the @samp{Overview} view, or by using the @samp{Settings} dialog, those metrics are also displayed. Filters may be applied to the data shown. The @samp{Seconds} view differs from the @samp{Samples} view in that it shows periodic samples that occur every second beginning at 0 and the interval cannot be changed. @c -- A new node -------------------------------------------------------------- @node Source @section Source @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Source} If the source code is available, this view shows the source lines of the selected function, annotated with performance metrics to the left of the lines. High metrics are highlighted in yellow to indicate lines that are expensive regarding the metric(s) used. For each of such lines, an orange navigation marker is shown in a margin next to the scrollbar on the right. Non-zero metrics that are below the threshold are not highlighted, but they are flagged with grey navigation markers. The threshold for highlighting metrics can be set in the @samp{Settings dialog box}, or in the @samp{Source/Disassembly} view. To quickly navigate to source lines with metrics, click the yellow markers in the right margin to jump to the lines with metrics. To jump to the next line with metrics, right-click the metrics themselves and select an option such as @samp{Next Hot Line}, or @samp{Next Non-Zero Metric Line}. In the column heading for the source code, the full path to the source file is shown, plus the corresponding object file, and the name of the load object In case where the same source file is used to compile more than one object file, the source view shows the performance data for the object file containing the selected function. If a source file cannot be located, the @samp{Resolve} button may be used to browse to the source file, or type the path to the source, or browse to it. The source code is then displayed from the new location. Optionally, @samp{Archive Source Files Inside Experiment} can be selected to copy the source files into the experiment. When double clicking on a function in the @samp{Functions view}, the source view is opened. The source file displayed is the default source context for that function. @cindex Default source context The default source context of a function is the file containing the function's first instruction. For example, for C code this is the function's opening brace. Immediately following the first instruction, the annotated source file adds an index line for the function. The source window displays index lines as text in red italics within angle brackets in the form: @code{<Function: f_name>}. @cindex Alternate source context A function might have an alternate source context, which is another file that contains instructions attributed to the function. Such instructions might come from include files, or from other functions inlined into the selected function. If there are any alternate source contexts, the beginning of the default source context includes a list of extended index lines that indicate where the alternate source contexts are located: @code{<Function: f, instructions from source file src.h>}. Double-click an index line that refers to another source context to open the file containing that source context at the location associated with the indexed function. To aid navigation, alternate source contexts also start with a list of index lines that refer back to functions defined in the default source context and other alternate source contexts. @c -- TBD Expand on this: @c -- The metrics displayed in the source view can be changed or reorganized. @c -- For detailed information about the content of the "Source View Layout". @c -- A new node -------------------------------------------------------------- @node Statistics @section Statistics @c ---------------------------------------------------------------------------- @IndexSubentry{Views, Statistics} This view shows the totals for various system statistics aggregated over the experiments loaded and samples. These totals are followed by the statistics for the selected samples of each experiment. @c -- TBD Verify @c -- For information on the statistics presented, see the @c -- getrusage(3C) and proc (4) man pages. @c -- An appendix ------------------------------------------------------------- @node The gprofng GUI Man Page @appendix The gprofng GUI Man Page @c ---------------------------------------------------------------------------- @include gprofng-display-gui.texi @ifnothtml @node Index @unnumbered Index @printindex cp @end ifnothtml @bye �����������������������������������������������������gprofng-gui-2.1/doc/stamp-vti�����������������������������������������������������������������������0000644�0001750�0001750�00000000137�15044714135�013142� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@set UPDATED 23 January 2025 @set UPDATED-MONTH January 2025 @set EDITION 2.1 @set VERSION 2.1 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/gprofng-display-gui.texi��������������������������������������������������������0000644�0001750�0001750�00000026402�14744453367�016075� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@c ---------------------------------------------------------------------------- @c This is the Texinfo source file for the gp-display-gui man page. @c @c Author: Ruud van der Pas @c ---------------------------------------------------------------------------- @ifset man \input texinfo @c -*-texinfo-*- @setfilename gprofng-display-gui @settitle Graphical tool to analyze one or more gprofng experiments @include gp-macros.texi @end ifset @clear REMOTE_HOST @c ---------------------------------------------------------------------------- @c This is from the man-pages(7) man page @c @c "The list below shows conventional or suggested sections. Most manual pages @c should include at least the highlighted sections. Arrange a new manual @c page so that sections are placed in the order shown in the list." @c @c NAME @c SYNOPSIS @c CONFIGURATION [Normally only in Section 4] @c DESCRIPTION @c OPTIONS [Normally only in Sections 1, 8] @c EXIT STATUS [Normally only in Sections 1, 8] @c RETURN VALUE [Normally only in Sections 2, 3] @c ERRORS [Typically only in Sections 2, 3] @c ENVIRONMENT @c FILES @c VERSIONS [Normally only in Sections 2, 3] @c ATTRIBUTES [Normally only in Sections 2, 3] @c CONFORMING TO @c NOTES @c BUGS @c EXAMPLES @c AUTHORS [Discouraged] @c REPORTING BUGS [Not used in man-pages] @c COPYRIGHT [Not used in man-pages] @c SEE ALSO @c @c This is what the texi2pod.pl tool recognizes: @c @c for $sect (qw(NAME SYNOPSIS TARGET DESCRIPTION OPTIONS ENVIRONMENT FILES @c BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { @c @c What is interesting is that it places "SEE ALSO" before "COPYRIGHT", which @c makes sense and adhered to for the other formats. @c ---------------------------------------------------------------------------- @c ---------------------------------------------------------------------------- @c NAME section @c ---------------------------------------------------------------------------- @ManPageStart{NAME} @c man begin NAME gprofng-gui - Graphical tool to analyze one or more gprofng experiments @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c SYNOPSIS section @c ---------------------------------------------------------------------------- @ManPageStart{SYNOPSIS} @c man begin SYNOPSIS @ifclear man @IndexSubentry{Options, @code{-c}} @end ifclear @iftex @command{gprofng display gui} [@var{option(s)}] \ @indentedblock [[@option{-c}] @var{experiment(s)} | @var{target} [@var{target-options}]] @end indentedblock @end iftex @ifnottex @command{gprofng display gui} [@var{option(s)}] [[@option{-c}] @var{experiment(s)} | @var{target} [@var{target-options}]] @end ifnottex @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c DESCRIPTION section @c ---------------------------------------------------------------------------- @ManPageStart{DESCRIPTION} @c man begin DESCRIPTION The @command{gprofng display gui} tool starts the GUI, which is a Java based graphical tool that can be used to analyze performance data that has been collected with the @command{gprofng collect app} tool. Multiple experiments may be specified on the command line. The data for all these experiments is loaded and ready for analysis. Once the tool has started, it is also possible to drop or load other experiments. By default, if multiple experiments are specified, the data is aggregated across the experiments. If the @ifclear man @IndexSubentry{Options, @code{-c}} @end ifclear @option{-c} option is used, the tool starts in comparison mode. In this case, the data for the various experiments can be compared. If this option is used, at least two experiments must be specified on the command line. Alternatively, the tool can be invoked without specifying experiments. In this case, a target program is expected to be specified. Optionally, there may be options for the target. If started this way, a window with user settings will be opened. These may be used to specify the options and other preferences that define the data collection experiment. The user can then run the experiment from this window and upon successful completion, analyze the results. If @command{gprofng display gui} is invoked without specifying one or more experiments, or a target, a welcome screen is shown. In this screen, the user can specify whether to analyze an existing experiment, or to create a new experiment by specifying the data collection settings to define and run a new performance experiment. @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c OPTIONS section @c ---------------------------------------------------------------------------- @ManPageStart{OPTIONS} @c man begin OPTIONS @table @gcctabopt @item --version @ifclear man @IndexSubentry{Options, @code{--version}} @end ifclear Print the version number and exit. @item --help @ifclear man @IndexSubentry{Options, @code{--help}} @end ifclear Print usage information and exit. @item -v, --verbose @ifclear man @IndexSubentry{Options, @code{-v}} @IndexSubentry{Options, @code{--verbose}} @end ifclear By default, verbose mode is disabled. This option enables it. @item -j @var{jvmpath}, --jdkhome @var{jvmpath} @ifclear man @IndexSubentry{Options, @code{-j}} @IndexSubentry{Options, @code{--jdkhome}} @end ifclear Specify the path to the Java Virtual Machine (JVM) to be used for running @command{gprofng display gui}. The default path is taken first by examining environment variables for a path to the JVM, in the order @env{JDK_HOME}, and then @env{JAVA_PATH}. If neither environment variable is set, the version found in the search path set with the @env{PATH} environment variable is used. If none is found, @command{/usr/java/bin/java} is tried. @item -J@var{jvm-setting} @ifclear man @IndexSubentry{Options, @code{-J}} @end ifclear Use this option to pass on settings to the JVM. Multiple @option{-J} options and corresponding settings may be supplied. Note that there is @emph{no} space between the @option{-J} option and the @var{jvm-setting} setting to the JVM. @item -c @var{base-group compare-group} @ifclear man @IndexSubentry{Options, @code{-c}} @end ifclear By default, the results for multiple experiments are aggregated. With this option, the GUI starts in comparison mode. If this option is specified, two or more experiments must be provided as arguments. The first experiment is the base group. The results in the other experiment(s) are compared to this reference experiment. Note that the user can toggle between aggregation and comparison mode from within the GUI. @item -f @var{size}, --fontsize @var{size} @ifclear man @IndexSubentry{Options, @code{-f}} @IndexSubentry{Options, @code{--fontsize}} @end ifclear Specify the font size to be used in the GUI. @item -u @var{dir-path}, --userdir @var{dir-path} @ifclear man @IndexSubentry{Options, @code{-u}} @IndexSubentry{Options, @code{--userdir}} @end ifclear Specify the path to the user directory in which to store user settings. @end table @c man end @ManPageEnd{} @ifset REMOTE_HOST @c ---------------------------------------------------------------------------- @c ENVIRONMENT SECTION @c @c Temporarily disabled until the remote host feature has been implemented. @c Once this has been done, remove the ifset REMOTE_HOST/end ifset and the @c "@c deferred " strings. @c ---------------------------------------------------------------------------- @c deferred @ManPageStart{ENVIRONMENT} @c deferred @c man begin ENVIRONMENT The following environment variables for connecting to a remote host are supported: @table @samp @item @env{GPROFNG_HEARTBEAT_DISABLE} @ifclear man @IndexSubentry{Environment variables, @code{GPROFNG_HEARTBEAT_DISABLE}} @end ifclear If defined, disable periodic checking of the connection between @command{gprofng} and the remote host. By default, a heartbeat packet is sent periodically from @command{gprofng} to the remote back-end. When enabled, the heartbeat packet can help to keep some SSH connections from automatically closing due to inactivity. @item @env{GPROFNG_HEARTBEAT_MSEC} @ifclear man @IndexSubentry{Environment variables, @code{GPROFNG_HEARTBEAT_MSEC}} @end ifclear Set the interval for checking the connection between @command{gprofng} and the remote host. The default is 2000 milliseconds. @item @env{GPROFNG_REMOTE_SHELL} @ifclear man @IndexSubentry{Environment variables, @code{GPROFNG_REMOTE_SHELL}} @end ifclear Set this variable to @command{/usr/bin/ssh} to use @samp{/usr/bin/ssh} for connecting @command{gprofng} to a remote host. If this variable is not set, the internal tool to connect is used. For example: @smallexample $ export GPROFNG_REMOTE_SHELL="/usr/bin/ssh -u test-linux-nm1.pem" @end smallexample Note that this variable is only available on UNIX-based systems, and only for connections that do not require a password or passphrase. @end table @c deferred @c man end @c deferred @ManPageEnd{} @end ifset @c ---------------------------------------------------------------------------- @c NOTES section @c ---------------------------------------------------------------------------- @ManPageStart{NOTES} @c man begin NOTES The @command{gprofng display gui} tool relies on other @command{gprofng} components. Therefore, it is necessary to also install the other components, either by using one of the available RPM's, install from a tar file distribution, or to build and install @command{gprofng} directly from the source. @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c SEEALSO section @c ---------------------------------------------------------------------------- @ManPageStart{SEE ALSO} @c man begin SEEALSO gprofng(1), gp-archive(1), gp-collect-app(1), gp-display-html(1), gp-display-src(1), gp-display-text(1) @iftex @vspace{1} @end iftex The user guide for gprofng is maintained as a Texinfo manual. If the @command{info} and @command{gprofng} programs are correctly installed, the command @command{info gprofng} should give access to this document. @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c COPYRIGHT section @c ---------------------------------------------------------------------------- @ManPageStart{COPYRIGHT} @c man begin COPYRIGHT Copyright @copyright{} 2022-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @c man end @ManPageEnd{} @c ---------------------------------------------------------------------------- @c If this text is used for a man page, exit. Otherwise we need to continue. @c ---------------------------------------------------------------------------- @ifset man @bye @end ifset ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/version.texi��������������������������������������������������������������������0000644�0001750�0001750�00000000137�15044714135�013653� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@set UPDATED 23 January 2025 @set UPDATED-MONTH January 2025 @set EDITION 2.1 @set VERSION 2.1 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/doc/gprofng-gui.info����������������������������������������������������������������0000644�0001750�0001750�00000172713�15044723207�014406� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������This is gprofng-gui.info, produced by makeinfo version 7.1 from gprofng-gui.texi. This document is the manual for the GNU gprofng Graphical User Interface, last updated 23 January 2025. Copyright © 2024-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License." INFO-DIR-SECTION Software development START-INFO-DIR-ENTRY * gprofng-gui: (gprofng-gui). The GNU gprofng Graphical User Interface END-INFO-DIR-ENTRY  File: gprofng-gui.info, Node: Top, Next: Introduction, Up: (dir) GNU gprofng GUI *************** This document is the manual for the GNU gprofng Graphical User Interface, last updated 23 January 2025. Copyright © 2024-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License." * Menu: * Introduction:: About this manual. * Overview:: A brief overview of the GUI. * Prerequisites:: What is required to install and use the GUI. * How to Install the GUI:: Build and install the GUI. * Getting Started:: How get started with the GUI. * Create an Experiment:: Set up and run a performance experiment. * The Default Views:: The default views into the data. * The Additional Views:: The non-default views that are available. * The gprofng GUI Man Page:: The man page for the gprofng GUI. * Index:: The index. -- The Detailed Node Listing -- Introduction Overview Prerequisites * Build Requirements:: What is needed to build the GUI code? * Runtime Requirements:: What is needed when executing the GUI? How to Install the GUI * Prepare the Build from the Tar File:: Getting ready to build. * Prepare the Build from the Git Repository:: Getting ready to build. * Build and Install from Source:: Get ready to run the GUI. Getting Started * Start the GUI:: Different ways to invoke the GUI. * The Initial Screen:: What is shown initially? Create an Experiment The Default Views * Callers-Callees:: The calling relationships between the functions. * Call Tree:: A graphical representation of the call structure. * Disassembly:: Shows the metrics at the instruction level. * Experiments:: An overview of the experiments loaded. * Flame Graph:: A compact representation of the call tree. * Functions:: A function level overview where the time has been spent. * Processes:: Shows a list of the processes and their metrics. * Source/Disassembly:: Split window source and disassembly view. * Threads:: Show a list of the threads and their metrics. * Timeline:: A graphical representation of the program behaviour. * More ...:: Enable or disable views. The Additional Views * CPUs:: The CPUs used while executing the application, plus metrics. * Datasize:: Show data statistics for Heap and I/O tracing. * Duration:: Show durations for Heap, I/O and Synchronization tracing. * Experiment IDs:: List of processes created and metrics collected. * GCEvents:: List of Garbage Collection events. * Lines:: A sorted view with the source lines and their metric values. * PCs:: A sorted view with the Program Counters and their metrics. * Samples:: Show the samples plus the total CPU time. * Seconds:: Show the seconds plus the total CPU time. * Source:: Source listing with the metrics to the left of the lines. * Statistics:: Execution statistics for the application. The gprofng GUI Man Page Index  File: gprofng-gui.info, Node: Introduction, Next: Overview, Prev: Top, Up: Top 1 Introduction ************** The gprofng GUI is GNU project. It is a graphical tool to create, view, or both create as well as view, gprofng performance experiments. All the information about this project can be found at the gprofng GUI home page (https://savannah.gnu.org/projects/gprofng-gui). This tool, hereafter also referred to as "the GUI", provides multiple views into the data. While some views are similar to what is shown with the command line tools, there are also features that are unique to the GUI. Examples are the Timeline and Flame Chart. The experiments do not need to be created with the GUI though. Experiments generated using the ‘gprofng collect app’ tool may also be analyzed and combined with experiments generated from within the GUI. In the remainder of this user guide, we first cover what is required in order to install and use the GUI. This is followed by a chapter how to invoke the GUI and load an experiment for subsequent analysis. The features and how to use them are the topics of the remainder of this guide.  File: gprofng-gui.info, Node: Overview, Next: Prerequisites, Prev: Introduction, Up: Top 2 Overview ********** Before we cover this tool in quite some detail, we start with a brief overview of the main features of the GUI: • One or more experiments created with the GUI, or through the ‘gprofng collect app’ tool, may be loaded into the GUI and analyzed. Within the GUI, experiments may be dropped, or additional experiments can be added by loading them into the GUI. • Many of the GUI settings are customizable and preferences may be saved in a configuration file that is read upon starting the GUI. • If multiple experiments have been loaded, the data is aggregated by default, but the user can change this to instead compare the data. In this mode, the results are compared against the reference experiment, which is the first experiment loaded. The reference experiment can be changed by modifying the order of the experiments on the command line, or within the GUI. Alternatively, the ‘-c’ option may be used to start the GUI in comparison mode. • All the views available through various ‘gprofng display text’ commands are supported. A subset of these commands is avaible through entries in the sidebar. The user can modify (and save) what is shown in the sidebar, but all features are available regardless of this. • Through filters, the user may zoom in on an area of interest.  File: gprofng-gui.info, Node: Prerequisites, Next: How to Install the GUI, Prev: Overview, Up: Top 3 Prerequisites *************** In this chapter it is explained what is needed in order to build the GUI. After this we cover what is needed to execute the GUI. * Menu: * Build Requirements:: What is needed to build the GUI? * Runtime Requirements:: What is needed when executing the GUI?  File: gprofng-gui.info, Node: Build Requirements, Next: Runtime Requirements, Up: Prerequisites 3.1 Build Requirements ====================== The GUI is a Java application. In order to build it, the ‘javac’ Java compiler and developer classes are needed. The compiler reads the source files for the GUI and compiles them into bytecode class files. For this, the ‘java-devel’ package needs to be installed in order to build and execute the GUI. The minimum Java version required is 8. If the git repository is used to build and install the GUI, the ‘autoconf’ and ‘automake’ tools need to be installed. This is _not_ needed when using the tar file.  File: gprofng-gui.info, Node: Runtime Requirements, Prev: Build Requirements, Up: Prerequisites 3.2 Runtime Requirements ======================== The GUI utilizes the Java Swing framework, and needs the X Window System (‘X11’, or simply ‘X’). It is commonly available for Linux systems, but may not be installed by default. Please make sure that it is installed before using the GUI. There are two common scenarios regarding accessing a system remotely (e.g. a cloud instance) where the GUI is to be executed: • If ‘ssh’ is used to access the remote system, make sure to have the correct access permissions and to set environment variable ‘DISPLAY’ accordingly. • If a remote desktop like ‘vnc’ is used, the GUI can be executed from within this desktop. No additional settings are needed. Since the GUI uses some of the tools that come with the core part of ‘gprofng’, it is necessary to also install this tool. Make sure to include these tools in the search path as set with environment variable ‘PATH’.  File: gprofng-gui.info, Node: How to Install the GUI, Next: Getting Started, Prev: Prerequisites, Up: Top 4 How to Install the GUI ************************ The GUI can be built and installed from the Java source. The source code is available as a tar file, and as a git repository. A tar file based installation has the advantage that tools like ‘autoconf’ and ‘automake’ have already been applied. With an installation from the repository, these tools are used and therefore need to be installed. Below we explain how to get the source and build, as well as install, the GUI. * Menu: * Prepare the Build from the Tar File:: Getting ready to build. * Prepare the Build from the Git Repository:: Getting ready to build. * Build and Install from Source:: Get ready to run the GUI.  File: gprofng-gui.info, Node: Prepare the Build from the Tar File, Next: Prepare the Build from the Git Repository, Up: How to Install the GUI 4.1 Prepare the Build from the Tar File ======================================= In general it is recommended to use the most recent version, but there may be a reason to use an older release. This is why various releases of the GUI are available on the GNU ftp site (https://ftp.gnu.org/gnu/gprofng-gui). The files have been compressed and are available in different formats. From this web site, the code may be downloaded directly. Alternatively, the ‘wget’ command can be used to download the tar file from the command line. To build the gprofng GUI from a released tar file, get your copy of the tar file first. In the example below we assume that version ‘1.1’ has been selected, but the process is identical for other versions. Below we show how the ‘wget’ command can be used to download a specific version. Below this, we show the output for a specific release. For lay-out reasons it has been slightly shortened and modified. $ wget https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz wget https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz --2024-03-19 https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-1.1.tar.gz ... Proxy request sent, awaiting response... 200 OK Length: 1576556 (1.5M) [application/x-gzip] Saving to: 'gprofng-gui-1.1.tar.gz' gprofng-gui-1.1.tar.gz 100%[========================>] 1.50M 2.00MB/s in 0.8s 2024-03-19 (2.00 MB/s) - 'gprofng-gui-1.1.tar.gz' saved [1576556/1576556] The next step is to unpack the compressed tar file and go into the newly created directory with the name ‘gprofng-gui-1.1’. Make sure that the target directory name, ‘gprofng-gui-1.1’ in this example, does not exist already. If so, remove it first. Unpack the tar file: $ tar xzvf gprofng-gui-1.1.tar.gz This is sample output from the command: gprofng-gui-1.1/ gprofng-gui-1.1/compile gprofng-gui-1.1/ChangeLog ... gprofng-gui-1.1/gprofng-gui.sh Next, go into the newly created directory: $ cd gprofng-gui-1.1 This directory with the name ‘gprofng-gui-1.1’ has everything needed to build and install the GUI. *Note Build and Install from Source:: how to proceed next.  File: gprofng-gui.info, Node: Prepare the Build from the Git Repository, Next: Build and Install from Source, Prev: Prepare the Build from the Tar File, Up: How to Install the GUI 4.2 Prepare the Build from the Git Repository ============================================= The development git repository contains the most recent version of the GUI. If this is used to build and installed the GUI, make sure that the ‘autoconf’ and ‘automake’ tools are installed and in the search path. Before cloning the git repository, make sure that a directory with the name ‘gprofng-gui’ does not exist. If so, the clone command fails with an error message. The next step is to clone the git repository: $ git clone https://git.savannah.gnu.org/git/gprofng-gui.git There should be diagnostic messages similar to what is shown below: Cloning into 'gprofng-gui'... remote: Counting objects: 1334, done. remote: Compressing objects: 100% (605/605), done. remote: Total 1334 (delta 777), reused 1222 (delta 696) Receiving objects: 100% (1334/1334), 1.77 MiB | 4.29 MiB/s, done. Resolving deltas: 100% (777/777), done. The clone command succeeded and the newly created ‘gprofng-gui’ directory should be present. The ‘ls’ command may be used to verify this: $ ls gprofng-gui Go into this directory and execute the ‘autoreconf’ command: $ cd gprofng-gui $ autoreconf -i -f The output from this command should be similar to this: configure.ac:18: installing './compile' configure.ac:17: installing './install-sh' configure.ac:17: installing './missing' Makefile.am: installing './INSTALL' We are now ready to build and install the GUI. *Note Build and Install from Source:: how to proceed next.  File: gprofng-gui.info, Node: Build and Install from Source, Prev: Prepare the Build from the Git Repository, Up: How to Install the GUI 4.3 Build and Install from Source ================================= Whether the sources originate from a tar file, or a git repository, the steps to build and install the code are the same. They are covered in this section. By default, the GUI related files are installed in ‘/usr/local’, but through the ‘--prefix’ option, this can be changed. As a first step, a build location needs to be selected. This is the directory where, among other files, the generated files like the Java classes and jar files will be placed. Before the code can be built, a configuration step is needed. This is handled by the ‘configure’ tool that comes with the distribution. This is also where an alternate location for the installation needs to be specified. In the example below, it is assumed that the current directory is at the same level as where the source directory is located. This is where we create the build directory. It is called ‘build’ in this example, but any other name may be chosen. In the next step, the ‘configure’ tool is used to set up the configuration details. _This tool is located in the source directory_, but is executed from the build directory. By default, the necessary files will be installed in ‘/usr/local’. In the example the ‘--prefix’ option is used to change this and set the installation directory to ‘/home/demo/gui-install’. This is where the files needed to execute the ‘gprofng display gui’ command will be installed. Make sure to set the correct permissions such that the installation process is allowed to write to directory ‘/home/demo’. As an example, below it is assumed that a tar file with version ‘1.1’ has been used. The following commands create the build directory and configure the settings: $ mkdir build $ cd build $ ../gprofng-gui-1.1/configure --prefix=/home/demo/gui-install The command for the git repository is nearly identical. The only difference is that the ‘configure’ tool is executed from directory ‘gprofng-gui’: $ ../gprofng-gui/configure --prefix=/home/demo/gui-install The ‘configure’ command prints messages on the screen, but also produces a ‘config.log’ file. It is strongly recommended to check this file to make sure the configuration phase was successful. Any error should be resolved and warnings need to be checked. If there are no errors and warnings, the next step is to build the code using the ‘make’ command. If the build has been successful, the next thing to do is to use the ‘make install’ command to install the files. Make sure that the correct write permissions are set on the installation directory, or use the ‘sudo’ command when executing ‘make install’: $ make $ make install The very last steps are to make sure that the ‘bin’ directory in the installation directory is in the search path as set through the ‘PATH’ environment variable and to adjust variable ‘MANPATH’ to include the man page for the GUI. For example ‘/home/demo/gui-install/bin’. $ export PATH=/home/demo/gui-install/bin:$PATH $ export MANPATH=/home/demo/gui-install/share/man:$MANPATH To verify that the GUI has been installed successfully, use the following command: $ gprofng display gui --version If the installation has been successful, a diagnostic message is printed.  File: gprofng-gui.info, Node: Getting Started, Next: Create an Experiment, Prev: How to Install the GUI, Up: Top 5 Getting Started ***************** In this chapter the steps needed to start the GUI, load an experiment, and use some of the menus to provide a first view into the performance data, are explained. This is sufficient to get started. In subsequent chapters, more details on the features and the results displayed are prodvided. * Menu: * Start the GUI:: Different ways to invoke the GUI. * The Initial Screen:: What is shown initially?  File: gprofng-gui.info, Node: Start the GUI, Next: The Initial Screen, Up: Getting Started 5.1 Start the GUI ================= The details of the usage information and an overview of the options supported, can be found in the man page for the GUI. For convenience a brief description is provided here. For more details *Note The gprofng GUI Man Page::. The GUI is invoked through the ‘gprofng display gui’ command. Among other things, one or more experiments can be included on the command line. All experiments listed will be opened and loaded into the GUI. For example, this command starts the GUI and loads an experiment called ‘experiment_1.er’: $ gprofng display gui experiment_1.er The GUI main window will be displayed. This includes a summary of the experiments loaded. Loading multiple experiments is very similar. Simply add the experiments on the command line. By default, the data shown is aggregated across all the experiments that have been loaded, but with the ‘-c’ option, the GUI starts up in comparison mode. For example, this command loads two experiments in comparison mode, where the first experiment is used as the reference. The data in the second experiment will be shown relative to this reference: $ gprofng display gui -c experiment_1.er experiment_2.er Alternatively, the GUI may be started without experiments. This will cause a window to appear that shows previously loaded experiments. If none have been loaded in the past, the list is empty. Once the GUI is running and one or more experiments have been loaded, it is possible to remove or add experiments from within the GUI. Under the ‘File’ menu, there are entries to manage the experiments. For example to load, or remove, one or more experiments, but also to toggle the mode from aggregation to comparison, and viceversa. If menu entry ‘Aggregate Experiments ...’ is selected, a list with the currently loaded experiments is shown. This list may be modified by adding, or removing experiments. The comparison mode is enabled by selecting ‘Compare Experiments ...’. In this menu, the experiments loaded can be modified. The reference experiment may also be changed here.  File: gprofng-gui.info, Node: The Initial Screen, Prev: Start the GUI, Up: Getting Started 5.2 The Initial Screen ====================== This is the screen that is shown when the GUI is started. The top bar shows the menus that are available. Below this, there are icons that represent shortcuts to specific features. For example, adding or removing filters is activated by clicking on the funnel icon. Tooltips provide a brief description of each icon. This is followed by a window with a dashboard overview of the experiment(s) loaded. The top panel is titled ‘Experiment(s)’, and shows a summary of the experiment(s). By clicking on the little black arrow, more information is displayed. This info panel is followed by a second panel titled ‘Metrics’ that provides a summary of the metrics collected. This includes the duration of the experiment, or the maximum duration if multiple experiments have been loaded, and the aggregated CPU time. In case hardware events have been collected, the total values will be displayed here too. The third panel, ‘Metrics Preview’, shows how the metrics will look in the data views. The metrics that are displayed can also be configured. There is a menu entry called ‘Metrics’ at the top that is a shortcut to one of the settings. If selected, it shows a table with the metrics that should be enabled, or disabled. The panel on the left hand side lists the various views that are available. For example there is a ‘Functions’ view that provides a function overview, or the ‘Timeline’ to get a color coded execution overview of the application. This panel also has a very useful entry at the very top. It is titled ‘Views’ and through green colored navigation errors, one can go back and forth between views that have been selected earlier. It is important to note that by default the list with the views shows a subset of the available views only. By clicking on the last entry (‘More ...’), additional views may be enabled, or disabled, by clicking on the checkbox to the left of the view. The view(s) selected will be added to the list on the left. The (updated) list will be stored transparently as part of the settings for the experiment. In case the settings should be accessible to other experiments, they can be saved in a different location. For this, select ‘Tools’ in the top level menu bar. From there, the ‘Export’ feature can be used to select where the preferences need to be stored. Several choices for the location are supported. Earlier saved preferences may be imported through the ‘Import’ feature. The initial screen is meant to provide a quick overview and point at the first possible area(s) of interest. From there, further exploration is probably warranted.  File: gprofng-gui.info, Node: Create an Experiment, Next: The Default Views, Prev: Getting Started, Up: Top 6 Create an Experiment ********************** In many cases, the ‘gprofng collect app’ tool will be used to generate the performance data, but it is also possible to set up an experiment and execute it from within the GUI. To access this feature, select the ‘Profile Application ...’ menu item under the top level ‘File’ menu. This opens a separate window that is used to define and run the experiment. The first tab titled ‘General’ is used to specify the application to be profiled, options (if any), and environment variables. Below this, the details of the experiment directory, like the name, need to be set. The ‘Preview command’ field shows the generated command. The second tab (‘Data to Collect’) is used to define what kind of data needs to be collected. In this window, click on the ‘Run’ button to start the program and the performance data collection process. The third tab is titled ‘Output’. It displays the output from the data collection process in the top window, and the program output in the window below.  File: gprofng-gui.info, Node: The Default Views, Next: The Additional Views, Prev: Create an Experiment, Up: Top 7 The Default Views ******************* Many views into the performance data are available. The panel on the lefthand side shows a selection. This list can be managed by clicking on the ‘More ...’ entry at the bottom. There, additional views may be enabled, or existing views may be removed from the current list. Note that adding a view is persistent. It will stay there, until it has been deselected through the checkbox in the corresponding entry in the ‘More ...’ view. In this chapter we list and briefly describe the default set of views. * Menu: * Callers-Callees:: The calling relationships between the functions. * Call Tree:: A graphical representation of the call structure. * Disassembly:: Shows the metrics at the instruction level. * Experiments:: An overview of the experiments loaded. * Flame Graph:: A compact representation of the call tree. * Functions:: A function level overview where the time has been spent. * Processes:: Shows a list of the processes and their metrics. * Source/Disassembly:: Split window source and disassembly view. * Threads:: Show a list of the threads and their metrics. * Timeline:: A graphical representation of the program behaviour. * More ...:: Enable or disable views.  File: gprofng-gui.info, Node: Callers-Callees, Next: Call Tree, Up: The Default Views 7.1 Callers-Callees =================== This view shows the calling relationships between the functions executed, along with the performance metrics. The selected function is shown in the center panel. The function(s) in the panel above (the ‘callers’) are those that call the target function. The ones in the panel below (the ‘callees’), are called by this function. On the righthand side, the ‘Selection Details’ window displays more details of the function selected.  File: gprofng-gui.info, Node: Call Tree, Next: Disassembly, Prev: Callers-Callees, Up: The Default Views 7.2 Call Tree ============= This view displays a dynamic call graph of the program as a tree. It is useful to see the details of branches in the call tree that have the greatest impact on the performance. Each function call is shown as a node that can be expanded, or collapsed, by clicking on the key-like icon to the left of the node. An expanded function node shows all the function calls made by the function, plus performance metrics for those function calls. When a function is selected, the _Selection Details_ window displays the metrics for the function call and its callees. The percentages given for attributed metrics are the percentages of the total program metrics. The default root of the tree is ‘<Total>’, which is a pseudo function that represents 100% of the performance metrics of all the functions executed. To easily find the branch that is consuming the most time, right-click any node and in the pulldown menu, select ‘Expand Hottest Branch’. In this menu, predefined filters are available to narrow down the view.  File: gprofng-gui.info, Node: Disassembly, Next: Experiments, Prev: Call Tree, Up: The Default Views 7.3 Disassembly =============== The instructions for the selected function are shown. The metrics that have been measured are displayed to the left. The source line number where an instruction originates from is shown in square brackets.  File: gprofng-gui.info, Node: Experiments, Next: Flame Graph, Prev: Disassembly, Up: The Default Views 7.4 Experiments =============== This view displays more details on the experiment(s) and the load objects that have been used. For each experiment, a ‘Notes’ and ‘Info’ section are shown. The ‘Notes’ section allows text to be added, or modified. This may be used to annotate the experiment. Note that such comments can also be added by using the ‘-C’ option on the ‘gprofng collect app’ tool.  File: gprofng-gui.info, Node: Flame Graph, Next: Functions, Prev: Experiments, Up: The Default Views 7.5 Flame Graph =============== The flame graph is a compact graphical representation of the call tree. The call stacks are organized vertically. Frames include the name a function and the width of the frame is a relative measure of the inclusive CPU time for that function. Just as with the call tree, right-clicking on a frame, shows a pulldown menu with filters and navigation controls. The zoom function at the top may be used to zoom in, or out.  File: gprofng-gui.info, Node: Functions, Next: Processes, Prev: Flame Graph, Up: The Default Views 7.6 Functions ============= One common view to explore is the function overview. By selecting the ‘Functions’ feature, a list with the functions that have been executed, as well as the metrics that have been recorded, is displayed. By default, the exclusive and inclusive CPU times are displayed, both as a number and a percentage. If hardware events have been collected, these will be shown as well. The data is sorted with respect to the exclusive timings. By clicking on a different column, the data is sorted according to that metric. Most likely more details are needed. To see more details for a function, select the function name shown under column ‘Name’. This will show several characteristics of the function, including the metrics, in a window to the right. By double clicking a function name, control is transferred and the view changes to display the source lines of the function, annotated with the performance metrics that are shown to the right. The most expensive source lines are highlighted. Colored markers to the right indicate where the expensive lines are. By clicking on one of those, the display is changed to show the source code fragment with the target line included. This action automatically adds the _Source_ view to the list in the righthand side panel. This is a persistent change. A next time the same experiment is loaded, this view is included in the list. The source view can also be selected by clicking on _Source/Disassembly_ in the panel on the lefthand side. This will show a split window with the source code at the top and the disassembly with the instructions underneath. In both windows the source lines and instructions are annotated with the performance metric(s).  File: gprofng-gui.info, Node: Processes, Next: Source/Disassembly, Prev: Functions, Up: The Default Views 7.7 Processes ============= This view shows a list of processes that were created by the application, along with their metrics. In this view, it is easy to find those processes that used the most resources. Filters may be used to select a particular set of processes. This selection is used in other views. The processes are represented by process ID (PID) numbers and show the Total CPU time metric by default. Other metrics might also be displayed if the metrics are present in the loaded experiment(s). If other metrics have been selected in the ‘Overview’ view, or by using the ‘Settings’ dialog, those metrics are also displayed.  File: gprofng-gui.info, Node: Source/Disassembly, Next: Threads, Prev: Processes, Up: The Default Views 7.8 Source/Disassembly ====================== This shows two windows, each with their own scrollbar. The top window shows the source code, annotated with the values for the metrics selected. The window below lists the instructions with the metrics to the left. In both cases, the expensive parts are highlighted.  File: gprofng-gui.info, Node: Threads, Next: Timeline, Prev: Source/Disassembly, Up: The Default Views 7.9 Threads =========== This view shows a list of the threads that have been created together with their metrics. The threads are represented by a process plus thread pair and show the Total CPU time. Other metrics might also be displayed if the metrics are present in the loaded experiments. The filter button may be used to filter the data shown.  File: gprofng-gui.info, Node: Timeline, Next: More ..., Prev: Threads, Up: The Default Views 7.10 Timeline ============= The timeline view is shown by selecting ‘Timeline’ in the panel on the lefthandside. This displays the color coded dynamic behavior of the application as a function of time. * Menu: * The Default View:: Description of the main Timeline window and tabs. * More Details:: Expand the view and zoom in to get more details. * Customization:: Change some views. * Filters:: Apply filters to select a section of interest.  File: gprofng-gui.info, Node: The Default View, Next: More Details, Up: Timeline 7.10.1 The Default View ----------------------- The top line shows a color coded representation of the operating system (or OS for short). For example, a bright green color means the OS is in user mode. This data is sampled every second and each block represents one second of execution. By clicking on such a block in the top level bar, a legend is shown, plus a summary with the metrics and states for the selected block. The horizontal bar with the OS overview is followed by a bar for each thread that has been created when the program was running. Every function in the application has been assigned a unique color. What is shown in these bars is the color coded representation of the dynamic behaviour of the application. These vertical call stacks show all the functions that were executed by the top level function. In case no colors are shown for a period of time, it means that the thread was not active during that period. By clicking anywhere in the area with the horizontal bars, a point in time is selected. On the righthand side, details at this point are displayed. For example, if a thread was selected, the thread and CPU IDs are displayed. Below this information, the call stack is shown. Double clicking on a function in this list transfers the view to the source level view. To return to the timeline, click on the green arrow in the ‘Views’ tab in the panel on the left hand side. For a given point in time selected, the orange arrows shown at the top change the view to go to the next, or previous thread, or to select the next, or previous point in time.  File: gprofng-gui.info, Node: More Details, Next: Customization, Prev: The Default View, Up: Timeline 7.10.2 More Details ------------------- While the default view gives a good first impression of the behavior of the application, often more details are needed. Through the control part shown in the bar just above the timelines, it is possible to zoom in, or out, in both the vertical, as well as the horizontal direction. Next to the zoom controls there are two icons to undo or redo a zoom action. Repeated selection of these functions allows the view to be rolled back, or forward. The vertical zoom increases the depth of the call stack. By default it is set to a specific limit. This may cause the call stack(s) to be truncated. By increasing the vertical zoom, more of the call stack is shown. The horizontal zoom increases the space between the samples, up to the point that the individual samples are shown. This allows for a very detailed analysis of the runtime behavior. Another way to see more details is to select a window of time. Position the cursor on the bar titled ‘Time(sec)’. This bar shows the elapsed time, starting at zero. Select a region by selecting a range with the cursor and press return on the keyboard. This displays the selected region.  File: gprofng-gui.info, Node: Customization, Next: Filters, Prev: More Details, Up: Timeline 7.10.3 Customization -------------------- By default the horizontal bars in the main display are thread based. To change this, use the pull down menu labelled _Group Data by_ to select _LWP_, _CPU_, or _Process_ instead. For example, by selecting ‘CPU’, the view is adjusted to show which CPU(s) have been used. Another feature that can be customized is the colors used for the call stacks. The top bar has an icon with three small colored circles that opens a new window titled ‘Function Colors’. This window allows the user to change the colors of selected, or all of the, functions. One use for this is to select a light color, gray say, for all functions and then select specific colors for the function(s) of interest. In this way, it is often easier to see how the most time consuming functions behave over time.  File: gprofng-gui.info, Node: Filters, Prev: Customization, Up: Timeline 7.10.4 Filters -------------- Filters provide a way to focus on a particular area of interest. For example, to select one or more threads, or to restrict the view to a specific window in time, or a combination of these two. The top level ‘Tools’ menu includes an entry for filters. Alternatively, the icon of a funnel can be used to directly access the filter part. Several filters have been preprogrammed and these can be used repeatedly to combine the various filters. Use entry ‘Additional Filters’ to go to ‘Advanced Custom Filter’. Under this menu, customized filters can be defined and applied. Note that a filter action can be undone and existing filters can be removed.  File: gprofng-gui.info, Node: More ..., Prev: Timeline, Up: The Default Views 7.11 More ... ============= Several other views are available. Through this view, they can be enabled, or already visible views may be disabled. The choices available are documented in the next chapter.  File: gprofng-gui.info, Node: The Additional Views, Next: The gprofng GUI Man Page, Prev: The Default Views, Up: Top 8 The Additional Views ********************** In addition to the default views, additional views are available. These may be enabled through the ‘More ...’ entry. * Menu: * CPUs:: The CPUs used while executing the application, plus metrics. * Datasize:: Show data statistics for Heap and I/O tracing. * Duration:: Show durations for Heap, I/O and Synchronization tracing. * Experiment IDs:: List of processes created and metrics collected. * GCEvents:: List of Garbage Collection events. * Lines:: A sorted view with the source lines and their metric values. * PCs:: A sorted view with the Program Counters and their metrics. * Samples:: Show the samples plus the total CPU time. * Seconds:: Show the seconds plus the total CPU time. * Source:: Source listing with the metrics to the left of the lines. * Statistics:: Execution statistics for the application.  File: gprofng-gui.info, Node: CPUs, Next: Datasize, Up: The Additional Views 8.1 CPUs ======== This view shows a list of CPUs that have been used while executing the application. This is shown along with the metrics that have been enabled for the data collection. The CPUs are represented by a CPU number. By default, the ‘Total CPU time’ is shown. Other metrics might also be displayed by default if the metrics are present in the loaded experiments. Filters may be applied to the data shown.  File: gprofng-gui.info, Node: Datasize, Next: Duration, Prev: CPUs, Up: The Additional Views 8.2 Datasize ============ This view is available for ‘Heap Tracing’, and ‘I/O Tracing’ experiments. They contain data that has a size element, such as the number of bytes. The data is organized into ranges of data sizes. The metrics for the events whose data falls into a given range are shown. Data without a size element is attributed to data size 0. This view can be used to filter the data. For example, in an experiment that contains heap tracing data, you could select a size range line that has high metrics for ‘Bytes Leaked’ and add the filter ‘Include only events with selected items’. In other data views, the data is then filtered to only show events that produced memory leaks of the size range that was selected.  File: gprofng-gui.info, Node: Duration, Next: Experiment IDs, Prev: Datasize, Up: The Additional Views 8.3 Duration ============ This view is available for ‘Heap Tracing’, ‘I/O Tracing’, and ‘Synchronization Tracing’ experiments. They contain data that has a duration. The data is organized into ranges of the duration time. The metrics for the events whose data falls into each range of duration time are shown. The duration of the function call is recorded for I/O and Synchronization tracing. For heap tracing, the duration is the time between the allocation and release of memory. Data without a duration element is attributed to duration 0. This view may be used to filter the data. For example, in an experiment that contains heap tracing data, you could select a duration range line that has high metrics for ‘Bytes Allocated’ and add the filter ‘Include only events with selected items’. In other data views, the data is then filtered to show only events whose duration matched the range that was selected. This might reveal memory allocations that have a longer than expected duration.  File: gprofng-gui.info, Node: Experiment IDs, Next: GCEvents, Prev: Duration, Up: The Additional Views 8.4 Experiment IDs ================== This view shows a list of processes that were created by the application, along with its metrics. The ‘IDs’ are represented by process ID (‘PID’) numbers and show the ‘Total CPU time’ metric by default. Other metrics might also be displayed if the metrics are present in the experiment(s) loaded. If other metrics have been selected in the ‘Overview’ view, or by using the ‘Settings’ dialog, those metrics are also displayed. The metrics values reflect the states recorded at each sample point in the loaded experiment(s). The numbers reflect the value, or percentage, of the metrics that were recorded in each of the loaded experiments.  File: gprofng-gui.info, Node: GCEvents, Next: Lines, Prev: Experiment IDs, Up: The Additional Views 8.5 GCEvents ============ This view shows a summary of the Garbage Collection (‘GC’) events that occurred while the program was executing.  File: gprofng-gui.info, Node: Lines, Next: PCs, Prev: GCEvents, Up: The Additional Views 8.6 Lines ========= This view shows a list consisting of source lines and their metrics. Source lines are labeled with the function from which they came, plus the line number and source file name. Selecting a line shows all the metrics for a given line in the ‘Selection Details’ tab. Selecting the ‘Source’ or ‘Disassembly’ view after selecting a line, positions the display at the appropriate line. If no line number information is available for a function, or if the source file for the function is not known, all of the function's Program Counters (‘PCs’) appear aggregated into a single entry for the functions. PCs from functions that are from load objects whose functions are hidden, appear aggregated as a single entry for the load object.  File: gprofng-gui.info, Node: PCs, Next: Samples, Prev: Lines, Up: The Additional Views 8.7 PCs ======= This view is similar to the _Lines_ view, but instead of source lines, lists Program Counters (‘PCs’) and their metrics. Selecting a line shows all the metrics for that PC in the _Summary_ tab. Selecting the ‘Source’, or ‘Disassembly’ view after selecting a line, positions the display at the appropriate line. PCs are labeled with the function from which they came and the offset within that function. PCs from functions that are from load objects whose functions are hidden appear aggregated as a single entry for the load object.  File: gprofng-gui.info, Node: Samples, Next: Seconds, Prev: PCs, Up: The Additional Views 8.8 Samples =========== This view shows a list of (Operating System) sample points and their metrics, which reflect the states recorded at each sample point in the loaded experiments. The samples are represented by sample numbers and by default show the ‘Total CPU time’. Other metrics might also be displayed if they have been selected in the ‘Overview’ view, or in the ‘Settings’ dialog box. Filters may be applied to the data shown.  File: gprofng-gui.info, Node: Seconds, Next: Source, Prev: Samples, Up: The Additional Views 8.9 Seconds =========== This view shows each second of the program run that was captured in the experiment, along with metrics collected in that second. The ‘Seconds’ view lists the seconds of execution with the ‘Total CPU time’ by default. Other metrics might also be displayed if the metrics are present in the loaded experiments. If other metrics have been selected in the ‘Overview’ view, or by using the ‘Settings’ dialog, those metrics are also displayed. Filters may be applied to the data shown. The ‘Seconds’ view differs from the ‘Samples’ view in that it shows periodic samples that occur every second beginning at 0 and the interval cannot be changed.  File: gprofng-gui.info, Node: Source, Next: Statistics, Prev: Seconds, Up: The Additional Views 8.10 Source =========== If the source code is available, this view shows the source lines of the selected function, annotated with performance metrics to the left of the lines. High metrics are highlighted in yellow to indicate lines that are expensive regarding the metric(s) used. For each of such lines, an orange navigation marker is shown in a margin next to the scrollbar on the right. Non-zero metrics that are below the threshold are not highlighted, but they are flagged with grey navigation markers. The threshold for highlighting metrics can be set in the ‘Settings dialog box’, or in the ‘Source/Disassembly’ view. To quickly navigate to source lines with metrics, click the yellow markers in the right margin to jump to the lines with metrics. To jump to the next line with metrics, right-click the metrics themselves and select an option such as ‘Next Hot Line’, or ‘Next Non-Zero Metric Line’. In the column heading for the source code, the full path to the source file is shown, plus the corresponding object file, and the name of the load object In case where the same source file is used to compile more than one object file, the source view shows the performance data for the object file containing the selected function. If a source file cannot be located, the ‘Resolve’ button may be used to browse to the source file, or type the path to the source, or browse to it. The source code is then displayed from the new location. Optionally, ‘Archive Source Files Inside Experiment’ can be selected to copy the source files into the experiment. When double clicking on a function in the ‘Functions view’, the source view is opened. The source file displayed is the default source context for that function. The default source context of a function is the file containing the function's first instruction. For example, for C code this is the function's opening brace. Immediately following the first instruction, the annotated source file adds an index line for the function. The source window displays index lines as text in red italics within angle brackets in the form: ‘<Function: f_name>’. A function might have an alternate source context, which is another file that contains instructions attributed to the function. Such instructions might come from include files, or from other functions inlined into the selected function. If there are any alternate source contexts, the beginning of the default source context includes a list of extended index lines that indicate where the alternate source contexts are located: ‘<Function: f, instructions from source file src.h>’. Double-click an index line that refers to another source context to open the file containing that source context at the location associated with the indexed function. To aid navigation, alternate source contexts also start with a list of index lines that refer back to functions defined in the default source context and other alternate source contexts.  File: gprofng-gui.info, Node: Statistics, Prev: Source, Up: The Additional Views 8.11 Statistics =============== This view shows the totals for various system statistics aggregated over the experiments loaded and samples. These totals are followed by the statistics for the selected samples of each experiment.  File: gprofng-gui.info, Node: The gprofng GUI Man Page, Next: Index, Prev: The Additional Views, Up: Top Appendix A The gprofng GUI Man Page *********************************** NAME gprofng-gui - Graphical tool to analyze one or more gprofng experiments SYNOPSIS ‘gprofng display gui’ [OPTION(S)] [[‘-c’] EXPERIMENT(S) | TARGET [TARGET-OPTIONS]] DESCRIPTION The ‘gprofng display gui’ tool starts the GUI, which is a Java based graphical tool that can be used to analyze performance data that has been collected with the ‘gprofng collect app’ tool. Multiple experiments may be specified on the command line. The data for all these experiments is loaded and ready for analysis. Once the tool has started, it is also possible to drop or load other experiments. By default, if multiple experiments are specified, the data is aggregated across the experiments. If the ‘-c’ option is used, the tool starts in comparison mode. In this case, the data for the various experiments can be compared. If this option is used, at least two experiments must be specified on the command line. Alternatively, the tool can be invoked without specifying experiments. In this case, a target program is expected to be specified. Optionally, there may be options for the target. If started this way, a window with user settings will be opened. These may be used to specify the options and other preferences that define the data collection experiment. The user can then run the experiment from this window and upon successful completion, analyze the results. If ‘gprofng display gui’ is invoked without specifying one or more experiments, or a target, a welcome screen is shown. In this screen, the user can specify whether to analyze an existing experiment, or to create a new experiment by specifying the data collection settings to define and run a new performance experiment. OPTIONS ‘--version’ Print the version number and exit. ‘--help’ Print usage information and exit. ‘-v, --verbose’ By default, verbose mode is disabled. This option enables it. ‘-j JVMPATH, --jdkhome JVMPATH’ Specify the path to the Java Virtual Machine (JVM) to be used for running ‘gprofng display gui’. The default path is taken first by examining environment variables for a path to the JVM, in the order ‘JDK_HOME’, and then ‘JAVA_PATH’. If neither environment variable is set, the version found in the search path set with the ‘PATH’ environment variable is used. If none is found, ‘/usr/java/bin/java’ is tried. ‘-JJVM-SETTING’ Use this option to pass on settings to the JVM. Multiple ‘-J’ options and corresponding settings may be supplied. Note that there is _no_ space between the ‘-J’ option and the JVM-SETTING setting to the JVM. ‘-c BASE-GROUP COMPARE-GROUP’ By default, the results for multiple experiments are aggregated. With this option, the GUI starts in comparison mode. If this option is specified, two or more experiments must be provided as arguments. The first experiment is the base group. The results in the other experiment(s) are compared to this reference experiment. Note that the user can toggle between aggregation and comparison mode from within the GUI. ‘-f SIZE, --fontsize SIZE’ Specify the font size to be used in the GUI. ‘-u DIR-PATH, --userdir DIR-PATH’ Specify the path to the user directory in which to store user settings. NOTES The ‘gprofng display gui’ tool relies on other ‘gprofng’ components. Therefore, it is necessary to also install the other components, either by using one of the available RPM's, install from a tar file distribution, or to build and install ‘gprofng’ directly from the source. SEE ALSO gprofng(1), gp-archive(1), gp-collect-app(1), gp-display-html(1), gp-display-src(1), gp-display-text(1) The user guide for gprofng is maintained as a Texinfo manual. If the ‘info’ and ‘gprofng’ programs are correctly installed, the command ‘info gprofng’ should give access to this document. COPYRIGHT Copyright © 2022-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".  File: gprofng-gui.info, Node: Index, Prev: The gprofng GUI Man Page, Up: Top Index ***** �[index�] * Menu: * Aggregation mode: Overview. (line 19) * Alternate source context: Source. (line 46) * Call Tree, Apply filters: Call Tree. (line 23) * Call Tree, Expand hottest branch: Call Tree. (line 22) * Call Tree, Selection details: Call Tree. (line 13) * Comparison mode: Overview. (line 20) * Comparison mode <1>: Start the GUI. (line 23) * Create an experiment: Create an Experiment. (line 6) * Default source context: Source. (line 39) * Default views: The Default Views. (line 6) * Function View, Function overview: Functions. (line 6) * Function View, More details: Functions. (line 16) * Function View, Source information: Functions. (line 21) * Getting started: Getting Started. (line 6) * Initial Screen: The Initial Screen. (line 6) * Installation, autoconf: Prepare the Build from the Git Repository. (line 7) * Installation, automake: Prepare the Build from the Git Repository. (line 8) * Installation, Build from source: Build and Install from Source. (line 6) * Installation, Getting ready: How to Install the GUI. (line 6) * Installation, Use the git repository: Prepare the Build from the Git Repository. (line 6) * Installation, Use the tar file: Prepare the Build from the Tar File. (line 6) * Installation, Verify the installation: Build and Install from Source. (line 74) * Options, --fontsize: The gprofng GUI Man Page. (line 101) * Options, --help: The gprofng GUI Man Page. (line 63) * Options, --jdkhome: The gprofng GUI Man Page. (line 71) * Options, --userdir: The gprofng GUI Man Page. (line 105) * Options, --verbose: The gprofng GUI Man Page. (line 67) * Options, --version: The gprofng GUI Man Page. (line 59) * Options, -c: Start the GUI. (line 23) * Options, -c <1>: The gprofng GUI Man Page. (line 15) * Options, -c <2>: The gprofng GUI Man Page. (line 34) * Options, -c <3>: The gprofng GUI Man Page. (line 89) * Options, -f: The gprofng GUI Man Page. (line 101) * Options, -j: The gprofng GUI Man Page. (line 71) * Options, -J: The gprofng GUI Man Page. (line 82) * Options, -u: The gprofng GUI Man Page. (line 105) * Options, -v: The gprofng GUI Man Page. (line 67) * Overview Window, Default views: The Initial Screen. (line 33) * Overview Window, Enable views: The Initial Screen. (line 42) * Prerequisites: Prerequisites. (line 6) * Start the GUI: Start the GUI. (line 6) * Timeline, Call stack depth: More Details. (line 15) * Timeline, Change stack colors: Customization. (line 11) * Timeline, CPU view: Customization. (line 6) * Timeline, Customize filters: Filters. (line 15) * Timeline, Filters: Filters. (line 6) * Timeline, Horizontal zoom: More Details. (line 18) * Timeline, LWP view: Customization. (line 6) * Timeline, Process view: Customization. (line 6) * Timeline, Select time window: More Details. (line 22) * Timeline, Vertical zoom: More Details. (line 15) * Toggle the mode: Start the GUI. (line 37) * Tracing experiments, Heap: Datasize. (line 6) * Tracing experiments, Heap <1>: Duration. (line 6) * Tracing experiments, I/O: Datasize. (line 6) * Tracing experiments, I/O <1>: Duration. (line 6) * Tracing experiments, Synchronization: Duration. (line 6) * Views, Call tree: Call Tree. (line 6) * Views, Callers-callees: Callers-Callees. (line 6) * Views, CPUs: CPUs. (line 6) * Views, Datasize: Datasize. (line 6) * Views, Disassembly: Disassembly. (line 6) * Views, Duration: Duration. (line 6) * Views, Experiment IDs: Experiment IDs. (line 6) * Views, Experiments: Experiments. (line 6) * Views, Flame graph: Flame Graph. (line 6) * Views, Functions: Functions. (line 6) * Views, GCEvents: GCEvents. (line 6) * Views, Lines: Lines. (line 6) * Views, More: More .... (line 6) * Views, PCs: PCs. (line 6) * Views, Processes: Processes. (line 6) * Views, Samples: Samples. (line 6) * Views, Seconds: Seconds. (line 6) * Views, Source: Source. (line 6) * Views, Source/disassembly: Source/Disassembly. (line 6) * Views, Statistics: Statistics. (line 6) * Views, Threads: Threads. (line 6) * Views, Timeline: Timeline. (line 6)  Tag Table: Node: Top780 Node: Introduction4214 Node: Overview5370 Node: Prerequisites6892 Node: Build Requirements7294 Node: Runtime Requirements7977 Node: How to Install the GUI9058 Node: Prepare the Build from the Tar File9878 Node: Prepare the Build from the Git Repository12273 Node: Build and Install from Source14078 Node: Getting Started17651 Node: Start the GUI18218 Node: The Initial Screen20458 Node: Create an Experiment23289 Node: The Default Views24479 Node: Callers-Callees25920 Node: Call Tree26503 Node: Disassembly27677 Node: Experiments28027 Node: Flame Graph28562 Node: Functions29126 Node: Processes30988 Node: Source/Disassembly31755 Node: Threads32184 Node: Timeline32648 Node: The Default View33216 Node: More Details34911 Node: Customization36216 Node: Filters37158 Node: More ...37943 Node: The Additional Views38234 Node: CPUs39301 Node: Datasize39815 Node: Duration40673 Node: Experiment IDs41816 Node: GCEvents42635 Node: Lines42887 Node: PCs43762 Node: Samples44430 Node: Seconds44982 Node: Source45783 Node: Statistics48918 Node: The gprofng GUI Man Page49238 Node: Index54289  End Tag Table  Local Variables: coding: utf-8 End: �����������������������������������������������������gprofng-gui-2.1/gprofng-gui.spec��������������������������������������������������������������������0000644�0001750�0001750�00000004323�14744453367�013644� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Copyright (C) 2022-2025 Free Software Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. Summary: Graphical User Interface for the gprofng profiler. Name: gprofng-gui Version: 1.0 Release: 1%{?dist} License: GPLv3+ URL: https://www.gnu.org/software/gprofng-gui Source: https://ftp.gnu.org/gnu/gprofng-gui/gprofng-gui-%{version}.tar.xz BuildRequires: autoconf automake make sed coreutils BuildRequires: java-devel Requires: binutils-gprofng >= 2.40 Requires: java-devel Provides: gprofng-gui = %{version}-%{release} %description The GNU gprofng GUI is a feature rich graphical user interface for the GNU gprofng tool. It makes it possible to interactively analyze and compare gprofng profiling experiments. Users can drill into an applications profile together with the applications code to gather an understanding and insight into what an application is doing throughout it's runtime. %global debug_package %{nil} #---------------------------------------------------------------------------- %prep %setup #---------------------------------------------------------------------------- %build %configure %make_build #---------------------------------------------------------------------------- %install %make_install DESTDIR=%{buildroot} #---------------------------------------------------------------------------- %files %{_bindir}/gp-display-gui %{_datadir}/%{name}/gprofng-analyzer.jar %{_datadir}/%{name}/gprofng-collector.jar %{_datadir}/%{name}/gprofng.jar #---------------------------------------------------------------------------- %changelog * Thu Oct 27 2022 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> - First version being package �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/INSTALL�����������������������������������������������������������������������������0000644�0001750�0001750�00000036614�14517772130�011573� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this 'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a 'Makefile' in each directory of the package. It may also create one or more '.h' files containing system-dependent definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a file 'config.log' containing compiler output (useful mainly for debugging 'configure'). It can also use an optional file (typically called 'config.cache' and enabled with '--cache-file=config.cache' or simply '-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how 'configure' could check whether to do them, and mail diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at some point 'config.cache' contains results you don't want to keep, you may remove or edit it. The file 'configure.ac' (or 'configure.in') is used to create 'configure' by a program called 'autoconf'. You need 'configure.ac' if you want to change it or regenerate 'configure' using a newer version of 'autoconf'. The simplest way to compile this package is: 1. 'cd' to the directory containing the package's source code and type './configure' to configure the package for your system. Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type 'make' to compile the package. 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the 'make install' phase executed with root privileges. 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. There is also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. You can give 'configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run the 'configure' script. 'configure' automatically checks for the source code in the directory that 'configure' is in and in '..'. This is known as a "VPATH" build. With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple '-arch' options to the compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the 'lipo' tool if you have problems. Installation Names ================== By default, 'make install' installs the package's commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation prefix other than '/usr/local' by giving 'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like '--bindir=DIR' to specify different values for particular kinds of files. Run 'configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of '${prefix}', so that specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the 'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of '${prefix}'. Any directories that were specified during 'configure', but not in terms of '${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the 'DESTDIR' variable. For example, 'make install DESTDIR=/alternate/directory' will prepend '/alternate/directory' before all installation names. The approach of 'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of '${prefix}' at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving 'configure' the option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. Some packages pay attention to '--enable-FEATURE' options to 'configure', where FEATURE indicates an optional part of the package. They may also pay attention to '--with-PACKAGE' options, where PACKAGE is something like 'gnu-as' or 'x' (for the X Window System). The 'README' should mention any '--enable-' and '--with-' options that the package recognizes. For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, you can use the 'configure' options '--x-includes=DIR' and '--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be overridden with 'make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX 'make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its '<wchar.h>' header file. The option '-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in '/usr/bin'. So, if you need '/usr/ucb' in your 'PATH', put it _after_ '/usr/bin'. On Haiku, software installed for all users goes in '/boot/common', not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the '--build=TYPE' option. TYPE can either be a short name for the system type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file 'config.sub' for the possible values of each field. If 'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with '--host=TYPE'. Sharing Defaults ================ If you want to set default values for 'configure' scripts to share, you can create a site shell script called 'config.site' that gives default values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' looks for 'PREFIX/share/config.site' if it exists, then 'PREFIX/etc/config.site' if it exists. Or, you can set the 'CONFIG_SITE' environment variable to the location of the site script. A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 'configure' Invocation ====================== 'configure' recognizes the following options to control how it operates. '--help' '-h' Print a summary of all of the options to 'configure', and exit. '--help=short' '--help=recursive' Print a summary of the options unique to this package's 'configure', and exit. The 'short' variant lists options used only in the top level, while the 'recursive' variant lists options also present in any nested packages. '--version' '-V' Print the version of Autoconf used to generate the 'configure' script, and exit. '--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. '--config-cache' '-C' Alias for '--cache-file=config.cache'. '--quiet' '--silent' '-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). '--srcdir=DIR' Look for the package's source code in directory DIR. Usually 'configure' can determine that directory automatically. '--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. '--no-create' '-n' Run the configure checks, but stop before creating any output files. 'configure' also accepts some other, not widely useful, options. Run 'configure --help' for more details. ��������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/tools/������������������������������������������������������������������������������0000755�0001750�0001750�00000000000�15044710303�011736� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/tools/LocaleString.java�������������������������������������������������������������0000644�0001750�0001750�00000025377�15044710303�015125� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Copyright (C) 2022-2025 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses>. */ // stdin: source files // stdout: properties file import java.io.BufferedReader; import java.io.InputStreamReader; import java.text.MessageFormat; import java.text.ParsePosition; import java.util.Arrays; import java.util.Vector; public final class LocaleString { private final static MessageFormat mf1 = new MessageFormat("({0}){1}"); // NOI18N private final static MessageFormat mf2 = new MessageFormat("{0}){1}"); // NOI18N private final static MessageFormat mf3 = new MessageFormat("\''{0}\'',{1}"); // NOI18N private final static MessageFormat mf4 = new MessageFormat("\"{0}\",{1}"); // NOI18N private final static ParsePosition parsePos = new ParsePosition(0); private final static String key = "AnLocale.getString"; // NOI18N private final static int key_len = key.length(); private final static String key1 = "getLocaleStr"; // NOI18N private final static int key1_len = key1.length(); public static void main(String[] args) { int index, index1; Elem strs; // Open stdin as BufferedReader BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = null; Vector<Elem> values = new Vector<Elem>(); Vector<Elem> mnem_values = new Vector<Elem>(); try { for (;;) { if ((line == null) && ((line = in.readLine()) == null)) { break; } // Search keyword, the Locale get string method index = line.indexOf(key); index1 = line.indexOf(key1); if ((line.indexOf("getLocaleStr(String") > 0) || // NOI18N (line.indexOf("AnLocale.getString(str") > 0) || // NOI18N (line.indexOf("getLocaleStr(char") > 0) || // NOI18N (line.indexOf("AnLocale.getString(c") > 0)) { // NOI18N line = null; continue; } if ((index == -1) && (index1 == -1)) { line = null; continue; } // Parse for the string argument for (;;) { if (index != -1) { strs = parse(line.substring(index + key_len).trim()); } else { strs = parse(line.substring(index1 + key1_len).trim()); } if (strs != null) { if (strs.isMnemonic()) { mnem_values.addElement(strs); } else { values.addElement(strs); } line = strs.getLeftStr(); break; } line += in.readLine(); } } } catch (Exception e) { System.err.println(e); System.exit(1); } // Sort & Output result properties values = sort(values); mnem_values = sort(mnem_values); Elem elem; for (index = 0; index < values.size(); index++) { elem = values.get(index); if (elem.getKey() != null) { System.out.println(setEscape(elem.getValue()) + "[" + elem.getKey() + "]" + "=" + // NOI18N (elem.getValue().startsWith(" ") ? "\\" : "") + elem.getValue()); // NOI18N } else { System.out.println(setEscape(elem.getValue()) + "=" + // NOI18N (elem.getValue().startsWith(" ") ? "\\" : "") + elem.getValue()); // NOI18N } } if (mnem_values.size() > 0) { System.out.println("\n# MNEMONICS"); // NOI18N System.out.println("# =================================================================================="); // NOI18N System.out.println("#"); // NOI18N for (index = 0; index < mnem_values.size(); index++) { elem = mnem_values.get(index); System.out.println(elem.getKey() + "=" + // NOI18N (elem.getValue().startsWith(" ") ? "\\" : "") + elem.getValue()); // NOI18N } } } private final static Object syncFormat = new Object(); // Parser for getting the string argument private static Elem parse(String str) { MessageFormat mf; String ans, value, check; Object[] result; Elem elem; mf = mf1; ans = ""; // NOI18N for (;;) { parsePos.setIndex(0); result = mf.parse(str, parsePos); mf = mf2; if (result != null) { value = (String) result[0]; str = (String) result[1]; ans += value; check = value.trim(); // If ends with ", then done if (check.endsWith("\"") && !check.endsWith("\\\"")) { // NOI18N value = ans.trim(); parsePos.setIndex(0); synchronized (syncFormat) { // begin critical section: format is not thread safe result = mf3.parse(value, parsePos); String key = null; boolean is_mnemonic = false; if (result != null) { value = ((String) result[0]).trim(); key = ((String) result[1]).trim(); is_mnemonic = true; } else { result = mf4.parse(value, parsePos); if (result != null) { value = ((String) result[0]).trim(); key = ((String) result[1]).trim(); } } elem = new Elem(key, value, str, is_mnemonic); } // end of critical section return elem.removeQuotes(); } else { ans += ")"; // NOI18N } } else { return null; } } } // Sort the string list private static Vector<Elem> sort(final Vector<Elem> vec) { final int size; int index; // Convert results to Object[] & Sort size = vec.size(); final Object[] strs = vec.toArray(); Arrays.sort(strs); // Remove Repeated elements Elem elem = null; Vector<Elem> result = new Vector<Elem>(); for (index = 0; index < size; index++) { if (((Elem) strs[index]).equals(elem)) { continue; } elem = (Elem) strs[index]; // Remove the "" from the both ends result.addElement(new Elem(elem)); } return result; } // Add escape char '\' for ' ' & ':' private static String setEscape(final String str) { String esc; final int size; int index; char c; esc = ""; // NOI18N size = str.length(); for (index = 0; index < size; index++) { c = str.charAt(index); if ((c == ' ') || (c == ':') || (c == '=')) // NOI18N { esc += '\\'; // NOI18N } esc += c; } return esc; } /* Class which contains a parsed properties value */ private static final class Elem implements Comparable<Elem> { private String key; // optional bundle key private String value; // required properties value private String left; // residual string private boolean is_mnemonic; // element is mnemonic // Constructor public Elem(final String key, final String value, final String left, final boolean is_mnemonic) { this.key = key; this.value = value; this.left = left; this.is_mnemonic = is_mnemonic; } // Copy constructor public Elem(final Elem elem) { this.key = elem.key; this.value = elem.value; this.is_mnemonic = elem.is_mnemonic; } public String getLeftStr() { return left; } public String getKey() { return key; } public boolean isMnemonic() { return is_mnemonic; } public String getValue() { return value; } // Comparator implementation method @Override public int compareTo(final Elem obj) { final String obj_key = obj.key; final String obj_value = obj.value; final boolean obj_mnem = obj.is_mnemonic; if (key != null && obj_key != null) { if (is_mnemonic && obj_mnem) { return key.compareTo(obj_key); } else { return (value + key).compareTo(obj_value + obj_key); } } else { return value.compareTo(obj_value); } } public String toString() { return (key == null ? value : key) + "=" + value; // NOI18N } protected Elem removeQuotes() { if (key != null) { if (key.charAt(0) == '\"' || key.charAt(0) == '\'') { // NOI18N key = key.substring(1, key.length() - 1); } } if (value != null) { if (value.charAt(0) == '\"' || value.charAt(0) == '\'') { // NOI18N value = value.substring(1, value.length() - 1); } } return this; } public boolean equals(final Elem e) { if (e != null) { if (!this.is_mnemonic && !e.is_mnemonic) { if (this.key != null && e.key != null) { return this.compareTo(e) == 0; } if (this.key != null || e.key != null) { return false; } } return this.compareTo(e) == 0; } return false; } } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/missing�����������������������������������������������������������������������������0000755�0001750�0001750�00000015336�14517772130�012137� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to <bug-automake@gnu.org>." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������gprofng-gui-2.1/gprofng-gui.sh����������������������������������������������������������������������0000644�0001750�0001750�00000024573�14744453367�013335� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env bash # Copyright (C) 2022-2025 Free Software Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # loader for gprofng GUI # # L10N Message translation utility # $1 - message id # $2 - fallback message text # GTXT() { eval I18Ntxt$2='$1' eval I18Nset$2='$3' eval I18Nid$2='$4' } # define all i18n messages GTXT "Usage: %s {options} arguments\n\nOptions can be\n\n" 1 17 1 GTXT "\t-?|-h|--help\n\t show usage and exit\n" 2 17 2 GTXT "\t-j|--jdkhome <path>\n\t specify the JVM directory\n" 3 17 3 GTXT "\t-J<jvm_options>\n\t pass <jvm_options> to JVM\n" 4 17 4 GTXT "\t-v|--verbose\n\t enable verbose output\n" 5 17 5 GTXT "\t-V|--version\n\t show version and exit\n" 6 17 6 GTXT "\nAll other options and arguments are passed to gprofng GUI.\nSee documentations for details.\n" 7 17 7 GTXT "Cannot find JVM. Please set the JAVA_PATH environment variable to point\nto your JVM installation directory, or use the -j switch.\n" 8 17 8 GTXT "Cannot find JVM at \"%s\". Please set the JAVA_PATH\nenvironment variable to point to your JVM installation directory,\nor use the -j switch.\n" 9 17 9 GTXT "\t-f|--fontsize <size>\n\t specify the font size to be used in the gprofng GUI\n" 10 17 10 GTXT "Unrecognized option \"%s\"\n" 11 17 11 GTXT "Studio Default" 12 17 12 GTXT "WARNING: JDK_1_4_HOME is obsolete, and is ignored\n" 13 17 13 GTXT "Java at %s selected by %s\n" 14 17 14 GTXT "System Default" 15 17 15 GTXT "%s: ERROR: environment variable DISPLAY is not set\n" 16 17 16 GTXT "%s: WARNING: Current directory does not exist\n" 17 17 17 GTXT "%s: WARNING: Changed current directory to /\n" 18 17 18 GTXT "\t-c|--compare\n\t enter compare mode\n" 19 17 19 GTXT "\t-u|--userdir <path>\n\t use specified directory to store user settings\n" 20 17 20 GTXT "%s: ERROR: argument is missed for %s option\n" 21 17 21 GTXT "Error: java (%s) cannot be used to run gprofng GUI (command not found)\n" 22 17 22 GTXT "Error: java (%s) cannot be used to run gprofng GUI (Unsupported major.minor version)\n" 23 17 23 GTXT " The following J2SE[tm] versions are recommended:\n" 24 17 24 GTXT " J2SE[tm] 1.7.0_72 or later 1.7.0 updates\n" 25 17 25 GTXT " J2SE[tm] 1.8.0_20 or later 1.8.0 updates\n" 26 17 26 GTXT "Error: java (%s) cannot be used to run gprofng GUI (unrecognized class file version)\n" 27 17 27 Message() { text=I18Ntxt$1 mset=I18Nset$1 mid=I18Nid$1 if [ -x /usr/dt/bin/dtdspmsg ]; then eval eval /usr/dt/bin/dtdspmsg -s \${${mset}} analyzer.cat \${${mid}} \\\"\\\${$text}\\\" ${2:+"\\\"$2\\\""} ${3:+"\\\"$3\\\""} ${4:+"\\\"$4\\\""} else eval eval printf \\\"\\\${$text}\\\" ${2:+"\\\"$2\\\""} ${3:+"\\\"$3\\\""} ${4:+"\\\"$4\\\""} fi } Usage() { Message 1 $0 # "Usage: %s {options} arguments\n\nOptions can be\n\n" Message 2 # "\t-?|-h|--help\n\t show usage and exit\n" Message 3 # "\t-j|--jdkhome <path>\n\t specify the JVM directory\n" Message 4 # "\t-J<jvm_options>\n\t pass <jvm_options> to JVM\n" Message 10 # "\t-f|--fontsize <size>\n\t specify the font size to be used in gprofng GUI\n" Message 5 # "\t-v|--verbose\n\t enable verbose output\n" Message 6 # "\t-V|--version\n\t show version and exit\n" Message 19 # -c|--compare Message 20 # -u|--userdir Message 7 # "\nAll other options and arguments are passed to gprofng GUI.\nSee documentations for details.\n" } ShowLogs() { if [ -s "$1" ]; then echo "===== /bin/cat -- $1: ======" /bin/cat -- "$1" echo "" fi if [ -s $1.err ]; then echo "===== /bin/cat -- $1.err: ======" /bin/cat -- "$1".err echo "" fi } ########################################################################### # main program starts here # defaults # jdkhome will be really set below # the jvmflags value set here can be augmented by a -J argument # the verbose value set here can be overridden by a -v argument jdkhome="" java_how="?" jvmflags="-Xmx1024m" verbose="false" # end of defaults PATH=$PATH:/bin:/usr/bin export PATH # # define OS_TYPE # OS_TYPE=`/bin/uname` PRG=$(readlink -f -- "$0") progdir=$(dirname -- "$PRG") fdhome="$progdir/.." GPROFNG_bindir= GPROFNG_libdir= GPROFNG_datadir= # # L10N path # NLSPATH="${GPROFNG_libdir}/locale/%L/LC_MESSAGES/%N.cat:${GPROFNG_libdir}/locale/%L/LC_MESSAGES/%N:$NLSPATH" export NLSPATH # # absolutize fdhome # oldpwd=`pwd` ; if [ $? -ne 0 ]; then Message 17 $0 # echo "$0: WARNING: Current directory does not exist" cd / Message 18 $0 # echo "$0: WARNING: Changed current directory to /" oldpwd=`pwd` ; fi cd "$fdhome"; fdhome=`pwd`; cd "$oldpwd"; unset oldpwd jargs=$jvmflags args="--bindir='${GPROFNG_bindir}' --datadir='${GPROFNG_datadir}'" # see if invoked as "tha" or "rdt", and set environment variable accordingly if [ "`basename $0`" = "tha" -o "`basename $0`" = "rdt" ]; then SP_ANALYZER_CONFIG_MODE="R" export SP_ANALYZER_CONFIG_MODE fi # Check that there is an argument for the $1 option CheckArgsCount() { if [ $2 -lt 2 ]; then Message 21 ${PRG} $1 # Usage; exit 2 fi } HOME_USER_DIR=${HOME}/.gprofng DEFAULT_USER_DIR=${HOME_USER_DIR}/gui USER_DIR=${DEFAULT_USER_DIR} whoami=`basename $PRG` # parse arguments endargs=false while [ $# -gt 0 ] ; do case "$1" in --whoami=*) whoami=`echo -- "$1" | sed -e 's/--whoami=//'` ;; -j|--jdkhome) CheckArgsCount "$1" $# ; shift; java_how="-j"; jdkhome=$1; # jdk home ;; -J*) jopt=`expr $1 : '-J\(.*\)'`; jargs="$jargs \"$jopt\"";; -v|--verbose) args="$args --verbose" verbose="true" ;; -V|--version) echo GNU `basename $PRG`: "REPLACE_ME_WITH_VERSION"; exit 0;; -\?|-h|--help) Usage; exit 0;; -f|--fontsize) CheckArgsCount "$1" $# ; args="$args \"$1\"" ; # option shift; args="$args \"$1\"" ; # font size ;; -c|--compare) args="$args $1" ;; -u|--userdir) CheckArgsCount "$1" $# ; args="$args \"$1\"" ; # option shift; args="$args \"$1\"" ; # user directory USER_DIR=$1 ;; --gprofngdir=*) args="$args \"$1\"" ;; -*) Message 11 $1; Usage; exit 1;; *) endargs=true ;; esac [ $endargs = true ] && break shift done # Add remaining arguments and pass them down while [ $# -gt 0 ] ; do args="$args \"$1\"" ; shift done # create user directory and set correct permissions if [ ! -d ${USER_DIR} ]; then /bin/mkdir -p ${USER_DIR} if [ "${USER_DIR}" = "${DEFAULT_USER_DIR}" ]; then /bin/chmod 700 ${HOME_USER_DIR} fi fi /bin/chmod 700 ${USER_DIR} # if user did not specify a jdkhome, set default if [ "$jdkhome" = "" ]; then # look at environment variables, and -j to find Java # if JAVA_PATH is set it overrides the default in the script if [ ! -z "$JAVA_PATH" ] ; then jdkhome="$JAVA_PATH" java_how="JAVA_PATH" fi # if JDK_HOME is set it overrides the default and JAVA_PATH in the script if [ ! -z "$JDK_HOME" ] ; then jdkhome="$JDK_HOME" java_how="JDK_HOME" fi # if we still don't have a jdkhome, try the user's path if [ "$jdkhome" = "" ]; then javaloc=`LC_ALL=C type java | sed -e 's|^[^/]*||' | sed -e "s|/java'|/java|"` if [ -f "$javaloc" ]; then javaloc1=$(dirname -- "$javaloc") jdkhome=$(dirname -- "$javaloc1") java_how="PATH" fi fi # finally, just try /usr/java/bin/java if [ "$jdkhome" = "" ]; then jdkhome=/usr/java java_how=$I18Ntxt15 fi fi # # check JVM # if [ -z "$jdkhome" ] ; then Message 8 exit 1 fi if [ ! -x "$jdkhome/bin/java" ] ; then Message 9 $jdkhome exit 1 fi if [ $verbose = "true" ] ; then echo `basename $PRG`: "REPLACE_ME_WITH_VERSION"; Message 14 "$jdkhome/bin/java" "$java_how" $jdkhome/bin/java -version; fi # Check DISPLAY variable if [ "no$DISPLAY" = "no" ]; then Message 16 $0 # "$0: ERROR: environment variable DISPLAY is not set" exit 2 fi # If this is Solaris SPARC disable sun.java2d.xrender if [ "${OS_TYPE}" = "SunOS" ]; then # if [ "no$VNCDESKTOP" != "no" ]; then HW_TYPE=`/bin/uname -p` if [ "${HW_TYPE}" = "sparc" ]; then jargs="-Dsun.java2d.xrender=false ${jargs}" fi # fi fi # Set special environment variable SP_COLLECTOR_FROM_GUI=1 export SP_COLLECTOR_FROM_GUI PID=$$ LOG="${USER_DIR}/an.${PID}.log" /bin/rm -f -- "${LOG}" "${LOG}.err" gprofng_jar="${GPROFNG_datadir}/gprofng-gui/gprofng-analyzer.jar" if [ $verbose = "true" ]; then echo "% '$jdkhome/bin/java' $jargs -jar '${gprofng_jar}' $args >${LOG} 2>${LOG}.err" # eval "/usr/bin/strace -v -f -t -o ${USER_DIR}/truss.log '$jdkhome/bin/java'" $jargs -jar ${gprofng_jar} $args # exit fi eval "'$jdkhome/bin/java'" $jargs -jar "'${gprofng_jar}'" $args >"${LOG}" 2>"${LOG}.err" res=$? if [ $verbose = "true" ]; then ShowLogs "${LOG}" fi if [ ${res} -eq 0 ]; then /bin/rm -f -- "${LOG}" "${LOG}.err" exit ${res} fi # Execution failed # /bin/echo "Command failed: $jdkhome/bin/java $jargs -jar ${gprofng_jar} $args" err=`/bin/cat -- "${LOG}" | /bin/grep UnsupportedClassVersionError | wc -l` if [ ${err} -eq 0 ]; then err=`/bin/cat -- "${LOG}" | /bin/grep 'java: command not found' | wc -l` if [ ${err} -eq 0 ]; then err=`/bin/cat -- "${LOG}" | /bin/grep ClassFormatError | wc -l` if [ ${err} -eq 0 ]; then # unknown error if [ $verbose != "true" ]; then ShowLogs "${LOG}" fi /bin/rm -f -- "${LOG}" "${LOG}.err" exit ${res} fi Message 27 "$jdkhome/bin/java" else Message 22 "$jdkhome/bin/java" fi else Message 23 "$jdkhome/bin/java" fi Message 24 Message 25 Message 26 /bin/rm -f -- "${LOG}" "${LOG}.err" exit ${res} �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������