hwctable.c 287 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410
  1. /* Copyright (C) 2021 Free Software Foundation, Inc.
  2. Contributed by Oracle.
  3. This file is part of GNU Binutils.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #include <stdlib.h>
  17. #include <stdio.h>
  18. #include <errno.h>
  19. #include <string.h>
  20. #include <limits.h>
  21. #include "hwcdrv.h"
  22. #include "hwcfuncs.h"
  23. /* TprintfT(<level>,...) definitions. Adjust per module as needed */
  24. #define DBG_LT0 0 // for high-level configuration, unexpected errors/warnings
  25. #define DBG_LT1 1 // for configuration details, warnings
  26. #define DBG_LT2 2
  27. #define DBG_LT3 3
  28. /*---------------------------------------------------------------------------*/
  29. /* compile options */
  30. #define DISALLOW_USI_USII_6357446
  31. /* Solaris 9/libcpc1 allows cpc_bind() to work on US-IIe processors, even
  32. though this processor cannot generate profiling interrupts. */
  33. #define DISALLOW_PENTIUM_PRO_MMX_7007575
  34. /* Solaris/libcpc2 defaults to "Pentium Pro with MMX, Pentium II"
  35. when it doesn't recognize an Intel processor. As a result,
  36. when collect attempts to start Pentium Pro counters on a
  37. new machine (e.g. Westmere as of 1/2011), the OS may hang. */
  38. /* Register 0 counter doesn't work on Niagara T1 version (?) */
  39. #define WORKAROUND_6231196_NIAGARA1_NO_CTR_0
  40. /*---------------------------------------------------------------------------*/
  41. /* consts, macros */
  42. /* 10^N rates */
  43. #define PRELOADS_9 1001000001
  44. #define PRELOADS_85 320100001
  45. #define PRELOADS_8 100100001
  46. #define PRELOADS_75 32010001
  47. #define PRELOADS_7 10010001
  48. #define PRELOADS_65 3201001
  49. #define PRELOADS_6 1001001
  50. #define PRELOADS_55 320101
  51. #define PRELOADS_5 100101
  52. #define PRELOADS_45 32001
  53. #define PRELOADS_4 10001
  54. #define PRELOADS_35 3201
  55. #define PRELOADS_3 1001
  56. #define PRELOADS_25 301
  57. #define ABST_TBD ABST_NONE /* to be determined */
  58. /*---------------------------------------------------------------------------*/
  59. /* prototypes */
  60. static void hwc_cb (uint_t cpc_regno, const char *name);
  61. static void attrs_cb (const char *attr);
  62. static int attr_is_valid (int forKernel, const char *attr);
  63. /*---------------------------------------------------------------------------*/
  64. /* HWC definition tables */
  65. /*
  66. comments on hwcentry tables
  67. ---------------------------
  68. name: this field should not contain '~'.
  69. int_name: actual name of register, may contain ~ attribute specifications.
  70. regnum: assigned register.
  71. metric: if non-NULL, is a 'standard' counter that will show up in help.
  72. timecvt: >0: can convert to time, 'timecvt' CPU cycles per event
  73. =0: counts events
  74. <0: can convert to time, count reference-clock cycles at '-timecvt' MHz
  75. memop: see description for ABST_type enum
  76. */
  77. // PRELOAD(): generates an interval based on the cycles/event and CPU GHZ.
  78. // Note: the macro tweaks the interval so that it ends in decimal 001.
  79. #define CYC_PER_SAMPLE (1000ULL*1000*1000/100) // cycles per signal at 1ghz, 100 samples/second
  80. #define PRELOAD(min_cycles_per_event,ghz) (((ghz)*CYC_PER_SAMPLE/(min_cycles_per_event))/100*100+1)
  81. // PRELOAD_DEF: initial value for uncalibrated events.
  82. // This value should be based on a rate that will work for the slowest changing
  83. // HWCs, HWCs where there are many CPU cycles between events.
  84. //
  85. // The interval needs to target the slowest HWCs so that
  86. // automatic adjustment of HWC overflow intervals can adapt.
  87. #define PRELOAD_DEF PRELOAD(1000,3) // default interval targets 1000 cycles/event at 3ghz
  88. // For er_kernel, which HWC intervals cannot be adjusted automatically for ON/HI/LO,
  89. // The interval should target some safe interval for fast events
  90. #define PRELOAD_DEF_ERKERNEL PRELOAD(4,4) // default interval targets 4 cycles/event at 4ghz
  91. static const Hwcentry empty_ctr = {NULL, NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, 0};
  92. // --- use cycles counter to expose "system_time" on Linux ---
  93. #define SYSTIME_REGNOS REGNO_ANY // Linux: make sys_time/usr_time available for data collection
  94. // Note: For x86, Linux and Solaris use different ref-clock names
  95. #define USE_INTEL_REF_CYCLES(MHZ) \
  96. {"usr_time","unhalted-reference-cycles", SYSTIME_REGNOS, STXT("User CPU"), PRELOAD(900,MHZ), -(MHZ), ABST_NONE}, \
  97. {"usr_time","cpu_clk_unhalted.ref_p", SYSTIME_REGNOS, STXT("User CPU"), PRELOAD(900,MHZ), -(MHZ), ABST_NONE}, \
  98. {"sys_time","unhalted-reference-cycles~system=1~user=0", SYSTIME_REGNOS, STXT("System CPU"), PRELOAD(900,MHZ), -(MHZ), ABST_NONE}, \
  99. {"sys_time","cpu_clk_unhalted.ref_p~system=1~user=0", SYSTIME_REGNOS, STXT("System CPU"), PRELOAD( 900,MHZ), -(MHZ), ABST_NONE}, \
  100. {"cycles0", "unhalted-reference-cycles", 0, NULL, PRELOAD( 900,MHZ), -(MHZ), ABST_NONE}, /*hidden*/ \
  101. {"cycles0", "cpu_clk_unhalted.ref_p", 0, NULL, PRELOAD( 900,MHZ), -(MHZ), ABST_NONE}, /*hidden*/ \
  102. {"cycles1", "unhalted-reference-cycles", 1, NULL, PRELOAD( 910,MHZ), -(MHZ), ABST_NONE}, /*hidden*/ \
  103. {"cycles1", "cpu_clk_unhalted.ref_p", 1, NULL, PRELOAD( 910,MHZ), -(MHZ), ABST_NONE}, /*hidden*/ \
  104. /* end of list */
  105. #define SPARC_CYCLES \
  106. {"usr_time","Cycles_user", SYSTIME_REGNOS, STXT("User CPU"), PRELOADS_75,1, ABST_NONE}, \
  107. {"sys_time","Cycles_user~system=1~user=0", SYSTIME_REGNOS, STXT("System CPU"), PRELOADS_75,1, ABST_NONE}, \
  108. /* end of list */
  109. /* --- PERF_EVENTS "software" definitions --- */
  110. #define PERF_EVENTS_SW_EVENT_ALIASES \
  111. // none supported for now
  112. #if 0
  113. {"usr", "PERF_COUNT_SW_TASK_CLOCK", REGNO_ANY, STXT("User CPU"), PRELOADS_7, -(1000), ABST_NONE}, \
  114. {"sys", "PERF_COUNT_SW_TASK_CLOCK~system=1~user=0", REGNO_ANY, STXT("System CPU"), PRELOADS_7, -(1000), ABST_NONE}, \
  115. /* end of list */
  116. #endif
  117. #define PERF_EVENTS_SW_EVENT_DEFS \
  118. // none supported for now
  119. #if 0
  120. {"PERF_COUNT_SW_TASK_CLOCK", NULL, REGNO_ANY, NULL, PRELOADS_7, -(1000),ABST_NONE}, \
  121. /* end of list */
  122. #endif
  123. /*
  124. * The PAPI descriptive strings used to be wrapped with STXT(),
  125. * a macro defined in perfan/include/i18n.h. For the time being,
  126. * we want to demote the PAPI counters by omitting the
  127. * descriptions. So we use a new macro PAPITXT() for this purpose.
  128. */
  129. #define PAPITXT(x) NULL
  130. /* Solaris "Generic" Counters */
  131. static Hwcentry papi_generic_list[] = {
  132. {"PAPI_l1_dcm", NULL, REGNO_ANY, PAPITXT ("L1 D-cache misses"), PRELOADS_65, 0, ABST_NONE},
  133. {"PAPI_l1_icm", NULL, REGNO_ANY, PAPITXT ("L1 I-cache misses"), PRELOADS_6, 0, ABST_NONE},
  134. {"PAPI_l2_dcm", NULL, REGNO_ANY, PAPITXT ("L2 D-cache misses"), PRELOADS_6, 0, ABST_NONE},
  135. {"PAPI_l2_icm", NULL, REGNO_ANY, PAPITXT ("L2 I-cache misses"), PRELOADS_6, 0, ABST_NONE},
  136. {"PAPI_l3_dcm", NULL, REGNO_ANY, PAPITXT ("L3 D-cache misses"), PRELOADS_5, 0, ABST_NONE},
  137. {"PAPI_l3_icm", NULL, REGNO_ANY, PAPITXT ("L3 I-cache misses"), PRELOADS_5, 0, ABST_NONE},
  138. {"PAPI_l1_tcm", NULL, REGNO_ANY, PAPITXT ("L1 misses"), PRELOADS_65, 0, ABST_NONE},
  139. {"PAPI_l2_tcm", NULL, REGNO_ANY, PAPITXT ("L2 misses"), PRELOADS_6, 0, ABST_NONE},
  140. {"PAPI_l3_tcm", NULL, REGNO_ANY, PAPITXT ("L3 misses"), PRELOADS_5, 0, ABST_NONE},
  141. {"PAPI_ca_snp", NULL, REGNO_ANY, PAPITXT ("Requests for a snoop"), PRELOADS_6, 0, ABST_NONE},
  142. {"PAPI_ca_shr", NULL, REGNO_ANY, PAPITXT ("Requests for exclusive access to shared cache line"), PRELOADS_6, 0, ABST_NONE},
  143. {"PAPI_ca_cln", NULL, REGNO_ANY, PAPITXT ("Requests for exclusive access to clean cache line"), PRELOADS_6, 0, ABST_NONE},
  144. {"PAPI_ca_inv", NULL, REGNO_ANY, PAPITXT ("Requests for cache line invalidation"), PRELOADS_6, 0, ABST_NONE},
  145. {"PAPI_ca_itv", NULL, REGNO_ANY, PAPITXT ("Requests for cache line intervention"), PRELOADS_6, 0, ABST_NONE},
  146. {"PAPI_l3_ldm", NULL, REGNO_ANY, PAPITXT ("L3 load misses"), PRELOADS_5, 0, ABST_NONE},
  147. {"PAPI_l3_stm", NULL, REGNO_ANY, PAPITXT ("L3 store misses"), PRELOADS_5, 0, ABST_NONE},
  148. {"PAPI_bru_idl", NULL, REGNO_ANY, PAPITXT ("Cycles branch units are idle"), PRELOADS_7, 1, ABST_NONE},
  149. {"PAPI_fxu_idl", NULL, REGNO_ANY, PAPITXT ("Cycles integer units are idle"), PRELOADS_7, 1, ABST_NONE},
  150. {"PAPI_fpu_idl", NULL, REGNO_ANY, PAPITXT ("Cycles FP units are idle"), PRELOADS_7, 1, ABST_NONE},
  151. {"PAPI_lsu_idl", NULL, REGNO_ANY, PAPITXT ("Cycles load/store units are idle"), PRELOADS_7, 1, ABST_NONE},
  152. {"PAPI_tlb_dm", NULL, REGNO_ANY, PAPITXT ("DTLB misses"), PRELOADS_6, 0, ABST_NONE},
  153. {"PAPI_tlb_im", NULL, REGNO_ANY, PAPITXT ("ITLB misses"), PRELOADS_6, 0, ABST_NONE},
  154. {"PAPI_tlb_tl", NULL, REGNO_ANY, PAPITXT ("Total TLB misses"), PRELOADS_6, 0, ABST_NONE},
  155. {"PAPI_tlb_tm", NULL, REGNO_ANY, PAPITXT ("Total TLB misses"), PRELOADS_6, 0, ABST_NONE},
  156. {"PAPI_l1_ldm", NULL, REGNO_ANY, PAPITXT ("L1 load misses"), PRELOADS_65, 0, ABST_NONE},
  157. {"PAPI_l1_stm", NULL, REGNO_ANY, PAPITXT ("L1 store misses"), PRELOADS_65, 0, ABST_NONE},
  158. {"PAPI_l2_ldm", NULL, REGNO_ANY, PAPITXT ("L2 load misses"), PRELOADS_6, 0, ABST_NONE},
  159. {"PAPI_l2_stm", NULL, REGNO_ANY, PAPITXT ("L2 store misses"), PRELOADS_6, 0, ABST_NONE},
  160. {"PAPI_btac_m", NULL, REGNO_ANY, PAPITXT ("Branch target address cache misses"), PRELOADS_5, 0, ABST_NONE},
  161. {"PAPI_prf_dm", NULL, REGNO_ANY, PAPITXT ("Data prefetch cache misses"), PRELOADS_65, 0, ABST_NONE},
  162. {"PAPI_l3_dch", NULL, REGNO_ANY, PAPITXT ("L3 D-cache hits"), PRELOADS_6, 0, ABST_NONE},
  163. {"PAPI_tlb_sd", NULL, REGNO_ANY, PAPITXT ("TLB shootdowns"), PRELOADS_6, 0, ABST_NONE},
  164. {"PAPI_csr_fal", NULL, REGNO_ANY, PAPITXT ("Failed store conditional instructions"), PRELOADS_6, 0, ABST_NONE},
  165. {"PAPI_csr_suc", NULL, REGNO_ANY, PAPITXT ("Successful store conditional instructions"), PRELOADS_7, 0, ABST_NONE},
  166. {"PAPI_csr_tot", NULL, REGNO_ANY, PAPITXT ("Total store conditional instructions"), PRELOADS_7, 0, ABST_NONE},
  167. {"PAPI_mem_scy", NULL, REGNO_ANY, PAPITXT ("Cycles Stalled Waiting for memory accesses"), PRELOADS_7, 1, ABST_NONE},
  168. {"PAPI_mem_rcy", NULL, REGNO_ANY, PAPITXT ("Cycles Stalled Waiting for memory reads"), PRELOADS_7, 1, ABST_NONE},
  169. {"PAPI_mem_wcy", NULL, REGNO_ANY, PAPITXT ("Cycles Stalled Waiting for memory writes"), PRELOADS_7, 1, ABST_NONE},
  170. {"PAPI_stl_icy", NULL, REGNO_ANY, PAPITXT ("Cycles with no instruction issue"), PRELOADS_7, 1, ABST_NONE},
  171. {"PAPI_ful_icy", NULL, REGNO_ANY, PAPITXT ("Cycles with maximum instruction issue"), PRELOADS_7, 1, ABST_NONE},
  172. {"PAPI_stl_ccy", NULL, REGNO_ANY, PAPITXT ("Cycles with no instructions completed"), PRELOADS_7, 1, ABST_NONE},
  173. {"PAPI_ful_ccy", NULL, REGNO_ANY, PAPITXT ("Cycles with maximum instructions completed"), PRELOADS_7, 1, ABST_NONE},
  174. {"PAPI_hw_int", NULL, REGNO_ANY, PAPITXT ("Hardware interrupts"), PRELOADS_5, 0, ABST_NONE},
  175. {"PAPI_br_ucn", NULL, REGNO_ANY, PAPITXT ("Unconditional branch instructions"), PRELOADS_7, 0, ABST_NONE},
  176. {"PAPI_br_cn", NULL, REGNO_ANY, PAPITXT ("Cond. branch instructions"), PRELOADS_7, 0, ABST_NONE},
  177. {"PAPI_br_tkn", NULL, REGNO_ANY, PAPITXT ("Cond. branch instructions taken"), PRELOADS_7, 0, ABST_NONE},
  178. {"PAPI_br_ntk", NULL, REGNO_ANY, PAPITXT ("Cond. branch instructions not taken"), PRELOADS_7, 0, ABST_NONE},
  179. {"PAPI_br_msp", NULL, REGNO_ANY, PAPITXT ("Cond. branch instructions mispredicted"), PRELOADS_6, 0, ABST_NONE},
  180. {"PAPI_br_prc", NULL, REGNO_ANY, PAPITXT ("Cond. branch instructions correctly predicted"), PRELOADS_7, 0, ABST_NONE},
  181. {"PAPI_fma_ins", NULL, REGNO_ANY, PAPITXT ("FMA instructions completed"), PRELOADS_65, 0, ABST_NONE},
  182. {"PAPI_tot_iis", NULL, REGNO_ANY, PAPITXT ("Instructions issued"), PRELOADS_7, 0, ABST_NONE},
  183. {"PAPI_tot_ins", NULL, REGNO_ANY, PAPITXT ("Instructions completed"), PRELOADS_7, 0, ABST_NONE},
  184. {"PAPI_int_ins", NULL, REGNO_ANY, PAPITXT ("Integer instructions"), PRELOADS_7, 0, ABST_NONE},
  185. {"PAPI_fp_ins", NULL, REGNO_ANY, PAPITXT ("Floating-point instructions"), PRELOADS_7, 0, ABST_NONE},
  186. {"PAPI_ld_ins", NULL, REGNO_ANY, PAPITXT ("Load instructions"), PRELOADS_7, 0, ABST_NONE},
  187. {"PAPI_sr_ins", NULL, REGNO_ANY, PAPITXT ("Store instructions"), PRELOADS_7, 0, ABST_NONE},
  188. {"PAPI_br_ins", NULL, REGNO_ANY, PAPITXT ("Branch instructions"), PRELOADS_7, 0, ABST_NONE},
  189. {"PAPI_vec_ins", NULL, REGNO_ANY, PAPITXT ("Vector/SIMD instructions"), PRELOADS_7, 0, ABST_NONE},
  190. {"PAPI_res_stl", NULL, REGNO_ANY, PAPITXT ("Cycles stalled on any resource"), PRELOADS_7, 1, ABST_NONE},
  191. {"PAPI_fp_stal", NULL, REGNO_ANY, PAPITXT ("Cycles the FP unit(s) are stalled"), PRELOADS_7, 1, ABST_NONE},
  192. {"PAPI_tot_cyc", NULL, REGNO_ANY, PAPITXT ("Total cycles"), PRELOADS_7, 1, ABST_NONE},
  193. {"PAPI_lst_ins", NULL, REGNO_ANY, PAPITXT ("Load/store instructions completed"), PRELOADS_7, 0, ABST_NONE},
  194. {"PAPI_syc_ins", NULL, REGNO_ANY, PAPITXT ("Sync instructions completed"), PRELOADS_65, 0, ABST_NONE},
  195. {"PAPI_l1_dch", NULL, REGNO_ANY, PAPITXT ("L1 D-cache hits"), PRELOADS_7, 0, ABST_NONE},
  196. {"PAPI_l2_dch", NULL, REGNO_ANY, PAPITXT ("L2 D-cache hits"), PRELOADS_65, 0, ABST_NONE},
  197. {"PAPI_l1_dca", NULL, REGNO_ANY, PAPITXT ("L1 D-cache accesses"), PRELOADS_7, 0, ABST_NONE},
  198. {"PAPI_l2_dca", NULL, REGNO_ANY, PAPITXT ("L2 D-cache accesses"), PRELOADS_65, 0, ABST_NONE},
  199. {"PAPI_l3_dca", NULL, REGNO_ANY, PAPITXT ("L3 D-cache accesses"), PRELOADS_6, 0, ABST_NONE},
  200. {"PAPI_l1_dcr", NULL, REGNO_ANY, PAPITXT ("L1 D-cache reads"), PRELOADS_7, 0, ABST_NONE},
  201. {"PAPI_l2_dcr", NULL, REGNO_ANY, PAPITXT ("L2 D-cache reads"), PRELOADS_65, 0, ABST_NONE},
  202. {"PAPI_l3_dcr", NULL, REGNO_ANY, PAPITXT ("L3 D-cache reads"), PRELOADS_6, 0, ABST_NONE},
  203. {"PAPI_l1_dcw", NULL, REGNO_ANY, PAPITXT ("L1 D-cache writes"), PRELOADS_7, 0, ABST_NONE},
  204. {"PAPI_l2_dcw", NULL, REGNO_ANY, PAPITXT ("L2 D-cache writes"), PRELOADS_65, 0, ABST_NONE},
  205. {"PAPI_l3_dcw", NULL, REGNO_ANY, PAPITXT ("L3 D-cache writes"), PRELOADS_6, 0, ABST_NONE},
  206. {"PAPI_l1_ich", NULL, REGNO_ANY, PAPITXT ("L1 I-cache hits"), PRELOADS_7, 0, ABST_NONE},
  207. {"PAPI_l2_ich", NULL, REGNO_ANY, PAPITXT ("L2 I-cache hits"), PRELOADS_65, 0, ABST_NONE},
  208. {"PAPI_l3_ich", NULL, REGNO_ANY, PAPITXT ("L3 I-cache hits"), PRELOADS_6, 0, ABST_NONE},
  209. {"PAPI_l1_ica", NULL, REGNO_ANY, PAPITXT ("L1 I-cache accesses"), PRELOADS_7, 0, ABST_NONE},
  210. {"PAPI_l2_ica", NULL, REGNO_ANY, PAPITXT ("L2 I-cache accesses"), PRELOADS_65, 0, ABST_NONE},
  211. {"PAPI_l3_ica", NULL, REGNO_ANY, PAPITXT ("L3 I-cache accesses"), PRELOADS_6, 0, ABST_NONE},
  212. {"PAPI_l1_icr", NULL, REGNO_ANY, PAPITXT ("L1 I-cache reads"), PRELOADS_7, 0, ABST_NONE},
  213. {"PAPI_l2_icr", NULL, REGNO_ANY, PAPITXT ("L2 I-cache reads"), PRELOADS_65, 0, ABST_NONE},
  214. {"PAPI_l3_icr", NULL, REGNO_ANY, PAPITXT ("L3 I-cache reads"), PRELOADS_6, 0, ABST_NONE},
  215. {"PAPI_l1_icw", NULL, REGNO_ANY, PAPITXT ("L1 I-cache writes"), PRELOADS_7, 0, ABST_NONE},
  216. {"PAPI_l2_icw", NULL, REGNO_ANY, PAPITXT ("L2 I-cache writes"), PRELOADS_65, 0, ABST_NONE},
  217. {"PAPI_l3_icw", NULL, REGNO_ANY, PAPITXT ("L3 I-cache writes"), PRELOADS_6, 0, ABST_NONE},
  218. {"PAPI_l1_tch", NULL, REGNO_ANY, PAPITXT ("L1 total hits"), PRELOADS_7, 0, ABST_NONE},
  219. {"PAPI_l2_tch", NULL, REGNO_ANY, PAPITXT ("L2 total hits"), PRELOADS_65, 0, ABST_NONE},
  220. {"PAPI_l3_tch", NULL, REGNO_ANY, PAPITXT ("L3 total hits"), PRELOADS_6, 0, ABST_NONE},
  221. {"PAPI_l1_tca", NULL, REGNO_ANY, PAPITXT ("L1 total accesses"), PRELOADS_7, 0, ABST_NONE},
  222. {"PAPI_l2_tca", NULL, REGNO_ANY, PAPITXT ("L2 total accesses"), PRELOADS_65, 0, ABST_NONE},
  223. {"PAPI_l3_tca", NULL, REGNO_ANY, PAPITXT ("L3 total accesses"), PRELOADS_6, 0, ABST_NONE},
  224. {"PAPI_l1_tcr", NULL, REGNO_ANY, PAPITXT ("L1 total reads"), PRELOADS_7, 0, ABST_NONE},
  225. {"PAPI_l2_tcr", NULL, REGNO_ANY, PAPITXT ("L2 total reads"), PRELOADS_65, 0, ABST_NONE},
  226. {"PAPI_l3_tcr", NULL, REGNO_ANY, PAPITXT ("L3 total reads"), PRELOADS_6, 0, ABST_NONE},
  227. {"PAPI_l1_tcw", NULL, REGNO_ANY, PAPITXT ("L1 total writes"), PRELOADS_7, 0, ABST_NONE},
  228. {"PAPI_l2_tcw", NULL, REGNO_ANY, PAPITXT ("L2 total writes"), PRELOADS_65, 0, ABST_NONE},
  229. {"PAPI_l3_tcw", NULL, REGNO_ANY, PAPITXT ("L3 total writes"), PRELOADS_6, 0, ABST_NONE},
  230. {"PAPI_fml_ins", NULL, REGNO_ANY, PAPITXT ("FP multiply instructions"), PRELOADS_7, 0, ABST_NONE},
  231. {"PAPI_fad_ins", NULL, REGNO_ANY, PAPITXT ("FP add instructions"), PRELOADS_7, 0, ABST_NONE},
  232. {"PAPI_fdv_ins", NULL, REGNO_ANY, PAPITXT ("FP divide instructions"), PRELOADS_7, 0, ABST_NONE},
  233. {"PAPI_fsq_ins", NULL, REGNO_ANY, PAPITXT ("FP square root instructions"), PRELOADS_65, 0, ABST_NONE},
  234. {"PAPI_fnv_ins", NULL, REGNO_ANY, PAPITXT ("FP inverse instructions"), PRELOADS_7, 0, ABST_NONE},
  235. {"PAPI_fp_ops", NULL, REGNO_ANY, PAPITXT ("FP operations"), PRELOADS_7, 0, ABST_NONE},
  236. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  237. };
  238. static Hwcentry usIlist[] = {
  239. {"cycles", "Cycle_cnt", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  240. {"insts", "Instr_cnt", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  241. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  242. };
  243. static Hwcentry usIIIlist[] = /* III, IIIi, IIIp. Note that some counters are processor-specific */{
  244. {"cycles", "Cycle_cnt", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  245. {"insts", "Instr_cnt", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  246. {"icm", "IC_miss", REGNO_ANY, STXT ("I$ Misses"), PRELOADS_5, 0, ABST_NONE},
  247. {"dcrm", "DC_rd_miss", REGNO_ANY, STXT ("D$ Read Misses"), PRELOADS_5, 0, ABST_LOAD},
  248. {"dcwm", "DC_wr_miss", REGNO_ANY, STXT ("D$ Write Misses"), PRELOADS_5, 0, ABST_STORE},
  249. {"dcr", "DC_rd", REGNO_ANY, STXT ("D$ Read Refs"), PRELOADS_6, 0, ABST_LOAD},
  250. {"dcw", "DC_wr", REGNO_ANY, STXT ("D$ Write Refs"), PRELOADS_6, 0, ABST_STORE},
  251. {"ecref", "EC_ref", REGNO_ANY, STXT ("E$ Refs"), PRELOADS_6, 0, ABST_LDST},
  252. {"itlbm", "ITLB_miss", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  253. {"dtlbm", "DTLB_miss", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_5, 0, ABST_US_DTLBM},
  254. {"ecm", "EC_misses", REGNO_ANY, STXT ("E$ Misses"), PRELOADS_5, 0, ABST_LDST},
  255. {"ecrm", "EC_rd_miss", REGNO_ANY, STXT ("E$ Read Misses"), PRELOADS_5, 0, ABST_LOAD},
  256. {"ecml", "EC_miss_local", REGNO_ANY, STXT ("E$ Local Misses"), PRELOADS_5, 0, ABST_LDST},
  257. {"ecmr", "EC_miss_remote", REGNO_ANY, STXT ("E$ Remote Misses"), PRELOADS_5, 0, ABST_LDST},
  258. {"ecim", "EC_ic_miss", REGNO_ANY, STXT ("E$ Instr. Misses"), PRELOADS_5, 0, ABST_NONE},
  259. {"icstall", "Dispatch0_IC_miss", REGNO_ANY, STXT ("I$ Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  260. {"dcstall", "Re_DC_miss", REGNO_ANY, STXT ("D$ and E$ Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  261. {"ecstall", "Re_EC_miss", REGNO_ANY, STXT ("E$ Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  262. {"sqstall", "Rstall_storeQ", REGNO_ANY, STXT ("StoreQ Stall Cycles"), PRELOADS_6, 1, ABST_STORE},
  263. {"rawstall", "Re_RAW_miss", REGNO_ANY, STXT ("RAW Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  264. {"dcmissov", "Re_DC_missovhd", REGNO_ANY, STXT ("DC Miss Ovhd"), PRELOADS_6, 1, ABST_LOAD},
  265. {"fpustall", "Re_FPU_bypass", REGNO_ANY, STXT ("FPU Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  266. {"fpusestall", "Rstall_FP_use", REGNO_ANY, STXT ("FPU Use Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  267. {"iustall", "Rstall_IU_use", REGNO_ANY, STXT ("IU Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  268. {"fpadd", "FA_pipe_completion", REGNO_ANY, STXT ("FP Adds"), PRELOADS_6, 0, ABST_NONE},
  269. {"fpmul", "FM_pipe_completion", REGNO_ANY, STXT ("FP Muls"), PRELOADS_6, 0, ABST_NONE},
  270. /* explicit definitions of (hidden) entries for proper counters */
  271. /* Only counters that can be time converted, or are load-store need to be in this table */
  272. {"Cycle_cnt", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  273. {"EC_miss_mtag_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  274. {"DC_rd_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  275. {"DC_wr_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  276. {"DC_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  277. {"DC_wr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  278. {"EC_ref", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  279. {"EC_snoop_inv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  280. {"EC_wb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  281. {"EC_wb_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  282. {"DTLB_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_US_DTLBM},
  283. {"EC_misses", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  284. {"EC_rd_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  285. {"PC_port0_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  286. {"EC_miss_local", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  287. {"EC_miss_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  288. {"EC_snoop_cb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  289. {"WC_snoop_cb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  290. {"WC_scrubbed", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  291. {"WC_wb_wo_read", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  292. {"PC_MS_misses", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  293. {"PC_soft_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  294. {"PC_hard_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  295. {"PC_port1_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  296. {"PC_snoop_inv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE /*?*/},
  297. {"SW_count_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_COUNT},
  298. {"SW_count_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_COUNT},
  299. {"Dispatch0_IC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  300. {"Dispatch0_mispred", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  301. {"Dispatch0_br_target", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  302. {"Dispatch0_2nd_br", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  303. {"Dispatch_rs_mispred", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  304. {"Rstall_storeQ", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_STORE},
  305. {"Rstall_FP_use", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  306. {"Rstall_IU_use", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  307. {"EC_write_hit_RTO", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  308. {"Re_RAW_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  309. {"Re_DC_missovhd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  310. {"Re_endian_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  311. {"Re_FPU_bypass", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  312. {"Re_DC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  313. {"Re_EC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  314. {"Re_PC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  315. {"SI_snoop", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  316. {"SI_ciq_flow", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  317. {"SI_owned", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  318. {"MC_msl_busy_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  319. {"MC_mdb_overflow_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  320. {"MC_page_close_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  321. {"MC_reads_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  322. {"MC_reads_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  323. {"MC_reads_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  324. {"MC_reads_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  325. {"MC_writes_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  326. {"MC_writes_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  327. {"MC_writes_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  328. {"MC_writes_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  329. {"MC_stalls_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  330. {"MC_stalls_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  331. {"MC_stalls_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  332. {"MC_stalls_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  333. /* additional (hidden) aliases, for convenience */
  334. {"cycles0", "Cycle_cnt", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  335. {"cycles1", "Cycle_cnt", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  336. {"insts0", "Instr_cnt", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  337. {"insts1", "Instr_cnt", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  338. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  339. };
  340. static Hwcentry usIVplist[] = {
  341. {"cycles", "Cycle_cnt", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  342. {"insts", "Instr_cnt", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  343. {"icm", "IC_fill", REGNO_ANY, STXT ("I$ Misses"), PRELOADS_5, 0, ABST_NONE},
  344. {"dcrm", "DC_rd_miss", REGNO_ANY, STXT ("D$ Read Misses"), PRELOADS_5, 0, ABST_LOAD},
  345. {"dcwm", "DC_wr_miss", REGNO_ANY, STXT ("D$ Write Misses"), PRELOADS_5, 0, ABST_STORE},
  346. {"dcr", "DC_rd", REGNO_ANY, STXT ("D$ Read Refs"), PRELOADS_6, 0, ABST_LOAD},
  347. {"dcw", "DC_wr", REGNO_ANY, STXT ("D$ Write Refs"), PRELOADS_6, 0, ABST_STORE},
  348. {"itlbm", "ITLB_miss", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  349. {"dtlbm", "DTLB_miss", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_5, 0, ABST_US_DTLBM},
  350. {"l2ref", "L2_ref", REGNO_ANY, STXT ("L2$ Refs"), PRELOADS_5, 0, ABST_LDST},
  351. {"l2m", "L2_miss", REGNO_ANY, STXT ("L2$ Misses"), PRELOADS_5, 0, ABST_LDST},
  352. {"l2rm", "L2_rd_miss", REGNO_ANY, STXT ("L2$ Read Misses"), PRELOADS_5, 0, ABST_LOAD},
  353. {"l2im", "L2_IC_miss", REGNO_ANY, STXT ("L2$ Instr. Misses"), PRELOADS_5, 0, ABST_NONE},
  354. {"ecm", "L3_miss", REGNO_ANY, STXT ("E$ Misses"), PRELOADS_5, 0, ABST_LDST},
  355. {"ecrm", "L3_rd_miss", REGNO_ANY, STXT ("E$ Read Misses"), PRELOADS_5, 0, ABST_LOAD},
  356. {"ecml", "SSM_L3_miss_local", REGNO_ANY, STXT ("E$ Local Misses"), PRELOADS_5, 0, ABST_LDST},
  357. {"ecmr", "SSM_L3_miss_remote", REGNO_ANY, STXT ("E$ Remote Misses"), PRELOADS_5, 0, ABST_LDST},
  358. {"ecim", "L3_IC_miss", REGNO_ANY, STXT ("E$ Instr. Misses"), PRELOADS_5, 0, ABST_NONE},
  359. {"icstall", "Dispatch0_IC_miss", REGNO_ANY, STXT ("I$ Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  360. {"dcstall", "Re_DC_miss", REGNO_ANY, STXT ("D$ and E$ Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  361. {"ecstall", "Re_L3_miss", REGNO_ANY, STXT ("E$ Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  362. {"sqstall", "Rstall_storeQ", REGNO_ANY, STXT ("StoreQ Stall Cycles"), PRELOADS_6, 1, ABST_STORE},
  363. {"rawstall", "Re_RAW_miss", REGNO_ANY, STXT ("RAW Stall Cycles"), PRELOADS_6, 1, ABST_LOAD},
  364. {"dcmissov", "Re_DC_missovhd", REGNO_ANY, STXT ("DC Miss Ovhd"), PRELOADS_6, 1, ABST_LOAD},
  365. {"fpustall", "Re_FPU_bypass", REGNO_ANY, STXT ("FPU Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  366. {"fpusestall", "Rstall_FP_use", REGNO_ANY, STXT ("FPU Use Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  367. {"iustall", "Rstall_IU_use", REGNO_ANY, STXT ("IU Stall Cycles"), PRELOADS_6, 1, ABST_NONE},
  368. {"fpadd", "FA_pipe_completion", REGNO_ANY, STXT ("FP Adds"), PRELOADS_6, 0, ABST_NONE},
  369. {"fpmul", "FM_pipe_completion", REGNO_ANY, STXT ("FP Muls"), PRELOADS_6, 0, ABST_NONE},
  370. /* explicit definitions of (hidden) entries for proper counters */
  371. /* Only counters that can be time converted, or are load-store need to be in this table */
  372. {"Cycle_cnt", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  373. {"DC_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  374. {"DC_rd_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  375. {"DC_wr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  376. {"DC_wr_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  377. {"DTLB_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_US_DTLBM},
  378. {"Dispatch0_2nd_br", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  379. {"Dispatch0_IC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  380. {"Dispatch0_other", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  381. {"L2L3_snoop_cb_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  382. {"L2L3_snoop_inv_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  383. {"L2_hit_I_state_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST /*?*/},
  384. {"L2_hit_other_half", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  385. {"L2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  386. {"L2_rd_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  387. {"L2_ref", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  388. {"L2_snoop_cb_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  389. {"L2_snoop_inv_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC /*?*/},
  390. {"L2_wb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  391. {"L2_wb_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  392. {"L2_write_hit_RTO", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  393. {"L2_write_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  394. {"L3_hit_I_state_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  395. {"L3_hit_other_half", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  396. {"L3_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  397. {"L3_rd_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  398. {"L3_wb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  399. {"L3_wb_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  400. {"L3_write_hit_RTO", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  401. {"L3_write_miss_RTO", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE},
  402. {"MC_reads_0_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  403. {"MC_reads_1_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  404. {"MC_reads_2_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  405. {"MC_reads_3_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  406. {"MC_stalls_0_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  407. {"MC_stalls_1_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  408. {"MC_stalls_2_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  409. {"MC_stalls_3_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  410. {"MC_writes_0_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  411. {"MC_writes_1_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  412. {"MC_writes_2_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  413. {"MC_writes_3_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  414. /*? {"PC_MS_misses", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD}, */
  415. {"PC_hard_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  416. {"PC_inv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE /*?*/},
  417. {"PC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  418. {"PC_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  419. {"PC_soft_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LOAD},
  420. {"Re_DC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  421. {"Re_DC_missovhd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  422. {"Re_FPU_bypass", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  423. {"Re_L2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  424. {"Re_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  425. {"Re_PFQ_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  426. {"Re_RAW_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_LOAD},
  427. {"Rstall_FP_use", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  428. {"Rstall_IU_use", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  429. {"Rstall_storeQ", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_STORE},
  430. {"SI_RTO_src_data", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  431. {"SI_RTS_src_data", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  432. {"SI_ciq_flow_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NOPC},
  433. {"SI_owned_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  434. {"SI_snoop_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NOPC},
  435. {"ecml", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  436. {"ecmr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST},
  437. {"SSM_L3_miss_local", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST /*?*/},
  438. {"SSM_L3_miss_mtag_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST /*?*/},
  439. {"SSM_L3_miss_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_LDST /*?*/},
  440. {"SSM_L3_wb_remote", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_STORE /*?*/},
  441. {"SSM_new_transaction_sh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_TBD /*?*/},
  442. /* additional (hidden) aliases, for convenience */
  443. {"cycles0", "Cycle_cnt", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  444. {"cycles1", "Cycle_cnt", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  445. {"insts0", "Instr_cnt", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  446. {"insts1", "Instr_cnt", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  447. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  448. };
  449. static Hwcentry niagara1[] =
  450. /* CPC_ULTRA_T1 , "UltraSPARC T1" */{
  451. {"insts", "Instr_cnt", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  452. #ifndef WORKAROUND_6231196_NIAGARA1_NO_CTR_0 /* since register 0 counter don't work XXX */
  453. {"icm", "IC_miss", REGNO_ANY, STXT ("I$ Misses"), PRELOADS_5, 0, ABST_NONE},
  454. {"itlbm", "ITLB_miss", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  455. {"ecim", "L2_imiss", REGNO_ANY, STXT ("E$ Instr. Misses"), PRELOADS_4, 0, ABST_NONE},
  456. {"dcm", "DC_miss", REGNO_ANY, STXT ("D$ Misses"), PRELOADS_5, 0, ABST_EXACT},
  457. {"dtlbm", "DTLB_miss", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_5, 0, ABST_EXACT},
  458. {"ecdm", "L2_dmiss_ld", REGNO_ANY, STXT ("E$ Data Misses"), PRELOADS_4, 0, ABST_EXACT},
  459. {"flops", "FP_instr_cnt", REGNO_ANY, STXT ("Floating-point Ops"), PRELOADS_6, 0, ABST_NONE},
  460. /* explicit definitions of (hidden) entries for proper counters */
  461. /* Only counters that can be time converted, or are load-store need to be in this table */
  462. {"SB_full", NULL, REGNO_ANY, NULL, PRELOADS_6, 1, ABST_NONE},
  463. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOADS_6, 0, ABST_EXACT},
  464. {"DTLB_miss", NULL, REGNO_ANY, NULL, PRELOADS_6, 0, ABST_EXACT},
  465. {"L2_dmiss_ld", NULL, REGNO_ANY, NULL, PRELOADS_6, 0, ABST_EXACT},
  466. #endif
  467. /* additional (hidden) aliases, for convenience */
  468. {"insts1", "Instr_cnt", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  469. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  470. };
  471. static Hwcentry niagara2[] = {
  472. /* CPC_ULTRA_T2 , "UltraSPARC T2" */
  473. /* CPC_ULTRA_T2 , "UltraSPARC T2+" */
  474. {"insts", "Instr_cnt", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  475. {"loads", "Instr_ld", REGNO_ANY, STXT ("Load Instructions"), PRELOADS_7, 0, ABST_EXACT},
  476. {"stores", "Instr_st", REGNO_ANY, STXT ("Store Instructions"), PRELOADS_6, 0, ABST_EXACT},
  477. {"dcm", "DC_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_6, 0, ABST_EXACT},
  478. {"dtlbm", "DTLB_miss", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  479. {"l2drm", "L2_dmiss_ld", REGNO_ANY, STXT ("L2 D-cache Read Misses (See Bug 15664448)"), PRELOADS_5, 0, ABST_EXACT},
  480. {"icm", "IC_miss", REGNO_ANY, STXT ("L1 I-cache Misses"), PRELOADS_5, 0, ABST_NONE},
  481. {"itlbm", "ITLB_miss", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  482. {"l2im", "L2_imiss", REGNO_ANY, STXT ("L2 I-cache Misses"), PRELOADS_4, 0, ABST_NONE},
  483. /* explicit definitions of (hidden) entries for proper counters */
  484. /* Only counters that can be time converted, or are load-store need to be in this table */
  485. {"Instr_ld", NULL, REGNO_ANY, NULL, PRELOADS_7, 0, ABST_EXACT},
  486. {"Instr_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  487. {"Atomics", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  488. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  489. {"L2_dmiss_ld", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  490. {"DTLB_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  491. {"DES_3DES_busy_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  492. {"AES_busy_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  493. {"Kasumi_busy_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  494. {"MD5_SHA-1_SHA-256_busy_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  495. {"MA_busy_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  496. /* additional (hidden) aliases, for convenience */
  497. {"insts1", "Instr_cnt", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  498. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  499. };
  500. static Hwcentry sparc_t4[] = {
  501. // Identical to sparc_t5_m6 except for: l3m_spec
  502. // when updating this table, also update sparc_t5_m6[]
  503. // obsolete aliases marked with REGNO_INVALID (allows reading of older experiments)
  504. {"l2l3dh", "DC_miss_L2_L3_hit_nospec", REGNO_INVALID, STXT ("L2 or L3 D-cache Hits"), PRELOADS_6, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  505. {"l3m", "DC_miss_remote_L3_hit_nospec~emask=0x6", REGNO_INVALID, STXT ("L3 D-cache Misses"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  506. {"lmh", "DC_miss_local_hit_nospec", REGNO_INVALID, STXT ("Local Mem. Hits"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  507. {"rmh", "DC_miss_remote_L3_hit_nospec", REGNO_INVALID, STXT ("Remote Mem. Hits"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  508. {"pqs", "PQ_tag_wait", REGNO_INVALID, STXT ("Pick Queue Stalls"), PRELOADS_7, 1, ABST_NONE}, // old alias name
  509. {"raw_stb", "RAW_hit_st_buf", REGNO_INVALID, STXT ("RAW Hazard in Store Buffer"), PRELOADS_55, 0, ABST_NONE}, // 11@full hit, 60@partial hit (in future, combine w/st_q)
  510. {"raw_stq", "RAW_hit_st_q", REGNO_INVALID, STXT ("RAW Hazard in Store Queue"), PRELOADS_55, 0, ABST_NONE}, // 11@full hit, 60@partial hit (in future, combine w/st_buf)
  511. {"sel_stalls", "Sel_0_ready", REGNO_INVALID, STXT ("Stalls Another Thread Selected"), PRELOADS_7, 1, ABST_NONE},
  512. {"icm", "IC_miss", REGNO_INVALID, STXT ("L1 I-Cache Misses"), PRELOADS_55, 0, ABST_NONE}, // 20@ l2/l3 hit (guess)
  513. {"icm_stalls", "IC_miss", REGNO_INVALID, STXT ("L1 I-Cache Miss Est Stalls"), PRELOADS_55, 25, ABST_NONE}, // 25@ l2-20/l3-50
  514. // current aliases
  515. SPARC_CYCLES
  516. {"cycles", "Cycles_user", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  517. {"insts", "Instr_all", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  518. {"c_stalls", "Commit_0", REGNO_ANY, STXT ("Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  519. {"loads", "Instr_ld", REGNO_ANY, STXT ("Load Instructions"), PRELOADS_7, 0, ABST_EXACT},
  520. {"stores", "Instr_st", REGNO_ANY, STXT ("Store Instructions"), PRELOADS_7, 0, ABST_EXACT},
  521. {"dcm", "DC_miss_nospec", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_EXACT},
  522. {"l3m_spec", "DC_miss_local_hit~emask=0x6", REGNO_ANY, STXT ("L3 D-cache Speculative Misses"), PRELOADS_5, 0, ABST_NONE, STXT ("Loads that speculatively missed local L3")}, // T4 encoding (430 lm, 690 rm) ~5 misses overlap on t5/pico_ile
  523. // {"l3m_spec", "DC_miss_local_hit~emask=0x30", REGNO_ANY, STXT("L3 D-cache Speculative Misses"),PRELOADS_5,0, ABST_NONE, STXT("Loads that speculatively missed local L3")}, // T5/M6 encoding (430 lm, 690 rm) ~5 misses overlap on t5/pico_ile
  524. {"lmh_spec", "DC_miss_local_hit", REGNO_ANY, STXT ("Local Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  525. {"rmh_spec", "DC_miss_remote_L3_hit", REGNO_ANY, STXT ("Remote Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  526. //
  527. {"dtlbm", "DTLB_miss_asynch", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_55, 0, ABST_NONE}, // 10@l1 hit, 24@l2 hit, 60@l3 hit, 500@l3 miss, 5000@trap 0.001 events/cycle
  528. {"dtlb_hwtw_stalls", "DTLB_HWTW_all", REGNO_ANY, STXT ("DTLB HWTW Est Stalls"), PRELOADS_55, 25, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss requiring a HW tablewalk")}, // l2-20, l3-50
  529. {"dtlb_trap_stalls", "DTLB_fill_trap", REGNO_ANY, STXT ("DTLB Trap Est Stalls"), PRELOADS_35, 5000, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss with HW tablewalk unsuccessful")}, // 5000@trap
  530. {"rawhaz", "RAW_hit_st_q~emask=0xf", REGNO_ANY, STXT ("Read-after-write Hazards"), PRELOADS_55, 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write hazards)")},
  531. {"br_msp_stalls", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict Stalls"), PRELOADS_6, 24, ABST_NONE, STXT ("Estimated time stalled on Branch mispredictions")}, // 24@miss, %5 of branches is bad
  532. {"br_msp", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict"), PRELOADS_6, 0, ABST_NONE}, // 24@miss, %5 of branches is bad
  533. {"br_tkn", "Br_taken", REGNO_ANY, STXT ("Branch Taken"), PRELOADS_7, 0, ABST_NONE}, // 2 cycles minimum
  534. {"br_ins", "Branches", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE}, // 24@miss, %5 of branches is bad
  535. {"fgu", "Instr_FGU_crypto", REGNO_ANY, STXT ("FP/VIS/Crypto Instructions"), PRELOADS_7, 0, ABST_NONE}, // 1 cycle/event
  536. /* explicit definitions of (hidden) entries for proper counters */
  537. /* Counters that can be time converted, support memspace, or have a short_desc need to be in this table */
  538. {"Sel_pipe_drain_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting with correct instructions when pipeline has to drain after branch misprediction")},
  539. {"Sel_0_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting for various conditions to be resolved")},
  540. {"Sel_0_ready", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread was ready to have its instructions selected but another hardware thread was selected instead")},
  541. {"Sel_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that only 1 instruction or uop was selected")},
  542. {"Sel_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that 2 instructions or uops were selected")},
  543. {"Pick_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  544. {"Pick_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  545. {"Pick_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  546. {"Pick_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  547. {"Pick_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  548. {"Branches", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Control transfer instructions completed, excluding trap-related transfers")},
  549. {"Instr_FGU_crypto", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("FP and VIS instructions completed by the Floating Point and Graphics Unit")},
  550. {"Instr_ld", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Load instructions completed")},
  551. {"Instr_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Store instructions completed")},
  552. {"SPR_ring_ops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Specialized instructions that require internal use of SPR ring completed")},
  553. {"Instr_other", NULL, REGNO_ANY, NULL, PRELOAD (2, 4), 0, ABST_NONE, STXT ("Basic arithmetic and logical instructions completed")},
  554. {"Instr_all", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 0, ABST_NONE, STXT ("Total instructions completed")},
  555. {"Br_taken", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branch instructions taken and completed")},
  556. {"Sw_count_intr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("SW Count instructions completed")},
  557. {"Atomics", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Atomic instructions, including CASA/XA, completed")},
  558. {"SW_prefetch", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("PREFETCH and PREFETCHA instructions completed")},
  559. {"Block_ld_st", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Block load/store instructions completed")},
  560. {"BTC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branches delayed a few extra cycles because branch target not found in Branch Target Cache")},
  561. {"ITLB_fill_8KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 8K page")},
  562. {"ITLB_fill_64KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 64K page")},
  563. {"ITLB_fill_4MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 4M page")},
  564. {"ITLB_fill_256MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 256M page")},
  565. {"ITLB_fill_2GB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  566. {"ITLB_fill_trap", NULL, REGNO_ANY, NULL, PRELOAD (1000, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk unsuccessful")},
  567. {"ITLB_miss_asynch", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk search done")},
  568. {"Fetch_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  569. {"Fetch_0_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  570. {"Instr_buffer_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  571. {"PQ_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  572. {"ROB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  573. {"LB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  574. {"ROB_LB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  575. {"SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  576. {"ROB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  577. {"LB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  578. {"ROB_LB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  579. {"DTLB_miss_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  580. {"ITLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L2D")},
  581. {"ITLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  582. {"ITLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk missed all local caches")},
  583. {"DTLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L2D")},
  584. {"DTLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  585. {"DTLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk missed all local caches")},
  586. {"DTLB_HWTW_all", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss requiring HW tablewalk")},
  587. {"DC_miss_L2_L3_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT},
  588. {"DC_miss_local_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_EXACT},
  589. {"DC_miss_remote_L3_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_EXACT},
  590. {"DC_miss_nospec", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT, STXT ("Loads that missed local L1D")},
  591. {"DTLB_fill_8KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 8K page")},
  592. {"DTLB_fill_64KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 64K page")},
  593. {"DTLB_fill_4MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 4M page")},
  594. {"DTLB_fill_256MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 256M page")},
  595. {"DTLB_fill_2GB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  596. {"DTLB_fill_trap", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk unsuccessful")},
  597. {"DTLB_miss_asynch", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk search done")},
  598. {"RAW_hit_st_buf", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) still in store buffer not yet committed")},
  599. {"RAW_hit_st_q", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) committed but in store queue not yet written to L2D")},
  600. {"St_q_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  601. {"St_hit_L2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L2D")},
  602. {"St_hit_L3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L3")},
  603. {"DC_miss_L2_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local L2D or L3")},
  604. {"DC_miss_local_hit", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local memory")},
  605. {"DC_miss_remote_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit remote cache or remote memory")},
  606. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed L1D")},
  607. {"L2_pipe_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  608. {"Br_dir_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction was mispredicted")},
  609. {"Br_trg_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose target was mispredicted")},
  610. {"Br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction or target was mispredicted")},
  611. {"Cycles_user", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 1, ABST_NONE, STXT ("Cycles hardware thread is active in specified mode(s)")},
  612. //
  613. {"Commit_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from this hardware thread")},
  614. {"Commit_0_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from any hardware thread on this core")},
  615. {"Commit_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 uop commits from this hardware thread")},
  616. {"Commit_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 2 uops commit from this hardware thread")},
  617. {"Commit_1_or_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 or 2 uops commit from this hardware thread")},
  618. /* additional (hidden) aliases, for convenience */
  619. {"cycles0", "Cycles_user", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  620. {"cycles1", "Cycles_user", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  621. {"insts0", "Instr_all", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  622. {"insts1", "Instr_all", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  623. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  624. };
  625. static Hwcentry sparc_t5_m6[] = {
  626. // Identical to sparc_t4 except for: l3m_spec
  627. // when updating this table, also update sparc_t4[]
  628. // obsolete aliases marked with REGNO_INVALID (allows reading of older experiments)
  629. {"l2l3dh", "DC_miss_L2_L3_hit_nospec", REGNO_INVALID, STXT ("L2 or L3 D-cache Hits"), PRELOADS_6, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  630. {"l3m", "DC_miss_remote_L3_hit_nospec~emask=0x6", REGNO_INVALID, STXT ("L3 D-cache Misses"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  631. {"lmh", "DC_miss_local_hit_nospec", REGNO_INVALID, STXT ("Local Mem. Hits"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  632. {"rmh", "DC_miss_remote_L3_hit_nospec", REGNO_INVALID, STXT ("Remote Mem. Hits"), PRELOADS_5, 0, ABST_EXACT}, // undercounts due to thread-hog issue
  633. {"pqs", "PQ_tag_wait", REGNO_INVALID, STXT ("Pick Queue Stalls"), PRELOADS_7, 1, ABST_NONE}, // old alias name
  634. {"raw_stb", "RAW_hit_st_buf", REGNO_INVALID, STXT ("RAW Hazard in Store Buffer"), PRELOADS_55, 0, ABST_NONE}, // 11@full hit, 60@partial hit (in future, combine w/st_q)
  635. {"raw_stq", "RAW_hit_st_q", REGNO_INVALID, STXT ("RAW Hazard in Store Queue"), PRELOADS_55, 0, ABST_NONE}, // 11@full hit, 60@partial hit (in future, combine w/st_buf)
  636. {"sel_stalls", "Sel_0_ready", REGNO_INVALID, STXT ("Stalls Another Thread Selected"), PRELOADS_7, 1, ABST_NONE},
  637. {"icm", "IC_miss", REGNO_INVALID, STXT ("L1 I-Cache Misses"), PRELOADS_55, 0, ABST_NONE}, // 20@ l2/l3 hit (guess)
  638. {"icm_stalls", "IC_miss", REGNO_INVALID, STXT ("L1 I-Cache Miss Est Stalls"), PRELOADS_55, 25, ABST_NONE}, // 25@ l2-20/l3-50
  639. // current aliases
  640. SPARC_CYCLES
  641. {"cycles", "Cycles_user", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  642. {"insts", "Instr_all", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  643. {"c_stalls", "Commit_0", REGNO_ANY, STXT ("Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  644. {"loads", "Instr_ld", REGNO_ANY, STXT ("Load Instructions"), PRELOADS_7, 0, ABST_EXACT},
  645. {"stores", "Instr_st", REGNO_ANY, STXT ("Store Instructions"), PRELOADS_7, 0, ABST_EXACT},
  646. {"dcm", "DC_miss_nospec", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_EXACT},
  647. // {"l3m_spec", "DC_miss_local_hit~emask=0x6", REGNO_ANY, STXT("L3 D-cache Speculative Misses"),PRELOADS_5,0, ABST_NONE, STXT("Loads that speculatively missed local L3")}, // T4 encoding (430 lm, 690 rm) ~5 misses overlap on t5/pico_ile
  648. {"l3m_spec", "DC_miss_local_hit~emask=0x30", REGNO_ANY, STXT ("L3 D-cache Speculative Misses"), PRELOADS_5, 0, ABST_NONE, STXT ("Loads that speculatively missed local L3")}, // T5/M6 encoding (430 lm, 690 rm) ~5 misses overlap on t5/pico_ile
  649. {"lmh_spec", "DC_miss_local_hit", REGNO_ANY, STXT ("Local Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  650. {"rmh_spec", "DC_miss_remote_L3_hit", REGNO_ANY, STXT ("Remote Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  651. //
  652. {"dtlbm", "DTLB_miss_asynch", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_55, 0, ABST_NONE}, // 10@l1 hit, 24@l2 hit, 60@l3 hit, 500@l3 miss, 5000@trap 0.001 events/cycle
  653. {"dtlb_hwtw_stalls", "DTLB_HWTW_all", REGNO_ANY, STXT ("DTLB HWTW Est Stalls"), PRELOADS_55, 25, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss requiring a HW tablewalk")}, // l2-20, l3-50
  654. {"dtlb_trap_stalls", "DTLB_fill_trap", REGNO_ANY, STXT ("DTLB Trap Est Stalls"), PRELOADS_35, 5000, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss with HW tablewalk unsuccessful")}, // 5000@trap
  655. {"rawhaz", "RAW_hit_st_q~emask=0xf", REGNO_ANY, STXT ("Read-after-write Hazards"), PRELOADS_55, 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write hazards)")},
  656. {"br_msp_stalls", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict Stalls"), PRELOADS_6, 24, ABST_NONE, STXT ("Estimated time stalled on Branch mispredictions")}, // 24@miss, %5 of branches is bad
  657. {"br_msp", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict"), PRELOADS_6, 0, ABST_NONE}, // 24@miss, %5 of branches is bad
  658. {"br_tkn", "Br_taken", REGNO_ANY, STXT ("Branch Taken"), PRELOADS_7, 0, ABST_NONE}, // 2 cycles minimum
  659. {"br_ins", "Branches", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE}, // 24@miss, %5 of branches is bad
  660. {"fgu", "Instr_FGU_crypto", REGNO_ANY, STXT ("FP/VIS/Crypto Instructions"), PRELOADS_7, 0, ABST_NONE}, // 1 cycle/event
  661. /* explicit definitions of (hidden) entries for proper counters */
  662. /* Counters that can be time converted, support memspace, or have a short_desc need to be in this table */
  663. {"Sel_pipe_drain_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting with correct instructions when pipeline has to drain after branch misprediction")},
  664. {"Sel_0_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting for various conditions to be resolved")},
  665. {"Sel_0_ready", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread was ready to have its instructions selected but another hardware thread was selected instead")},
  666. {"Sel_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that only 1 instruction or uop was selected")},
  667. {"Sel_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that 2 instructions or uops were selected")},
  668. {"Pick_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  669. {"Pick_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  670. {"Pick_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  671. {"Pick_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  672. {"Pick_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  673. {"Branches", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Control transfer instructions completed, excluding trap-related transfers")},
  674. {"Instr_FGU_crypto", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("FP and VIS instructions completed by the Floating Point and Graphics Unit")},
  675. {"Instr_ld", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Load instructions completed")},
  676. {"Instr_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Store instructions completed")},
  677. {"SPR_ring_ops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Specialized instructions that require internal use of SPR ring completed")},
  678. {"Instr_other", NULL, REGNO_ANY, NULL, PRELOAD (2, 4), 0, ABST_NONE, STXT ("Basic arithmetic and logical instructions completed")},
  679. {"Instr_all", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 0, ABST_NONE, STXT ("Total instructions completed")},
  680. {"Br_taken", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branch instructions taken and completed")},
  681. {"Sw_count_intr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("SW Count instructions completed")},
  682. {"Atomics", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Atomic instructions, including CASA/XA, completed")},
  683. {"SW_prefetch", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("PREFETCH and PREFETCHA instructions completed")},
  684. {"Block_ld_st", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Block load/store instructions completed")},
  685. {"BTC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branches delayed a few extra cycles because branch target not found in Branch Target Cache")},
  686. {"ITLB_fill_8KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 8K page")},
  687. {"ITLB_fill_64KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 64K page")},
  688. {"ITLB_fill_4MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 4M page")},
  689. {"ITLB_fill_256MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 256M page")},
  690. {"ITLB_fill_2GB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  691. {"ITLB_fill_trap", NULL, REGNO_ANY, NULL, PRELOAD (1000, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk unsuccessful")},
  692. {"ITLB_miss_asynch", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk search done")},
  693. {"Fetch_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  694. {"Fetch_0_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  695. {"Instr_buffer_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  696. {"PQ_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  697. {"ROB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  698. {"LB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  699. {"ROB_LB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  700. {"SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  701. {"ROB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  702. {"LB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  703. {"ROB_LB_SB_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  704. {"DTLB_miss_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  705. {"ITLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L2D")},
  706. {"ITLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  707. {"ITLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk missed all local caches")},
  708. {"DTLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L2D")},
  709. {"DTLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  710. {"DTLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk missed all local caches")},
  711. {"DTLB_HWTW_all", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss requiring HW tablewalk")},
  712. {"DC_miss_L2_L3_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT},
  713. {"DC_miss_local_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_EXACT},
  714. {"DC_miss_remote_L3_hit_nospec", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_EXACT},
  715. {"DC_miss_nospec", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT, STXT ("Loads that missed local L1D")},
  716. {"DTLB_fill_8KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 8K page")},
  717. {"DTLB_fill_64KB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 64K page")},
  718. {"DTLB_fill_4MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 4M page")},
  719. {"DTLB_fill_256MB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 256M page")},
  720. {"DTLB_fill_2GB", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  721. {"DTLB_fill_trap", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk unsuccessful")},
  722. {"DTLB_miss_asynch", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk search done")},
  723. {"RAW_hit_st_buf", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) still in store buffer not yet committed")},
  724. {"RAW_hit_st_q", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) committed but in store queue not yet written to L2D")},
  725. {"St_q_tag_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  726. {"St_hit_L2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L2D")},
  727. {"St_hit_L3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L3")},
  728. {"DC_miss_L2_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local L2D or L3")},
  729. {"DC_miss_local_hit", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local memory")},
  730. {"DC_miss_remote_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit remote cache or remote memory")},
  731. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed L1D")},
  732. {"L2_pipe_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  733. {"Br_dir_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction was mispredicted")},
  734. {"Br_trg_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose target was mispredicted")},
  735. {"Br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction or target was mispredicted")},
  736. {"Cycles_user", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 1, ABST_NONE, STXT ("Cycles hardware thread is active in specified mode(s)")},
  737. //
  738. {"Commit_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from this hardware thread")},
  739. {"Commit_0_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from any hardware thread on this core")},
  740. {"Commit_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 uop commits from this hardware thread")},
  741. {"Commit_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 2 uops commit from this hardware thread")},
  742. {"Commit_1_or_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 or 2 uops commit from this hardware thread")},
  743. /* additional (hidden) aliases, for convenience */
  744. {"cycles0", "Cycles_user", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  745. {"cycles1", "Cycles_user", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  746. {"insts0", "Instr_all", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  747. {"insts1", "Instr_all", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  748. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  749. };
  750. static Hwcentry sparc_m7[] = {
  751. // obsolete aliases marked with REGNO_INVALID (allows reading of older experiments)
  752. {"icm", "IC_miss_commit", REGNO_INVALID, STXT ("L1 I-Cache Misses"), PRELOADS_6, 0, ABST_EXACT},
  753. {"raw_stb", "RAW_hit_st_buf", REGNO_INVALID, STXT ("RAW Hazard in Store Buffer"), PRELOADS_55, 0, ABST_NONE},
  754. {"raw_stq", "RAW_hit_st_q", REGNO_INVALID, STXT ("RAW Hazard in Store Queue"), PRELOADS_55, 0, ABST_NONE},
  755. {"pqs", "PQ_tag_wait_cyc", REGNO_INVALID, STXT ("Pick Queue Stalls"), PRELOADS_7, 1, ABST_NONE},
  756. {"sel_stalls", "Sel_0_ready_cyc", REGNO_INVALID, STXT ("Stalls Another Thread Selected"), PRELOADS_7, 1, ABST_NONE},
  757. // current aliases
  758. SPARC_CYCLES
  759. {"cycles", "Cycles_user", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  760. {"insts", "Instr_all", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  761. {"c_stalls", "Commit_0_cyc", REGNO_ANY, STXT ("Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  762. {"loads", "Instr_ld", REGNO_ANY, STXT ("Load Instructions"), PRELOADS_7, 0, ABST_EXACT},
  763. {"stores", "Instr_st", REGNO_ANY, STXT ("Store Instructions"), PRELOADS_6, 0, ABST_EXACT},
  764. {"dcm", "DC_miss_commit", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_6, 0, ABST_EXACT},
  765. {"l3m_spec", "DC_miss_L3_miss", REGNO_ANY, STXT ("L3 D-cache Speculative Misses"), PRELOADS_5, 0, ABST_NONE},
  766. {"lmh_spec", "DC_miss_local_mem_hit", REGNO_ANY, STXT ("Local Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  767. {"rmh_spec", "DC_miss_remote_mem_hit", REGNO_ANY, STXT ("Remote Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  768. //
  769. {"dtlbm", "DTLB_HWTW_search", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_55, 0, ABST_NONE}, // 10@l1 hit, 24@l2 hit, 60@l3 hit, 500@l3 miss, 5000@trap 0.001 events/cycle
  770. {"dtlb_hwtw_stalls", "DTLB_HWTW_ref", REGNO_ANY, STXT ("DTLB HWTW Est Stalls"), PRELOADS_55, 25, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss requiring a HW tablewalk")}, // l2-20, l3-50
  771. {"dtlb_trap_stalls", "DTLB_HWTW_miss_trap", REGNO_ANY, STXT ("DTLB Trap Est Stalls"), PRELOADS_35, 5000, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss with HW tablewalk unsuccessful")}, // 5000@trap
  772. {"rawhaz", "RAW_hit_st_q~emask=0xf", REGNO_ANY, STXT ("Read-after-write Hazards"), PRELOADS_55, 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write hazards)")},
  773. {"br_msp_stalls", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict Stalls"), PRELOADS_6, 24, ABST_NONE, STXT ("Estimated time stalled on Branch mispredictions")}, // 24@miss, %5 of branches is bad
  774. {"br_msp", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict"), PRELOADS_6, 0, ABST_NONE},
  775. {"br_tkn", "Br_taken", REGNO_ANY, STXT ("Branch Taken"), PRELOADS_7, 0, ABST_NONE},
  776. {"br_ins", "Branches", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE},
  777. {"fgu", "Instr_FGU_crypto", REGNO_ANY, STXT ("FP/VIS/Crypto Instructions"), PRELOADS_7, 0, ABST_NONE},
  778. {"spill_fill", "Flush_arch_exception", REGNO_ANY, STXT ("Reg Window Spill/Fill Est Stalls"), PRELOAD (100, 4), 80, ABST_NONE, STXT ("Estimated time stalled on flushing pipeline due to register window spill/fill")},
  779. /* explicit definitions of (hidden) entries for proper counters */
  780. /* Counters that can be time converted, support memspace, or have a short_desc need to be in this table */
  781. {"Sel_pipe_drain_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting with correct instructions when pipeline has to drain after branch misprediction")},
  782. {"Sel_0_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting for various conditions to be resolved")},
  783. {"Sel_0_ready_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread was ready to have its instructions selected but another hardware thread was selected instead")},
  784. {"Sel_1_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that only 1 instruction or uop was selected")},
  785. {"Sel_2_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles that 2 instructions or uops were selected")},
  786. {"Pick_0_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  787. {"Pick_1_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  788. {"Pick_2_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  789. {"Pick_3_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  790. {"Pick_any_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  791. {"Branches", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Control transfer instructions completed, excluding trap-related transfers")},
  792. {"Instr_FGU_crypto", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("FP and VIS instructions completed by the Floating Point and Graphics Unit")},
  793. {"Instr_ld", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Load instructions completed")},
  794. {"Instr_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Store instructions completed")},
  795. {"Instr_SPR_ring_ops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Specialized instructions that require internal use of SPR ring completed")},
  796. {"Instr_other", NULL, REGNO_ANY, NULL, PRELOAD (2, 4), 0, ABST_NONE, STXT ("Basic arithmetic and logical instructions completed")},
  797. {"Instr_all", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 0, ABST_NONE, STXT ("Total instructions completed")},
  798. {"Br_taken", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branch instructions taken and completed")},
  799. {"Instr_SW_count", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("SW Count instructions completed")},
  800. {"Instr_atomic", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Atomic instructions, including CASA/XA, completed")},
  801. {"Instr_SW_prefetch", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("PREFETCH and PREFETCHA instructions completed")},
  802. {"Instr_block_ld_st", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_EXACT, STXT ("Block load/store instructions completed")},
  803. {"Br_BTC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branches delayed a few extra cycles because branch target not found in Branch Target Cache")},
  804. {"ITLB_HWTW_hit_8K", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 8K page")},
  805. {"ITLB_HWTW_hit_64K", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 64K page")},
  806. {"ITLB_HWTW_hit_4M", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 4M page")},
  807. {"ITLB_HWTW_hit_256M", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 256M page")},
  808. {"ITLB_HWTW_hit_2G_16G", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  809. {"ITLB_HWTW_miss_trap", NULL, REGNO_ANY, NULL, PRELOAD (1000, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk unsuccessful")},
  810. {"ITLB_HWTW_search", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk search done")},
  811. {"Fetch_0_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  812. {"Fetch_0_all_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  813. {"Instr_buffer_full_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  814. {"PQ_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  815. {"ROB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  816. {"LB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  817. {"SB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  818. {"ROB_LB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  819. {"ROB_SB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  820. {"LB_SB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  821. {"ROB_LB_SB_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  822. {"DTLB_miss_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  823. {"ITLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L2D")},
  824. {"ITLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  825. {"ITLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk missed all local caches")},
  826. {"DTLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L2D")},
  827. {"DTLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  828. {"DTLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk missed all local caches")},
  829. {"DTLB_HWTW_ref", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss requiring HW tablewalk")},
  830. {"DC_miss_L2_L3_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT},
  831. {"DC_miss_nbr_scc_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_EXACT},
  832. {"DC_miss_nbr_scc_miss_commit", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_EXACT},
  833. {"DC_miss_commit", NULL, REGNO_ANY, NULL, PRELOAD (25, 4), 0, ABST_EXACT, STXT ("Loads that missed local L1D")},
  834. {"DTLB_HWTW_hit_8K", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 8K page")},
  835. {"DTLB_HWTW_hit_64K", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 64K page")},
  836. {"DTLB_HWTW_hit_4M", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 4M page")},
  837. {"DTLB_HWTW_hit_256M", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 256M page")},
  838. {"DTLB_HWTW_hit_2G_16G", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 2G or 16G page")},
  839. {"DTLB_HWTW_miss_trap", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk unsuccessful")},
  840. {"DTLB_HWTW_search", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk search done")},
  841. {"RAW_hit_st_buf", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) still in store buffer not yet committed")},
  842. {"RAW_hit_st_q", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) committed but in store queue not yet written to L2D")},
  843. {"St_q_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  844. {"St_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L2D")},
  845. {"St_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L3")},
  846. {"DC_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Loads that speculatively hit local L1D")},
  847. {"DC_miss_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (20, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local L2D")},
  848. {"DC_miss_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local L3")},
  849. {"DC_miss_nbr_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (100, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit neighbor L2D via local L3")},
  850. {"DC_miss_nbr_scc_hit", NULL, REGNO_ANY, NULL, PRELOAD (100, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit neighbor L3 on same socket")},
  851. {"DC_miss_nbr_scc_miss", NULL, REGNO_ANY, NULL, PRELOAD (400, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed all caches on same socket")},
  852. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOAD (10, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed local L1D")},
  853. {"DC_miss_L2_miss", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed local L2D")},
  854. {"DC_miss_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (200, 4), 0, ABST_NONE, STXT ("Loads that speculatively missed local L3")},
  855. {"DC_miss_remote_scc_hit", NULL, REGNO_ANY, NULL, PRELOAD (800, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit remote cache on different socket")},
  856. {"DC_miss_local_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (500, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit local memory")},
  857. {"DC_miss_remote_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (1000, 4), 0, ABST_NONE, STXT ("Loads that speculatively hit remote memory")},
  858. {"Br_dir_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction was mispredicted")},
  859. {"Br_tgt_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose target was mispredicted")},
  860. {"Br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Branch instructions completed whose direction or target was mispredicted")},
  861. {"Cycles_user", NULL, REGNO_ANY, NULL, PRELOAD (1, 4), 1, ABST_NONE, STXT ("Cycles hardware thread is active in specified mode(s)")},
  862. {"Flush_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Pipeline flushes due to a load that misses L3 when more than 1 hardware thread is active on the core")},
  863. {"Flush_br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Pipeline flushes due to a branch misprediction")},
  864. {"Flush_arch_exception", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Pipeline flushes due to SPARC architecture exceptions and trap entry/return")},
  865. {"Flush_other", NULL, REGNO_ANY, NULL, PRELOAD (40, 4), 0, ABST_NONE, STXT ("Pipeline flushes due to hardware thread state change to/from halted/paused state")},
  866. //
  867. {"Commit_0_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from this hardware thread")},
  868. {"Commit_0_all_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from any hardware thread on this core")},
  869. {"Commit_1_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 uop commits from this hardware thread")},
  870. {"Commit_2_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 2 uops commit from this hardware thread")},
  871. {"Commit_1_or_2_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles 1 or 2 uops commit from this hardware thread")},
  872. /* additional (hidden) aliases, for convenience */
  873. {"cycles0", "Cycles_user", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  874. {"cycles1", "Cycles_user", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  875. {"insts0", "Instr_all", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  876. {"insts1", "Instr_all", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  877. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  878. };
  879. static Hwcentry sparc_m8[] = {
  880. // current aliases
  881. SPARC_CYCLES
  882. {"cycles", "Cycles_user", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  883. {"insts", "Instr_all", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  884. {"c_stalls", "Commit_0_cyc", 3, STXT ("Stall Cycles"), PRELOADS_7, 1, ABST_NONE}, // 22825776: limit to reg 3
  885. {"Sel_0_wait_cyc", "Sel_0_cyc~emask=0x3f", REGNO_ANY, STXT ("Select Stall Cycles"), PRELOADS_7, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting for various conditions to be resolved that prevent it being selected")},
  886. {"loads", "Instr_ld", REGNO_ANY, STXT ("Load Instructions"), PRELOADS_7, 0, ABST_EXACT},
  887. {"stores", "Instr_st", REGNO_ANY, STXT ("Store Instructions"), PRELOADS_6, 0, ABST_EXACT},
  888. {"dcm", "DC_miss_commit", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_6, 0, ABST_EXACT},
  889. {"lmh_spec", "DC_miss_local_mem_hit", REGNO_ANY, STXT ("Local Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  890. {"rmh_spec", "DC_miss_remote_mem_hit", REGNO_ANY, STXT ("Remote Mem Speculative Hits"), PRELOADS_5, 0, ABST_NONE},
  891. {"dtlbm", "DTLB_HWTW", REGNO_ANY, STXT ("DTLB Misses"), PRELOAD (40, 5), 0, ABST_NONE}, // 10@l1 hit, 24@l2 hit, 60@l3 hit, 500@l3 miss, 5000@trap 0.001 events/cycle
  892. {"dtlb_hwtw_stalls", "DTLB_HWTW", REGNO_ANY, STXT ("DTLB HWTW Est Stalls"), PRELOAD (40, 5), 25, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss requiring a HW tablewalk")}, // l2-20, l3-50
  893. {"dtlb_trap_stalls", "DTLB_HWTW_miss_trap", REGNO_ANY, STXT ("DTLB Trap Est Stalls"), PRELOAD (800, 5), 5000, ABST_NONE, STXT ("Estimated time stalled on a DTLB miss with HW tablewalk unsuccessful")}, // 5000@trap
  894. {"rawhaz", "RAW_hit", REGNO_ANY, STXT ("Read-after-write Hazards"), PRELOAD (40, 5), 0, ABST_NONE},
  895. {"br_msp_stalls", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict Stalls"), PRELOAD (40, 5), 24, ABST_NONE, STXT ("Estimated time stalled on Branch mispredictions")}, // 24@miss, %5 of branches is bad
  896. {"br_msp", "Br_mispred", REGNO_ANY, STXT ("Branch Mispredict"), PRELOAD (40, 5), 0, ABST_NONE},
  897. {"br_tkn", "Br_taken", REGNO_ANY, STXT ("Branch Taken"), PRELOADS_7, 0, ABST_NONE},
  898. {"br_ins", "Branches", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE},
  899. {"fgu", "Instr_FGU_crypto", REGNO_ANY, STXT ("FP/VIS/Crypto Instructions"), PRELOADS_7, 0, ABST_NONE},
  900. {"spill_fill", "Flush_spill_fill", REGNO_ANY, STXT ("Reg Window Spill/Fill Est Stalls"), PRELOAD (100, 5), 80, ABST_NONE, STXT ("Estimated time stalled on flushing pipeline due to register window spill/fill")},
  901. /* explicit definitions of (hidden) entries for proper counters */
  902. /* Counters that can be time converted, support memspace, or have a short_desc need to be in this table */
  903. //0x01
  904. {"Fetch_stall_IFU_reset_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  905. {"Fetch_stall_IC_miss_MB_full_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  906. {"Fetch_stall_IC_miss_MB_avail_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  907. {"Fetch_stall_IC_miss_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  908. {"Fetch_stall_ITLB_miss_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  909. {"Fetch_stall_SEL_buf_full_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  910. {"Fetch_ready_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  911. {"Fetch_0_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  912. {"Fetch_0_all_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  913. //0x02
  914. {"Fetch_1_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  915. {"Fetch_2_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  916. {"Fetch_3_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  917. {"Fetch_4_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  918. {"Fetch_5_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  919. {"Fetch_6_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  920. {"Fetch_7_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  921. {"Fetch_8_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  922. {"Fetch_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  923. //0x07
  924. {"ITLB_HWTW_hit_8K", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 8K page")},
  925. {"ITLB_HWTW_hit_64K", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 64K page")},
  926. {"ITLB_HWTW_hit_4M", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 4M page")},
  927. {"ITLB_HWTW_hit_256M", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 256M page")},
  928. {"ITLB_HWTW_hit_16G", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 16G page")},
  929. {"ITLB_HWTW_hit_1T", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk successfully loaded translation for 1T page")},
  930. // { "ITLB_HWTW_miss_RA2PAC", 0x0740, 0xf07ff },
  931. // { "ITLB_HWTW_miss_not_RA2PAC", 0x0780, 0xf07ff },
  932. {"ITLB_HWTW_miss_trap", NULL, REGNO_ANY, NULL, PRELOAD (1000, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk unsuccessful")},
  933. {"ITLB_HWTW", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk search done")},
  934. //0x08
  935. {"Br_BTC_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branches delayed a few extra cycles because branch target not found in Branch Target Cache")},
  936. //0x09
  937. {"Sel_0_no_instr_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select because no instructions are available")},
  938. {"Sel_0_pipe_drain_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting with correct instructions when pipeline has to drain after branch misprediction")},
  939. {"Sel_0_postsync_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select waiting for prior instructions to commit")},
  940. {"Sel_0_presync_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select with instruction that cannot decode until prior instructions have committed")},
  941. {"Sel_0_thread_hog_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select to prevent strand monopolizing resources")},
  942. {"Sel_0_tag_stall_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread stalls at Select because no required tags are available")},
  943. {"Sel_0_ready_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread was ready to have its instructions selected but another hardware thread was selected instead")},
  944. {"Sel_0_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles a hardware thread is not selected")},
  945. // No direct equivalent Sel_1/2_cyc. Nearest is Decode_uop, which increments by 0-4 each cycle according to how many uops were decoded.
  946. //0x13
  947. {"ITLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L2D")},
  948. {"ITLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  949. {"ITLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 5), 0, ABST_NONE, STXT ("ITLB miss and HW tablewalk missed all local caches")},
  950. {"DTLB_HWTW_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L2D")},
  951. {"DTLB_HWTW_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (80, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk hit local L3 or neighbor L2D")},
  952. {"DTLB_HWTW_L3_miss", NULL, REGNO_ANY, NULL, PRELOAD (800, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk missed all local caches")},
  953. {"DTLB_HWTW_ref", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss requiring HW tablewalk")},
  954. //0x0E
  955. {"Instr_FGU_crypto", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("FP and VIS instructions completed by the Floating Point and Graphics Unit")},
  956. {"Instr_ld", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Load instructions completed")},
  957. {"Instr_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Store instructions completed")},
  958. {"Instr_block_ld_st", NULL, REGNO_ANY, NULL, PRELOAD (20, 5), 0, ABST_EXACT, STXT ("Block load/store instructions completed")},
  959. {"Instr_SPR_ring_ops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("Specialized instructions that require internal use of SPR ring completed")},
  960. {"Instr_atomic", NULL, REGNO_ANY, NULL, PRELOAD (20, 5), 0, ABST_EXACT, STXT ("Atomic instructions, including CASA/XA, completed")},
  961. {"Instr_SW_prefetch", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT, STXT ("PREFETCH and PREFETCHA instructions completed")},
  962. {"Instr_other", NULL, REGNO_ANY, NULL, PRELOAD (2, 5), 0, ABST_NONE, STXT ("Basic arithmetic and logical instructions completed")},
  963. {"Instr_all", NULL, REGNO_ANY, NULL, PRELOAD (1, 5), 0, ABST_NONE, STXT ("Total instructions completed")},
  964. //0x0F
  965. {"Branches", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Control transfer instructions completed, excluding trap-related transfers")},
  966. //0x10
  967. {"Br_taken", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Branch instructions taken and completed")},
  968. //0x11
  969. {"Rename_tag_wait_PQ_1_EXU_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  970. {"Rename_tag_wait_PQ_0_LSU_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  971. {"Rename_wait_crypto_diag_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  972. {"Sel_0_wait_ROB_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  973. {"Sel_0_wait_WRF_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  974. {"Sel_0_wait_LB_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  975. {"Sel_0_wait_SB_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  976. //0x12
  977. {"Fetch_stall_BDA_tag_unavail_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  978. {"Fetch_stall_BTA_tag_unavail_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  979. {"Fetch_stall_misc_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  980. {"Fetch_stall_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  981. {"MMU_TTE_buffer_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  982. {"MMU_PRQ_pool_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  983. //0x15
  984. {"L2I_request_block_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  985. {"L2I_thread_hog_stall_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  986. {"L2I_MB_full_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  987. {"L2I_snoop_eviction", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  988. {"L2I_stall_no_request_credit_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  989. {"L2I_stall_no_response_credit_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  990. //0x16
  991. {"Flush_thread_hog", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes to prevent thread from monopolizing resources")},
  992. {"Flush_br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to a branch misprediction")},
  993. {"Flush_arch_exception", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to SPARC architecture exceptions and trap entry/return")},
  994. {"Flush_evil_twin", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to detecting floating point evil twin condition")},
  995. {"Flush_LSU_trap", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes to refetch Next-PC")},
  996. {"Flush_mode_change", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to strand mode change")},
  997. {"Flush_misalign", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to detecting misaligned load/store requiring transition to misaligned mitigation mode")},
  998. {"Flush_other", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to hardware thread state change to/from halted/paused state")},
  999. {"Flush_all", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to any reason")},
  1000. //0x17
  1001. {"Flush_spill_n_normal", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to spill_n_normal exception")},
  1002. {"Flush_spill_n_other", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to spill_n_other exception")},
  1003. {"Flush_fill_n_normal", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to fill_n_normal exception")},
  1004. {"Flush_fill_n_other", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to fill_n_other exception")},
  1005. {"Flush_spill_fill", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to spill/fill exceptions")},
  1006. {"Flush_lost_load", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Pipeline flushes due to speculatively executed load violating memory order")},
  1007. //0x21
  1008. {"Br_dir_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Branch instructions completed whose direction was mispredicted")},
  1009. {"Br_tgt_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Branch instructions completed whose target was mispredicted")},
  1010. {"Br_mispred", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Branch instructions completed whose direction or target was mispredicted")},
  1011. //0x23
  1012. {"LSU_st_q_tag_wait_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1013. {"LSU_st_q_tag_wait_all_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1014. {"L2D_stall_no_request_credit_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1015. {"L2D_stall_no_response_credit_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1016. //0x27
  1017. {"DC_miss_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (20, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit local L2D")},
  1018. {"DC_miss_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit local L3")},
  1019. {"DC_miss_L3_dirty_copyback", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit local L3 but require copyback from L2D within same CPC")},
  1020. {"DC_miss_nbr_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (100, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit neighbor L3 on same socket")},
  1021. {"DC_miss_remote_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (400, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit remote cache on different socket")},
  1022. {"DC_miss_local_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (500, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit local memory")},
  1023. {"DC_miss_remote_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (1000, 5), 0, ABST_NONE, STXT ("Loads that speculatively hit remote memory")},
  1024. {"DC_miss", NULL, REGNO_ANY, NULL, PRELOAD (10, 5), 0, ABST_NONE, STXT ("Loads that speculatively missed local L1D")},
  1025. //0x28
  1026. {"DC_sec_miss_L2_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1027. {"DC_miss_L2_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1028. {"DC_miss_L3_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1029. {"DC_miss_L3_dirty_copyback_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1030. {"DC_miss_nbr_L3_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1031. {"DC_miss_remote_L3_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1032. {"DC_miss_local_mem_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1033. {"DC_miss_remote_mem_hit_commit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_EXACT},
  1034. {"DC_miss_commit", NULL, REGNO_ANY, NULL, PRELOAD (25, 5), 0, ABST_EXACT, STXT ("Loads that missed local L1D")},
  1035. //0x29
  1036. // {"Store_DC_sec_miss_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT("")},
  1037. {"Store_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (20, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L2D")},
  1038. {"Store_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local L3")},
  1039. {"Store_nbr_L2_hit", NULL, REGNO_ANY, NULL, PRELOAD (100, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in neighbor L2 on same socket")},
  1040. {"Store_nbr_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (100, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in neighbor L3 on same socket")},
  1041. {"Store_remote_L3_hit", NULL, REGNO_ANY, NULL, PRELOAD (400, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in remote cache on different socket")},
  1042. {"Store_local_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (500, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in local memory")},
  1043. {"Store_remote_mem_hit", NULL, REGNO_ANY, NULL, PRELOAD (1000, 5), 0, ABST_NONE, STXT ("Stores whose cacheline being updated was in remote memory")},
  1044. {"Store_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE, STXT ("Stores whose cacheline being updated was observed to be somewhere in the memory hierarchy")},
  1045. //0x2d
  1046. {"RAW_hit_st_buf", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) still in store buffer not yet committed")},
  1047. {"RAW_hit_st_q", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write) committed but in store queue not yet written to L2D")},
  1048. {"RAW_hit", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("Loads delayed by a previous store (read-after-write hazards)")},
  1049. //0x2f
  1050. {"Cycles_user_non_MLA", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1051. {"Cycles_user_MLA", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1052. {"Cycles_user", NULL, REGNO_ANY, NULL, PRELOAD (1, 5), 1, ABST_NONE, STXT ("Cycles hardware thread is active in specified mode(s)")},
  1053. //0x37
  1054. {"DTLB_HWTW_hit_8K", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 8K page")},
  1055. {"DTLB_HWTW_hit_64K", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 64K page")},
  1056. {"DTLB_HWTW_hit_4M", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 4M page")},
  1057. {"DTLB_HWTW_hit_256M", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 256M page")},
  1058. {"DTLB_HWTW_hit_16G", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 16G page")},
  1059. {"DTLB_HWTW_hit_1T", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk successfully loaded translation for 1T page")},
  1060. {"DTLB_HWTW_miss_trap", NULL, REGNO_ANY, NULL, PRELOAD (800, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk unsuccessful")},
  1061. {"DTLB_HWTW", NULL, REGNO_ANY, NULL, PRELOAD (40, 5), 0, ABST_NONE, STXT ("DTLB miss and HW tablewalk search done")},
  1062. //0x3f
  1063. {"Commit_0_cyc", /*22825776*/ NULL, 3, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from this hardware thread")},
  1064. {"Commit_0_all_cyc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE, STXT ("Cycles no uop commits from any hardware thread on this core")},
  1065. // Similar situation to Sel_1_cyc etc. No direct equivalent, nearest is Commit_uop, which increments by 0-4 each cycle according to how many uops were committed.
  1066. /* additional (hidden) aliases, for convenience */
  1067. {"cycles0", "Cycles_user", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  1068. {"cycles1", "Cycles_user", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  1069. {"insts0", "Instr_all", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1070. {"insts1", "Instr_all", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1071. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1072. };
  1073. static Hwcentry usfuji_V_list[] = {
  1074. {"cycles", "cycle_counts", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  1075. {"insts", "instruction_counts", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  1076. {"flops", "floating_instructions", REGNO_ANY, STXT ("Floating-point Ops"), PRELOADS_6, 0, ABST_NONE},
  1077. /* explicit definitions of (hidden) entries for proper counters */
  1078. /* Only counters that can be time converted, or are load-store need to be in this table */
  1079. {"cycle_counts", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  1080. {"load_store_instructions", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1081. /* additional (hidden) aliases for convenience */
  1082. {"cycles0", "cycle_counts", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  1083. {"cycles1", "cycle_counts", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  1084. {"insts0", "instruction_counts", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  1085. {"insts1", "instruction_counts", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  1086. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1087. };
  1088. static Hwcentry usfuji_VI_VII_list[] = {
  1089. {"cycles", "cycle_counts", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1090. {"insts", "instruction_counts", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1091. {"dcm", "op_r_iu_req_mi_go", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_6, 0, ABST_NONE},
  1092. {"dcstall", "op_wait_all", REGNO_ANY, STXT ("L1 D-cache Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  1093. {"dtlbm", "write_op_uTLB", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_5, 0, ABST_NONE},
  1094. // l2m: mem_cache_load test shows undercount of 3x, however, we don't care too much about this chip, keeping the alias for now
  1095. {"l2m", "sx_miss_count_dm", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_5, 0, ABST_NONE}, /*YXXX undercounts?*/
  1096. {"l2wm", "dvp_count_dm", REGNO_ANY, STXT ("L2 Cache Writeback Misses"), PRELOADS_5, 0, ABST_NONE},
  1097. {"l2ref", "sx_read_count_dm", REGNO_ANY, STXT ("L2 Cache Refs"), PRELOADS_6, 0, ABST_NONE},
  1098. {"l2stall", "sx_miss_wait_dm", REGNO_ANY, STXT ("L2 Cache Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  1099. {"icm", "if_r_iu_req_mi_go", REGNO_ANY, STXT ("L1 I-cache Misses"), PRELOADS_6, 0, ABST_NONE},
  1100. {"icstall", "if_wait_all", REGNO_ANY, STXT ("L1 I-cache Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  1101. {"itlbm", "write_if_uTLB", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  1102. {"flops", "floating_instructions", REGNO_ANY, STXT ("Floating-point Ops"), PRELOADS_7, 0, ABST_NONE},
  1103. /* explicit definitions of (hidden) entries for proper counters */
  1104. /* Only counters that can be time converted, or are load-store need to be in this table */
  1105. {"cycle_counts", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1106. {"op_stv_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1107. {"load_store_instructions", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1108. {"active_cycle_count", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1109. {"op_stv_wait_sxmiss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1110. {"branch_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1111. {"write_op_uTLB", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1112. {"sx_miss_wait_pf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1113. {"sx_miss_wait_dm", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1114. {"op_stv_wait_nc_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1115. {"op_stv_wait_sxmiss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1116. {"eu_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1117. {"sx_miss_count_dm", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1118. {"fl_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1119. {"op_r_iu_req_mi_go", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1120. {"sx_miss_count_dm_if", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1121. {"op_stv_wait_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1122. {"swpf_lbs_hit", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1123. {"sx_read_count_dm", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1124. {"trap_DMMU_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1125. {"op_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1126. {"sx_miss_count_dm_opex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1127. {"if_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1128. {"dvp_count_dm", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1129. {"sx_miss_count_dm_opsh", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 0, ABST_NONE},
  1130. /* additional (hidden) aliases for convenience */
  1131. {"cycles0", "cycle_counts", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  1132. {"cycles1", "cycle_counts", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  1133. {"insts0", "instruction_counts", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1134. {"insts1", "instruction_counts", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1135. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1136. };
  1137. static Hwcentry usfuji_X_list[] = {
  1138. {"cycles", "cycle_counts", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1139. {"insts", "instruction_counts", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1140. {"dcm", "L1D_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE},
  1141. {"dcstall", "L1D_wait_all", REGNO_ANY, STXT ("L1 D-cache Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  1142. /* explicit definitions of (hidden) entries for proper counters */
  1143. /* Only counters that can be time converted, or are load-store need to be in this table */
  1144. {"cycle_counts", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1145. {"w_op_stv_wait_nc_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1146. {"op_stv_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1147. {"eu_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1148. {"L2_miss_wait_pf_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1149. {"op_stv_wait_pfp_busy_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1150. {"L2_miss_wait_dm_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1151. {"w_branch_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1152. {"w_op_stv_wait_sxmiss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1153. {"op_stv_wait_nc_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1154. {"L2_miss_wait_pf_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1155. {"w_eu_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1156. {"w_op_stv_wait_sxmiss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1157. {"op_stv_wait_sxmiss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1158. {"branch_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1159. {"L2_miss_wait_dm_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1160. {"d_move_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1161. {"w_op_stv_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1162. {"w_fl_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1163. {"op_stv_wait_pfp_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1164. {"fl_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1165. {"L2_miss_wait_pf_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1166. {"op_stv_wait_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1167. {"L2_miss_wait_dm_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1168. {"w_op_stv_wait_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1169. {"op_stv_wait_sxmiss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1170. {"op_stv_wait_swpf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1171. {"L1D_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1172. {"L2_miss_wait_pf_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1173. {"cse_priority_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1174. {"op_stv_wait_pfp_busy_swpf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1175. {"L1I_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1176. {"L2_miss_wait_dm_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1177. {"single_mode_cycle_counts", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1178. {"suspend_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1179. {"sleep_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1180. /* additional (hidden) aliases for convenience */
  1181. {"cycles0", "cycle_counts", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  1182. {"cycles1", "cycle_counts", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  1183. {"insts0", "instruction_counts", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1184. {"insts1", "instruction_counts", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1185. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1186. };
  1187. static Hwcentry usfuji_XII_list[] = {
  1188. {"cycles", "cycle_counts", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1189. {"insts", "instruction_counts", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1190. {"dcm", "L1D_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE},
  1191. {"dcstall", "L1D_wait_all", REGNO_ANY, STXT ("L1 D-cache Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  1192. /* explicit definitions of (hidden) entries for proper counters */
  1193. /* Only counters that can be time converted, or are load-store need to be in this table */
  1194. {"cycle_counts", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1195. {"L1D_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1196. {"L1I_wait_all", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1197. {"L2_miss_wait_dm_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1198. {"L2_miss_wait_dm_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1199. {"L2_miss_wait_dm_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1200. {"L2_miss_wait_dm_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1201. {"L2_miss_wait_pf_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1202. {"L2_miss_wait_pf_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1203. {"L2_miss_wait_pf_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1204. {"L2_miss_wait_pf_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1205. {"LL_miss_wait_dm_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1206. {"LL_miss_wait_dm_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1207. {"LL_miss_wait_dm_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1208. {"LL_miss_wait_dm_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1209. {"LL_miss_wait_pf_bank0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1210. {"LL_miss_wait_pf_bank1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1211. {"LL_miss_wait_pf_bank2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1212. {"LL_miss_wait_pf_bank3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1213. {"branch_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1214. {"cse_priority_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1215. {"d_move_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1216. {"eu_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1217. {"fl_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1218. {"l2_sy_miss_wait_dm_part1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1219. {"l2_sy_miss_wait_dm_part2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1220. {"msgr_reqp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1221. {"msgr_rtnp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1222. {"msgs_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1223. {"op_stv_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1224. {"op_stv_wait_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1225. {"op_stv_wait_l1d_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1226. {"op_stv_wait_l1d_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1227. {"op_stv_wait_l2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1228. {"op_stv_wait_l2_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1229. {"op_stv_wait_ll_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1230. {"op_stv_wait_ll_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1231. {"op_stv_wait_nc_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1232. {"op_stv_wait_pfp_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1233. {"op_stv_wait_pfp_busy_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1234. {"op_stv_wait_pfp_busy_swpf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1235. {"op_stv_wait_swpf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1236. {"op_stv_wait_sxmiss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1237. {"op_stv_wait_sxmiss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1238. {"w_branch_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1239. {"w_eu_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1240. {"w_fl_comp_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1241. {"w_op_stv_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1242. {"w_op_stv_wait_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1243. {"w_op_stv_wait_l1d_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1244. {"w_op_stv_wait_l1d_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1245. {"w_op_stv_wait_l2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1246. {"w_op_stv_wait_l2_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1247. {"w_op_stv_wait_ll_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1248. {"w_op_stv_wait_ll_miss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1249. {"w_op_stv_wait_nc_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1250. {"w_op_stv_wait_pfp_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1251. {"w_op_stv_wait_pfp_busy_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1252. {"w_op_stv_wait_pfp_busy_swpf", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1253. {"w_op_stv_wait_sxmiss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1254. {"w_op_stv_wait_sxmiss_ex", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1255. {"single_mode_cycle_counts", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1256. {"suspend_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1257. {"sleep_cycle", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1258. /* additional (hidden) aliases for convenience */
  1259. {"cycles0", "cycle_counts", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  1260. {"cycles1", "cycle_counts", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  1261. {"insts0", "instruction_counts", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1262. {"insts1", "instruction_counts", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1263. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1264. };
  1265. /* Kernel profiling pseudo-chip, OBSOLETE (To support 12.3 and earlier, TBR) */
  1266. static Hwcentry kproflist[] = {
  1267. {"kcycles", "kcycles", 0, STXT ("KCPU Cycles"), PRELOADS_5, 1, ABST_NONE},
  1268. {"kucycles", "kucycles", 0, STXT ("KUCPU Cycles"), PRELOADS_5, 1, ABST_NONE},
  1269. {"kthr", "kthr", 0, STXT ("KTHR Cycles"), PRELOADS_5, 1, ABST_NONE},
  1270. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1271. };
  1272. static Hwcentry pentiumIIlist[] = {
  1273. /* note -- missing entries for dtlbm, ecm */
  1274. {"cycles", "cpu_clk_unhalted", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  1275. {"insts", "inst_retired", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  1276. {"icm", "ifu_ifetch_miss", REGNO_ANY, STXT ("I$ Misses"), PRELOADS_5, 0, ABST_NONE},
  1277. {"dcrm", "dcu_m_lines_in", REGNO_ANY, STXT ("D$ Read Misses"), PRELOADS_5, 0, ABST_NONE},
  1278. {"dcwm", "dcu_m_lines_out", REGNO_ANY, STXT ("D$ Write Misses"), PRELOADS_5, 0, ABST_NONE},
  1279. {"flops", "flops", REGNO_ANY, STXT ("Floating-point Ops"), PRELOADS_7, 0, ABST_NONE},
  1280. {"itlbm", "itlb_miss", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_5, 0, ABST_NONE},
  1281. {"ecim", "l2_ifetch", REGNO_ANY, STXT ("E$ Instr. Misses"), PRELOADS_5, 0, ABST_NONE},
  1282. /* explicit definitions of (hidden) entries for proper counters */
  1283. /* Only counters that can be time converted, or are load-store need to be in this table */
  1284. {"cpu_clk_unhalted", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  1285. /* additional (hidden) aliases for convenience */
  1286. {"cycles0", "cpu_clk_unhalted", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  1287. {"cycles1", "cpu_clk_unhalted", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  1288. {"insts0", "inst_retired", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  1289. {"insts1", "inst_retired", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  1290. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1291. };
  1292. static Hwcentry pentiumIIIlist[] = {
  1293. /* note -- many missing entries; no reference machine to try */
  1294. {"cycles", "cpu_clk_unhalted", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  1295. {"insts", "inst_retired", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  1296. /* explicit definitions of (hidden) entries for proper counters */
  1297. /* Only counters that can be time converted, or are load-store need to be in this table */
  1298. {"cpu_clk_unhalted", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  1299. /* additional (hidden) aliases for convenience */
  1300. {"cycles0", "cpu_clk_unhalted", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  1301. {"cycles1", "cpu_clk_unhalted", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  1302. {"insts0", "inst_retired", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  1303. {"insts1", "inst_retired", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  1304. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1305. };
  1306. static Hwcentry pentium4[] = {
  1307. {"cycles", "TC_deliver_mode~threshold=0xf~complement=1~compare=1", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  1308. {"insts", "instr_retired~emask=0x3", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  1309. {"l1m", "BSQ_cache_reference~emask=0x0507", REGNO_ANY, STXT ("L1 Cache Misses"), PRELOADS_7, 0, ABST_NONE},
  1310. {"l2h", "BSQ_cache_reference~emask=0x0007", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1311. {"l2m", "BSQ_cache_reference~emask=0x0500", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE},
  1312. /* explicit definitions of (hidden) entries for proper counters */
  1313. /* Only counters that can be time converted, or are load-store need to be in this table */
  1314. {"TC_deliver_mode", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1315. {"machine_clear", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1316. /* additional (hidden) aliases, for convenience */
  1317. {"cycles0", "TC_deliver_mode~threshold=0xf~complement=1~compare=1", 5, NULL, PRELOADS_75, 1, ABST_NONE},
  1318. {"cycles1", "TC_deliver_mode~threshold=0xf~complement=1~compare=1", 6, NULL, PRELOADS_75, 1, ABST_NONE},
  1319. {"insts0", "instr_retired~emask=0x3", 15, NULL, PRELOADS_75, 0, ABST_NONE},
  1320. {"insts1", "instr_retired~emask=0x3", 16, NULL, PRELOADS_75, 0, ABST_NONE},
  1321. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1322. };
  1323. static Hwcentry intelCore2list[] = {
  1324. // For post-processing, both Linux and Solaris definitions need to be "live".
  1325. // However, for data collection, OS-specific definitions may need to be hidden.
  1326. // Use REGNO_INVALID for definitions that should be hidden for data collection.
  1327. #define LINUX_ONLY REGNO_ANY
  1328. #define SOLARIS_ONLY REGNO_INVALID /* hidden for Linux data collection */
  1329. {"cycles", "cpu_clk_unhalted.core", /*6759307*/ SOLARIS_ONLY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1330. {"cycles", "cpu_clk_unhalted.thread", /*6759307*/ SOLARIS_ONLY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1331. /* Linux Note: 7046312 Many HWC tests fail on system Core2 system with perf_events if above alias used */
  1332. {"cycles", "cpu_clk_unhalted", LINUX_ONLY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1333. {"insts", "instr_retired.any", SOLARIS_ONLY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1334. /* Linux Note: 7046312 Many HWC tests fail on system Core2 system with perf_events if above alias used */
  1335. {"insts", "inst_retired", LINUX_ONLY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1336. // The following counters were identified in "Cycle Accounting Analysis on Intel Core2 Processors" by David Levinthal
  1337. {"uops_stalled", "rs_uops_dispatched~cmask=1~inv=1", REGNO_ANY, STXT ("uOps Stalled"), PRELOADS_7, 1, ABST_NONE},
  1338. {"l2m", "mem_load_retired~umask=0x08", REGNO_ANY, STXT ("L2 Line Misses"), PRELOADS_5, 0, ABST_NONE},
  1339. {"dtlbm", "mem_load_retired~umask=0x10", REGNO_ANY, STXT ("L1 DTLB Misses"), PRELOADS_5, 0, ABST_NONE},
  1340. {"l1m", "mem_load_retired~umask=0x02", REGNO_ANY, STXT ("L1 Line Misses"), PRELOADS_6, 0, ABST_NONE},
  1341. // {"stalls_resources","resource_stalls~umask=0x1f", REGNO_ANY, STXT("Resource Stalls"), PRELOADS_6, 1, ABST_NONE},
  1342. {"rs_full", "resource_stalls~umask=0x02", REGNO_ANY, STXT ("Reservation Station Full"), PRELOADS_6, 1, ABST_NONE},
  1343. {"br_miss_flush", "resource_stalls~umask=0x10", REGNO_ANY, STXT ("Mispredicted Branch Flushes"), PRELOADS_6, 1, ABST_NONE},
  1344. {"ld_st_full", "resource_stalls~umask=0x04", REGNO_ANY, STXT ("Load/Store Buffers Full"), PRELOADS_6, 1, ABST_NONE},
  1345. {"rob_full", "resource_stalls~umask=0x01", REGNO_ANY, STXT ("Reorder Buffer Full"), PRELOADS_6, 1, ABST_NONE},
  1346. {"slow_decode", "ild_stall", REGNO_ANY, STXT ("Slow Instruction Decode"), PRELOADS_6, 1, ABST_NONE},
  1347. {"br_miss", "br_cnd_missp_exec", REGNO_ANY, STXT ("Mispredicted Branches"), PRELOADS_5, 0, ABST_NONE},
  1348. {"ret_miss", "br_call_missp_exec", REGNO_ANY, STXT ("Mispredicted Return Calls"), PRELOADS_5, 0, ABST_NONE},
  1349. {"div_busy", "idle_during_div", REGNO_ANY, STXT ("Divider Unit Busy"), PRELOADS_5, 1, ABST_NONE},
  1350. {"fp_assists", "fp_assist", REGNO_ANY, STXT ("FP Microcode Assists"), PRELOADS_5, 0, ABST_NONE},
  1351. {"bus_busy", "bus_drdy_clocks~umask=0x60", REGNO_ANY, STXT ("Busy Data Bus"), PRELOADS_5, 1, ABST_NONE},
  1352. /* explicit definitions of (hidden) entries for proper counters */
  1353. /* Only counters that can be time converted, or are load-store need to be in this table */
  1354. {/*30a*/"cpu_clk_unhalted.core", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1355. {/*30a*/"cpu_clk_unhalted.thread", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1356. {/*03*/"store_block", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1357. {/*03*/"store_block.drain_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1358. {/*03*/"store_block.order", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1359. {/*03*/"store_block.snoop", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1360. {/*09*/"memory_disambiguation.reset", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1361. {/*0c*/"page_walks.cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1362. {/*14*/"cycles_div_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1363. {/*18*/"idle_during_div", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1364. {/*19*/"delayed_bypass.load", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1365. {/*21*/"l2_ads", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1366. {/*23*/"l2_dbus_busy_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1367. {/*32*/"l2_no_req", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1368. {/*3c*/"cpu_clk_unhalted", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1369. {/*3c*/"cpu_clk_unhalted.core_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1370. {/*3c*/"cpu_clk_unhalted.bus", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1371. {/*3c*/"cpu_clk_unhalted.no_other", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1372. {/*42*/"l1d_cache_lock.duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1373. {/*62*/"bus_drdy_clocks", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1374. {/*63*/"bus_lock_clocks", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1375. {/*64*/"bus_data_rcv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1376. {/*7a*/"bus_hit_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1377. {/*7b*/"bus_hitm_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1378. {/*7d*/"busq_empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1379. {/*7e*/"snoop_stall_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1380. {/*7f*/"bus_io_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1381. {/*83*/"inst_queue", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1382. {/*83*/"inst_queue.full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1383. {/*86*/"cycles_l1i_mem_stalled", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1384. {/*87*/"ild_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1385. {/*a1*/"rs_uops_dispatched", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1386. {/*a1*/"rs_uops_dispatched_port", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1387. {/*a1*/"rs_uops_dispatched_port.0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1388. {/*a1*/"rs_uops_dispatched_port.1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1389. {/*a1*/"rs_uops_dispatched_port.2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1390. {/*a1*/"rs_uops_dispatched_port.3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1391. {/*a1*/"rs_uops_dispatched_port.4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1392. {/*a1*/"rs_uops_dispatched_port.5", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1393. {/*6c*/"cycles_int", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1394. {/*6c*/"cycles_int.masked", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1395. {/*6c*/"cycles_int.pending_and_masked", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1396. {/*d2*/"rat_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1397. {/*d2*/"rat_stalls.rob_read_port", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1398. {/*d2*/"rat_stalls.partial_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1399. {/*d2*/"rat_stalls.flags", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1400. {/*d2*/"rat_stalls.fpsw", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1401. {/*d2*/"rat_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1402. {/*d2*/"rat_stalls.other_serialization_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1403. {/*d4*/"seg_rename_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1404. {/*d4*/"seg_rename_stalls.es", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1405. {/*d4*/"seg_rename_stalls.ds", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1406. {/*d4*/"seg_rename_stalls.fs", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1407. {/*d4*/"seg_rename_stalls.gs", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1408. {/*d4*/"seg_rename_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1409. {/*dc*/"resource_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1410. {/*dc*/"resource_stalls.rob_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1411. {/*dc*/"resource_stalls.rs_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1412. {/*dc*/"resource_stalls.ld_st", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1413. {/*dc*/"resource_stalls.fpcw", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1414. {/*dc*/"resource_stalls.br_miss_clear", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1415. {/*dc*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1416. /* "Architectural" events: */
  1417. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1418. /* additional (hidden) aliases for convenience */
  1419. {"cycles0", "cpu_clk_unhalted", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  1420. {"cycles1", "cpu_clk_unhalted", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  1421. {"insts0", "inst_retired", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1422. {"insts1", "inst_retired", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1423. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1424. };
  1425. static Hwcentry intelNehalemList[] = {
  1426. /* 6832635: on Linux, we're not seeing consistent overflows on FFCs */
  1427. /* 15634344==6940930: HWC overflow profiling can cause system hang on Solaris/core-i7 systems */
  1428. /* 17578620: counter overflow for fixed-function counters hangs systems */
  1429. /* same issues for intelSandyBridgeList and intelHaswellList */
  1430. PERF_EVENTS_SW_EVENT_ALIASES
  1431. USE_INTEL_REF_CYCLES (133)
  1432. {"cycles", "cpu_clk_unhalted.thread_p", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1433. {"insts", "inst_retired.any_p", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1434. // cpu_clk_unhalted.ref: at the ref requency of the cpu. Should not be affected by Speedstep or Turbo.
  1435. // cpu_clk_unhalted.thread_p: with HT & 2 threads, 2x cycles. Affected by Speedstep and Turbo.
  1436. // PEBs (Sampling)
  1437. {"l2m_latency", "mem_inst_retired.latency_above_threshold", REGNO_ANY, STXT ("L2 Cache Miss Est. Latency"), PRELOADS_4, 33, ABST_EXACT_PEBS_PLUS1},
  1438. // See file hwctable.README.corei7
  1439. {"dch", "mem_load_retired.l1d_hit", REGNO_ANY, STXT ("L1 D-cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1440. {"dcm", "0xCB~umask=0x1e", REGNO_ANY, STXT ("L1 D-Cache Misses"), PRELOADS_65, 0, ABST_NONE}, /*mem_load_retired*/
  1441. {"lfbdh", "mem_load_retired.hit_lfb", REGNO_ANY, STXT ("LFB D-cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1442. {"l2h", "mem_load_retired.l2_hit", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1443. {"l2m", "0xCB~umask=0x1c", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE}, /*mem_load_retired*/
  1444. {"l3h", "mem_load_retired.llc_unshared_hit", REGNO_ANY, STXT ("L3 Cache Hit w/o Snoop"), PRELOADS_6, 0, ABST_NONE},
  1445. {"l3h_stall", "mem_load_retired.llc_unshared_hit", REGNO_ANY, STXT ("L3 Cache Hit w/o Snoop x 35: Est. Stalls"), PRELOADS_6, 35, ABST_NONE},
  1446. {"l3hsnoop", "mem_load_retired.other_core_l2_hit_hitm", REGNO_ANY, STXT ("L3 Cache Hit w/Snoop"), PRELOADS_6, 0, ABST_NONE},
  1447. {"l3hsnoop_stall", "mem_load_retired.other_core_l2_hit_hitm", REGNO_ANY, STXT ("L3 Cache Hit w/Snoop x 74: Est. Stalls"), PRELOADS_6, 74, ABST_NONE},
  1448. {"l3m", "mem_load_retired.llc_miss", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  1449. {"l3m_stall", "mem_load_retired.llc_miss", REGNO_ANY, STXT ("L3 Cache Misses x 180: Estimated Stalls"), PRELOADS_5, 180, ABST_NONE},
  1450. {"dtlbm", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1451. {"dtlbm_stall", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses x 30: Estimated Stalls"), PRELOADS_6, 30, ABST_NONE},
  1452. {"addr_alias_stall", "partial_address_alias", REGNO_ANY, STXT ("Partial Address Aliases x 3: Est. Stalls"), PRELOADS_6, 3, ABST_NONE},
  1453. {"uope_stall", "uops_executed.port234~cmask=1~inv=1", REGNO_ANY, STXT ("UOP Execute Stalls per Core"), PRELOADS_7, 1, ABST_NONE},
  1454. {"uopr_stall", "uops_retired.any~cmask=1~inv=1", REGNO_ANY, STXT ("UOP Retired Stalls"), PRELOADS_7, 1, ABST_NONE},
  1455. {"itlbm", "itlb_miss_retired", REGNO_ANY, STXT ("ITLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1456. {"l1i_stall", "l1i.cycles_stalled", REGNO_ANY, STXT ("L1 I-cache Stalls"), PRELOADS_6, 1, ABST_NONE},
  1457. {"br_rets", "br_inst_retired.all_branches", REGNO_ANY, STXT ("Branch Instruction Retires"), PRELOADS_7, 0, ABST_NONE},
  1458. {"br_misp", "br_misp_exec.any", REGNO_ANY, STXT ("Branch Mispredicts"), PRELOADS_6, 0, ABST_NONE},
  1459. {"mach_clear", "machine_clears.cycles", REGNO_ANY, STXT ("Machine Clear Asserted"), PRELOADS_6, 1, ABST_NONE},
  1460. {"fp_mmx", "fp_mmx_trans.any", REGNO_ANY, STXT ("FP-MMX Transistions"), PRELOADS_6, 0, ABST_NONE},
  1461. {"div_busy", "arith.cycles_div_busy", REGNO_ANY, STXT ("Divider Busy Cycles"), PRELOADS_6, 1, ABST_NONE},
  1462. /* explicit definitions of (hidden) entries for proper counters */
  1463. /* Only counters that can be time converted, or are load-store need to be in this table */
  1464. {/*30a*/"cpu_clk_unhalted.core", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1465. {/*30a*/"cpu_clk_unhalted.thread", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1466. {/*04*/"sb_drain.cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1467. {/*08.04*/"dtlb_load_misses.walk_cycles", /*westmere*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1468. //{/*0e*/"uops_issued.stalled_cycles",/*future, multibit*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1469. {/*09*/"memory_disambiguation.reset", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1470. {/*09*/"memory_disambiguation.watch_cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1471. {/*0b*/"mem_inst_retired.latency_above_threshold", /*PEBS*/ NULL, REGNO_ANY, NULL, PRELOADS_4, 33, ABST_EXACT_PEBS_PLUS1}, //non-standard overflow
  1472. {/*14*/"arith.cycles_div_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1473. {/*17*/"inst_queue_write_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1474. {/*1d*/"hw_int.cycles_masked", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1475. {/*1d*/"hw_int.cycles_pending_and_masked", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1476. {/*3c*/"cpu_clk_unhalted.thread_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1477. {/*48*/"l1d_pend_miss.load_buffers_full", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1478. {/*49.04*/"dtlb_misses.walk_cycles", /*westmere*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1479. {/*4e*/"sfence_cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1480. {/*4f.10*/"ept.walk_cycles", /*westmere*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1481. {/*60*/"offcore_requests_outstanding.demand.read_data", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1482. {/*60*/"offcore_requests_outstanding.demand.read_code", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1483. {/*60*/"offcore_requests_outstanding.demand.rfo", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1484. {/*60*/"offcore_requests_outstanding.any.read", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1485. {/*63*/"cache_lock_cycles.l1d", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1486. {/*63*/"cache_lock_cycles.l1d_l2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1487. {/*80*/"l1i.cycles_stalled", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1488. {/*85*/"itlb_misses.walk_cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1489. {/*85*/"itlb_misses.pmh_busy_cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1490. {/*87*/"ild_stall.lcp", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1491. {/*87*/"ild_stall.mru", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1492. {/*87*/"ild_stall.iq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1493. {/*87*/"ild_stall.regen", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1494. {/*87*/"ild_stall.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1495. {/*a2*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1496. {/*a2*/"resource_stalls.load", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1497. {/*a2*/"resource_stalls.rs_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1498. {/*a2*/"resource_stalls.store", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1499. {/*a2*/"resource_stalls.rob_full", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1500. {/*a2*/"resource_stalls.fpcw", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1501. {/*a2*/"resource_stalls.mxcsr", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1502. {/*a2*/"resource_stalls.other", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1503. {/*b0*/"offcore_requests_sq_full", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1504. {/*b3*/"snoopq_requests_outstanding.data", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1505. {/*b3*/"snoopq_requests_outstanding.invalidate", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1506. {/*b3*/"snoopq_requests_outstanding.code", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1507. //{/*c2*/"uops_retired.stalled_cycles",/*future, multibit*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1508. {/*c3*/"machine_clears.cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1509. {/*d2*/"rat_stalls.flags", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1510. {/*d2*/"rat_stalls.registers", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1511. {/*d2*/"rat_stalls.rob_read_port", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1512. {/*d2*/"rat_stalls.scoreboard", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1513. {/*d2*/"rat_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1514. {/*d4*/"seg_rename_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1515. {/*f6*/"sq_full_stall_cycles", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1516. /* "Architectural" events: */
  1517. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1518. PERF_EVENTS_SW_EVENT_DEFS
  1519. /* additional (hidden) aliases for convenience */
  1520. #if 0
  1521. USE_INTEL_REF_CYCLES (133),
  1522. #endif
  1523. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1524. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1525. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1526. };
  1527. static Hwcentry intelSandyBridgeList[] = {
  1528. /* see comments for "cycles" and "insts" for intelNehalemList */
  1529. PERF_EVENTS_SW_EVENT_ALIASES
  1530. USE_INTEL_REF_CYCLES (100)
  1531. {"cycles", "cpu_clk_unhalted.thread_p", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1532. {"insts", "inst_retired.any_p", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1533. // PEBS (sampling)
  1534. {"l2m_latency", "mem_trans_retired.load_latency", REGNO_ANY, STXT ("L2 Cache Miss Est. Latency"), PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1535. // See file hwctable.README.sandybridge
  1536. {"dch", "mem_load_uops_retired.l1_hit", REGNO_ANY, STXT ("L1 D-cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1537. {"dcm", "mem_load_uops_retired.l1_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE}, /*mem_load_uops_retired*/
  1538. {"l2h", "mem_load_uops_retired.l2_hit", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1539. {"l2m", "mem_load_uops_retired.l2_miss", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE}, /*mem_load_uops_retired*/
  1540. // Intel errata: BT241 and BT243 says the mem_load_uops_retired.llc* counters may not be reliable on some CPU variants
  1541. {"l3h", "mem_load_uops_retired.llc_hit", REGNO_ANY, STXT ("L3 Cache Hit w/o Snoop"), PRELOADS_6, 0, ABST_NONE}, // may undercount
  1542. {"l3m", "longest_lat_cache.miss", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  1543. /* dtlbm has not been confirmed via Intel white paper */
  1544. {"dtlbm", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1545. {"dtlbm_stall", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses x 30: Estimated Stalls"), PRELOADS_6, 30, ABST_NONE},
  1546. {"dtlbm", "dtlb_load_misses.demand_ld_walk_completed", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1547. {"dtlbm_stall", "dtlb_load_misses.demand_ld_walk_completed", REGNO_ANY, STXT ("DTLB Misses x 30: Estimated Stalls"), PRELOADS_6, 30, ABST_NONE},
  1548. /* explicit definitions of (hidden) entries for proper counters */
  1549. /* Only counters that can be time converted, or are load-store need to be in this table */
  1550. {/* 30a */"cpu_clk_unhalted.thread", /*15634344==6940930*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1551. //{/* 30a */"cpu_clk_unhalted.core", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1552. {/*08.04*/"dtlb_load_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1553. {/*08.84*/"dtlb_load_misses.demand_ld_walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1554. {/*0d.03*/"int_misc.recovery_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1555. {/*0d.40*/"int_misc.rat_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1556. {/*0e.01*/"uops_issued.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1557. {/*0e.01*/"uops_issued.core_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1558. {/*14.01*/"arith.fpu_div_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1559. {/*3c.00*/"cpu_clk_unhalted.thread_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1560. {/*48.01*/"l1d_pend_miss.pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1561. {/*49.04*/"dtlb_store_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1562. {/*59.20*/"partial_rat_stalls.flags_merge_uop", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1563. {/*59.20*/"partial_rat_stalls.flags_merge_uop_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1564. {/*59.40*/"partial_rat_stalls.slow_lea_window", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1565. //{/*59.80*/"partial_rat_stalls.mul_single_uop", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1566. {/*5b.0c*/"resource_stalls2.all_fl_empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1567. {/*5b.0f*/"resource_stalls2.all_prf_control", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1568. {/*5b.40*/"resource_stalls2.bob_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1569. {/*5b.4f*/"resource_stalls2.ooo_rsrc", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1570. {/*5c.01*/"cpl_cycles.ring0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1571. {/*5c.02*/"cpl_cycles.ring123", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1572. {/*5c.xx*/"cpl_cycles.ring0_trans", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1573. {/*5c.xx*/"cpl_cycles.ring0_transition", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1574. {/*5e.01*/"rs_events.empty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1575. {/*60.01*/"offcore_requests_outstanding.cycles_with_demand_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1576. {/*60.01*/"offcore_requests_outstanding.demand_data_rd_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1577. {/*60.04*/"offcore_requests_outstanding.cycles_with_demand_rfo", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1578. {/*60.04*/"offcore_requests_outstanding.demand_rfo_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1579. {/*60.08*/"offcore_requests_outstanding.cycles_with_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1580. {/*60.08*/"offcore_requests_outstanding.all_data_rd_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1581. {/*60.02*/"offcore_requests_outstanding.demand_code_rd_cycles", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1582. {/*63.01*/"lock_cycles.split_lock_uc_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1583. {/*63.02*/"lock_cycles.cache_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1584. {/*79.00*/"idq.empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1585. {/*79.04*/"idq.mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1586. {/*79.08*/"idq.dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1587. {/*79.10*/"idq.ms_dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1588. {/*79.20*/"idq.ms_mite_uops_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1589. {/*79.20*/"idq.ms_mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1590. {/*79.30*/"idq.ms_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1591. {/*79.18*/"idq.all_dsb_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1592. {/*79.18*/"idq.all_dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1593. {/*79.18*/"idq.all_dsb_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1594. {/*79.24*/"idq.all_mite_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1595. {/*79.24*/"idq.all_mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1596. {/*79.24*/"idq.all_mite_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1597. {/*79.3c*/"idq.mite_all_cycles", /* Linux, but not in docs? */ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1598. {/*80.04*/"icache.ifetch_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1599. {/*85.04*/"itlb_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1600. {/*87.01*/"ild_stall.lcp", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1601. {/*87.04*/"ild_stall.iq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1602. {/*9c.xx*/"idq_uops_not_delivered.cycles_0_uops_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1603. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1604. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_2_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1605. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_3_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1606. {/*9c.01*/"idq_uops_not_delivered.cycles_ge_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1607. {/*9c.01*/"idq_uops_not_delivered.cycles_fe_was_ok", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1608. {/*a1.01*/"uops_executed_port.port_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1609. {/*a1.02*/"uops_executed_port.port_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1610. {/*a1.04*/"uops_executed_port.port_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1611. {/*a1.08*/"uops_executed_port.port_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1612. {/*a1.10*/"uops_executed_port.port_4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1613. {/*a1.20*/"uops_executed_port.port_5", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1614. {/*a2.01*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1615. {/*a2.02*/"resource_stalls.lb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1616. {/*a2.04*/"resource_stalls.rs", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1617. {/*a2.08*/"resource_stalls.sb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1618. {/*a2.0a*/"resource_stalls.lb_sb", /*sb-ep*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1619. {/*a2.0e*/"resource_stalls.mem_rs", /*sb-ep*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1620. {/*a2.10*/"resource_stalls.rob", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1621. {/*a2.20*/"resource_stalls.fcsw", /*sb*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1622. {/*a2.40*/"resource_stalls.mxcsr", /*sb*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1623. {/*a2.80*/"resource_stalls.other", /*sb*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1624. {/*a2.F0*/"resource_stalls.ooo_rsrc", /*sb-ep*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1625. {/*a3.01*/"cycle_activity.cycles_l2_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1626. {/*??.??*/"cycle_activity.stalls_l2_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1627. {/*a3.02*/"cycle_activity.cycles_ldm_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1628. {/*??.??*/"cycle_activity.stalls_ldm_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1629. {/*a3.04*/"cycle_activity.cycles_no_execute", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1630. {/*a3.04*/"cycle_activity.cycles_no_dispatch", /*sandybridge*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1631. {/*a3.08*/"cycle_activity.cycles_l1d_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1632. {/*??.??*/"cycle_activity.stalls_l1d_pending", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1633. {/*ab.02*/"dsb2mite_switches.penalty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1634. {/*b1.??*/"uops_executed.stall_cycles", /*? not in PRM*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1635. {/*b1.01*/"uops_dispatched.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1636. {/*b1.01*/"uops_executed.stall_cycles", /*F6M62*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1637. {/*b1.01*/"uops_executed.cycles_ge_1_uop_exec", /*F6M62,not doc'd*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1638. {/*b1.01*/"uops_executed.cycles_ge_2_uops_exec", /*F6M62,not doc'd*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1639. {/*b1.01*/"uops_executed.cycles_ge_3_uops_exec", /*F6M62,not doc'd*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1640. {/*b1.01*/"uops_executed.cycles_ge_4_uops_exec", /*F6M62,not doc'd*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1641. {/*bf.05*/"l1d_blocks.bank_conflict_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1642. {/*c2.01*/"uops_retired.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1643. {/*c2.01*/"uops_retired.total_cycles", /*cmask==0x10*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1644. {/*c2.01*/"uops_retired.core_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1645. {/*c2.01*/"uops_retired.active_cycles", /*cmask==0x1*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1646. #if 0 // need to see documentation on the following before marking them as cycles
  1647. uops_executed.cycles_ge_1_uop_exec[ / {0 | 1 | 2 | 3}], 1000003 (events)
  1648. uops_executed.cycles_ge_2_uops_exec[ /
  1649. {0 | 1 | 2 | 3}
  1650. ], 1000003 (events)
  1651. uops_executed.cycles_ge_3_uops_exec[ /
  1652. {0 | 1 | 2 | 3}
  1653. ], 1000003 (events)
  1654. uops_executed.cycles_ge_4_uops_exec[ /
  1655. {0 | 1 | 2 | 3}
  1656. ], 1000003 (events)
  1657. #endif
  1658. {/*cd.01*/"mem_trans_retired.load_latency", /*PEBS*/ NULL, REGNO_ANY, NULL, PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1}, //non-standard overflow
  1659. /* "Architectural" events: */
  1660. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1661. PERF_EVENTS_SW_EVENT_DEFS
  1662. /* additional (hidden) aliases for convenience */
  1663. #if 0
  1664. USE_INTEL_REF_CYCLES (100),
  1665. #endif
  1666. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1667. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1668. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1669. };
  1670. static Hwcentry intelHaswellList[] = {
  1671. /* see comments for "cycles" and "insts" for intelNehalemList */
  1672. PERF_EVENTS_SW_EVENT_ALIASES
  1673. USE_INTEL_REF_CYCLES (100)
  1674. {"cycles", "cpu_clk_unhalted.thread_p", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1675. {"insts", "inst_retired.any_p", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1676. // PEBS (sampling)
  1677. {"l2m_latency", "mem_trans_retired.load_latency", REGNO_ANY, STXT ("L2 Cache Miss Est. Latency"), PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1678. {"dch", "mem_load_uops_retired.l1_hit", REGNO_ANY, STXT ("L1 D-cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1679. {"dcm", "mem_load_uops_retired.l1_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE}, //mem_load_uops_retired
  1680. {"dcm", "0xd1~umask=0x08", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE}, //mem_load_uops_retired
  1681. {"l2h", "mem_load_uops_retired.l2_hit", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1682. {"l2m", "mem_load_uops_retired.l2_miss", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE}, //mem_load_uops_retired
  1683. {"l2m", "0xd1~umask=0x10", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE}, //mem_load_uops_retired
  1684. {"l3h", "mem_load_uops_retired.l3_hit", REGNO_ANY, STXT ("L3 Cache Hit w/o Snoop"), PRELOADS_6, 0, ABST_NONE},
  1685. {"l3m", "mem_load_uops_retired.l3_miss", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE}, //mem_load_uops_retired
  1686. {"l3m", "0xd1~umask=0x20", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE}, //mem_load_uops_retired
  1687. /* dtlbm has not been confirmed via Intel white paper */
  1688. {"dtlbm", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1689. {"dtlbm_stall", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses x 30: Estimated Stalls"), PRELOADS_6, 30, ABST_NONE},
  1690. /* explicit definitions of (hidden) entries for proper counters */
  1691. /* Only counters that can be time converted, or are load-store need to be in this table */
  1692. {/* 30a */"cpu_clk_unhalted.thread", /*15634344==6940930*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1693. //{/* 30a */"cpu_clk_unhalted.core", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1694. {/*08.10*/"dtlb_load_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1695. {/*0d.03*/"int_misc.recovery_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1696. {/*0e.01*/"uops_issued.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1697. {/*0e.01*/"uops_issued.core_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1698. {/*3c.00*/"cpu_clk_unhalted.thread_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1699. {/*48.01*/"l1d_pend_miss.pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1700. {/*49.04*/"dtlb_store_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1701. {/*5c.01*/"cpl_cycles.ring0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1702. {/*5c.02*/"cpl_cycles.ring123", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1703. {/*5c.xx*/"cpl_cycles.ring0_trans", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1704. {/*5e.01*/"rs_events.empty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1705. {/*60.01*/"offcore_requests_outstanding.cycles_with_demand_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1706. {/*60.02*/"offcore_requests_outstanding.demand_code_rd_cycles", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1707. {/*60.04*/"offcore_requests_outstanding.demand_rfo_cycles", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1708. {/*60.08*/"offcore_requests_outstanding.cycles_with_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1709. {/*63.01*/"lock_cycles.split_lock_uc_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1710. {/*63.02*/"lock_cycles.cache_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1711. {/*79.00*/"idq.empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1712. {/*79.04*/"idq.mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1713. {/*79.08*/"idq.dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1714. {/*79.10*/"idq.ms_dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1715. {/*79.20*/"idq.ms_mite_uops_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1716. {/*79.20*/"idq.ms_mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1717. {/*79.30*/"idq.ms_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1718. {/*79.18*/"idq.all_dsb_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1719. {/*79.18*/"idq.all_dsb_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1720. {/*79.24*/"idq.all_mite_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1721. {/*79.24*/"idq.all_mite_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1722. {/*80.04*/"icache.ifetch_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1723. {/*85.04*/"itlb_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1724. {/*87.01*/"ild_stall.lcp", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE}, // Intel SDM says these are stalls, not cycles
  1725. {/*87.04*/"ild_stall.iq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1726. {/*9c.xx*/"idq_uops_not_delivered.cycles_0_uops_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1727. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1728. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_2_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1729. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_3_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1730. // {/*9c.01*/"idq_uops_not_delivered.cycles_ge_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1731. {/*9c.01*/"idq_uops_not_delivered.cycles_fe_was_ok", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1732. {/*a1.01*/"uops_executed_port.port_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1733. {/*a1.02*/"uops_executed_port.port_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1734. {/*a1.04*/"uops_executed_port.port_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1735. {/*a1.08*/"uops_executed_port.port_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1736. {/*a1.10*/"uops_executed_port.port_4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1737. {/*a1.20*/"uops_executed_port.port_5", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1738. {/*a1.40*/"uops_executed_port.port_6", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1739. {/*a1.80*/"uops_executed_port.port_7", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1740. {/*a1.01*/"uops_executed_port.port_0_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1741. {/*a1.02*/"uops_executed_port.port_1_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1742. {/*a1.04*/"uops_executed_port.port_2_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1743. {/*a1.08*/"uops_executed_port.port_3_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1744. {/*a1.10*/"uops_executed_port.port_4_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1745. {/*a1.20*/"uops_executed_port.port_5_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1746. {/*a1.40*/"uops_executed_port.port_6_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1747. {/*a1.80*/"uops_executed_port.port_7_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1748. {/*a2.01*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1749. {/*a2.04*/"resource_stalls.rs", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1750. {/*a2.08*/"resource_stalls.sb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1751. {/*a2.10*/"resource_stalls.rob", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1752. {/*a3.01*/"cycle_activity.cycles_l2_pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1753. // {/*a3.01*/"cycle_activity.cycles_l2_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1754. {/*a3.02*/"cycle_activity.cycles_ldm_pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1755. // {/*a3.05*/"cycle_activity.stalls_l2_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1756. {/*a3.08*/"cycle_activity.cycles_l1d_pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1757. // {/*a3.??*/"cycle_activity.cycles_no_execute", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1758. // {/*a3.??*/"cycle_activity.stalls_ldm_pending",/*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1759. {/*ab.02*/"dsb2mite_switches.penalty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1760. {/*b1.??*/"uops_executed.stall_cycles", /*? not in PRM*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1761. {/*b1.??*/"uops_executed.cycles_ge_1_uop_exec", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1762. {/*b1.??*/"uops_executed.cycles_ge_2_uops_exec", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1763. {/*b1.??*/"uops_executed.cycles_ge_3_uops_exec", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1764. {/*b1.??*/"uops_executed.cycles_ge_4_uops_exec", /*?*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1765. {/*c2.01*/"uops_retired.stall_cycles", /*cmask==1 + INV*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1766. {/*c2.01*/"uops_retired.total_cycles", /*cmask==0x1*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1767. {/*c2.01*/"uops_retired.core_stall_cycles", /*PEBS Any==1*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1768. {/*c3.01*/"machine_clears.cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1769. {/*ca.1e*/"fp_assist.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1770. {/*cd.01*/"mem_trans_retired.load_latency", /*PEBS*/ NULL, REGNO_ANY, NULL, PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1}, //non-standard overflow
  1771. /* "Architectural" events: */
  1772. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1773. PERF_EVENTS_SW_EVENT_DEFS
  1774. /* additional (hidden) aliases for convenience */
  1775. #if 0
  1776. USE_INTEL_REF_CYCLES (100),
  1777. #endif
  1778. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1779. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1780. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1781. };
  1782. static Hwcentry intelBroadwellList[] = {
  1783. /* see comments for "cycles" and "insts" for intelNehalemList */
  1784. PERF_EVENTS_SW_EVENT_ALIASES
  1785. USE_INTEL_REF_CYCLES (100)
  1786. {"cycles", "cpu_clk_unhalted.thread_p", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1787. {"insts", "inst_retired.any_p", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1788. // PEBS (sampling)
  1789. {"l2m_latency", "mem_trans_retired.load_latency", REGNO_ANY, STXT ("L2 Cache Miss Est. Latency"), PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1790. {/*cd.01*/"mem_trans_retired.load_latency", NULL, REGNO_ANY, NULL, PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1791. // aliases (the first set are PEBS, but on Intel the only precise counter we support is l2m_latency)
  1792. {"dch", "mem_load_uops_retired.l1_hit", REGNO_ANY, STXT ("L1 D-cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1793. {"dcm", "mem_load_uops_retired.l1_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE},
  1794. {"l2h", "mem_load_uops_retired.l2_hit", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1795. {"l2m", "mem_load_uops_retired.l2_miss", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE},
  1796. {"l3h", "mem_load_uops_retired.l3_hit", REGNO_ANY, STXT ("L3 Cache Hits"), PRELOADS_6, 0, ABST_NONE},
  1797. {"l3m", "mem_load_uops_retired.l3_miss", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  1798. {"dtlbm", "dtlb_load_misses.walk_completed", REGNO_ANY, STXT ("DTLB Misses"), PRELOADS_6, 0, ABST_NONE},
  1799. // counters that can be time converted (add FFCs if we decide to support them)
  1800. // counters that are load-store (did not include any... do we want to?)
  1801. {/*08.10*/"dtlb_load_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1802. {/*0d.03*/"int_misc.recovery_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1803. {/*0e.01*/"uops_issued.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1804. {/*0e.01*/"uops_issued.core_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1805. {/*14.01*/"arith.fpu_div_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1806. {/*3c.00*/"cpu_clk_unhalted.thread_p_any", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1807. {/*3c.00*/"cpu_clk_unhalted.thread_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1808. {/*3c.02*/"cpu_clk_thread_unhalted.one_thread_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1809. {/*48.01*/"l1d_pend_miss.pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1810. {/*48.01*/"l1d_pend_miss.pending_cycles_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1811. {/*49.10*/"dtlb_store_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1812. {/*4f.10*/"ept.walk_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1813. {/*5c.01*/"cpl_cycles.ring0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1814. {/*5c.01*/"cpl_cycles.ring0_trans", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1815. {/*5c.02*/"cpl_cycles.ring123", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1816. {/*5e.01*/"rs_events.empty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1817. {/*60.01*/"offcore_requests_outstanding.cycles_with_demand_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1818. {/*60.02*/"offcore_requests_outstanding.demand_code_rd_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1819. {/*60.04*/"offcore_requests_outstanding.demand_rfo_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1820. {/*60.08*/"offcore_requests_outstanding.cycles_with_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1821. {/*63.01*/"lock_cycles.split_lock_uc_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1822. {/*63.02*/"lock_cycles.cache_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1823. {/*79.02*/"idq.empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1824. {/*79.04*/"idq.mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1825. {/*79.08*/"idq.dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1826. {/*79.10*/"idq.ms_dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1827. {/*79.18*/"idq.all_dsb_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1828. {/*79.18*/"idq.all_dsb_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1829. {/*79.24*/"idq.all_mite_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1830. {/*79.24*/"idq.all_mite_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1831. {/*79.30*/"idq.ms_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1832. {/*85.10*/"itlb_misses.walk_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1833. {/*9c.xx*/"idq_uops_not_delivered.cycles_0_uops_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1834. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1835. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_2_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1836. {/*9c.xx*/"idq_uops_not_delivered.cycles_le_3_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1837. {/*9c.01*/"idq_uops_not_delivered.cycles_fe_was_ok", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1838. {/*a1.01*/"uops_executed_port.port_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1839. {/*a1.02*/"uops_executed_port.port_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1840. {/*a1.04*/"uops_executed_port.port_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1841. {/*a1.08*/"uops_executed_port.port_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1842. {/*a1.10*/"uops_executed_port.port_4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1843. {/*a1.20*/"uops_executed_port.port_5", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1844. {/*a1.40*/"uops_executed_port.port_6", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1845. {/*a1.80*/"uops_executed_port.port_7", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1846. {/*a1.01*/"uops_executed_port.port_0_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1847. {/*a1.02*/"uops_executed_port.port_1_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1848. {/*a1.04*/"uops_executed_port.port_2_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1849. {/*a1.08*/"uops_executed_port.port_3_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1850. {/*a1.10*/"uops_executed_port.port_4_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1851. {/*a1.20*/"uops_executed_port.port_5_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1852. {/*a1.40*/"uops_executed_port.port_6_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1853. {/*a1.80*/"uops_executed_port.port_7_core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1854. {/*a2.01*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1855. {/*a2.04*/"resource_stalls.rs", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1856. {/*a2.08*/"resource_stalls.sb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1857. {/*a2.10*/"resource_stalls.rob", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1858. {/*a3.01*/"cycle_activity.cycles_l2_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1859. {/*a3.02*/"cycle_activity.cycles_ldm_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1860. {/*a3.04*/"cycle_activity.cycles_no_execute", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1861. {/*a3.08*/"cycle_activity.cycles_l1d_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1862. {/*a8.01*/"lsd.cycles_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1863. {/*a8.01*/"lsd.cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1864. {/*ab.02*/"dsb2mite_switches.penalty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1865. {/*b1.01*/"uops_executed.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1866. {/*c2.01*/"uops_retired.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1867. {/*c2.01*/"uops_retired.total_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1868. {/*c2.01*/"uops_retired.core_stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1869. {/*c3.01*/"machine_clears.cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1870. {/*ca.1e*/"fp_assist.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1871. /* "Architectural" events: */
  1872. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1873. PERF_EVENTS_SW_EVENT_DEFS
  1874. /* additional (hidden) aliases for convenience */
  1875. #if 0
  1876. USE_INTEL_REF_CYCLES (100),
  1877. #endif
  1878. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  1879. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  1880. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  1881. };
  1882. static Hwcentry intelSkylakeList[] = {
  1883. /* see comments for "cycles" and "insts" for intelNehalemList */
  1884. PERF_EVENTS_SW_EVENT_ALIASES
  1885. USE_INTEL_REF_CYCLES (25)
  1886. {"cycles", "cpu_clk_unhalted.thread_p", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  1887. {"insts", "inst_retired.any_p", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  1888. // PEBS (sampling)
  1889. {"l2m_latency", "mem_trans_retired.load_latency", REGNO_ANY, STXT ("L2 Cache Miss Est. Latency"), PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1890. {/*cd.01*/"mem_trans_retired.load_latency", NULL, REGNO_ANY, NULL, PRELOADS_4, 65, ABST_EXACT_PEBS_PLUS1},
  1891. // aliases (the first set are PEBS, but on Intel the only precise counter we support is l2m_latency)
  1892. {"dch", "mem_load_retired.l1_hit", REGNO_ANY, STXT ("L1 D-cache Hits"), PRELOADS_7, 0, ABST_NONE},
  1893. {"dcm", "mem_load_retired.l1_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE},
  1894. {"l2h", "mem_load_retired.l2_hit", REGNO_ANY, STXT ("L2 Cache Hits"), PRELOADS_65, 0, ABST_NONE},
  1895. {"l2m", "mem_load_retired.l2_miss", REGNO_ANY, STXT ("L2 Cache Misses"), PRELOADS_6, 0, ABST_NONE},
  1896. {"l2m_stall", "cycle_activity.stalls_l2_miss", REGNO_ANY, STXT ("L2 Cache Miss Stall"), PRELOADS_7, 1, ABST_NONE}, // needs validation
  1897. {"l3h", "mem_load_retired.l3_hit", REGNO_ANY, STXT ("L3 Cache Hits"), PRELOADS_6, 0, ABST_NONE},
  1898. {"l3m", "mem_load_retired.l3_miss", REGNO_ANY, STXT ("L3 Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  1899. {"l3m_stall", "cycle_activity.stalls_l3_miss", REGNO_ANY, STXT ("L3 Cache Miss Stall"), PRELOADS_7, 1, ABST_NONE}, // needs validation
  1900. {"dtlbm_stall", "dtlb_load_misses.walk_active", REGNO_ANY, STXT ("DTLB Miss Est Stall"), PRELOADS_7, 1, ABST_NONE, STXT ("Estimated time stalled on DTLB misses requiring a tablewalk. Does not include time related to STLB hits.")}, // needs validation
  1901. // PEBS mem_inst_retired.stlb_miss_loads for finding location of DTLB issues
  1902. // what about: dtlb_load_misses.walk_completed, dtlb_load_misses.walk_pending, dtlb_load_misses.stlb_hit
  1903. {"fp_scalar", "fp_arith_inst_retired.scalar_double~umask=0x3", REGNO_ANY, STXT ("FP Scalar uOps"), PRELOADS_7, 0, ABST_NONE, STXT ("Floating-point scalar micro-ops that retired")},
  1904. {"fp_vector", "fp_arith_inst_retired.128b_packed_double~umask=0x3c", REGNO_ANY, STXT ("FP Vector uOps"), /*needs test*/ PRELOADS_7, 0, ABST_NONE, STXT ("Floating-point vector micro-ops that retired")},
  1905. // counters that can be time converted (add FFCs if we decide to support them)
  1906. // counters that are load-store (did not include any... do we want to?)
  1907. {/*08.10*/"dtlb_load_misses.walk_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1908. {/*08.10*/"dtlb_load_misses.walk_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1909. {/*0d.01*/"int_misc.recovery_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1910. {/*0d.01*/"int_misc.recovery_cycles_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1911. {/*0d.80*/"int_misc.clear_resteer_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1912. {/*0e.01*/"uops_issued.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1913. {/*14.01*/"arith.divider_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1914. {/*3c.00*/"cpu_clk_unhalted.ring0_trans", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1915. {/*3c.00*/"cpu_clk_unhalted.thread_p_any", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1916. {/*3c.00*/"cpu_clk_unhalted.thread_p", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1917. {/*3c.00*/"cpu_clk_unhalted.core", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1918. {/*48.01*/"l1d_pend_miss.pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1919. {/*48.01*/"l1d_pend_miss.pending_cycles_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1920. {/*49.10*/"dtlb_store_misses.walk_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1921. {/*49.10*/"dtlb_store_misses.walk_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1922. {/*4f.10*/"ept.walk_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1923. {/*5e.01*/"rs_events.empty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1924. {/*60.01*/"offcore_requests_outstanding.cycles_with_demand_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1925. {/*60.01*/"offcore_requests_outstanding.demand_data_rd_ge_6", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1926. {/*60.02*/"offcore_requests_outstanding.cycles_with_demand_code_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1927. {/*60.04*/"offcore_requests_outstanding.cycles_with_demand_rfo", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1928. {/*60.08*/"offcore_requests_outstanding.cycles_with_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1929. {/*60.10*/"offcore_requests_outstanding.cycles_with_l3_miss_demand_data_rd", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1930. {/*60.10*/"offcore_requests_outstanding.l3_miss_demand_data_rd_ge_6", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1931. {/*63.02*/"lock_cycles.cache_lock_duration", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1932. {/*79.04*/"idq.mite_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1933. {/*79.08*/"idq.dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1934. {/*79.10*/"idq.ms_dsb_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1935. {/*79.18*/"idq.all_dsb_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1936. {/*79.18*/"idq.all_dsb_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1937. {/*79.24*/"idq.all_mite_cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1938. {/*79.24*/"idq.all_mite_cycles_any_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1939. {/*79.30*/"idq.ms_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1940. {/*80.04*/"icache_16b.ifdata_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1941. {/*83.04*/"icache_64b.iftag_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1942. {/*85.10*/"itlb_misses.walk_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1943. {/*85.10*/"itlb_misses.walk_pending", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1944. {/*87.01*/"ild_stall.lcp", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1945. {/*9c.01*/"idq_uops_not_delivered.cycles_0_uops_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1946. {/*9c.01*/"idq_uops_not_delivered.cycles_le_1_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1947. {/*9c.01*/"idq_uops_not_delivered.cycles_le_2_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1948. {/*9c.01*/"idq_uops_not_delivered.cycles_le_3_uop_deliv.core", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1949. {/*9c.01*/"idq_uops_not_delivered.cycles_fe_was_ok", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1950. {/*a1.01*/"uops_dispatched_port.port_0", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1951. {/*a1.02*/"uops_dispatched_port.port_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1952. {/*a1.04*/"uops_dispatched_port.port_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1953. {/*a1.08*/"uops_dispatched_port.port_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1954. {/*a1.10*/"uops_dispatched_port.port_4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1955. {/*a1.20*/"uops_dispatched_port.port_5", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1956. {/*a1.40*/"uops_dispatched_port.port_6", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1957. {/*a1.80*/"uops_dispatched_port.port_7", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1958. {/*a2.01*/"resource_stalls.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1959. {/*a2.08*/"resource_stalls.sb", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1960. {/*a3.01*/"cycle_activity.cycles_l2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1961. {/*a3.02*/"cycle_activity.cycles_l3_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1962. {/*a3.04*/"cycle_activity.stalls_total", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1963. {/*a3.05*/"cycle_activity.stalls_l2_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1964. {/*a3.06*/"cycle_activity.stalls_l3_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1965. {/*a3.08*/"cycle_activity.cycles_l1d_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1966. {/*a3.0c*/"cycle_activity.stalls_l1d_miss", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1967. {/*a3.10*/"cycle_activity.cycles_mem_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1968. {/*a3.14*/"cycle_activity.stalls_mem_any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1969. {/*a6.01*/"exe_activity.exe_bound_0_ports", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1970. {/*a6.02*/"exe_activity.1_ports_util", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1971. {/*a6.04*/"exe_activity.2_ports_util", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1972. {/*a6.08*/"exe_activity.3_ports_util", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1973. {/*a6.10*/"exe_activity.4_ports_util", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1974. {/*a6.40*/"exe_activity.bound_on_stores", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1975. {/*a8.01*/"lsd.cycles_4_uops", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1976. {/*a8.01*/"lsd.cycles_active", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1977. {/*ab.02*/"dsb2mite_switches.penalty_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1978. {/*b1.01*/"uops_executed.cycles_ge_1_uop_exec", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1979. {/*b1.01*/"uops_executed.cycles_ge_2_uops_exec", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1980. {/*b1.01*/"uops_executed.cycles_ge_3_uops_exec", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1981. {/*b1.01*/"uops_executed.cycles_ge_4_uops_exec", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1982. {/*b1.01*/"uops_executed.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1983. {/*b1.02*/"uops_executed.core_cycles_ge_1", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1984. {/*b1.02*/"uops_executed.core_cycles_ge_2", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1985. {/*b1.02*/"uops_executed.core_cycles_ge_3", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1986. {/*b1.02*/"uops_executed.core_cycles_ge_4", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1987. {/*b1.02*/"uops_executed.core_cycles_none", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1988. {/*c0.1*/"inst_retired.total_cycles_ps", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1989. {/*c2.01*/"uops_retired.stall_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1990. {/*c2.01*/"uops_retired.total_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1991. {/*ca.1e*/"fp_assist.any", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  1992. /* "Architectural" events: */
  1993. {/* FFC */"cpu_clk_unhalted.thread", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1994. {/* FFC */"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  1995. PERF_EVENTS_SW_EVENT_DEFS
  1996. /* additional (hidden) aliases for convenience */
  1997. #if 0
  1998. USE_INTEL_REF_CYCLES (25),
  1999. #endif
  2000. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  2001. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  2002. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2003. };
  2004. static Hwcentry intelLinuxUnknown[] = {
  2005. PERF_EVENTS_SW_EVENT_ALIASES
  2006. // USE_INTEL_REF_CYCLES(100) // freq is unknown
  2007. {"cycles", "unhalted-core-cycles", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  2008. {"cycles", "PERF_COUNT_HW_CPU_CYCLES", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  2009. {"insts", "instruction-retired", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  2010. {"insts", "PERF_COUNT_HW_INSTRUCTIONS", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  2011. {"dcm", "PERF_COUNT_HW_CACHE_MISSES.L1D", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE},
  2012. {"llm", "llc-misses", REGNO_ANY, STXT ("Last-Level Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  2013. {"llm", "PERF_COUNT_HW_CACHE_MISSES.LL", REGNO_ANY, STXT ("Last-Level Cache Misses"), PRELOADS_5, 0, ABST_NONE},
  2014. {"br_msp", "branch-misses-retired", REGNO_ANY, STXT ("Branch Mispredict"), PRELOADS_6, 0, ABST_NONE},
  2015. {"br_msp", "PERF_COUNT_HW_BRANCH_MISSES", REGNO_ANY, STXT ("Branch Mispredict"), PRELOADS_6, 0, ABST_NONE},
  2016. {"br_ins", "branch-instruction-retired", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE},
  2017. {"br_ins", "PERF_COUNT_HW_BRANCH_INSTRUCTIONS", REGNO_ANY, STXT ("Branch Instructions"), PRELOADS_7, 0, ABST_NONE},
  2018. // counters that can be time converted (add FFCs if we decide to support them)
  2019. // counters that are load-store (did not include any... do we want to?)
  2020. /* "Architectural" events: */
  2021. {/* FFC */"cpu_clk_unhalted.thread", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  2022. {/* FFC */"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  2023. PERF_EVENTS_SW_EVENT_DEFS
  2024. /* additional (hidden) aliases for convenience */
  2025. {"cycles0", "unhalted-reference-cycles", 0, NULL, PRELOADS_6, -(25), ABST_NONE}, //YXXX -can't do with ref cycles #
  2026. {"cycles0", "PERF_COUNT_HW_BUS_CYCLES", 0, NULL, PRELOADS_6, -(25), ABST_NONE}, //YXXX -can't do with ref cycles #
  2027. {"cycles1", "unhalted-reference-cycles", 1, NULL, PRELOADS_65, -(25), ABST_NONE}, //YXXX - can't do with ref cycles #
  2028. {"cycles1", "PERF_COUNT_HW_BUS_CYCLES", 1, NULL, PRELOADS_65, -(25), ABST_NONE}, //YXXX - can't do with ref cycles #
  2029. {"insts0", "instruction-retired", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  2030. {"insts0", "PERF_COUNT_HW_INSTRUCTIONS", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  2031. {"insts1", "instruction-retired", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  2032. {"insts1", "PERF_COUNT_HW_INSTRUCTIONS", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  2033. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2034. };
  2035. static Hwcentry intelAtomList[] = {
  2036. {"cycles", "cpu_clk_unhalted.core", /*6759307*/ REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  2037. {"cycles", "cpu_clk_unhalted.thread", /*6759307*/ REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_7, 1, ABST_NONE},
  2038. {"insts", "instr_retired.any", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_7, 0, ABST_NONE},
  2039. /* explicit definitions of (hidden) entries for proper counters */
  2040. /* Only counters that can be time converted, or are load-store need to be in this table */
  2041. /* XXXX add core2-related entries if appropriate */
  2042. {/*30A*/"cpu_clk_unhalted.core", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  2043. {/*30A*/"cpu_clk_unhalted.thread", /*6759307*/ NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  2044. {/*0c*/"page_walks.cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2045. {/*14*/"cycles_div_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2046. {/*21*/"l2_ads", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2047. {/*22*/"l2_dbus_busy", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2048. {/*32*/"l2_no_req", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2049. {/*3c*/"cpu_clk_unhalted.core_p", NULL, REGNO_ANY, NULL, PRELOADS_7, 1, ABST_NONE},
  2050. {/*3c*/"cpu_clk_unhalted.bus", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2051. {/*3c*/"cpu_clk_unhalted.no_other", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2052. {/*62*/"bus_drdy_clocks", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2053. {/*63*/"bus_lock_clocks", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2054. {/*64*/"bus_data_rcv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2055. {/*7a*/"bus_hit_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2056. {/*7b*/"bus_hitm_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2057. {/*7d*/"busq_empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2058. {/*7e*/"snoop_stall_drv", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2059. {/*7f*/"bus_io_wait", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2060. {/*c6*/"cycles_int_masked.cycles_int_masked", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2061. {/*c6*/"cycles_int_masked.cycles_int_pending_and_masked", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2062. /* "Architectural" events: */
  2063. {/*3c*/"unhalted-core-cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2064. /* additional (hidden) aliases for convenience */
  2065. {"cycles0", "cpu_clk_unhalted.core_p", 0, NULL, PRELOADS_75, 1, ABST_NONE},
  2066. {"cycles1", "cpu_clk_unhalted.core_p", 1, NULL, PRELOADS_75, 1, ABST_NONE},
  2067. {"insts0", "inst_retired.any_p", 0, NULL, PRELOADS_75, 0, ABST_NONE},
  2068. {"insts1", "inst_retired.any_p", 1, NULL, PRELOADS_75, 0, ABST_NONE},
  2069. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2070. };
  2071. static Hwcentry amd_opteron_10h_11h[] = {
  2072. {"cycles", "BU_cpu_clk_unhalted", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  2073. {"insts", "FR_retired_x86_instr_w_excp_intr", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  2074. {"icr", "IC_fetch", REGNO_ANY, STXT ("L1 I-cache Refs"), PRELOADS_7, 0, ABST_NONE}, /* new */
  2075. {"icm", "IC_miss", REGNO_ANY, STXT ("L1 I-cache Misses"), PRELOADS_6, 0, ABST_NONE},
  2076. {"l2itlbh", "IC_itlb_L1_miss_L2_hit", REGNO_ANY, STXT ("L2 ITLB Hits"), PRELOADS_6, 0, ABST_NONE}, /* new */
  2077. {"l2itlbm", "IC_itlb_L1_miss_L2_miss", REGNO_ANY, STXT ("L2 ITLB Misses"), PRELOADS_5, 0, ABST_NONE}, /* new */
  2078. {"l2ir", "BU_internal_L2_req~umask=0x1", REGNO_ANY, STXT ("L2 I-cache Refs"), PRELOADS_6, 0, ABST_NONE},
  2079. {"l2im", "BU_fill_req_missed_L2~umask=0x1", REGNO_ANY, STXT ("L2 I-cache Misses"), PRELOADS_4, 0, ABST_NONE},
  2080. {"dcr", "DC_access", REGNO_ANY, STXT ("L1 D-cache Refs"), PRELOADS_7, 0, ABST_NONE}, /* new */
  2081. {"dcm", "DC_miss", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE}, /* new */
  2082. {"l2dtlbh", "DC_dtlb_L1_miss_L2_hit", REGNO_ANY, STXT ("L2 DTLB Hits"), PRELOADS_6, 0, ABST_NONE}, /* new */
  2083. {"l2dtlbm", "DC_dtlb_L1_miss_L2_miss", REGNO_ANY, STXT ("L2 DTLB Misses"), PRELOADS_5, 0, ABST_NONE}, /* new */
  2084. {"l2dr", "BU_internal_L2_req~umask=0x2", REGNO_ANY, STXT ("L2 D-cache Refs"), PRELOADS_65, 0, ABST_NONE}, /* hwc_cache_load: 1.6x overcount on shanghai01 */
  2085. {"l2dm", "BU_fill_req_missed_L2~umask=0x2", REGNO_ANY, STXT ("L2 D-cache Misses"), PRELOADS_6, 0, ABST_NONE}, /* new */
  2086. {"fpadd", "FP_dispatched_fpu_ops~umask=0x1", REGNO_ANY, STXT ("FP Adds"), PRELOADS_7, 0, ABST_NONE},
  2087. {"fpmul", "FP_dispatched_fpu_ops~umask=0x2", REGNO_ANY, STXT ("FP Muls"), PRELOADS_7, 0, ABST_NONE},
  2088. {"fpustall", "FR_dispatch_stall_fpu_full", REGNO_ANY, STXT ("FPU Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  2089. {"memstall", "FR_dispatch_stall_ls_full", REGNO_ANY, STXT ("Memory Unit Stall Cycles"), PRELOADS_7, 1, ABST_NONE},
  2090. // For PAPI mappings, see hwctable.README.family10h
  2091. // For PAPI mappings, see hwctable.README.opteron
  2092. /* explicit definitions of (hidden) entries for proper counters */
  2093. /* Only counters that can be time converted, or are load-store need to be in this table */
  2094. {"BU_cpu_clk_unhalted", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  2095. {"FP_cycles_no_fpu_ops_retired", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2096. {"FP_serialize_ops_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2097. {"FR_dispatch_stall_branch_abort_to_retire", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2098. {"FR_dispatch_stall_far_ctl_trsfr_resync_branch_pend", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2099. {"FR_dispatch_stall_fpu_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2100. {"FR_dispatch_stall_ls_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2101. {"FR_dispatch_stall_reorder_buffer_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2102. {"FR_dispatch_stall_resv_stations_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2103. {"FR_dispatch_stall_segment_load", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2104. {"FR_dispatch_stall_serialization", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2105. {"FR_dispatch_stall_waiting_all_quiet", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2106. {"FR_dispatch_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2107. {"FR_intr_masked_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2108. {"FR_intr_masked_while_pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2109. {"FR_nothing_to_dispatch", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2110. {"IC_instr_fetch_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2111. {"LS_buffer_2_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2112. {"NB_mem_ctrlr_dram_cmd_slots_missed", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2113. {"NB_mem_ctrlr_turnaround", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_TBD},
  2114. /* additional (hidden) aliases, for convenience */
  2115. {"cycles0", "BU_cpu_clk_unhalted", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  2116. {"cycles1", "BU_cpu_clk_unhalted", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  2117. {"insts0", "FR_retired_x86_instr_w_excp_intr", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  2118. {"insts1", "FR_retired_x86_instr_w_excp_intr", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  2119. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2120. };
  2121. static Hwcentry amd_15h[] = {
  2122. {"cycles", "CU_cpu_clk_unhalted", REGNO_ANY, STXT ("CPU Cycles"), PRELOADS_75, 1, ABST_NONE},
  2123. {"insts", "EX_retired_instr_w_excp_intr", REGNO_ANY, STXT ("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  2124. {"icr", "IC_fetch", REGNO_ANY, STXT ("L1 I-cache Refs"), PRELOADS_7, 0, ABST_NONE}, /* new */
  2125. {"icm", "IC_miss", REGNO_ANY, STXT ("L1 I-cache Misses"), PRELOADS_6, 0, ABST_NONE},
  2126. {"l2im", "IC_refill_from_system", REGNO_ANY, STXT ("L2 I-cache Misses"), PRELOADS_6, 0, ABST_NONE},
  2127. {"dcr", "DC_access", REGNO_ANY, STXT ("L1 D-cache Refs"), PRELOADS_7, 0, ABST_NONE}, /* new */
  2128. {"dcm", "DC_miss~umask=0x3", REGNO_ANY, STXT ("L1 D-cache Misses"), PRELOADS_65, 0, ABST_NONE}, /* new */
  2129. {"l2dm", "DC_refill_from_system", REGNO_ANY, STXT ("L2 D-cache Misses"), PRELOADS_6, 0, ABST_NONE}, /* new */
  2130. {"dtlbm", "DC_unified_tlb_miss~umask=0x7", REGNO_ANY, STXT ("L2 DTLB Misses"), PRELOADS_5, 0, ABST_NONE}, /* new */
  2131. // For PAPI mappings, see hwctable.README.family15h
  2132. /* explicit definitions of (hidden) entries for proper counters */
  2133. /* Only counters that can be time converted, or are load-store need to be in this table */
  2134. {/*001.xx*/"FP_scheduler_empty", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2135. {/*006.xx*/"FP_bottom_execute_uops_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2136. {/*023.xx*/"LS_ldq_stq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2137. {/*024.xx*/"LS_locked_operation", /*umask!=0*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2138. {/*069.xx*/"CU_mab_wait_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2139. {/*076.xx*/"CU_cpu_clk_unhalted", NULL, REGNO_ANY, NULL, PRELOADS_75, 1, ABST_NONE},
  2140. {/*087.xx*/"IC_instr_fetch_stall", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2141. {/*0cd.xx*/"EX_intr_masked_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2142. {/*0ce.xx*/"EX_intr_masked_while_pending_cycles", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2143. {/*0d0.xx*/"DE_nothing_to_dispatch", /*future*/ NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2144. {/*0d1.xx*/"DE_dispatch_stalls", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2145. {/*0d3.xx*/"DE_dispatch_stall_serialization", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2146. {/*0d5.xx*/"DE_dispatch_stall_instr_retire_q_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2147. {/*0d6.xx*/"DE_dispatch_stall_int_scheduler_q_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2148. {/*0d7.xx*/"DE_dispatch_stall_fp_scheduler_q_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2149. {/*0d8.xx*/"DE_dispatch_stall_ldq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2150. {/*0d9.xx*/"DE_dispatch_stall_waiting_all_quiet", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2151. {/*1d8.xx*/"EX_dispatch_stall_stq_full", NULL, REGNO_ANY, NULL, PRELOAD_DEF, 1, ABST_NONE},
  2152. /* additional (hidden) aliases, for convenience */
  2153. {"cycles0", "CU_cpu_clk_unhalted", 0, NULL, PRELOADS_8, 1, ABST_NONE},
  2154. {"cycles1", "CU_cpu_clk_unhalted", 1, NULL, PRELOADS_8, 1, ABST_NONE},
  2155. {"insts0", "EX_retired_instr_w_excp_intr", 0, NULL, PRELOADS_8, 0, ABST_NONE},
  2156. {"insts1", "EX_retired_instr_w_excp_intr", 1, NULL, PRELOADS_8, 0, ABST_NONE},
  2157. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2158. };
  2159. #define USE_ARM_REF_CYCLES \
  2160. {"usr_time","cycles", REGNO_ANY, STXT("User CPU"), PRELOADS_85, 1, ABST_NONE}, \
  2161. {"sys_time","cycles~system=1~user=0", REGNO_ANY, STXT("System CPU"), PRELOADS_85, 1, ABST_NONE}, \
  2162. static Hwcentry armlist[] = {
  2163. USE_ARM_REF_CYCLES
  2164. // Hardware event:
  2165. {"branch-instructions", NULL, REGNO_ANY, STXT("Branch-instructions"), PRELOADS_35, 0, ABST_NONE},
  2166. {"branch-misses", NULL, REGNO_ANY, STXT("Branch-misses"), PRELOADS_35, 0, ABST_NONE},
  2167. {"bus-cycles", NULL, REGNO_ANY, STXT("Bus Cycles"), PRELOADS_35, 1, ABST_NONE},
  2168. {"cache-misses", NULL, REGNO_ANY, STXT("Cache-misses"), PRELOADS_35, 0, ABST_NONE},
  2169. {"cache-references", NULL, REGNO_ANY, STXT("Cache-references"), PRELOADS_35, 0, ABST_NONE},
  2170. {"cycles", NULL, REGNO_ANY, STXT("CPU Cycles"), PRELOADS_85, 1, ABST_NONE},
  2171. {"insts", "instructions", REGNO_ANY, STXT("Instructions Executed"), PRELOADS_75, 0, ABST_NONE},
  2172. {"ref-cycles", NULL, REGNO_ANY, STXT("Total Cycles"), PRELOADS_85, 1, ABST_NONE},
  2173. {"stalled-cycles-backend", NULL, REGNO_ANY, STXT("Stalled Cycles during issue."), PRELOADS_85, 1, ABST_NONE},
  2174. {"stalled-cycles-frontend", NULL, REGNO_ANY, STXT("Stalled Cycles during retirement."), PRELOADS_85, 1, ABST_NONE},
  2175. // Software event:
  2176. {"alignment-faults", NULL, REGNO_ANY, STXT("Alignment Faults"), PRELOADS_85, 0, ABST_NONE},
  2177. {"context-switches", NULL, REGNO_ANY, STXT("Context Switches"), PRELOADS_85, 0, ABST_NONE},
  2178. {"cpu-clock", NULL, REGNO_ANY, STXT("CPU Clock"), PRELOADS_85, 1, ABST_NONE},
  2179. {"cpu-migrations", NULL, REGNO_ANY, STXT("CPU Migrations"), PRELOADS_85, 0, ABST_NONE},
  2180. {"emulation-faults", NULL, REGNO_ANY, STXT("Emulation Faults"), PRELOADS_85, 0, ABST_NONE},
  2181. {"major-faults", NULL, REGNO_ANY, STXT("Major Page Faults"), PRELOADS_85, 0, ABST_NONE},
  2182. {"minor-faults", NULL, REGNO_ANY, STXT("Minor Page Faults"), PRELOADS_85, 0, ABST_NONE},
  2183. {"page-faults", NULL, REGNO_ANY, STXT("Page Faults"), PRELOADS_85, 0, ABST_NONE},
  2184. {"task-clock", NULL, REGNO_ANY, STXT("Clock Count Specific"), PRELOADS_85, 1, ABST_NONE},
  2185. // Hardware cache event
  2186. {"L1-dcache-load-misses", NULL, REGNO_ANY, STXT("L1 D-cache Load Misses"), PRELOADS_35, 0, ABST_NONE},
  2187. {"L1-dcache-loads", NULL, REGNO_ANY, STXT("L1 D-cache Loads"), PRELOADS_35, 0, ABST_NONE},
  2188. {"L1-dcache-store-misses", NULL, REGNO_ANY, STXT("L1 D-cache Store Misses"), PRELOADS_35, 0, ABST_NONE},
  2189. {"L1-dcache-stores", NULL, REGNO_ANY, STXT("L1 D-cache Store Stores"), PRELOADS_35, 0, ABST_NONE},
  2190. {"L1-icache-load-misses", NULL, REGNO_ANY, STXT("L1 Instructions Load Misses"), PRELOADS_35, 0, ABST_NONE},
  2191. {"L1-icache-load-misses", NULL, REGNO_ANY, STXT("L1 Instructions Loads"), PRELOADS_35, 0, ABST_NONE},
  2192. {"dTLB-load-misses", NULL, REGNO_ANY, STXT("D-TLB Load Misses"), PRELOADS_35, 0, ABST_NONE},
  2193. {"dTLB-loads", NULL, REGNO_ANY, STXT("D-TLB Loads"), PRELOADS_35, 0, ABST_NONE},
  2194. {"iTLB-load-misses", NULL, REGNO_ANY, STXT("The Instruction TLB Load Misses"), PRELOADS_35, 0, ABST_NONE},
  2195. {"iTLB-loads", NULL, REGNO_ANY, STXT("The Instruction TLB Loads"), PRELOADS_35, 0, ABST_NONE},
  2196. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2197. };
  2198. static Hwcentry unknownlist[] =
  2199. /* used for unrecognized CPU type */{
  2200. {NULL, NULL, 0, NULL, 0, 0, 0, 0, ABST_NONE}
  2201. };
  2202. /* structure defining the counters for a CPU type */
  2203. typedef struct
  2204. {
  2205. int cputag;
  2206. Hwcentry *stdlist_table;
  2207. #define MAX_DEFAULT_HWC_DEFS 4 // allows multiple defs to handle OS variations; extend as needed
  2208. char *default_exp_p[MAX_DEFAULT_HWC_DEFS + 1]; // end of list MUST be marked with NULL
  2209. } cpu_list_t;
  2210. /* IMPORTANT NOTE:
  2211. *
  2212. * Any default HWC string must consist of counter names separated by -TWO- commas,
  2213. * with a no trailing comma/value after the last counter name
  2214. *
  2215. * Only aliased counters should be specified; non-aliased counters will
  2216. * not get the right overflow values set.
  2217. * If the string is not formatted that way, -h hi and -h lo will fail
  2218. */
  2219. static cpu_list_t cputabs[] = {
  2220. {CPC_ULTRA1, usIlist, {NULL}}, /* bind will fail */
  2221. {CPC_ULTRA2, usIlist, {NULL}}, /* bind will fail */
  2222. {CPC_ULTRA3, usIIIlist, {"insts,,ecstall", 0}},
  2223. {CPC_ULTRA3_PLUS, usIIIlist, {"insts,,ecstall", 0}},
  2224. {CPC_ULTRA3_I, usIIIlist, {"insts,,ecstall", 0}},
  2225. {CPC_ULTRA4_PLUS, usIVplist, {"insts,,ecstall", 0}},
  2226. {CPC_ULTRA_T1, niagara1, {"insts", 0}},
  2227. {CPC_ULTRA_T2, niagara2, {"insts,,+l2drm", 0}},
  2228. {CPC_ULTRA_T2P, niagara2, {"insts,,+l2drm", 0}},
  2229. {CPC_ULTRA_T3, niagara2, {"insts,,+l2drm", 0}},
  2230. {CPC_SPARC_T4, sparc_t4, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}},
  2231. {CPC_SPARC_M4, sparc_t5_m6, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}}, // renamed to m5
  2232. {CPC_SPARC_T5, sparc_t5_m6, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}},
  2233. {CPC_SPARC_M5, sparc_t5_m6, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}},
  2234. {CPC_SPARC_T6, sparc_t5_m6, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}}, // no such processor
  2235. {CPC_SPARC_M6, sparc_t5_m6, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}},
  2236. {CPC_SPARC_M7, sparc_m7, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}}, // includes T7
  2237. {CPC_SPARC_M8, sparc_m8, {"insts,,cycles,,c_stalls,,dcm", "c_stalls", 0}},
  2238. {CPC_PENTIUM_PRO_MMX, pentiumIIlist, {"insts", 0}},
  2239. {CPC_PENTIUM_PRO, pentiumIIIlist, {"insts", 0}},
  2240. {CPC_PENTIUM_4, pentium4, {"insts", 0}},
  2241. {CPC_PENTIUM_4_HT, pentium4, {"insts", 0}},
  2242. {CPC_INTEL_CORE2, intelCore2list, {"insts,,cycles", 0}},
  2243. {CPC_INTEL_NEHALEM, intelNehalemList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2244. "insts,,cycles,,l3m_stall,,dtlbm_stall", 0}},
  2245. {CPC_INTEL_WESTMERE, intelNehalemList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2246. "insts,,cycles,,l3m_stall,,dtlbm_stall", 0}},
  2247. {CPC_INTEL_SANDYBRIDGE, intelSandyBridgeList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2248. "insts,,cycles,,l3m,,dtlbm", 0}},
  2249. {CPC_INTEL_IVYBRIDGE, intelSandyBridgeList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2250. "insts,,cycles,,l3m,,dtlbm", 0}},
  2251. {CPC_INTEL_HASWELL, intelHaswellList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2252. "insts,,cycles,,l3m,,dtlbm", 0}},
  2253. {CPC_INTEL_BROADWELL, intelBroadwellList, {"insts,,cycles,,+l2m_latency,,dtlbm",
  2254. "insts,,cycles,,l3m,,dtlbm", 0}},
  2255. {CPC_INTEL_SKYLAKE, intelSkylakeList, {"insts,,cycles,,+l2m_latency,,dtlbm_stall",
  2256. "insts,,cycles,,l2m_stall,,dtlbm_stall", 0}},
  2257. {CPC_INTEL_UNKNOWN, intelLinuxUnknown, {"cycles,,insts,,llm",
  2258. "user_time,,system_time,,cycles,,insts,,llm", 0}},
  2259. {CPC_INTEL_ATOM, intelAtomList, {"insts", 0}},
  2260. {CPC_AMD_K8C, amd_opteron_10h_11h, {"insts,,cycles,,l2dm,,l2dtlbm", 0}},
  2261. {CPC_AMD_FAM_10H, amd_opteron_10h_11h, {"insts,,cycles,,l2dm,,l2dtlbm", 0}},
  2262. {CPC_AMD_FAM_11H, amd_opteron_10h_11h, {"insts,,cycles,,l2dm,,l2dtlbm", 0}},
  2263. {CPC_AMD_FAM_15H, amd_15h, {"insts,,cycles", 0}},
  2264. {CPC_SPARC64_V, usfuji_V_list, {"insts,,cycles", 0}},
  2265. {CPC_SPARC64_VI, usfuji_VI_VII_list, {"insts,,cycles,,dcstall", 0}},
  2266. {CPC_SPARC64_VII, usfuji_VI_VII_list, {"insts,,cycles,,dcstall", 0}},
  2267. {CPC_SPARC64_X, usfuji_X_list, {"insts,,cycles,,dcstall", 0}},
  2268. {CPC_SPARC64_XII, usfuji_XII_list, {"insts,,cycles,,dcstall", 0}},
  2269. {CPC_KPROF, kproflist, {NULL}}, // OBSOLETE (To support 12.3 and earlier, TBR)
  2270. {ARM_CPU_IMP_APM, armlist, {"insts,,cycles", 0}},
  2271. {0, unknownlist, {NULL}} /* processor is unknown, but experiment is allowed */
  2272. };
  2273. /*---------------------------------------------------------------------------*/
  2274. /* state variables */
  2275. static int initialized;
  2276. static int signals_disabled;
  2277. // Simple array list
  2278. typedef struct
  2279. {
  2280. void** array; // array of ptrs, last item set to null
  2281. int sz; // num live elements in array
  2282. int max; // array allocation size
  2283. } ptr_list;
  2284. static void
  2285. ptr_list_init (ptr_list *lst)
  2286. {
  2287. lst->sz = 0;
  2288. lst->max = 0;
  2289. lst->array = 0;
  2290. }
  2291. static void
  2292. ptr_list_add (ptr_list *lst, char* ptr)
  2293. { // ptr must be freeable
  2294. if (lst->sz >= lst->max - 1)
  2295. {
  2296. void * * new;
  2297. int newmax = lst->max ? lst->max * 2 : 16;
  2298. new = (void**) realloc (lst->array, newmax * sizeof (void*));
  2299. if (!new) return; // failed, discard add
  2300. lst->max = newmax;
  2301. lst->array = new;
  2302. }
  2303. lst->array[lst->sz++] = ptr;
  2304. lst->array[lst->sz] = NULL; // mark new end-of-list
  2305. }
  2306. static void
  2307. ptr_list_free (ptr_list *lst)
  2308. { // includes shallow free of all elements
  2309. if (lst->array)
  2310. {
  2311. for (int ii = 0; lst->array[ii]; ii++)
  2312. free (lst->array[ii]);
  2313. free (lst->array);
  2314. }
  2315. lst->sz = 0;
  2316. lst->max = 0;
  2317. lst->array = 0;
  2318. }
  2319. // Capabilities of this machine (initialized by setup_cpc())
  2320. static int cpcx_cpuver = CPUVER_UNDEFINED;
  2321. static uint_t cpcx_npics;
  2322. static const char *cpcx_cciname;
  2323. static const char *cpcx_docref;
  2324. static uint64_t cpcx_support_bitmask;
  2325. // cpcx_*[0]: collect lists
  2326. // cpcx_*[1]: er_kernel lists
  2327. // Each cpcx_*[] list is an array of ptrs with null ptr marking end of list
  2328. static char **cpcx_attrs[2];
  2329. static Hwcentry **cpcx_std[2];
  2330. static Hwcentry **cpcx_raw[2];
  2331. static Hwcentry **cpcx_hidden[2];
  2332. static uint_t cpcx_max_concurrent[2];
  2333. static char *cpcx_default_hwcs[2];
  2334. static char *cpcx_orig_default_hwcs[2];
  2335. static int cpcx_has_precise[2];
  2336. #define VALID_FOR_KERNEL(forKernel) ((forKernel)>=0 && (forKernel)<=1)
  2337. #define IS_KERNEL(forKernel) ((forKernel)==1)
  2338. // used to build lists:
  2339. static ptr_list unfiltered_attrs;
  2340. static ptr_list unfiltered_raw;
  2341. /*---------------------------------------------------------------------------*/
  2342. /* misc internal utilities */
  2343. /* compare 2 strings to either \0 or <termchar> */
  2344. #define IS_EOL(currchar, termchar) ((currchar)==(termchar) || (currchar)==0)
  2345. static int
  2346. is_same (const char * regname, const char * int_name, char termchar)
  2347. {
  2348. do
  2349. {
  2350. char a = *regname;
  2351. char b = *int_name;
  2352. if (IS_EOL (a, termchar))
  2353. {
  2354. if (IS_EOL (b, termchar))
  2355. return 1; /* strings are the same up to terminating char */
  2356. else
  2357. break; /* strings differ */
  2358. }
  2359. if (a != b)
  2360. break; /* strings differ */
  2361. regname++;
  2362. int_name++;
  2363. }
  2364. while (1);
  2365. return 0;
  2366. }
  2367. static int
  2368. is_numeric (const char *name, uint64_t *pval)
  2369. {
  2370. char *endptr;
  2371. uint64_t val = strtoull (name, &endptr, 0);
  2372. if (!*name || *endptr)
  2373. return 0; /* name does not specify a numeric value */
  2374. if (pval)
  2375. *pval = val;
  2376. return 1;
  2377. }
  2378. static int
  2379. is_visible_alias (Hwcentry* pctr)
  2380. {
  2381. if (!pctr)
  2382. return 0;
  2383. if (pctr->name && pctr->int_name && pctr->metric)
  2384. return 1;
  2385. return 0;
  2386. }
  2387. static int
  2388. is_hidden_alias (Hwcentry* pctr)
  2389. {
  2390. if (!pctr)
  2391. return 0;
  2392. if (pctr->name && pctr->int_name && pctr->metric == NULL)
  2393. return 1;
  2394. return 0;
  2395. }
  2396. static int
  2397. is_numeric_alias (Hwcentry* pctr)
  2398. {
  2399. int is_numeric_alias = 0;
  2400. regno_t regno;
  2401. char *nameOnly = NULL;
  2402. hwcfuncs_parse_ctr (pctr->int_name, NULL, &nameOnly, NULL, NULL, &regno);
  2403. if (is_numeric (nameOnly, NULL))
  2404. is_numeric_alias = 1;
  2405. free (nameOnly);
  2406. return is_numeric_alias;
  2407. }
  2408. /* print list of register to a buffer */
  2409. /*
  2410. * style e x a m p l e s
  2411. * 0 NONE 2 {0|1|2|3}
  2412. * 1 NONE 2 : 0, 1, 2, or 3
  2413. * 2 0 1 2 3 6
  2414. */
  2415. static char *
  2416. get_regnolist (char *buf, size_t sz, const regno_t *reg_list, int style)
  2417. {
  2418. if (!buf || !sz)
  2419. return "INTERNAL ERROR";
  2420. buf[0] = 0;
  2421. if (style == 2)
  2422. {
  2423. int ii;
  2424. // width should be consistent with that in format_columns()
  2425. // the format will accommodate cpcx_npics regs
  2426. if (cpcx_npics < 1)
  2427. return "INTERNAL ERROR";
  2428. // clear out the buffer
  2429. for (ii = 0; ii < sz; ii++)
  2430. buf[ii] = '_';
  2431. if (cpcx_npics <= 9)
  2432. {
  2433. // one char per reg, plus terminating null char
  2434. if (cpcx_npics + 1 > sz)
  2435. return "INTERNAL ERROR";
  2436. buf[cpcx_npics] = '\0';
  2437. // fill buf with regnos
  2438. for (ii = 0; ii < MAX_PICS; ii++)
  2439. {
  2440. regno_t regno = reg_list[ii];
  2441. if (REG_LIST_EOL (regno))
  2442. break;
  2443. if (regno < 0 || regno >= cpcx_npics)
  2444. return "INTERNAL ERROR";
  2445. buf[regno] = '0' + regno;
  2446. }
  2447. }
  2448. else
  2449. {
  2450. /* space between regs, which may be 1 or 2 digits each
  2451. * 1 char for reg 0
  2452. * 2 chars for regs 1-9 each
  2453. * 3 chars for regs 10- each
  2454. * 1 char for terminating null char
  2455. */
  2456. int nchars = 17 + 3 * (cpcx_npics - 9);
  2457. if (nchars > sz)
  2458. return "INTERNAL ERROR";
  2459. buf[nchars - 1] = '\0';
  2460. // fill buf with regnos
  2461. for (ii = 0; ii < MAX_PICS; ii++)
  2462. {
  2463. regno_t regno = reg_list[ii];
  2464. if (REG_LIST_EOL (regno))
  2465. break;
  2466. if (regno <= 9)
  2467. buf[2 * regno ] = '0' + regno;
  2468. else
  2469. {
  2470. buf[3 * (regno - 9) + 17] = '0' + (regno / 10);
  2471. buf[3 * (regno - 9) + 18] = '0' + (regno % 10);
  2472. }
  2473. }
  2474. }
  2475. return buf;
  2476. }
  2477. if (REG_LIST_IS_EMPTY (reg_list))
  2478. {
  2479. snprintf (buf, sz, GTXT ("NONE"));
  2480. return buf;
  2481. }
  2482. else if (REG_LIST_EOL (reg_list[1]))
  2483. {
  2484. /* 1 item in list */
  2485. snprintf (buf, sz, "%d", reg_list[0]);
  2486. return buf;
  2487. }
  2488. else
  2489. {
  2490. /* 2 more items in list */
  2491. int ii, num_regs;
  2492. for (ii = 0; ii < MAX_PICS; ii++)
  2493. {
  2494. regno_t regno = reg_list[ii];
  2495. if (REG_LIST_EOL (regno))
  2496. break;
  2497. }
  2498. num_regs = ii;
  2499. buf[0] = 0;
  2500. for (ii = 0; ii < num_regs; ii++)
  2501. {
  2502. regno_t regno = reg_list[ii];
  2503. if (style == 0)
  2504. snprintf (buf + strlen (buf), sz - strlen (buf),
  2505. "%c%d", ii ? '|' : '{', regno);
  2506. else
  2507. {
  2508. if (num_regs == 2)
  2509. snprintf (buf + strlen (buf), sz - strlen (buf),
  2510. "%d%s", regno, !ii ? " or " : "");
  2511. else
  2512. {
  2513. /* 3 or more items in list */
  2514. if (ii < num_regs - 2)
  2515. snprintf (buf + strlen (buf), sz - strlen (buf),
  2516. "%d, ", regno);
  2517. else if (ii == num_regs - 2)
  2518. snprintf (buf + strlen (buf), sz - strlen (buf),
  2519. "%d, or ", regno);
  2520. else
  2521. snprintf (buf + strlen (buf), sz - strlen (buf),
  2522. "%d", regno);
  2523. }
  2524. }
  2525. }
  2526. if (style == 0)
  2527. snprintf (buf + strlen (buf), sz - strlen (buf), "}");
  2528. }
  2529. return buf;
  2530. }
  2531. #if !HWC_DEBUG
  2532. #define hwcentry_print(lvl,x1,x2)
  2533. #else
  2534. /* print a Hwcentry */
  2535. static void
  2536. hwcentry_print (int lvl, const char * header, const Hwcentry *pentry)
  2537. {
  2538. char buf[1024];
  2539. Tprintf (lvl, "%s '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, /",
  2540. header,
  2541. pentry->name ? pentry->name : "NULL",
  2542. pentry->int_name ? pentry->int_name : "NULL",
  2543. pentry->reg_num,
  2544. pentry->metric ? pentry->metric : "NULL",
  2545. pentry->lval, /* low-resolution/long run */
  2546. pentry->val, /* normal */
  2547. pentry->hval, /* high-resolution/short run */
  2548. pentry->timecvt,
  2549. pentry->memop, /* type of instruction that can trigger */
  2550. pentry->sort_order);
  2551. get_regnolist (buf, sizeof (buf), pentry->reg_list, 0);
  2552. Tprintf (lvl, "%s\n", buf);
  2553. }
  2554. #endif
  2555. /* add <regno> to a Hwcentry's list */
  2556. static void
  2557. regno_add (Hwcentry * pctr, regno_t regno)
  2558. {
  2559. int jj;
  2560. regno_t *reg_list;
  2561. if (!pctr)
  2562. {
  2563. Tprintf (0, "hwctable: regno_add(): ERROR: pctr==NULL\n");
  2564. return;
  2565. }
  2566. reg_list = pctr->reg_list;
  2567. if (!reg_list)
  2568. {
  2569. /* create list */
  2570. reg_list = (regno_t*) malloc (sizeof (regno_t*) * MAX_PICS);
  2571. if (!reg_list)
  2572. {
  2573. hwcentry_print (DBG_LT0, "hwctable: regno_add: ERROR:"
  2574. " Out of memory: ", pctr);
  2575. return;
  2576. }
  2577. /* initialize list */
  2578. for (jj = 0; jj < MAX_PICS; jj++)
  2579. reg_list[jj] = REGNO_ANY;
  2580. pctr->reg_list = reg_list;
  2581. }
  2582. if (regno == REGNO_ANY)
  2583. {
  2584. /* add all counters up to cpcx_npics */
  2585. for (jj = 0; jj < MAX_PICS && jj < cpcx_npics; jj++)
  2586. reg_list[jj] = jj;
  2587. }
  2588. else
  2589. {
  2590. /* add <regno> to list of registers */
  2591. for (jj = 0; jj < MAX_PICS; jj++)
  2592. {
  2593. if (reg_list[jj] == regno)
  2594. {
  2595. hwcentry_print (DBG_LT0, "hwctable: regno_add: WARNING: "
  2596. "Duplicate regno: ", pctr);
  2597. break;
  2598. }
  2599. if (reg_list[jj] == REGNO_ANY)
  2600. {
  2601. reg_list[jj] = regno;
  2602. break;
  2603. }
  2604. }
  2605. }
  2606. if (jj == MAX_PICS)
  2607. hwcentry_print (DBG_LT0, "hwctable: regno_add: WARNING:"
  2608. " regno list is full:", pctr);
  2609. }
  2610. /*---------------------------------------------------------------------------*/
  2611. /* utilities for rawlist (list of raw counters with reglist[] filled in) */
  2612. /* search the 'raw' list of counters for <name> */
  2613. static Hwcentry *
  2614. ptrarray_find_by_name (Hwcentry** array, const char * name)
  2615. {
  2616. if (name == NULL)
  2617. return NULL;
  2618. Tprintf (DBG_LT3, "hwctable: array_find_by_name(%s):\n", name);
  2619. for (int ii = 0; array && array[ii]; ii++)
  2620. if (strcmp (array[ii]->name, name) == 0)
  2621. return array[ii];
  2622. return NULL; /* not found */
  2623. }
  2624. /* add Hwcentry to the 'raw' list of counters */
  2625. static Hwcentry *
  2626. alloc_shallow_copy (const Hwcentry *pctr)
  2627. {
  2628. Hwcentry *node = (Hwcentry *) malloc (sizeof (Hwcentry));
  2629. if (!node)
  2630. return NULL; // fail
  2631. *node = *pctr; /* shallow copy! */
  2632. if (pctr->name)
  2633. node->name = strdup (pctr->name);
  2634. return node;
  2635. }
  2636. /* add Hwcentry to the 'raw' list of counters */
  2637. static Hwcentry *
  2638. list_append_shallow_copy (ptr_list *list, const Hwcentry *pctr)
  2639. {
  2640. Hwcentry *node = alloc_shallow_copy (pctr);
  2641. if (!node)
  2642. return NULL; // fail
  2643. ptr_list_add (list, (void*) node);
  2644. return node;
  2645. }
  2646. static Hwcentry *
  2647. list_add (ptr_list *list, uint_t regno, const char *name)
  2648. {
  2649. Hwcentry *praw;
  2650. praw = ptrarray_find_by_name ((Hwcentry**) list->array, name);
  2651. if (!praw)
  2652. {
  2653. Hwcentry tmpctr = empty_ctr;
  2654. tmpctr.name = (char *) name;
  2655. praw = list_append_shallow_copy (list, &tmpctr);
  2656. }
  2657. if (praw)
  2658. regno_add (praw, regno);
  2659. return praw;
  2660. }
  2661. /*---------------------------------------------------------------------------*/
  2662. /* utilities for stdlist (table of aliased, hidden, & convenience, ctrs) */
  2663. /* find top level definition for <cpuid> */
  2664. static cpu_list_t*
  2665. cputabs_find_entry (int cpuid)
  2666. {
  2667. int i;
  2668. /* now search for the appropriate table */
  2669. for (i = 0;; i++)
  2670. {
  2671. if (cputabs[i].cputag == 0)
  2672. break;
  2673. if (cpuid == cputabs[i].cputag)
  2674. return &cputabs[i];
  2675. }
  2676. Tprintf (0, "hwctable: cputabs_find_entry: WARNING: "
  2677. "cpu_id = %d not defined. No 'standard' counters are available\n",
  2678. cpuid);
  2679. return &cputabs[i];
  2680. }
  2681. /* find Hwcentry table for <cpuid> */
  2682. static Hwcentry*
  2683. stdlist_get_table (int cpuid)
  2684. {
  2685. cpu_list_t* tmp = cputabs_find_entry (cpuid);
  2686. if (tmp)
  2687. return tmp->stdlist_table;
  2688. return NULL;
  2689. }
  2690. /* search the 'standard' list of counters for <name>,<regno> */
  2691. /* note: <regno>=REGNO_ANY is a wildcard that matches any value. */
  2692. /* note: int_name==NULL is a wildcard */
  2693. static const Hwcentry *
  2694. ptrarray_find (const Hwcentry **array, const char *name, const char *int_name,
  2695. int check_regno, regno_t regno)
  2696. {
  2697. const Hwcentry *pctr;
  2698. if (!array)
  2699. return NULL;
  2700. for (int ii = 0; array[ii]; ii++)
  2701. {
  2702. pctr = array[ii];
  2703. if (strcmp (pctr->name, name))
  2704. continue;
  2705. if (int_name && int_name[0] != 0 && pctr->int_name)
  2706. {
  2707. if (NULL == strstr (int_name, pctr->int_name))
  2708. continue;
  2709. }
  2710. if (!check_regno)
  2711. return pctr;
  2712. else
  2713. {
  2714. /* duplicates aliases are allowed in table because of 6759307 */
  2715. if (REG_LIST_IS_EMPTY (pctr->reg_list))
  2716. {
  2717. /* skip aliases that don't have a valid list of registers */
  2718. hwcentry_print (1, "hwctable: stdlist_find_by_name:"
  2719. " WARNING: alias found, but event not supported by HW:",
  2720. pctr);
  2721. continue;
  2722. }
  2723. if (!regno_is_valid (pctr, regno))
  2724. {
  2725. hwcentry_print (1, "hwctable: stdlist_find_by_name():"
  2726. " WARNING: alias found, but regno doesn't match:",
  2727. pctr);
  2728. continue;
  2729. }
  2730. return pctr;
  2731. }
  2732. }
  2733. return NULL;
  2734. }
  2735. /* search the 'standard' list of counters for <name>,<regno> */
  2736. /* note: <regno>=REGNO_ANY is a wildcard that matches any value. */
  2737. static const Hwcentry *
  2738. static_table_find (const Hwcentry *table, const char *name, const char *int_name,
  2739. int check_regno, regno_t regno)
  2740. {
  2741. int sz;
  2742. for (sz = 0; table && table[sz].name; sz++)
  2743. ;
  2744. if (!sz)
  2745. return NULL;
  2746. const Hwcentry ** list = calloc (sz + 1, sizeof (void*));
  2747. if (!list)
  2748. return NULL;
  2749. for (int ii = 0; ii < sz; ii++)
  2750. list[ii] = &table[ii];
  2751. list[sz] = NULL;
  2752. const Hwcentry *pctr = ptrarray_find (list, name, int_name, check_regno, regno);
  2753. free (list);
  2754. return pctr;
  2755. }
  2756. #if !HWC_DEBUG
  2757. #define stdlist_print(dbg_lvl,table)
  2758. #else
  2759. /* print all Hwcentries in standard table. Check for weird stuff */
  2760. static void
  2761. stdlist_print (int dbg_lvl, const Hwcentry* table)
  2762. {
  2763. const Hwcentry *pctr;
  2764. if (!table)
  2765. {
  2766. Tprintf (0, "hwctable: stdlist_print: ERROR: "
  2767. "table is invalid.\n");
  2768. return;
  2769. }
  2770. for (pctr = table; pctr->name; pctr++)
  2771. {
  2772. int ii;
  2773. hwcentry_print (dbg_lvl, "hwctable: stdlist: ", pctr);
  2774. if (REG_LIST_IS_EMPTY (pctr->reg_list))
  2775. {
  2776. if (pctr->int_name || !pctr->metric)
  2777. hwcentry_print (DBG_LT1, "hwctable: stdlist_print: WARNING: "
  2778. "no hardware event found for table entry", pctr);
  2779. continue;
  2780. }
  2781. /* check if incorrect reg_num used in table */
  2782. if (!regno_is_valid (pctr, pctr->reg_num))
  2783. {
  2784. hwcentry_print (DBG_LT0, "hwctable: stdlist_print: ERROR: "
  2785. "reg_num is not in table. ", pctr);
  2786. continue;
  2787. }
  2788. for (ii = 0; ii < MAX_PICS; ii++)
  2789. {
  2790. regno_t regno = pctr->reg_list[ii];
  2791. if (REG_LIST_EOL (regno))
  2792. break;
  2793. }
  2794. if (ii > 1 && pctr->reg_num != REGNO_ANY)
  2795. {
  2796. /* several regnos were valid, but only one can be specified */
  2797. if (pctr->metric || !pctr->int_name)
  2798. {
  2799. /* pctr is standard or a raw definition */
  2800. /* (pctr is not an alias like cycles0) */
  2801. hwcentry_print (DBG_LT0, "hwctable: stdlist_print: ERROR: "
  2802. "regno in table should have been REGNO_ANY. ",
  2803. pctr);
  2804. }
  2805. }
  2806. }
  2807. }
  2808. #endif
  2809. /*---------------------------------------------------------------------------*/
  2810. /* utilities for init */
  2811. /* try to bind counters to hw. Return 0 on success, nonzero otherwise */
  2812. static int
  2813. test_hwcs (const Hwcentry* entries[], unsigned numctrs)
  2814. {
  2815. int rc = -1;
  2816. hwc_event_t sample;
  2817. int created = 0;
  2818. hwcdrv_api_t *hwcdrv = get_hwcdrv ();
  2819. Tprintf (DBG_LT2, "hwctable: test_hwcs()...\n");
  2820. rc = hwcfuncs_bind_hwcentry (entries, numctrs);
  2821. if (rc)
  2822. {
  2823. Tprintf (0, "hwctable: WARNING: test "
  2824. "counters could not be created\n");
  2825. goto end_test_hwcs;
  2826. }
  2827. created = 1;
  2828. if (!signals_disabled)
  2829. {
  2830. (void) signal (HWCFUNCS_SIGNAL, SIG_IGN);
  2831. signals_disabled = 1;
  2832. }
  2833. rc = hwcdrv->hwcdrv_start ();
  2834. if (rc)
  2835. {
  2836. Tprintf (0, "hwctable: WARNING: test "
  2837. "counters could not be started\n");
  2838. goto end_test_hwcs;
  2839. }
  2840. rc = hwcdrv->hwcdrv_read_events (&sample, NULL);
  2841. if (rc)
  2842. Tprintf (0, "hwctable: WARNING: test sample failed\n");
  2843. rc = 0;
  2844. #if HWC_DEBUG
  2845. {
  2846. unsigned ii;
  2847. Tprintf (DBG_LT1, "hwctable: test_hwcs(");
  2848. for (ii = 0; ii < numctrs; ii++)
  2849. Tprintf (DBG_LT1, "%s%s", ii ? "," : "", entries[ii]->name);
  2850. Tprintf (DBG_LT1, ") PASS\n");
  2851. }
  2852. #endif
  2853. end_test_hwcs:
  2854. if (created && hwcdrv->hwcdrv_free_counters ())
  2855. Tprintf (0, "hwctable: WARNING: test counters could not be freed\n");
  2856. return rc;
  2857. }
  2858. #if !HWC_DEBUG
  2859. #define check_tables()
  2860. #else
  2861. /* check for typos in tables */
  2862. static void
  2863. check_tables ()
  2864. {
  2865. int i;
  2866. /* now search the known table of counters */
  2867. for (i = 0;; i++)
  2868. {
  2869. Hwcentry * pentry;
  2870. int cputag = cputabs[i].cputag;
  2871. if (cputag == 0)
  2872. break;
  2873. if (cputag == CPC_KPROF)
  2874. continue;
  2875. pentry = cputabs[i].stdlist_table;
  2876. for (; pentry; pentry++)
  2877. {
  2878. if (!pentry->name)
  2879. break;
  2880. if (!pentry->int_name)
  2881. {/* internal, only to supply ABST and timecvt */
  2882. if (pentry->metric)
  2883. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2884. " internal && metric @%d, %s\n", cputag, pentry->name);
  2885. if (pentry->reg_num != REGNO_ANY)
  2886. Tprintf (DBG_LT1, "hwctable: check_tables: WARNING:"
  2887. " internal && reg_num!=REGNO_ANY @%d, %s\n",
  2888. cputag, pentry->name);
  2889. if (pentry->val != PRELOAD_DEF
  2890. && pentry->memop != ABST_EXACT_PEBS_PLUS1)
  2891. Tprintf (DBG_LT2, "hwctable: check_tables: INFO:"
  2892. " internal && custom val=%d @%d, %s\n",
  2893. pentry->val, cputag, pentry->name);
  2894. #if 0
  2895. if (!pentry->timecvt && pentry->memop == ABST_NONE)
  2896. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2897. " internal && not special! @%d, %s\n",
  2898. cputag, pentry->name);
  2899. #endif
  2900. }
  2901. if (pentry->metric)
  2902. { /* aliased */
  2903. if (!pentry->int_name)
  2904. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2905. " aliased && !int_name @%d, %s\n", cputag, pentry->name);
  2906. #if 0
  2907. else if (!strcmp (pentry->name, pentry->int_name))
  2908. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2909. " name==int_name @%d, %s\n",
  2910. cputag, pentry->name);
  2911. #endif
  2912. if (pentry->reg_num != REGNO_ANY && pentry->reg_num != REGNO_INVALID)
  2913. Tprintf (DBG_LT1, "hwctable: check_tables: INFO:"
  2914. " aliased && custom reg_num==%d @%d, %s\n",
  2915. pentry->reg_num, cputag, pentry->name);
  2916. if (pentry->reg_num == REGNO_INVALID)
  2917. Tprintf (DBG_LT2, "hwctable: check_tables: INFO:"
  2918. " aliased && reg_num==REGNO_INVALID @%d, %s\n",
  2919. cputag, pentry->name);
  2920. }
  2921. if (pentry->int_name && !pentry->metric)
  2922. { /* convenience */
  2923. if (!strcmp (pentry->name, pentry->int_name))
  2924. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2925. " convenience && name==int_name @%d, %s\n",
  2926. cputag, pentry->name);
  2927. if (pentry->reg_num == REGNO_ANY)
  2928. Tprintf (DBG_LT0, "hwctable: check_tables: ERROR:"
  2929. " convenience && reg_num==REGNO_ANY @%d, %s\n",
  2930. cputag, pentry->name);
  2931. }
  2932. }
  2933. }
  2934. }
  2935. #endif
  2936. static int try_a_counter ();
  2937. static void hwc_process_raw_ctrs (int forKernel, Hwcentry ***pstd_out,
  2938. Hwcentry ***praw_out, Hwcentry ***phidden_out,
  2939. Hwcentry**static_tables,
  2940. Hwcentry **raw_unfiltered_in);
  2941. /* internal call to initialize libs, ctr tables */
  2942. static void
  2943. setup_cpc_general (int skip_hwc_test)
  2944. {
  2945. const cpu_list_t* cputabs_entry;
  2946. int rc = -1;
  2947. Tprintf (DBG_LT2, "hwctable: setup_cpc()... \n");
  2948. if (initialized)
  2949. {
  2950. Tprintf (0, "hwctable: WARNING: setup_cpc() has already been called\n");
  2951. return;
  2952. }
  2953. initialized = 1;
  2954. cpcx_cpuver = CPUVER_UNDEFINED;
  2955. cpcx_cciname = NULL;
  2956. cpcx_npics = 0;
  2957. cpcx_docref = NULL;
  2958. cpcx_support_bitmask = 0;
  2959. for (int kk = 0; kk < 2; kk++)
  2960. { // collect-0 and kernel-1
  2961. cpcx_attrs[kk] = NULL;
  2962. cpcx_std[kk] = NULL;
  2963. cpcx_raw[kk] = NULL;
  2964. cpcx_hidden[kk] = NULL;
  2965. cpcx_max_concurrent[kk] = 0;
  2966. cpcx_default_hwcs[kk] = NULL;
  2967. cpcx_orig_default_hwcs[kk] = NULL;
  2968. cpcx_has_precise[kk] = 0;
  2969. }
  2970. check_tables ();
  2971. hwcdrv_api_t *hwcdrv = get_hwcdrv ();
  2972. if (hwcdrv->hwcdrv_init_status)
  2973. {
  2974. Tprintf (0, "WARNING: setup_cpc_general() failed. init_status=%d \n",
  2975. hwcdrv->hwcdrv_init_status);
  2976. goto setup_cpc_wrapup;
  2977. }
  2978. hwcdrv->hwcdrv_get_info (&cpcx_cpuver, &cpcx_cciname, &cpcx_npics,
  2979. &cpcx_docref, &cpcx_support_bitmask);
  2980. #ifdef DISALLOW_USI_USII_6357446
  2981. if (cpcx_cpuver == CPC_ULTRA1 || cpcx_cpuver == CPC_ULTRA2)
  2982. {
  2983. Tprintf (0, "hwctable: WARNING: setup_cpc(): cpu=%d"
  2984. " US-I/US-II cannot provide profile interrupts\n", cpcx_cpuver);
  2985. /* profiling interrupts don't work on US-I, US-II */
  2986. hwcfuncs_int_logerr (GTXT ("UltraSPARC I and II cannot provide overflow interrupts\n"));
  2987. goto setup_cpc_wrapup;
  2988. }
  2989. #endif
  2990. #ifdef DISALLOW_PENTIUM_PRO_MMX_7007575
  2991. if (cpcx_cpuver == CPC_PENTIUM_PRO_MMX)
  2992. {
  2993. Tprintf (0, "hwctable: WARNING: setup_cpc(): cpu=%d"
  2994. " `Pentium Pro with MMX, Pentium II' is not supported\n", cpcx_cpuver);
  2995. hwcfuncs_int_logerr (GTXT ("libcpc cannot identify processor type\n"));
  2996. goto setup_cpc_wrapup;
  2997. }
  2998. #endif
  2999. /* now search the known table of counters */
  3000. cputabs_entry = cputabs_find_entry (cpcx_cpuver);
  3001. if (cputabs_entry == NULL)
  3002. {
  3003. Tprintf (0, "hwctable: WARNING: setup_cpc(): cpu=%d"
  3004. " could not be found in the tables\n", cpcx_cpuver);
  3005. /* strange, should have at least selected "unknownlist" */
  3006. hwcfuncs_int_logerr (GTXT ("Analyzer CPU table could not be found\n"));
  3007. goto setup_cpc_wrapup;
  3008. }
  3009. Hwcentry * valid_cpu_tables[2]; // [0]:static table of counters, [1]:static table of generic counters
  3010. valid_cpu_tables[0] = cputabs_entry->stdlist_table;
  3011. if (valid_cpu_tables[0] == NULL)
  3012. {
  3013. Tprintf (0, "hwctable: WARNING: setup_cpc(): "
  3014. " valid_cpu_tables was NULL??\n");
  3015. /* strange, someone put a NULL in the lookup table? */
  3016. hwcfuncs_int_logerr (GTXT ("Analyzer CPU table is invalid\n"));
  3017. goto setup_cpc_wrapup;
  3018. }
  3019. valid_cpu_tables[1] = papi_generic_list;
  3020. Tprintf (DBG_LT2, "hwctable: setup_cpc(): getting descriptions \n");
  3021. // populate cpcx_raw and cpcx_attr
  3022. hwcdrv->hwcdrv_get_descriptions (hwc_cb, attrs_cb);
  3023. for (int kk = 0; kk < 2; kk++)
  3024. { // collect and er_kernel
  3025. hwc_process_raw_ctrs (kk, &cpcx_std[kk], &cpcx_raw[kk], &cpcx_hidden[kk],
  3026. valid_cpu_tables, (Hwcentry**) unfiltered_raw.array);
  3027. cpcx_has_precise[kk] = 0;
  3028. for (int rr = 0; cpcx_raw[kk] && cpcx_raw[kk][rr]; rr++)
  3029. {
  3030. int memop = cpcx_raw[kk][rr]->memop;
  3031. if (ABST_MEMSPACE_ENABLED (memop))
  3032. {
  3033. cpcx_has_precise[kk] = 1;
  3034. break;
  3035. }
  3036. }
  3037. cpcx_attrs[kk] = (char**) unfiltered_attrs.array;
  3038. cpcx_max_concurrent[kk] = cpcx_npics;
  3039. }
  3040. #if 1 // 22897042 - DTrace cpc provider does not support profiling on multiple ctrs on some systems
  3041. if ((cpcx_support_bitmask & HWCFUNCS_SUPPORT_OVERFLOW_CTR_ID) != HWCFUNCS_SUPPORT_OVERFLOW_CTR_ID)
  3042. {
  3043. // kernel profiling only supports one counter if overflowing counter can't be identified
  3044. cpcx_max_concurrent[1] = cpcx_npics ? 1 : 0;
  3045. }
  3046. #endif
  3047. /* --- quick test of the cpc interface --- */
  3048. if (skip_hwc_test)
  3049. rc = 0;
  3050. else
  3051. rc = try_a_counter (0);
  3052. /* initialize the default counter string definition */
  3053. for (int kk = 0; kk < 2; kk++)
  3054. {
  3055. char * default_exp = 0;
  3056. int jj;
  3057. for (jj = 0; (default_exp = cputabs_entry->default_exp_p[jj]); jj++)
  3058. {
  3059. int rc = hwc_lookup (kk, 0, default_exp, NULL, 0, NULL, NULL);
  3060. if (rc > 0)
  3061. break;
  3062. }
  3063. if (!default_exp)
  3064. {
  3065. char * fallback[3] = {NTXT ("insts,,cycles,,l3m"), NTXT ("insts,,cycles"), NTXT ("insts")};
  3066. for (int ff = 0; ff < 3; ff++)
  3067. {
  3068. int rc = hwc_lookup (kk, 0, fallback[ff], NULL, 0, NULL, NULL);
  3069. if (rc > 0)
  3070. {
  3071. default_exp = strdup (fallback[ff]);
  3072. break;
  3073. }
  3074. }
  3075. }
  3076. cpcx_default_hwcs[kk] = default_exp;
  3077. cpcx_orig_default_hwcs[kk] = default_exp;
  3078. }
  3079. setup_cpc_wrapup:
  3080. if (rc)
  3081. {
  3082. cpcx_npics = 0;
  3083. /*
  3084. ptr_list_free(&tmp_raw); // free stuff... YXXX
  3085. ptr_list_free(&unfiltered_attrs);
  3086. */
  3087. }
  3088. return;
  3089. }
  3090. static void
  3091. setup_cpcx ()
  3092. {
  3093. if (initialized)
  3094. return;
  3095. setup_cpc_general (0); // set up and include a hwc test run
  3096. }
  3097. static void
  3098. setup_cpc_skip_hwctest ()
  3099. {
  3100. if (initialized)
  3101. return;
  3102. setup_cpc_general (1); // set up but skip hwc test run
  3103. }
  3104. static int
  3105. try_a_counter (int forKernel)
  3106. {
  3107. if (!VALID_FOR_KERNEL (forKernel))
  3108. return -1;
  3109. int rc = -1;
  3110. const Hwcentry * testevent;
  3111. if (cpcx_std[forKernel] == NULL)
  3112. {
  3113. Tprintf (0, "hwctable: WARNING: cpcx_std not initialized");
  3114. return 0; /* consider this an automatic PASS */
  3115. }
  3116. /* look for a valid table entry, only try valid_cpu_tables[0] */
  3117. {
  3118. testevent = cpcx_std[forKernel][0];
  3119. if (!testevent || !testevent->name)
  3120. {
  3121. Tprintf (0, "hwctable: WARNING: no test metric"
  3122. " available to verify counters\n");
  3123. return 0; /* consider this an automatic PASS */
  3124. }
  3125. if (REG_LIST_IS_EMPTY (testevent->reg_list))
  3126. return 0; // weird
  3127. }
  3128. Hwcentry tmp_testevent;
  3129. tmp_testevent = *testevent; /* shallow copy */
  3130. if (tmp_testevent.int_name == NULL)
  3131. {
  3132. /* counter is defined in 'hidden' section of table, supply int_name */
  3133. tmp_testevent.int_name = strdup (tmp_testevent.name);
  3134. }
  3135. Hwcentry * test_array[1] = {&tmp_testevent};
  3136. rc = hwcfuncs_assign_regnos (test_array, 1); /* may modify test_array */
  3137. if (rc)
  3138. return rc;
  3139. rc = test_hwcs ((const Hwcentry**) test_array, 1);
  3140. if (rc == HWCFUNCS_ERROR_UNAVAIL)
  3141. {
  3142. // consider this a pass (allow HWC table to be printed)
  3143. Tprintf (0, "hwctable: WARNING: "
  3144. "cpc_bind_event() shows counters busy; allow to continue\n");
  3145. return 0;
  3146. }
  3147. else if (rc)
  3148. {
  3149. // failed to start for some other reason
  3150. Tprintf (0, "hwctable: WARNING: "
  3151. "test of counter '%s' failed\n",
  3152. testevent->name);
  3153. return rc;
  3154. }
  3155. return 0;
  3156. }
  3157. void
  3158. hwc_update_val (Hwcentry *hwc)
  3159. {
  3160. if (hwc->ref_val == 0)
  3161. hwc->ref_val = hwc->val; // save original reference
  3162. int64_t newVal;
  3163. hrtime_t min_time_nsec = hwc->min_time;
  3164. if (min_time_nsec == HWCTIME_TBD)
  3165. min_time_nsec = hwc->min_time_default;
  3166. switch (min_time_nsec)
  3167. {
  3168. case 0: // disable time-based intervals
  3169. // do not modify val
  3170. return;
  3171. case HWCTIME_ON:
  3172. case HWCTIME_TBD:
  3173. newVal = HWC_VAL_ON (hwc->ref_val);
  3174. break;
  3175. case HWCTIME_LO:
  3176. newVal = HWC_VAL_LO (hwc->ref_val);
  3177. break;
  3178. case HWCTIME_HI:
  3179. newVal = HWC_VAL_HI (hwc->ref_val);
  3180. break;
  3181. default:
  3182. newVal = HWC_VAL_CUSTOM (hwc->ref_val, min_time_nsec);
  3183. break;
  3184. }
  3185. #define MAX_INT_VAL (2*1000*1000*1000 + 1000100)// yuck, limited to signed int
  3186. if (newVal >= MAX_INT_VAL)
  3187. newVal = MAX_INT_VAL;
  3188. hwc->val = newVal;
  3189. }
  3190. /* convert value string to value and store result in hwc->val */
  3191. /* This function moved here from collctrl.cc */
  3192. /*
  3193. * Keep the HWCTIME_* definitions in sync with those in
  3194. * collctrl.cc Coll_Ctrl::add_hwcstring().
  3195. */
  3196. static int
  3197. set_hwcval (Hwcentry *hwc, hrtime_t global_min_time_nsec, const char *valptr)
  3198. {
  3199. hwc->min_time_default = global_min_time_nsec;
  3200. if (hwc->val == 1)
  3201. {
  3202. // An interval of 1 is used for certain types of count data.
  3203. // (er_bit, er_generic, er_rock ...)
  3204. // Hi and Lo do not apply.
  3205. /* use the default */
  3206. }
  3207. else if (valptr == NULL || valptr[0] == 0 || strcmp (valptr, "auto") == 0)
  3208. hwc->min_time = HWCTIME_TBD;
  3209. else if (strcmp (valptr, "on") == 0)
  3210. hwc->min_time = HWCTIME_ON;
  3211. else if (strcmp (valptr, "lo") == 0 || strcmp (valptr, "low") == 0)
  3212. hwc->min_time = HWCTIME_LO;
  3213. else if (strcmp (valptr, "hi") == 0 || strcmp (valptr, "high") == 0
  3214. || strcmp (valptr, "h") == 0)
  3215. hwc->min_time = HWCTIME_HI;
  3216. else
  3217. {
  3218. /* the remaining string should be a number > 0 */
  3219. char *endchar = NULL;
  3220. long long tmp = strtoll (valptr, &endchar, 0);
  3221. int value = (int) tmp;
  3222. if (*endchar != 0 || tmp <= 0 || value != tmp)
  3223. {
  3224. // also covers errno == ERANGE
  3225. Tprintf (0, "hwctable: set_hwcval(): ERROR: "
  3226. "Invalid counter value %s for counter `%s'\n",
  3227. valptr, hwc->name);
  3228. return -1;
  3229. }
  3230. if (tmp > UINT32_MAX / 2)
  3231. {
  3232. /* Roch B. says that we MUST do this check for er_kernel
  3233. because some platforms deliver overflow interrupts without
  3234. identifying which counter overflowed. The only way to
  3235. determine which counter overflowed is to have enough
  3236. margin on 32 bit counters to make sure they don't
  3237. wrap.
  3238. */
  3239. Tprintf (0, "hwctable: set_hwcval(): ERROR: "
  3240. "Counter value %s exceeds %lu\n",
  3241. valptr, (unsigned long) UINT32_MAX / 2);
  3242. return -1;
  3243. }
  3244. /* set the value */
  3245. if (value != 0)
  3246. {
  3247. if (hwc->ref_val == 0)
  3248. hwc->ref_val = hwc->val; // save original reference
  3249. hwc->val = value;
  3250. hwc->min_time = 0; // turn off auto-adjust
  3251. }
  3252. }
  3253. hwc_update_val (hwc);
  3254. return 0;
  3255. }
  3256. static char *
  3257. canonical_name (const char *counter)
  3258. {
  3259. char *nameOnly = NULL;
  3260. char *attrs = NULL;
  3261. char tmpbuf[1024];
  3262. tmpbuf[0] = 0;
  3263. hwcfuncs_parse_ctr (counter, NULL, &nameOnly, &attrs, NULL, NULL);
  3264. snprintf (tmpbuf + strlen (tmpbuf), sizeof (tmpbuf) - strlen (tmpbuf),
  3265. "%s", nameOnly);
  3266. if (attrs)
  3267. {
  3268. hwcfuncs_attr_t cpc2_attrs[HWCFUNCS_MAX_ATTRS];
  3269. void * attr_mem;
  3270. unsigned nattrs;
  3271. int ii, jj;
  3272. /* extract attributes from counter */
  3273. attr_mem = hwcfuncs_parse_attrs (counter, cpc2_attrs, HWCFUNCS_MAX_ATTRS,
  3274. &nattrs, NULL);
  3275. if (!attr_mem)
  3276. {
  3277. snprintf (tmpbuf + strlen (tmpbuf), sizeof (tmpbuf) - strlen (tmpbuf),
  3278. "~UNKNOWN");
  3279. goto canonical_attrs_wrapup;
  3280. }
  3281. /* sort the attributes */
  3282. for (ii = 0; ii < (int) nattrs - 1; ii++)
  3283. {
  3284. for (jj = ii + 1; jj < nattrs; jj++)
  3285. {
  3286. int cmp = strcmp (cpc2_attrs[ii].ca_name,
  3287. cpc2_attrs[jj].ca_name);
  3288. if (cmp > 0)
  3289. {
  3290. hwcfuncs_attr_t tmp = cpc2_attrs[jj];
  3291. cpc2_attrs[jj] = cpc2_attrs[ii];
  3292. cpc2_attrs[ii] = tmp;
  3293. }
  3294. }
  3295. }
  3296. /* print attributes in canonical format */
  3297. for (ii = 0; ii < nattrs; ii++)
  3298. snprintf (tmpbuf + strlen (tmpbuf), sizeof (tmpbuf) - strlen (tmpbuf),
  3299. "~%s=0x%llx", cpc2_attrs[ii].ca_name, (long long) cpc2_attrs[ii].ca_val);
  3300. free (attr_mem);
  3301. }
  3302. canonical_attrs_wrapup:
  3303. free (nameOnly);
  3304. free (attrs);
  3305. return strdup (tmpbuf);
  3306. }
  3307. /* process counter and value strings - put results in <*pret_ctr> */
  3308. /* Print errors to UEbuf for any failure that results in nonzero return */
  3309. static int
  3310. process_ctr_def (int forKernel, hrtime_t global_min_time_nsec,
  3311. const char *counter, const char *value, Hwcentry *pret_ctr,
  3312. char* UWbuf, size_t UWsz, char* UEbuf, size_t UEsz)
  3313. {
  3314. int rc = -1;
  3315. char *nameOnly = NULL;
  3316. char *attrs = NULL;
  3317. char *regstr = NULL;
  3318. int plus;
  3319. regno_t regno;
  3320. const Hwcentry *pfound = NULL;
  3321. const char *uname = NULL;
  3322. int disable_backtrack;
  3323. UEbuf[0] = 0;
  3324. UWbuf[0] = 0;
  3325. Tprintf (DBG_LT3, "hwctable: process_ctr_def(): counter=%s value=%s \n",
  3326. counter, value ? value : "NULL");
  3327. hwcfuncs_parse_ctr (counter, &plus, &nameOnly, &attrs, &regstr, &regno);
  3328. /* search for the counter in the std and raw lists */
  3329. {
  3330. pfound = ptrarray_find ((const Hwcentry**) cpcx_std[forKernel], nameOnly, NULL, 1, regno);
  3331. if (pfound)
  3332. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: found in stdlist:",
  3333. pfound);
  3334. }
  3335. if (!pfound)
  3336. {
  3337. pfound = ptrarray_find ((const Hwcentry**) cpcx_hidden[forKernel], nameOnly, NULL, 1, regno);
  3338. if (pfound)
  3339. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: found in stdlist(hidden):", pfound);
  3340. }
  3341. if (!pfound)
  3342. {
  3343. pfound = ptrarray_find_by_name (cpcx_raw[forKernel], nameOnly); /* (regno match checked later) */
  3344. if (pfound)
  3345. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: found in rawlist:", pfound);
  3346. }
  3347. if (!pfound)
  3348. {
  3349. pfound = ptrarray_find ((const Hwcentry**) cpcx_std[forKernel], nameOnly, NULL, 1, REGNO_ANY);
  3350. if (pfound)
  3351. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: found in stdlist but regno didn't match:", pfound);
  3352. }
  3353. if (!pfound)
  3354. {
  3355. pfound = ptrarray_find ((const Hwcentry**) cpcx_hidden[forKernel], nameOnly, NULL, 1, REGNO_ANY);
  3356. if (pfound)
  3357. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: found in stdlist(hidden) but regno didn't match:", pfound);
  3358. }
  3359. if (!pfound)
  3360. {
  3361. uint64_t val = 0;
  3362. if (is_numeric (nameOnly, &val))
  3363. {
  3364. Hwcentry *tmp = alloc_shallow_copy (&empty_ctr); // Leaks?
  3365. if (tmp)
  3366. {
  3367. tmp->name = strdup (nameOnly);
  3368. regno_add (tmp, REGNO_ANY);
  3369. pfound = tmp;
  3370. }
  3371. }
  3372. if (pfound)
  3373. hwcentry_print (DBG_LT1, "hwctable: process_ctr_def: counter specified by numeric value:", pfound);
  3374. }
  3375. if (!pfound)
  3376. {
  3377. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3378. GTXT ("Invalid HW counter name: %s\n"), nameOnly);
  3379. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3380. GTXT ("Run \"%s -h\" with no other arguments for more information on HW counters on this system.\n"),
  3381. (IS_KERNEL (forKernel) ? "er_kernel" : "collect"));
  3382. goto process_ctr_def_wrapup;
  3383. }
  3384. /* counter found */
  3385. *pret_ctr = *pfound; /* shallow copy */
  3386. pret_ctr->int_name = NULL; /* so free doesn't try to free these pfound's ptrs */
  3387. pret_ctr->name = NULL; /* so free doesn't try to free these pfound's ptrs */
  3388. /* update uname,memop */
  3389. uname = counter;
  3390. disable_backtrack = 0;
  3391. if (plus != 0 || ABST_PLUS_BY_DEFAULT (pret_ctr->memop))
  3392. {
  3393. // attempt to process memoryspace profiling
  3394. int message_printed = 0;
  3395. if (cpcx_cpuver == CPUVER_GENERIC)
  3396. {
  3397. // accept plus, since we don't know what this CPU is
  3398. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3399. GTXT ("`+' may not be correctly supported on `%s' because processor is not recognized."),
  3400. cpcx_cciname);
  3401. pret_ctr->memop = ABST_LDST; // supply a backtracking data type - required for collector
  3402. }
  3403. else if (cpcx_cpuver == CPC_ULTRA1 || cpcx_cpuver == CPC_ULTRA2
  3404. || cpcx_cpuver == CPC_ULTRA3 || cpcx_cpuver == CPC_ULTRA3_PLUS
  3405. || cpcx_cpuver == CPC_ULTRA3_I || cpcx_cpuver == CPC_ULTRA4_PLUS
  3406. || cpcx_cpuver == CPC_ULTRA4 || cpcx_cpuver == CPC_ULTRA_T1
  3407. || cpcx_cpuver == CPC_ULTRA_T2 || cpcx_cpuver == CPC_ULTRA_T2P
  3408. || cpcx_cpuver == CPC_ULTRA_T3)
  3409. {
  3410. if (!ABST_BACKTRACK_ENABLED (pret_ctr->memop))
  3411. disable_backtrack = 1;
  3412. }
  3413. else if (cpcx_cpuver == CPC_SPARC_T4 || cpcx_cpuver == CPC_SPARC_T5
  3414. || cpcx_cpuver == CPC_SPARC_T6 || cpcx_cpuver == CPC_SPARC_M4
  3415. || cpcx_cpuver == CPC_SPARC_M5 || cpcx_cpuver == CPC_SPARC_M6
  3416. || cpcx_cpuver == CPC_SPARC_M7 || cpcx_cpuver == CPC_SPARC_M8)
  3417. {
  3418. if (pret_ctr->memop != ABST_EXACT)
  3419. disable_backtrack = 1;
  3420. }
  3421. else if (cpcx_cpuver == CPC_INTEL_NEHALEM || cpcx_cpuver == CPC_INTEL_WESTMERE
  3422. || cpcx_cpuver == CPC_INTEL_SANDYBRIDGE
  3423. || cpcx_cpuver == CPC_INTEL_IVYBRIDGE
  3424. || cpcx_cpuver == CPC_INTEL_HASWELL
  3425. || cpcx_cpuver == CPC_INTEL_BROADWELL
  3426. || cpcx_cpuver == CPC_INTEL_SKYLAKE)
  3427. {
  3428. if (pret_ctr->memop != ABST_EXACT_PEBS_PLUS1)
  3429. disable_backtrack = 1;
  3430. else if (plus < 0)
  3431. {
  3432. // disabling memoryspace not supported for
  3433. // remove specified -
  3434. uname++;
  3435. plus = 0;
  3436. snprintf (UWbuf + strlen (UWbuf), UWsz - strlen (UWbuf),
  3437. GTXT ("Warning: `-' is not supported on `%s' -- memory reference backtracking will remain enabled for this counter\n"),
  3438. nameOnly);
  3439. }
  3440. }
  3441. else
  3442. {
  3443. message_printed = 1;
  3444. snprintf (UWbuf + strlen (UWbuf), UWsz - strlen (UWbuf),
  3445. GTXT ("Warning: `+' is not supported on `%s' -- memory reference backtracking will not be enabled for `%s'\n"),
  3446. cpcx_cciname, nameOnly);
  3447. disable_backtrack = 1;
  3448. }
  3449. if (disable_backtrack)
  3450. {
  3451. if (plus != 0)
  3452. uname++; // remove specified + or -
  3453. if (!message_printed && plus > 0)
  3454. snprintf (UWbuf + strlen (UWbuf), UWsz - strlen (UWbuf),
  3455. GTXT ("Warning: `+' is not supported on `%s' -- memory reference backtracking will not be enabled for this counter\n"),
  3456. nameOnly);
  3457. }
  3458. }
  3459. else
  3460. disable_backtrack = 1;
  3461. if (disable_backtrack || plus < 0)
  3462. if (pret_ctr->memop != ABST_NOPC)
  3463. pret_ctr->memop = ABST_NONE;
  3464. if (pret_ctr->memop == ABST_NOPC)
  3465. snprintf (UWbuf + strlen (UWbuf), UWsz - strlen (UWbuf),
  3466. GTXT ("Warning: HW counter `%s' is not program-related -- callstacks will be not be recorded for this counter\n"),
  3467. uname);
  3468. /* update reg_num */
  3469. if (!regno_is_valid (pfound, regno))
  3470. {
  3471. char buf[1024];
  3472. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3473. GTXT ("For counter `%s', %s is not a valid register; valid registers: %s\n"),
  3474. nameOnly, regstr ? regstr + 1 : "?",
  3475. get_regnolist (buf, sizeof (buf), pfound->reg_list, 1));
  3476. goto process_ctr_def_wrapup;
  3477. }
  3478. if (pret_ctr->reg_num == REGNO_ANY)
  3479. { /* table's regno is a wildcard */
  3480. if (REG_LIST_EOL (pfound->reg_list[1]))
  3481. {
  3482. /* valid list only contains one regno, so use it */
  3483. pret_ctr->reg_num = pfound->reg_list[0];
  3484. }
  3485. else
  3486. pret_ctr->reg_num = regno; /* use user's selection */
  3487. }
  3488. /* update name and int_name */
  3489. {
  3490. // validate attributes
  3491. if (attrs)
  3492. {
  3493. hwcfuncs_attr_t cpc2_attrs[HWCFUNCS_MAX_ATTRS];
  3494. void * attr_mem;
  3495. unsigned nattrs;
  3496. char *errbuf;
  3497. /* extract attributes from uname */
  3498. attr_mem = hwcfuncs_parse_attrs (uname, cpc2_attrs, HWCFUNCS_MAX_ATTRS,
  3499. &nattrs, &errbuf);
  3500. if (!attr_mem)
  3501. {
  3502. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3503. "%s\n", errbuf);
  3504. free (errbuf);
  3505. goto process_ctr_def_wrapup;
  3506. }
  3507. /* make sure all attributes are valid */
  3508. for (unsigned ii = 0; ii < nattrs; ii++)
  3509. {
  3510. if (!attr_is_valid (forKernel, cpc2_attrs[ii].ca_name))
  3511. {
  3512. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3513. GTXT ("Invalid attribute specified for counter `%s': %s\n"),
  3514. nameOnly, cpc2_attrs[ii].ca_name);
  3515. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3516. GTXT ("Run \"%s -h\" with no other arguments for more information on HW counters on this system.\n"),
  3517. (IS_KERNEL (forKernel) ? "er_kernel" : "collect"));
  3518. free (attr_mem);
  3519. goto process_ctr_def_wrapup;
  3520. }
  3521. for (unsigned jj = ii + 1; jj < nattrs; jj++)
  3522. {
  3523. if (strcmp (cpc2_attrs[ii].ca_name,
  3524. cpc2_attrs[jj].ca_name) == 0)
  3525. {
  3526. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3527. GTXT ("Duplicate attribute specified for counter `%s': %s\n"),
  3528. nameOnly, cpc2_attrs[ii].ca_name);
  3529. free (attr_mem);
  3530. goto process_ctr_def_wrapup;
  3531. }
  3532. }
  3533. }
  3534. free (attr_mem);
  3535. }
  3536. pret_ctr->name = strdup (uname);
  3537. // assign int_name
  3538. if (pfound->int_name)
  3539. {
  3540. // Counter is one of the following:
  3541. // - aliased (e.g. cycles~system=1),
  3542. // - convenience (e.g. cycles0~system=1),
  3543. if (!attrs) // convert alias to internal name
  3544. pret_ctr->int_name = strdup (pfound->int_name);
  3545. else
  3546. {
  3547. // convert alias to internal name and
  3548. // append user-supplied attributes
  3549. size_t sz = strlen (pfound->int_name) + strlen (attrs) + 1;
  3550. char *tbuf = calloc (sz, 1);
  3551. if (tbuf)
  3552. snprintf (tbuf, sz, "%s%s", pfound->int_name, attrs);
  3553. pret_ctr->int_name = tbuf;
  3554. }
  3555. }
  3556. else
  3557. pret_ctr->int_name = strdup (uname); // user-supplied name
  3558. }
  3559. /* update val */
  3560. if (set_hwcval (pret_ctr, global_min_time_nsec, value))
  3561. {
  3562. snprintf (UEbuf + strlen (UEbuf), UEsz - strlen (UEbuf),
  3563. GTXT ("Invalid interval for HW counter `%s': %s\n"),
  3564. nameOnly, value);
  3565. goto process_ctr_def_wrapup;
  3566. }
  3567. hwcentry_print (DBG_LT2, "hwctable: process_ctr_def:", pret_ctr);
  3568. rc = 0;
  3569. process_ctr_def_wrapup:
  3570. free (regstr);
  3571. free (attrs);
  3572. free (nameOnly);
  3573. return rc;
  3574. }
  3575. /*---------------------------------------------------------------------------*/
  3576. /* external interfaces, see hwcentry.h for descriptions. */
  3577. extern int
  3578. hwc_lookup (int forKernel, hrtime_t global_min_time_nsec, const char *instring,
  3579. Hwcentry *caller_entries[], unsigned maxctrs, char **emsg, char **wmsg)
  3580. {
  3581. unsigned ii;
  3582. char *instr_copy = NULL, *ss = NULL;
  3583. unsigned numctrs = 0;
  3584. int rc = 0;
  3585. char *tokenptr[MAX_PICS * 2];
  3586. unsigned numtokens = 0;
  3587. char UEbuf[1024 * 5]; /* error message buffer; strdup of it is passed back to user */
  3588. char UWbuf[1024 * 5]; /* warning message buffer; strdup of it is passed back to user */
  3589. if (emsg)
  3590. *emsg = NULL;
  3591. if (wmsg)
  3592. *wmsg = NULL;
  3593. UEbuf[0] = 0;
  3594. UWbuf[0] = 0;
  3595. // supply temporary result buffers as needed
  3596. Hwcentry tmp_entry_table[MAX_PICS];
  3597. Hwcentry * tmp_entries[MAX_PICS];
  3598. Hwcentry **entries;
  3599. if (caller_entries)
  3600. entries = caller_entries;
  3601. else
  3602. {
  3603. // user doesn't care about results; provide temporary storage for results
  3604. for (ii = 0; ii < MAX_PICS; ii++)
  3605. tmp_entries[ii] = &tmp_entry_table[ii];
  3606. entries = tmp_entries;
  3607. maxctrs = MAX_PICS;
  3608. }
  3609. Tprintf (DBG_LT1, "hwctable: hwc_lookup(%s)\n",
  3610. instring ? instring : "NULL");
  3611. /* clear <entries> first - prevent seg faults in hwc_lookup_wrapup */
  3612. for (ii = 0; ii < maxctrs; ii++)
  3613. *entries[ii] = empty_ctr;
  3614. if (!instring)
  3615. {
  3616. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3617. GTXT ("No HW counters were specified."));
  3618. rc = -1;
  3619. goto hwc_lookup_wrapup;
  3620. }
  3621. /* make sure tables are initialized */
  3622. setup_cpc_skip_hwctest ();
  3623. if (cpcx_npics == 0)
  3624. {
  3625. if (cpcx_cpuver < 0)
  3626. {
  3627. char buf[1024];
  3628. *buf = 0;
  3629. char *pch = hwcfuncs_errmsg_get (buf, sizeof (buf), 0); /* get first err msg, disable capture */
  3630. if (*pch)
  3631. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3632. GTXT ("HW counter profiling is not supported on this system: %s%s"),
  3633. pch, pch[strlen (pch) - 1] == '\n' ? "" : "\n");
  3634. else
  3635. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3636. GTXT ("HW counter profiling is not supported on this system\n"));
  3637. }
  3638. else
  3639. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3640. GTXT ("HW counter profiling is not supported on '%s'\n"),
  3641. cpcx_cciname);
  3642. rc = -1;
  3643. goto hwc_lookup_wrapup;
  3644. }
  3645. ss = instr_copy = strdup (instring);
  3646. while (*ss != 0 && (*ss == ' ' || *ss == '\t'))
  3647. ss++;
  3648. tokenptr[numtokens++] = ss;
  3649. do
  3650. {
  3651. /* find end of previous token, replace w/ NULL, skip whitespace, set <tokenptr>, repeat */
  3652. for (; *ss; ss++)
  3653. {
  3654. if (*ss == ',' || *ss == ' ' || *ss == '\t')
  3655. {
  3656. /* end of previous token found */
  3657. *ss = 0; /* terminate the previous token */
  3658. ss++;
  3659. while (*ss != 0 && (*ss == ' ' || *ss == '\t'))
  3660. ss++;
  3661. if (*ss)
  3662. tokenptr[numtokens++] = ss;
  3663. break; // from for loop
  3664. }
  3665. }
  3666. }
  3667. while (*ss && numtokens < (MAX_PICS * 2));
  3668. if (*ss)
  3669. {
  3670. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3671. GTXT ("The number of HW counters specified exceeds internal resources\n"));
  3672. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3673. GTXT ("Run \"%s -h\" with no other arguments for more information on HW counters on this system.\n"),
  3674. (IS_KERNEL (forKernel) ? "er_kernel" : "collect"));
  3675. rc = -1;
  3676. goto hwc_lookup_wrapup;
  3677. }
  3678. Tprintf (DBG_LT3, "hwctable: hwc_lookup(): numtokens=%d\n", numtokens);
  3679. /* look up individual counters */
  3680. {
  3681. int fail = 0;
  3682. for (ii = 0; ii < numtokens && numctrs < maxctrs; ii += 2)
  3683. {
  3684. const char *counter;
  3685. const char *value;
  3686. Hwcentry *pret_ctr = entries[numctrs];
  3687. /* assign the tokens to ctrnames, timeoutValues. */
  3688. counter = tokenptr[ii];
  3689. if (ii + 1 < numtokens)
  3690. value = tokenptr[ii + 1];
  3691. else
  3692. value = 0;
  3693. if (process_ctr_def (forKernel, global_min_time_nsec, counter, value, pret_ctr,
  3694. UWbuf + strlen (UWbuf),
  3695. sizeof (UWbuf) - strlen (UWbuf),
  3696. UEbuf + strlen (UEbuf),
  3697. sizeof (UEbuf) - strlen (UEbuf)))
  3698. {
  3699. /* could choose to set fail=1 and continue here,
  3700. but errmsgs would be aggregated (messy) */
  3701. rc = -1;
  3702. goto hwc_lookup_wrapup;
  3703. }
  3704. numctrs++;
  3705. }
  3706. if (fail)
  3707. {
  3708. rc = -1;
  3709. goto hwc_lookup_wrapup;
  3710. }
  3711. }
  3712. if (!numctrs)
  3713. {
  3714. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3715. GTXT ("No HW counters were specified.\n"));
  3716. rc = -1;
  3717. goto hwc_lookup_wrapup;
  3718. }
  3719. if (numctrs > cpcx_max_concurrent[forKernel])
  3720. {
  3721. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3722. GTXT ("The HW counter configuration could not be loaded: More than %d counters were specified\n"), cpcx_max_concurrent[forKernel]);
  3723. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3724. GTXT ("Run \"%s -h\" with no other arguments for more information on HW counters on this system.\n"),
  3725. (IS_KERNEL (forKernel) ? "er_kernel" : "collect"));
  3726. rc = -1;
  3727. goto hwc_lookup_wrapup;
  3728. }
  3729. hwc_lookup_wrapup:
  3730. free (instr_copy);
  3731. if (wmsg && strlen (UWbuf))
  3732. *wmsg = strdup (UWbuf);
  3733. if (emsg && strlen (UEbuf))
  3734. *emsg = strdup (UEbuf);
  3735. if (rc == 0)
  3736. rc = numctrs;
  3737. return rc;
  3738. }
  3739. extern char *
  3740. hwc_validate_ctrs (int forKernel, Hwcentry *entries[], unsigned numctrs)
  3741. {
  3742. char UEbuf[1024 * 5];
  3743. UEbuf[0] = 0;
  3744. /* search for obvious duplicates*/
  3745. unsigned ii;
  3746. for (ii = 0; ii < numctrs; ii++)
  3747. {
  3748. regno_t reg_a = entries[ii]->reg_num;
  3749. if (reg_a != REGNO_ANY)
  3750. {
  3751. unsigned jj;
  3752. for (jj = ii + 1; jj < numctrs; jj++)
  3753. {
  3754. int reg_b = entries[jj]->reg_num;
  3755. if (reg_a == reg_b)
  3756. {
  3757. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3758. GTXT ("Only one HW counter is allowed per register. The following counters use register %d: \n"),
  3759. reg_a);
  3760. for (jj = 0; jj < numctrs; jj++)
  3761. {
  3762. char buf[256];
  3763. int reg_b = entries[jj]->reg_num;
  3764. if (reg_a == reg_b)
  3765. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3766. GTXT (" %d. %s\n"), jj + 1,
  3767. hwc_hwcentry_specd_string (buf, sizeof (buf),
  3768. entries[jj]));
  3769. }
  3770. return strdup (UEbuf);
  3771. }
  3772. }
  3773. }
  3774. }
  3775. /* test counters */
  3776. hwcfuncs_errmsg_get (NULL, 0, 1); /* enable errmsg capture */
  3777. int hwc_rc = hwcfuncs_assign_regnos (entries, numctrs);
  3778. if (!hwc_rc)
  3779. hwc_rc = test_hwcs ((const Hwcentry**) entries, numctrs);
  3780. if (hwc_rc)
  3781. {
  3782. if (cpcx_cpuver == CPC_PENTIUM_4_HT || cpcx_cpuver == CPC_PENTIUM_4)
  3783. {
  3784. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3785. GTXT ("HW counter profiling is disabled unless only one logical CPU per HyperThreaded processor is online (see psradm)\n"));
  3786. return strdup (UEbuf);
  3787. }
  3788. char buf[1024];
  3789. *buf = 0;
  3790. char * pch = hwcfuncs_errmsg_get (buf, sizeof (buf), 0); /* get first err msg, disable capture */
  3791. if (*pch)
  3792. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3793. GTXT ("The HW counter configuration could not be loaded: %s%s"),
  3794. pch, pch[strlen (pch) - 1] == '\n' ? "" : "\n");
  3795. else
  3796. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3797. GTXT ("The HW counter configuration could not be loaded\n"));
  3798. snprintf (UEbuf + strlen (UEbuf), sizeof (UEbuf) - strlen (UEbuf),
  3799. GTXT ("Run \"%s -h\" with no other arguments for more information on HW counters on this system.\n"),
  3800. (IS_KERNEL (forKernel) ? "er_kernel" : "collect"));
  3801. return strdup (UEbuf);
  3802. }
  3803. return NULL;
  3804. }
  3805. extern Hwcentry *
  3806. hwc_post_lookup (Hwcentry * pret_ctr, char *counter, char * int_name, int cpuver)
  3807. {
  3808. const Hwcentry *pfound;
  3809. regno_t regno;
  3810. char *nameOnly = NULL;
  3811. char *attrs = NULL;
  3812. /* fields in pret_ctr (name and int_name) should already be free */
  3813. hwcfuncs_parse_ctr (counter, NULL, &nameOnly, &attrs, NULL, &regno);
  3814. /* look for it in the canonical list */
  3815. pfound = static_table_find (stdlist_get_table (cpuver),
  3816. nameOnly, int_name, 0, REGNO_ANY);
  3817. if (!pfound) /* try the generic list */
  3818. pfound = static_table_find (papi_generic_list,
  3819. nameOnly, int_name, 0, REGNO_ANY);
  3820. if (pfound)
  3821. {
  3822. /* in standard list */
  3823. *pret_ctr = *pfound; /* shallow copy */
  3824. if (pret_ctr->int_name)
  3825. {
  3826. // aliased counter
  3827. pret_ctr->int_name = strdup (pret_ctr->int_name);
  3828. if (pret_ctr->short_desc == NULL)
  3829. {
  3830. // look for short_desc of corresponding raw counter
  3831. const Hwcentry *praw = static_table_find (stdlist_get_table (cpuver),
  3832. pret_ctr->int_name, NULL, 0, REGNO_ANY);
  3833. if (praw && praw->short_desc)
  3834. pret_ctr->short_desc = strdup (praw->short_desc);
  3835. }
  3836. }
  3837. else
  3838. pret_ctr->int_name = strdup (counter);
  3839. if (pret_ctr->reg_num == REGNO_ANY)
  3840. pret_ctr->reg_num = regno; /* table's regno is a wildcard */
  3841. }
  3842. else
  3843. {
  3844. /* not a standard counter */
  3845. *pret_ctr = empty_ctr;
  3846. pret_ctr->int_name = strdup (counter);
  3847. pret_ctr->reg_num = regno;
  3848. }
  3849. /* update the name */
  3850. if (attrs)
  3851. {
  3852. pret_ctr->name = canonical_name (counter);
  3853. if (pret_ctr->metric)
  3854. {
  3855. // metric text is supplied from a table. (User supplied HWC alias)
  3856. // Append user-supplied attributes to metric name:
  3857. size_t len = strlen (pret_ctr->metric) + strlen (attrs) + 4;
  3858. char *pch = calloc (len, 1);
  3859. if (pch)
  3860. snprintf (pch, len, "%s (%s)", pret_ctr->metric, attrs);
  3861. pret_ctr->metric = pch; // leaks
  3862. }
  3863. }
  3864. else
  3865. pret_ctr->name = strdup (nameOnly);
  3866. if (pfound)
  3867. hwcentry_print (DBG_LT2, "hwctable: hwc_post_lookup: found: ", pret_ctr);
  3868. else
  3869. hwcentry_print (DBG_LT2, "hwctable: hwc_post_lookup: default: ", pret_ctr);
  3870. free (attrs);
  3871. free (nameOnly);
  3872. return pret_ctr;
  3873. }
  3874. static const char *
  3875. hwc_on_lo_hi (const Hwcentry *pctr)
  3876. {
  3877. char* rate;
  3878. {
  3879. switch (pctr->min_time)
  3880. {
  3881. case (HWCTIME_LO):
  3882. rate = NTXT ("lo");
  3883. break;
  3884. case (HWCTIME_ON):
  3885. rate = NTXT ("on");
  3886. break;
  3887. case (HWCTIME_HI):
  3888. rate = NTXT ("hi");
  3889. break;
  3890. case (0):
  3891. rate = NULL; // null => use interval count
  3892. break;
  3893. default:
  3894. case (HWCTIME_TBD):
  3895. rate = NTXT ("on");
  3896. break;
  3897. }
  3898. }
  3899. return rate; //strdup( rate );
  3900. }
  3901. extern char *
  3902. hwc_rate_string (const Hwcentry *pctr, int force_numeric)
  3903. {
  3904. const char * rateString = hwc_on_lo_hi (pctr);
  3905. char buf[128];
  3906. if (!rateString || force_numeric)
  3907. {
  3908. snprintf (buf, sizeof (buf), NTXT ("%d"), pctr->val);
  3909. rateString = buf;
  3910. }
  3911. return strdup (rateString);
  3912. }
  3913. static char metricbuf[2048];
  3914. extern char *
  3915. hwc_i18n_metric (const Hwcentry *pctr)
  3916. {
  3917. if (pctr->metric != NULL)
  3918. snprintf (metricbuf, sizeof (metricbuf), NTXT ("%s"), PTXT (pctr->metric));
  3919. else if (pctr->name != NULL)
  3920. snprintf (metricbuf, sizeof (metricbuf), GTXT ("%s Events"), pctr->name);
  3921. else if (pctr->int_name != NULL)
  3922. snprintf (metricbuf, sizeof (metricbuf), GTXT ("%s Events"), pctr->int_name);
  3923. else
  3924. snprintf (metricbuf, sizeof (metricbuf), GTXT ("Undefined Events"));
  3925. return metricbuf;
  3926. }
  3927. /* return cpu version, should only be called when about to generate an experiment,
  3928. not when reading back an experiment */
  3929. #if 0 /* called by ... */
  3930. . / perfan / collect / src / collect.cc : start : 245 : cpuver = hwc_get_cpc_cpuver ();
  3931. . / ccr_components / Collector_Interface / collctrl.cc : constructor : 202 : cpcx_cpuver = hwc_get_cpc_cpuver ();
  3932. . / perfan / dbe / src / Dbe.cc : 3041 : JApplication::cpuver = hwc_get_cpc_cpuver ();
  3933. . / perfan / dbe / src / Dbe.cc : 3164 : JApplication::cpuver = hwc_get_cpc_cpuver ();
  3934. note:
  3935. cpc_getcpuver () : only papi, ostest, this and hwprofile.c call it
  3936. #endif
  3937. int
  3938. hwc_get_cpc_cpuver ()
  3939. {
  3940. setup_cpcx ();
  3941. return cpcx_cpuver;
  3942. }
  3943. extern char*
  3944. hwc_get_cpuname (char *buf, size_t buflen)
  3945. {
  3946. setup_cpcx ();
  3947. if (!buf || !buflen)
  3948. return buf;
  3949. buf[0] = 0;
  3950. if (cpcx_cciname)
  3951. {
  3952. strncpy (buf, cpcx_cciname, buflen - 1);
  3953. buf[buflen - 1] = 0;
  3954. }
  3955. return buf;
  3956. }
  3957. extern char*
  3958. hwc_get_docref (char *buf, size_t buflen)
  3959. {
  3960. setup_cpcx ();
  3961. if (!buf || !buflen)
  3962. return buf;
  3963. buf[0] = 0;
  3964. if (cpcx_docref)
  3965. {
  3966. strncpy (buf, cpcx_docref, buflen - 1);
  3967. buf[buflen - 1] = 0;
  3968. }
  3969. return buf;
  3970. }
  3971. //TBR:
  3972. extern char*
  3973. hwc_get_default_cntrs ()
  3974. {
  3975. setup_cpcx ();
  3976. if (cpcx_default_hwcs[0] != NULL)
  3977. return strdup (cpcx_default_hwcs[0]); // TBR deprecate this
  3978. return NULL;
  3979. }
  3980. extern char*
  3981. hwc_get_default_cntrs2 (int forKernel, int style)
  3982. {
  3983. setup_cpcx ();
  3984. if (!VALID_FOR_KERNEL (forKernel))
  3985. return NULL;
  3986. char *cpcx_default = cpcx_default_hwcs[forKernel];
  3987. if (cpcx_default == NULL || cpcx_npics == 0)
  3988. return NULL;
  3989. if (style == 1)
  3990. return strdup (cpcx_default);
  3991. // style == 2
  3992. // we will replace "," delimiters with " -h " (an extra 3 chars per HWC)
  3993. char *s = (char *) malloc (strlen (cpcx_default) + 3 * cpcx_npics);
  3994. if (s == NULL) return s;
  3995. char *p = s;
  3996. char *q = cpcx_default;
  3997. int i;
  3998. for (i = 0; i < cpcx_npics; i++)
  3999. {
  4000. int qlen = strlen (q);
  4001. if (qlen == 0)
  4002. {
  4003. p[0] = '\0';
  4004. break;
  4005. }
  4006. // add " -h " if not the first HWC
  4007. if (i != 0)
  4008. {
  4009. p[0] = ' ';
  4010. p[1] = '-';
  4011. p[2] = 'h';
  4012. p[3] = ' ';
  4013. p += 4;
  4014. }
  4015. // find second comma
  4016. char *r = strchr (q, ',');
  4017. if (r)
  4018. r = strchr (r + 1, ',');
  4019. // we didn't find one, so the rest of the string is the last HWC
  4020. if (r == NULL)
  4021. {
  4022. // EUGENE could check i==cpcx_npicx-1, but what if it isn't???
  4023. strcpy (p, q);
  4024. if (p[qlen - 1] == ',')
  4025. qlen--;
  4026. p[qlen] = '\0';
  4027. break;
  4028. }
  4029. // copy the HWC, trim trailing comma, add null char
  4030. qlen = r - q - 1;
  4031. strcpy (p, q);
  4032. if (p[qlen - 1] == ',')
  4033. qlen--;
  4034. p += qlen;
  4035. p[0] = '\0';
  4036. q = r + 1;
  4037. }
  4038. return s;
  4039. }
  4040. extern char*
  4041. hwc_get_orig_default_cntrs (int forKernel)
  4042. {
  4043. setup_cpcx ();
  4044. if (!VALID_FOR_KERNEL (forKernel))
  4045. return NULL;
  4046. if (cpcx_orig_default_hwcs[forKernel] != NULL)
  4047. return strdup (cpcx_orig_default_hwcs[forKernel]);
  4048. return NULL;
  4049. }
  4050. extern const char *
  4051. hwc_memop_string (ABST_type memop)
  4052. {
  4053. const char * s;
  4054. switch (memop)
  4055. {
  4056. case ABST_NONE:
  4057. s = "";
  4058. break;
  4059. case ABST_LOAD:
  4060. s = GTXT ("load ");
  4061. break;
  4062. case ABST_STORE:
  4063. s = GTXT ("store ");
  4064. break;
  4065. case ABST_LDST:
  4066. case ABST_US_DTLBM:
  4067. case ABST_LDST_SPARC64:
  4068. s = GTXT ("load-store ");
  4069. break;
  4070. case ABST_EXACT_PEBS_PLUS1:
  4071. case ABST_EXACT:
  4072. s = GTXT ("memoryspace ");
  4073. break;
  4074. case ABST_COUNT:
  4075. s = GTXT ("count ");
  4076. break;
  4077. case ABST_NOPC:
  4078. s = GTXT ("not-program-related ");
  4079. break;
  4080. default:
  4081. s = ""; // was "ABST_UNK", but that's meaningless to users
  4082. break;
  4083. }
  4084. return s;
  4085. }
  4086. static const char *
  4087. timecvt_string (int timecvt)
  4088. {
  4089. if (timecvt > 0)
  4090. return GTXT ("CPU-cycles");
  4091. if (timecvt < 0)
  4092. return GTXT ("ref-cycles");
  4093. return GTXT ("events");
  4094. }
  4095. int show_regs = 0; // The register setting is available on Solaris only
  4096. /*
  4097. * print the specified strings in aligned columns
  4098. */
  4099. static void
  4100. format_columns (char *buf, int bufsiz, char *s1, char *s2, const char *s3,
  4101. const char *s4, char *s5, const char *s6)
  4102. {
  4103. // NULL strings are blanks
  4104. char *blank = NTXT ("");
  4105. if (s2 == NULL)
  4106. s2 = blank;
  4107. if (s3 == NULL)
  4108. s3 = blank;
  4109. if (s6 == NULL)
  4110. s6 = blank;
  4111. // get the lengths and target widths
  4112. // (s6 can be as wide as it likes)
  4113. int l1 = strlen (s1), n1 = 10, l2 = strlen (s2), n2 = 13;
  4114. int l3 = strlen (s3), n3 = 20, l4 = strlen (s4), n4 = 10, n5;
  4115. char divide = ' ';
  4116. // adjust widths, stealing from one column to help a neighbor
  4117. // There's a ragged boundary between s2 and s3.
  4118. // So push this boundary to the right.
  4119. n2 += n3 - l3;
  4120. n3 -= n3 - l3;
  4121. // If s3 is empty, push the boundary over to s4.
  4122. if (l3 == 0)
  4123. {
  4124. n2 += n4 - l4;
  4125. n4 -= n4 - l4;
  4126. }
  4127. // If there's enough room to fit s1 and s2, do so.
  4128. if (n1 + n2 >= l1 + l2)
  4129. {
  4130. if (n1 < l1)
  4131. {
  4132. n2 -= l1 - n1;
  4133. n1 += l1 - n1;
  4134. }
  4135. if (n2 < l2)
  4136. {
  4137. n1 -= l2 - n2;
  4138. n2 += l2 - n2;
  4139. }
  4140. }
  4141. else
  4142. {
  4143. // not enough room, so we need to divide the line
  4144. n3 += 4 // 4-blank margin
  4145. + n1 // 1st column
  4146. + 1 // space between 1st and 2nd columns
  4147. + n2 // 2nd column
  4148. + 1; // space between 2nd and 3th columns
  4149. divide = '\n';
  4150. // make 1st column large enough
  4151. if (n1 < l1)
  4152. n1 = l1;
  4153. // width of 2nd column no longer matters since we divided the line
  4154. n2 = 0;
  4155. }
  4156. if (show_regs)
  4157. {
  4158. // fifth column should be wide enough for regnolist
  4159. // see function get_regnolist()
  4160. if (cpcx_npics < 10)
  4161. n5 = cpcx_npics; // one char per regno
  4162. else
  4163. n5 = 16 + 3 * (cpcx_npics - 9); // spaces between regnos and some regnos are 2-char wide
  4164. // ... and be wide enough for header "regs"
  4165. if (n5 < 4)
  4166. n5 = 4;
  4167. // print to buffer
  4168. // (don't need a space before s4 since historical precedent to have a trailing space in s3)
  4169. snprintf (buf, bufsiz, "%-*s %-*s%c%*s%*s %-*s %s",
  4170. n1, s1, n2, s2, divide, n3, s3, n4, s4, n5, s5, s6);
  4171. }
  4172. else
  4173. snprintf (buf, bufsiz, "%-*s %-*s%c%*s%*s %s",
  4174. n1, s1, n2, s2, divide, n3, s3, n4, s4, s6);
  4175. for (int i = strlen (buf); i > 0; i--)
  4176. if (buf[i] == ' ' || buf[i] == '\t')
  4177. buf[i] = 0;
  4178. else
  4179. break;
  4180. }
  4181. /* routine to return HW counter string formatted and i18n'd */
  4182. static char *
  4183. hwc_hwcentry_string_internal (char *buf, size_t buflen, const Hwcentry *ctr,
  4184. int show_short_desc)
  4185. {
  4186. char stderrbuf[1024];
  4187. char regnolist[256];
  4188. if (!buf || !buflen)
  4189. return buf;
  4190. buf[0] = 0;
  4191. if (ctr == NULL)
  4192. {
  4193. snprintf (stderrbuf, sizeof (stderrbuf), GTXT ("HW counter not available"));
  4194. goto hwc_hwcentry_string_done;
  4195. }
  4196. char *desc = NULL;
  4197. if (show_short_desc)
  4198. desc = ctr->short_desc;
  4199. if (desc == NULL)
  4200. desc = ctr->metric ? hwc_i18n_metric (ctr) : NULL;
  4201. format_columns (stderrbuf, sizeof (stderrbuf), ctr->name, ctr->int_name,
  4202. hwc_memop_string (ctr->memop), timecvt_string (ctr->timecvt),
  4203. get_regnolist (regnolist, sizeof (regnolist), ctr->reg_list, 2),
  4204. desc);
  4205. hwc_hwcentry_string_done:
  4206. strncpy (buf, stderrbuf, buflen - 1);
  4207. buf[buflen - 1] = 0;
  4208. return buf;
  4209. }
  4210. /* routine to return HW counter string formatted and i18n'd */
  4211. extern char *
  4212. hwc_hwcentry_string (char *buf, size_t buflen, const Hwcentry *ctr)
  4213. {
  4214. return hwc_hwcentry_string_internal (buf, buflen, ctr, 0);
  4215. }
  4216. /* routine to return HW counter string formatted and i18n'd */
  4217. extern char *
  4218. hwc_hwcentry_specd_string (char *buf, size_t buflen, const Hwcentry *ctr)
  4219. {
  4220. char stderrbuf[1024];
  4221. const char *memop, *timecvt;
  4222. char descstr[1024];
  4223. if (!buf || !buflen)
  4224. return buf;
  4225. buf[0] = 0;
  4226. if (ctr == NULL)
  4227. {
  4228. snprintf (stderrbuf, sizeof (stderrbuf), GTXT ("HW counter not available"));
  4229. goto hwc_hwcentry_specd_string_done;
  4230. }
  4231. timecvt = timecvt_string (ctr->timecvt);
  4232. if (ctr->memop)
  4233. memop = hwc_memop_string (ctr->memop);
  4234. else
  4235. memop = "";
  4236. if (ctr->metric != NULL) /* a standard counter for a specific register */
  4237. snprintf (descstr, sizeof (descstr), GTXT (" (`%s'; %s%s)"),
  4238. hwc_i18n_metric (ctr), memop, timecvt);
  4239. else /* raw counter */
  4240. snprintf (descstr, sizeof (descstr), GTXT (" (%s%s)"), memop, timecvt);
  4241. char *rateString = hwc_rate_string (ctr, 1);
  4242. snprintf (stderrbuf, sizeof (stderrbuf), NTXT ("%s,%s%s"), ctr->name,
  4243. rateString ? rateString : "", descstr);
  4244. free (rateString);
  4245. hwc_hwcentry_specd_string_done:
  4246. strncpy (buf, stderrbuf, buflen - 1);
  4247. buf[buflen - 1] = 0;
  4248. return buf;
  4249. }
  4250. unsigned
  4251. hwc_get_max_regs ()
  4252. {
  4253. setup_cpcx ();
  4254. return cpcx_npics;
  4255. }
  4256. unsigned
  4257. hwc_get_max_concurrent (int forKernel)
  4258. {
  4259. setup_cpcx ();
  4260. if (!VALID_FOR_KERNEL (forKernel))
  4261. return 0;
  4262. return cpcx_max_concurrent[forKernel];
  4263. }
  4264. char**
  4265. hwc_get_attrs (int forKernel)
  4266. {
  4267. setup_cpcx ();
  4268. if (!VALID_FOR_KERNEL (forKernel))
  4269. return NULL;
  4270. return cpcx_attrs[forKernel];
  4271. }
  4272. Hwcentry **
  4273. hwc_get_std_ctrs (int forKernel)
  4274. {
  4275. setup_cpcx ();
  4276. if (!VALID_FOR_KERNEL (forKernel))
  4277. return NULL;
  4278. return cpcx_std[forKernel];
  4279. }
  4280. Hwcentry **
  4281. hwc_get_raw_ctrs (int forKernel)
  4282. {
  4283. setup_cpcx ();
  4284. if (!VALID_FOR_KERNEL (forKernel))
  4285. return NULL;
  4286. return cpcx_raw[forKernel];
  4287. }
  4288. /* Call an action function for each attribute supported */
  4289. unsigned
  4290. hwc_scan_attrs (void (*action)(const char *attr, const char *desc))
  4291. {
  4292. setup_cpcx ();
  4293. int cnt = 0;
  4294. for (int ii = 0; cpcx_attrs[0] && cpcx_attrs[0][ii]; ii++, cnt++)
  4295. {
  4296. if (action)
  4297. action (cpcx_attrs[0][ii], NULL);
  4298. }
  4299. if (!cnt && action)
  4300. action (NULL, NULL);
  4301. return cnt;
  4302. }
  4303. unsigned
  4304. hwc_scan_std_ctrs (void (*action)(const Hwcentry *))
  4305. {
  4306. setup_cpcx ();
  4307. Tprintf (DBG_LT1, "hwctable: hwc_scan_standard_ctrs()...\n");
  4308. int cnt = 0;
  4309. for (int ii = 0; cpcx_std[0] && cpcx_std[0][ii]; ii++, cnt++)
  4310. if (action)
  4311. action (cpcx_std[0][ii]);
  4312. if (!cnt && action)
  4313. action (NULL);
  4314. return cnt;
  4315. }
  4316. /* Call an action function for each counter supported */
  4317. /* action is called with NULL when all counters have been seen */
  4318. unsigned
  4319. hwc_scan_raw_ctrs (void (*action)(const Hwcentry *))
  4320. {
  4321. setup_cpcx ();
  4322. Tprintf (DBG_LT1, "hwctable: hwc_scan_raw_ctrs()...\n");
  4323. int cnt = 0;
  4324. for (int ii = 0; cpcx_raw[0] && cpcx_raw[0][ii]; ii++, cnt++)
  4325. if (action)
  4326. action (cpcx_raw[0][ii]);
  4327. if (!cnt && action)
  4328. action (NULL);
  4329. return cnt;
  4330. }
  4331. static void
  4332. hwc_usage_raw_overview_sparc (FILE *f_usage, int cpuver)
  4333. {
  4334. /* All these cpuver's use cputabs[]==sparc_t5_m6 anyhow. */
  4335. if ((cpuver == CPC_SPARC_M5) || (cpuver == CPC_SPARC_M6)
  4336. || (cpuver == CPC_SPARC_T5) || (cpuver == CPC_SPARC_T6))
  4337. cpuver = CPC_SPARC_M4; // M4 was renamed to M5
  4338. /* While there are small differences between
  4339. * cputabs[]== sparc_t4
  4340. * cputabs[]== sparc_t5_m6
  4341. * they are in HWCs we don't discuss in the overview anyhow.
  4342. * So just lump them in with T4.
  4343. */
  4344. if (cpuver == CPC_SPARC_M4)
  4345. cpuver = CPC_SPARC_T4;
  4346. /* Check for the cases we support. */
  4347. if (cpuver != CPC_SPARC_T4 && cpuver != CPC_SPARC_M7 && cpuver != CPC_SPARC_M8)
  4348. return;
  4349. fprintf (f_usage, GTXT (" While the above aliases represent the most useful hardware counters\n"
  4350. " for this processor, a full list of raw (unaliased) counter names appears\n"
  4351. " below. First is an overview of some of these names.\n\n"));
  4352. fprintf (f_usage, GTXT (" == Cycles.\n"
  4353. " Count active cycles with\n"
  4354. " Cycles_user\n"
  4355. " Set attributes to choose user, system, and/or hyperprivileged cycles.\n\n"));
  4356. fprintf (f_usage, GTXT (" == Instructions.\n"
  4357. " Count instructions when they are committed with:\n"));
  4358. fprintf (f_usage, NTXT (" Instr_all\n"));
  4359. if (cpuver != CPC_SPARC_M8)
  4360. fprintf (f_usage, GTXT (" It is the total of these counters:\n"));
  4361. else
  4362. fprintf (f_usage, GTXT (" Some subsets of instructions can be counted separately:\n"));
  4363. fprintf (f_usage, NTXT (" Branches %s\n"), GTXT ("branches"));
  4364. fprintf (f_usage, NTXT (" Instr_FGU_crypto %s\n"), GTXT ("Floating Point and Graphics Unit"));
  4365. fprintf (f_usage, NTXT (" Instr_ld %s\n"), GTXT ("loads"));
  4366. fprintf (f_usage, NTXT (" Instr_st %s\n"), GTXT ("stores"));
  4367. fprintf (f_usage, NTXT (" %-19s %s\n"),
  4368. cpuver == CPC_SPARC_M7 ? NTXT ("Instr_SPR_ring_ops")
  4369. : NTXT ("SPR_ring_ops"),
  4370. GTXT ("internal use of SPR ring"));
  4371. fprintf (f_usage, NTXT (" Instr_other %s\n"), GTXT ("basic arithmetic and logical instructions"));
  4372. if (cpuver != CPC_SPARC_M8)
  4373. fprintf (f_usage, GTXT (" Some subsets of these instructions can be counted separately:\n"));
  4374. fprintf (f_usage, NTXT (" Br_taken %s\n"), GTXT ("Branches that are taken"));
  4375. fprintf (f_usage, NTXT (" %-19s %s\n"),
  4376. cpuver == CPC_SPARC_M7 ? NTXT ("Instr_block_ld_st")
  4377. : NTXT ("Block_ld_st"),
  4378. GTXT ("block load/store"));
  4379. fprintf (f_usage, NTXT (" %-19s %s\n"),
  4380. cpuver == CPC_SPARC_M7 ? NTXT ("Instr_atomic")
  4381. : NTXT ("Atomics"),
  4382. GTXT ("atomic instructions"));
  4383. fprintf (f_usage, NTXT (" %-19s %s\n"),
  4384. cpuver == CPC_SPARC_M7 ? NTXT ("Instr_SW_prefetch")
  4385. : NTXT ("SW_prefetch"),
  4386. GTXT ("prefetches"));
  4387. fprintf (f_usage, NTXT (" %-19s %s\n"),
  4388. cpuver == CPC_SPARC_M7 ? NTXT ("Instr_SW_count")
  4389. : NTXT ("Sw_count_intr"),
  4390. GTXT ("SW Count instructions (counts special no-op assembler instructions)"));
  4391. fprintf (f_usage, NTXT ("\n"));
  4392. #ifdef TMPLEN
  4393. compilation error : we're trying to use a macro that's already defined
  4394. #endif
  4395. #define TMPLEN 32
  4396. char s0[TMPLEN], s1[TMPLEN], s2[TMPLEN], s3[TMPLEN];
  4397. if (cpuver == CPC_SPARC_M7)
  4398. {
  4399. snprintf (s0, TMPLEN, "Commit_0_cyc");
  4400. snprintf (s1, TMPLEN, "Commit_1_cyc");
  4401. snprintf (s2, TMPLEN, "Commit_2_cyc");
  4402. snprintf (s3, TMPLEN, "Commit_1_or_2_cyc");
  4403. }
  4404. else
  4405. {
  4406. snprintf (s0, TMPLEN, "Commit_0");
  4407. snprintf (s1, TMPLEN, "Commit_1");
  4408. snprintf (s2, TMPLEN, "Commit_2");
  4409. snprintf (s3, TMPLEN, "Commit_1_or_2");
  4410. }
  4411. #undef TMPLEN
  4412. fprintf (f_usage, GTXT (" == Commit.\n"
  4413. " Instructions may be launched speculatively, executed out of order, etc.\n"));
  4414. if (cpuver != CPC_SPARC_M8)
  4415. {
  4416. fprintf (f_usage, GTXT (" We can count the number of cycles during which 0, 1, or 2 instructions are\n"
  4417. " actually completed and their results committed:\n"));
  4418. fprintf (f_usage, GTXT (" %s\n"
  4419. " %s\n"
  4420. " %s\n"
  4421. " %s\n"
  4422. " %s is a useful way of identifying parts of your application with\n"
  4423. " high-latency instructions.\n\n"),
  4424. s0, s1, s2, s3, s0);
  4425. }
  4426. else
  4427. {
  4428. fprintf (f_usage, GTXT (" We can count the number of cycles during which no instructions were\n"
  4429. " able to commit results using:\n"));
  4430. fprintf (f_usage, GTXT (" %s\n"
  4431. " %s is a useful way of identifying parts of your application with\n"
  4432. " high-latency instructions.\n\n"),
  4433. s0, s0);
  4434. }
  4435. fprintf (f_usage, GTXT (" == Cache/memory hierarchy.\n"));
  4436. if (cpuver == CPC_SPARC_M7)
  4437. {
  4438. fprintf (f_usage, GTXT (" In the cache hierarchy:\n"
  4439. " * Each socket has memory and multiple SPARC core clusters (scc).\n"
  4440. " * Each scc has an L3 cache and multiple L2 and L1 caches.\n"));
  4441. fprintf (f_usage, GTXT (" Loads can be counted by where they hit on socket:\n"));
  4442. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4443. NTXT ("DC_hit"), GTXT ("hit own L1 data cache"));
  4444. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4445. NTXT ("DC_miss_L2_hit"), GTXT ("hit own L2"));
  4446. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4447. NTXT ("DC_miss_L3_hit"), GTXT ("hit own L3"));
  4448. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4449. NTXT ("DC_miss_nbr_L2_hit"), GTXT ("hit neighbor L2 (same scc)"));
  4450. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4451. NTXT ("DC_miss_nbr_scc_hit"), GTXT ("hit neighbor scc (same socket)"));
  4452. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4453. NTXT ("DC_miss_nbr_scc_miss"), GTXT ("miss all caches (same socket)"));
  4454. fprintf (f_usage, GTXT (" These loads can also be grouped:\n"));
  4455. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4456. NTXT ("DC_miss"), GTXT ("all - DC_hit"));
  4457. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4458. NTXT ("DC_miss_L2_miss"), GTXT ("all - DC_hit - DC_miss_L2_hit"));
  4459. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4460. NTXT ("DC_miss_L3_miss"), GTXT ("DC_miss_nbr_scc_hit + DC_miss_nbr_scc_miss"));
  4461. fprintf (f_usage, GTXT (" Loads that miss all caches on this socket can be counted:\n"));
  4462. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4463. NTXT ("DC_miss_remote_scc_hit"), GTXT ("hit cache on different socket"));
  4464. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4465. NTXT ("DC_miss_local_mem_hit"), GTXT ("hit local memory (same socket)"));
  4466. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4467. NTXT ("DC_miss_remote_mem_hit"), GTXT ("hit remote memory (off socket)"));
  4468. fprintf (f_usage, GTXT (" These events are for speculative loads, launched in anticipation\n"
  4469. " of helping performance but whose results might not be committed.\n"));
  4470. #if 0 // was: #if defined(linux). See 22236226 - sparc-Linux: Support basic Memoryspace and Dataspace profiling (capture VADDR)
  4471. /* 21869427 should not look like memoryspace profiling is supported on Linux */
  4472. /* 21869424 desire memoryspace profiling on Linux */
  4473. fprintf (f_usage, GTXT (" To count only data-cache misses that commit, use:\n"));
  4474. fprintf (f_usage, NTXT (" DC_miss_commit\n"));
  4475. #else
  4476. fprintf (f_usage, GTXT (" To count only data-cache misses that commit, or for memoryspace profiling,\n"
  4477. " use the 'memoryspace' counter:\n"));
  4478. fprintf (f_usage, NTXT (" DC_miss_commit\n"));
  4479. #endif
  4480. fprintf (f_usage, NTXT ("\n"));
  4481. }
  4482. else if (cpuver == CPC_SPARC_M8)
  4483. {
  4484. fprintf (f_usage, GTXT (" In the cache hierarchy:\n"
  4485. " * Each processor has 4 memory controllers and 2 quad core clusters (QCC).\n"
  4486. " * Each QCC contains 4 cache processor clusters (CPC).\n"
  4487. " * Each CPC contains 4 cores.\n"
  4488. " * Each core supports 8 hardware threads.\n"
  4489. " * The L3 consists of 2 partitions with 1 QCC per partition.\n"
  4490. ));
  4491. fprintf (f_usage, GTXT (" Loads can be counted by where they hit on socket:\n"));
  4492. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4493. NTXT ("DC_miss_L2_hit"), GTXT ("hit own L2"));
  4494. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4495. NTXT ("DC_miss_L3_hit"), GTXT ("hit own L3"));
  4496. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4497. NTXT ("DC_miss_L3_dirty_copyback"), GTXT ("hit own L3 but require copyback from L2D"));
  4498. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4499. NTXT ("DC_miss_nbr_L3_hit"), GTXT ("hit neighbor L3 (same socket)"));
  4500. fprintf (f_usage, GTXT (" Loads that miss all caches on this socket can be counted:\n"));
  4501. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4502. NTXT ("DC_miss_remote_L3_hit"), GTXT ("hit cache on different socket"));
  4503. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4504. NTXT ("DC_miss_local_mem_hit"), GTXT ("hit local memory (same socket)"));
  4505. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4506. NTXT ("DC_miss_remote_mem_hit"), GTXT ("hit remote memory (off socket)"));
  4507. fprintf (f_usage, GTXT (" These events are for speculative loads, launched in anticipation\n"
  4508. " of helping performance but whose results might not be committed.\n"));
  4509. #if 0 // was: #if defined(linux). See 22236226 - sparc-Linux: Support basic Memoryspace and Dataspace profiling (capture VADDR)
  4510. /* 21869427 should not look like memoryspace profiling is supported on Linux */
  4511. /* 21869424 desire memoryspace profiling on Linux */
  4512. fprintf (f_usage, GTXT (" To count only data-cache misses that commit, use:\n"));
  4513. fprintf (f_usage, NTXT (" DC_miss_commit\n"));
  4514. #else
  4515. fprintf (f_usage, GTXT (" To count only data-cache misses that commit, or for memoryspace profiling,\n"
  4516. " use the 'memoryspace' counter:\n"));
  4517. fprintf (f_usage, NTXT (" DC_miss_commit\n"));
  4518. #endif
  4519. fprintf (f_usage, NTXT ("\n"));
  4520. }
  4521. else
  4522. {
  4523. fprintf (f_usage, GTXT (" Total data-cache misses can be counted with:\n"));
  4524. fprintf (f_usage, NTXT (" DC_miss DC_miss_nospec\n"));
  4525. fprintf (f_usage, GTXT (" They are the totals of misses that hit in L2/L3 cache, local memory, or\n"
  4526. " remote memory:\n"));
  4527. fprintf (f_usage, NTXT (" DC_miss_L2_L3_hit DC_miss_L2_L3_hit_nospec\n"));
  4528. fprintf (f_usage, NTXT (" DC_miss_local_hit DC_miss_local_hit_nospec\n"));
  4529. fprintf (f_usage, NTXT (" DC_miss_remote_L3_hit DC_miss_remote_L3_hit_nospec\n"));
  4530. fprintf (f_usage, GTXT (" The events in the left column include speculative operations. Use the\n"
  4531. " right-hand _nospec events to count only data accesses that commit\n"
  4532. " or for memoryspace profiling.\n\n"));
  4533. }
  4534. fprintf (f_usage, GTXT (" == TLB misses.\n"
  4535. " The Translation Lookaside Buffer (TLB) is a cache of virtual-to-physical\n"
  4536. " page translations."));
  4537. fprintf (f_usage, GTXT (" If a virtual address (VA) is not represented in the\n"
  4538. " TLB, an expensive hardware table walk (HWTW) must be conducted."));
  4539. fprintf (f_usage, GTXT (" If the\n"
  4540. " page is still not found, a trap results. There is a data TLB (DTLB) and\n"
  4541. " an instruction TLB (ITLB).\n\n"));
  4542. fprintf (f_usage, GTXT (" TLB misses can be counted by:\n"));
  4543. fprintf (f_usage, NTXT (" %s\n"),
  4544. cpuver == CPC_SPARC_M7 ?
  4545. NTXT ("DTLB_HWTW_search ITLB_HWTW_search") :
  4546. cpuver == CPC_SPARC_M8 ?
  4547. NTXT ("DTLB_HWTW ITLB_HWTW") :
  4548. NTXT ("DTLB_miss_asynch ITLB_miss_asynch"));
  4549. fprintf (f_usage, GTXT (" or broken down by page size:\n"));
  4550. fprintf (f_usage, NTXT (" %s"),
  4551. cpuver == CPC_SPARC_M7 ?
  4552. NTXT ("DTLB_HWTW_hit_8K ITLB_HWTW_hit_8K\n"
  4553. " DTLB_HWTW_hit_64K ITLB_HWTW_hit_64K\n"
  4554. " DTLB_HWTW_hit_4M ITLB_HWTW_hit_4M\n") :
  4555. NTXT ("DTLB_fill_8KB ITLB_fill_8KB\n"
  4556. " DTLB_fill_64KB ITLB_fill_64KB\n"
  4557. " DTLB_fill_4MB ITLB_fill_4MB\n"));
  4558. fprintf (f_usage, NTXT (" %s\n\n"),
  4559. cpuver == CPC_SPARC_M7 ?
  4560. NTXT ("DTLB_HWTW_hit_256M ITLB_HWTW_hit_256M\n"
  4561. " DTLB_HWTW_hit_2G_16G ITLB_HWTW_hit_2G_16G\n"
  4562. " DTLB_HWTW_miss_trap ITLB_HWTW_miss_trap") :
  4563. cpuver == CPC_SPARC_M8 ?
  4564. NTXT ("DTLB_HWTW_hit_256M ITLB_HWTW_hit_256M\n"
  4565. " DTLB_HWTW_hit_16G ITLB_HWTW_hit_16G\n"
  4566. " DTLB_HWTW_hit_1T ITLB_HWTW_hit_1T") :
  4567. NTXT ("DTLB_fill_256MB ITLB_fill_256MB\n"
  4568. " DTLB_fill_2GB ITLB_fill_2GB\n"
  4569. " DTLB_fill_trap ITLB_fill_trap"));
  4570. if (cpuver == CPC_SPARC_M8)
  4571. {
  4572. fprintf (f_usage, GTXT (" TLB traps, which can require hundreds of cycles, can be counted with:\n"));
  4573. fprintf (f_usage, NTXT (" %s\n\n"),
  4574. NTXT ("DTLB_fill_trap ITLB_fill_trap"));
  4575. }
  4576. fprintf (f_usage, GTXT (" == Branch misprediction.\n"
  4577. " Count branch mispredictions with:\n"
  4578. " Br_mispred\n"
  4579. " It is the total of:\n"
  4580. " Br_dir_mispred direction was mispredicted\n"
  4581. " %s target was mispredicted\n"
  4582. "\n"), cpuver == CPC_SPARC_M7 ? NTXT ("Br_tgt_mispred") : NTXT ("Br_trg_mispred"));
  4583. fprintf (f_usage, GTXT (" == RAW hazards.\n"
  4584. " A read-after-write (RAW) delay occurs when we attempt to read a datum\n"
  4585. " before an earlier write has had time to complete:\n"));
  4586. if (cpuver == CPC_SPARC_M8)
  4587. {
  4588. fprintf (f_usage, NTXT (" RAW_hit\n"));
  4589. fprintf (f_usage, GTXT (" RAW_hit events can be broken down into:\n"));
  4590. }
  4591. else
  4592. {
  4593. fprintf (f_usage, NTXT (" RAW_hit_st_q~emask=0xf\n"));
  4594. fprintf (f_usage, GTXT (" The mask 0xf counts the total of all types such as:\n"));
  4595. }
  4596. fprintf (f_usage, NTXT (" RAW_hit_st_buf write is still in store buffer\n"
  4597. " RAW_hit_st_q write is still in store queue\n"
  4598. "\n"));
  4599. if (cpuver == CPC_SPARC_M7)
  4600. {
  4601. fprintf (f_usage, GTXT (" == Flush.\n"
  4602. " One can count the number of times the pipeline must be flushed:\n"));
  4603. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4604. NTXT ("Flush_L3_miss"), GTXT ("load missed L3 and >1 strand is active on the core"));
  4605. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4606. NTXT ("Flush_br_mispred"), GTXT ("branch misprediction"));
  4607. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4608. NTXT ("Flush_arch_exception"), GTXT ("SPARC exceptions and trap entry/return"));
  4609. fprintf (f_usage, NTXT (" %-22s %s\n"),
  4610. NTXT ("Flush_other"), GTXT ("state change to/from halted/paused"));
  4611. fprintf (f_usage, NTXT ("\n"));
  4612. }
  4613. }
  4614. static void
  4615. hwc_usage_internal (int forKernel, FILE *f_usage, const char *cmd, const char *dataspace_msg, int show_syntax, int show_short_desc)
  4616. {
  4617. if (!VALID_FOR_KERNEL (forKernel))
  4618. return;
  4619. char cpuname[128];
  4620. hwc_get_cpuname (cpuname, 128);
  4621. Hwcentry** raw_ctrs = hwc_get_raw_ctrs (forKernel);
  4622. int has_raw_ctrs = (raw_ctrs && raw_ctrs[0]);
  4623. Hwcentry** std_ctrs = hwc_get_std_ctrs (forKernel);
  4624. int has_std_ctrs = (std_ctrs && std_ctrs[0]);
  4625. unsigned hwc_maxregs = hwc_get_max_concurrent (forKernel);
  4626. int cpuver = hwc_get_cpc_cpuver ();
  4627. if (hwc_maxregs != 0)
  4628. {
  4629. if (show_syntax)
  4630. {
  4631. fprintf (f_usage, GTXT ("\nSpecifying HW counters on `%s' (cpuver=%d):\n\n"), cpuname, cpuver);
  4632. fprintf (f_usage, GTXT (" -h {auto|lo|on|hi}\n"));
  4633. fprintf (f_usage, GTXT ("\tturn on default set of HW counters at the specified rate\n"));
  4634. if (hwc_maxregs == 1)
  4635. {
  4636. fprintf (f_usage, GTXT (" -h <ctr_def>\n"));
  4637. fprintf (f_usage, GTXT ("\tspecify HW counter profiling for one HW counter only\n"));
  4638. }
  4639. else
  4640. {
  4641. fprintf (f_usage, GTXT (" -h <ctr_def> [-h <ctr_def>]...\n"));
  4642. fprintf (f_usage, GTXT (" -h <ctr_def>[,<ctr_def>]...\n"));
  4643. fprintf (f_usage, GTXT ("\tspecify HW counter profiling for up to %u HW counters\n"), hwc_maxregs);
  4644. }
  4645. fprintf (f_usage, NTXT ("\n"));
  4646. }
  4647. else
  4648. {
  4649. fprintf (f_usage, GTXT ("\nSpecifying HW counters on `%s' (cpuver=%d)\n\n"), cpuname, cpuver);
  4650. if (hwc_maxregs == 1)
  4651. fprintf (f_usage, GTXT (" Hardware counter profiling is supported for only one counter.\n"));
  4652. else
  4653. fprintf (f_usage, GTXT (" Hardware counter profiling is supported for up to %u HW counters.\n"), hwc_maxregs);
  4654. }
  4655. }
  4656. else
  4657. {
  4658. if (!IS_KERNEL (forKernel))
  4659. { // EUGENE I don't see why we don't also use this for er_kernel
  4660. char buf[1024];
  4661. *buf = 0;
  4662. char *pch = hwcfuncs_errmsg_get (buf, sizeof (buf), 0);
  4663. if (*pch)
  4664. fprintf (f_usage, GTXT ("HW counter profiling is not supported on this system: %s%s"),
  4665. pch, pch[strlen (pch) - 1] == '\n' ? "" : "\n");
  4666. else
  4667. fprintf (f_usage, GTXT ("HW counter profiling is not supported on this system\n"));
  4668. }
  4669. return;
  4670. }
  4671. /* At this point, we know we have counters */
  4672. char**hwc_attrs = hwc_get_attrs (forKernel);
  4673. int has_attrs = (hwc_attrs && hwc_attrs[0]);
  4674. if (show_syntax)
  4675. {
  4676. const char *reg_s = show_regs ? "[/<reg#>]" : "";
  4677. const char *attr_s = has_attrs ? "[[~<attr>=<val>]...]" : "";
  4678. fprintf (f_usage, GTXT (" <ctr_def> == <ctr>%s%s,[<rate>]\n"), attr_s, reg_s);
  4679. if (dataspace_msg)
  4680. fprintf (f_usage, NTXT ("%s"), dataspace_msg);
  4681. fprintf (f_usage, GTXT (" <ctr>\n"));
  4682. fprintf (f_usage, GTXT (" counter name, "));
  4683. }
  4684. else
  4685. fprintf (f_usage, GTXT (" Counter name "));
  4686. fprintf (f_usage, GTXT ("must be selected from the available counters\n"
  4687. " listed below. On most systems, if a counter is not listed\n"
  4688. " below, it may still be specified by its numeric value.\n"));
  4689. if (cpcx_has_precise[forKernel])
  4690. {
  4691. if (!forKernel)
  4692. fprintf (f_usage, GTXT (" Counters labeled as 'memoryspace' in the list below will\n"
  4693. " collect memoryspace data by default.\n"));
  4694. }
  4695. fprintf (f_usage, GTXT ("\n"));
  4696. if (has_attrs)
  4697. {
  4698. if (show_syntax)
  4699. {
  4700. fprintf (f_usage, GTXT (" ~<attr>=<val>\n"));
  4701. fprintf (f_usage, GTXT (" optional attribute where <val> can be in decimal or hex\n"
  4702. " format, and <attr> can be one of: \n"));
  4703. }
  4704. else
  4705. fprintf (f_usage, GTXT (" Optional attribute where <val> can be in decimal or hex\n"
  4706. " format, and <attr> can be one of: \n"));
  4707. for (char **pattr = hwc_attrs; *pattr; pattr++)
  4708. fprintf (f_usage, NTXT (" `%s'\n"), *pattr);
  4709. if (show_syntax)
  4710. fprintf (f_usage, GTXT (" Multiple attributes may be specified, and each must be preceded by a ~.\n\n"));
  4711. else
  4712. fprintf (f_usage, GTXT (" Multiple attributes may be specified.\n\n"));
  4713. if (IS_KERNEL (forKernel))
  4714. fprintf (f_usage, GTXT (" Other attributes may be supported by the chip, but are not supported by DTrace and will be ignored by er_kernel.\n\n"));
  4715. }
  4716. if (show_syntax)
  4717. {
  4718. if (show_regs)
  4719. fprintf (f_usage, GTXT (" /<reg#>\n"
  4720. " forces use of a specific hardware register. (Solaris only)\n"
  4721. " If not specified, %s will attempt to place the counter into the first\n"
  4722. " available register and as a result may be unable to place\n"
  4723. " subsequent counters due to register conflicts.\n"
  4724. " The / in front of the register number is required if a register is specified.\n\n"),
  4725. cmd);
  4726. fprintf (f_usage, GTXT (" <rate> == {auto|lo|on|hi}\n"));
  4727. fprintf (f_usage, GTXT (" `auto' (default) match the rate used by clock profiling.\n"));
  4728. fprintf (f_usage, GTXT (" If clock profiling is disabled, use `on'.\n"));
  4729. fprintf (f_usage, GTXT (" `lo' per-thread maximum rate of ~10 samples/second\n"));
  4730. fprintf (f_usage, GTXT (" `on' per-thread maximum rate of ~100 samples/second\n"));
  4731. fprintf (f_usage, GTXT (" `hi' per-thread maximum rate of ~1000 samples/second\n\n"));
  4732. fprintf (f_usage, GTXT (" <rate> == <interval>\n"));
  4733. fprintf (f_usage, GTXT (" event interval; see collect (1) for details\n\n"));
  4734. fprintf (f_usage, GTXT (" A comma ',' followed immediately by white space may be omitted.\n\n"));
  4735. }
  4736. /* default counters */
  4737. fprintf (f_usage, GTXT ("Default set of HW counters:\n\n"));
  4738. char * defctrs = hwc_get_default_cntrs2 (forKernel, 1);
  4739. if (defctrs == NULL)
  4740. fprintf (f_usage, GTXT (" No default HW counter set defined for this system.\n"));
  4741. else if (strlen (defctrs) == 0)
  4742. {
  4743. char *s = hwc_get_orig_default_cntrs (forKernel);
  4744. fprintf (f_usage, GTXT (" The default HW counter set (%s) defined for %s cannot be loaded on this system.\n"),
  4745. s, cpuname);
  4746. free (s);
  4747. free (defctrs);
  4748. }
  4749. else
  4750. {
  4751. char *defctrs2 = hwc_get_default_cntrs2 (forKernel, 2);
  4752. fprintf (f_usage, GTXT (" -h %s\n"), defctrs);
  4753. free (defctrs2);
  4754. free (defctrs);
  4755. }
  4756. /* long listings */
  4757. char tmp[1024];
  4758. if (has_std_ctrs)
  4759. {
  4760. fprintf (f_usage, GTXT ("\nAliases for most useful HW counters:\n\n"));
  4761. format_columns (tmp, 1024, "alias", "raw name", "type ", "units", "regs", "description");
  4762. fprintf (f_usage, NTXT (" %s\n\n"), tmp);
  4763. for (Hwcentry **pctr = std_ctrs; *pctr; pctr++)
  4764. {
  4765. Hwcentry *ctr = *pctr;
  4766. hwc_hwcentry_string_internal (tmp, sizeof (tmp), ctr, 0);
  4767. fprintf (f_usage, NTXT (" %s\n"), tmp);
  4768. }
  4769. }
  4770. if (has_raw_ctrs)
  4771. {
  4772. fprintf (f_usage, GTXT ("\nRaw HW counters:\n\n"));
  4773. hwc_usage_raw_overview_sparc (f_usage, cpuver);
  4774. format_columns (tmp, 1024, "name", NULL, "type ", "units", "regs", "description");
  4775. fprintf (f_usage, NTXT (" %s\n\n"), tmp);
  4776. for (Hwcentry **pctr = raw_ctrs; *pctr; pctr++)
  4777. {
  4778. Hwcentry *ctr = *pctr;
  4779. hwc_hwcentry_string_internal (tmp, sizeof (tmp), ctr, show_short_desc);
  4780. fprintf (f_usage, NTXT (" %s\n"), tmp);
  4781. }
  4782. }
  4783. /* documentation notice */
  4784. hwc_get_docref (tmp, 1024);
  4785. if (strlen (tmp))
  4786. fprintf (f_usage, NTXT ("\n%s\n"), tmp);
  4787. }
  4788. /* Print a description of "-h" usage, largely common to collect and er_kernel. */
  4789. void
  4790. hwc_usage (int forKernel, const char *cmd, const char *dataspace_msg)
  4791. {
  4792. hwc_usage_internal (forKernel, stdout, cmd, dataspace_msg, 1, 0);
  4793. }
  4794. void
  4795. hwc_usage_f (int forKernel, FILE *f, const char *cmd, const char *dataspace_msg, int show_syntax, int show_short_desc)
  4796. {
  4797. hwc_usage_internal (forKernel, f, cmd, dataspace_msg, show_syntax, show_short_desc);
  4798. }
  4799. /*---------------------------------------------------------------------------*/
  4800. /* init functions */
  4801. static char* supported_pebs_counters[] = {
  4802. "mem_inst_retired.latency_above_threshold",
  4803. "mem_trans_retired.load_latency",
  4804. "mem_trans_retired.precise_store",
  4805. NULL
  4806. };
  4807. /* callback, (see setup_cpc()) called for each valid regno/name combo */
  4808. /* builds rawlist,, creates and updates reg_list[] arrays in stdlist table */
  4809. static void
  4810. hwc_cb (uint_t cpc_regno, const char *name)
  4811. {
  4812. regno_t regno = cpc_regno; /* convert type */
  4813. list_add (&unfiltered_raw, regno, name);
  4814. }
  4815. /* input:
  4816. * forKernel: 1 - generate lists for er_kernel, 0 - generate lists for collect
  4817. *
  4818. * raw_orig: HWCs as generated by hwc_cb()
  4819. * output:
  4820. * pstd_out[], praw_out[]: malloc'd array of pointers to malloc'd hwcentry, or NULL
  4821. */
  4822. static void
  4823. hwc_process_raw_ctrs (int forKernel, Hwcentry ***pstd_out,
  4824. Hwcentry ***praw_out, Hwcentry ***phidden_out,
  4825. Hwcentry**static_tables, Hwcentry **raw_unfiltered_in)
  4826. {
  4827. // set up output buffers
  4828. ptr_list s_outbufs[3];
  4829. ptr_list *std_out = &s_outbufs[0];
  4830. ptr_list_init (std_out);
  4831. ptr_list *raw_out = &s_outbufs[1];
  4832. ptr_list_init (raw_out);
  4833. ptr_list *hidden_out = &s_outbufs[2];
  4834. ptr_list_init (hidden_out);
  4835. #define NUM_TABLES 3
  4836. ptr_list table_copy[NUM_TABLES]; // copy of data from static tables. [0]std, [1]generic, and [2]hidden
  4837. for (int tt = 0; tt < NUM_TABLES; tt++)
  4838. ptr_list_init (&table_copy[tt]);
  4839. // copy records from std [0] and generic [1] static input tables into table_copy[0],[1],or[2]
  4840. for (int tt = 0; tt < 2; tt++)
  4841. for (Hwcentry *pctr = static_tables[tt]; pctr && pctr->name; pctr++)
  4842. if (is_hidden_alias (pctr))
  4843. list_append_shallow_copy (&table_copy[2], pctr); // hidden list
  4844. else
  4845. list_append_shallow_copy (&table_copy[tt], pctr);
  4846. // copy raw_unfiltered_in to raw_out
  4847. for (int ii = 0; raw_unfiltered_in && raw_unfiltered_in[ii]; ii++)
  4848. {
  4849. Hwcentry *pctr = raw_unfiltered_in[ii];
  4850. // filter out raw counters that don't work correctly
  4851. #ifdef WORKAROUND_6231196_NIAGARA1_NO_CTR_0
  4852. if (cpcx_cpuver == CPC_ULTRA_T1)
  4853. if (!regno_is_valid (pctr, 1))
  4854. continue; /* Niagara can not profile on register zero; skip this */
  4855. #endif
  4856. // remove specific PEBs counters when back end doesn't support sampling
  4857. const char *name = pctr->name;
  4858. if ((cpcx_support_bitmask & HWCFUNCS_SUPPORT_PEBS_SAMPLING) == 0 || forKernel)
  4859. {
  4860. int skip = 0;
  4861. for (int ii = 0; supported_pebs_counters[ii]; ii++)
  4862. if (strcmp (supported_pebs_counters[ii], name) == 0)
  4863. {
  4864. skip = 1;
  4865. break;
  4866. }
  4867. if (skip)
  4868. continue;
  4869. }
  4870. Hwcentry *pnew = list_append_shallow_copy (raw_out, pctr);
  4871. #ifdef WORKAROUND_6231196_NIAGARA1_NO_CTR_0
  4872. if (cpcx_cpuver == CPC_ULTRA_T1)
  4873. {
  4874. free (pnew->reg_list);
  4875. pnew->reg_list = NULL;
  4876. regno_add (pnew, 1); // only allow register 1
  4877. }
  4878. #endif
  4879. } // raw_unfiltered_in
  4880. // Scan raw counters to populate Hwcentry fields from matching static_tables entries
  4881. // Also populate reg_list for aliases found in table_copy[]
  4882. for (int uu = 0; uu < raw_out->sz; uu++)
  4883. {
  4884. Hwcentry *praw = (Hwcentry*) raw_out->array[uu];
  4885. Hwcentry *pstd = NULL; // set if non-alias entry from std table matches
  4886. char *name = praw->name;
  4887. /* in the standard counter and generic lists,
  4888. update reg_list for all matching items */
  4889. for (int tt = 0; tt < NUM_TABLES; tt++)
  4890. { // std, generic, and hidden
  4891. if (table_copy[tt].sz == 0)
  4892. continue;
  4893. Hwcentry **array = (Hwcentry**) table_copy[tt].array;
  4894. for (int jj = 0; array[jj]; jj++)
  4895. { // all table counters
  4896. Hwcentry *pctr = array[jj];
  4897. char *pname;
  4898. if (pctr->int_name)
  4899. pname = pctr->int_name;
  4900. else
  4901. pname = pctr->name;
  4902. if (!is_same (name, pname, '~'))
  4903. continue;
  4904. /* truncated pname matches <name>... */
  4905. // check to see if table entry applies only to specific register
  4906. int specific_reg_num_only = 0;
  4907. if (pctr->reg_num != REGNO_ANY)
  4908. {
  4909. // table entry applies only to specific register
  4910. if (!regno_is_valid (praw, pctr->reg_num))
  4911. continue;
  4912. specific_reg_num_only = 1;
  4913. }
  4914. // Match!
  4915. // Update cpu_table_copy's supported registers
  4916. if (specific_reg_num_only)
  4917. regno_add (pctr, pctr->reg_num);
  4918. else
  4919. pctr->reg_list = praw->reg_list;
  4920. if (!is_visible_alias (pctr) && !is_hidden_alias (pctr))
  4921. {
  4922. // Note: we could expand criteria to also allow aliases to set default rates for raw HWCs
  4923. /* This is an 'internal' raw counter */
  4924. if (!pstd)
  4925. pstd = pctr; /* use info as a template when adding to raw list */
  4926. else
  4927. hwcentry_print (DBG_LT0, "hwctable: hwc_cb: Warning: "
  4928. "counter %s appears in table more than once: ",
  4929. pstd);
  4930. }
  4931. }/* for table rows */
  4932. }/* for std and generic tables */
  4933. if (pstd)
  4934. {
  4935. /* the main table had an entry that matched <name> exactly */
  4936. /* Apply the main table entry as a template */
  4937. *praw = *pstd;
  4938. }
  4939. }/* for (raw_out) */
  4940. // update std_out and hidden_out
  4941. for (int tt = 0; tt < NUM_TABLES; tt++)
  4942. {
  4943. if (tt == 1 /*skip std_raw*/ || table_copy[tt].sz == 0)
  4944. continue;
  4945. Hwcentry *pctr;
  4946. for (int ii = 0; (pctr = table_copy[tt].array[ii]); ii++)
  4947. {
  4948. // prune unsupported rows from std table
  4949. if (!is_visible_alias (pctr) && !is_hidden_alias (pctr))
  4950. continue; // only aliases
  4951. if (REG_LIST_IS_EMPTY (pctr->reg_list))
  4952. {
  4953. if (is_numeric_alias (pctr))
  4954. {
  4955. #if 1 //22844570 DTrace cpc provider does not accept numeric counter names
  4956. if (forKernel)
  4957. continue;
  4958. #endif
  4959. regno_add (pctr, REGNO_ANY); // hwcs specified by number allowed on any register
  4960. }
  4961. else
  4962. continue;
  4963. }
  4964. ptr_list *dest = (tt == 0) ? std_out : hidden_out;
  4965. Hwcentry *isInList;
  4966. if (pctr->short_desc == NULL)
  4967. {
  4968. isInList = ptrarray_find_by_name ((Hwcentry**) raw_out->array, pctr->int_name);
  4969. if (isInList)
  4970. pctr->short_desc = isInList->short_desc; // copy the raw counter's detailed description
  4971. }
  4972. isInList = ptrarray_find_by_name ((Hwcentry**) dest->array, pctr->name);
  4973. if (isInList)
  4974. hwcentry_print (DBG_LT0, "hwctable: hwc_cb: Warning: "
  4975. "counter %s appears in alias list more than once: ",
  4976. pctr);
  4977. else
  4978. list_append_shallow_copy (dest, pctr);
  4979. }
  4980. }
  4981. for (int tt = 0; tt < NUM_TABLES; tt++)
  4982. ptr_list_free (&table_copy[tt]);
  4983. if (forKernel)
  4984. {
  4985. // for er_kernel, use baseline value of PRELOAD_DEF_ERKERNEL instead of PRELOAD_DEF
  4986. for (int tt = 0; tt < 3; tt++)
  4987. { // std_out-0, raw_out-1, hidden_out-2
  4988. Hwcentry** hwcs = (Hwcentry**) (s_outbufs[tt].array);
  4989. for (int ii = 0; hwcs && hwcs[ii]; ii++)
  4990. {
  4991. Hwcentry *hwc = hwcs[ii];
  4992. if (hwc->val == PRELOAD_DEF)
  4993. hwc->val = PRELOAD_DEF_ERKERNEL;
  4994. }
  4995. }
  4996. }
  4997. *pstd_out = (Hwcentry**) std_out->array;
  4998. *praw_out = (Hwcentry**) raw_out->array;
  4999. *phidden_out = (Hwcentry**) hidden_out->array;
  5000. }
  5001. /* callback, (see setup_cpc()) called for each valid attribute */
  5002. /* builds attrlist */
  5003. static void
  5004. attrs_cb (const char *attr)
  5005. {
  5006. Tprintf (DBG_LT3, "hwctable: attrs_cb(): %s\n", attr);
  5007. if (strcmp (attr, "picnum") == 0)
  5008. return; /* don't make this attribute available to users */
  5009. ptr_list_add (&unfiltered_attrs, (void*) strdup (attr));
  5010. }
  5011. /* returns true if attribute is valid for this platform */
  5012. static int
  5013. attr_is_valid (int forKernel, const char *attr)
  5014. {
  5015. setup_cpcx ();
  5016. if (!VALID_FOR_KERNEL (forKernel) || !cpcx_attrs[forKernel])
  5017. return 0;
  5018. for (int ii = 0; cpcx_attrs[forKernel][ii]; ii++)
  5019. if (strcmp (attr, cpcx_attrs[forKernel][ii]) == 0)
  5020. return 1;
  5021. return 0;
  5022. }