// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . util . indexing . diagnostic . dto Ċ Ċ import Ġcom . intellij . util . indexing . diagnostic .* Ċ import Ġjava . time . Duration Ċ Ċ fun ĠTime Nano . to Millis (): ĠTime Millis Ġ= Ġthis Ġ/ Ġ 1 _ 0 0 0 _ 0 0 0 Ċ Ċ // ĠInt Ġvalue Ġthat Ġis Ġgreater Ġthan Ġzero . Ċ // ĠCan Ġbe Ġused Ġto Ġskip Ġint Ġvalue Ġfrom ĠJSON Ġif Ġit Ġis Ġequal Ġto Ġ 0 Ġ( to Ġnot Ġpoll ute Ġthe ĠJSON Ġreport ). Ċ type alias ĠPositive Int Ġ= ĠInt ? Ċ Ċ fun ĠSc anning Statistics . toJson Statistics (): ĠJson Sc anning Statistics Ġ{ ĊĠ Ġval Ġjson Sc anned Files Ġ= Ġif Ġ( Index Diagnostic Dump er . should Dump Paths Of Indexed Files ) Ġ{ ĊĠĠĠ Ġscanned Files . map Ġ{ Ġit . toJson () Ġ} ĊĠ Ġ} ĊĠ Ġelse Ġ{ ĊĠĠĠ Ġnull ĊĠ Ġ} ĊĊĠ Ġreturn ĠJson Sc anning Statistics ( ĊĠĠĠ Ġprovider Name Ġ= Ġfile SetName , ĊĠĠĠ ĠnumberOf Sc anned Files Ġ= ĠnumberOf Sc anned Files , ĊĠĠĠ ĠnumberOf Files For Indexing Ġ= ĠnumberOf Files For Indexing , ĊĠĠĠ ĠnumberOf Skipped Files Ġ= ĠnumberOf Skipped Files , ĊĠĠĠ ĠnumberOf Files Fully Indexed By Infrastructure Extensions Ġ= ĠnumberOf Files Fully Indexed By Infrastructure Extension , ĊĠĠĠ Ġscanning Time Ġ= ĠJson Duration ( sc anning Time ), ĊĠĠĠ Ġtime Processing Up ToDate Files Ġ= ĠJson Duration ( time Processing Up ToDate Files ), ĊĠĠĠ Ġtime Updating Content Less Indexes Ġ= ĠJson Duration ( time Updating Content Less Indexes ), ĊĠĠĠ Ġtime Indexing Without Content Ġ= ĠJson Duration ( time Indexing Without Content ), ĊĠĠĠ Ġscanned Files Ġ= Ġjson Sc anned Files ĊĠ Ġ) Ċ } Ċ Ċ fun ĠSc anning Statistics . Sc anned File . toJson (): ĠJson Sc anning Statistics . Json Sc anned File Ġ= ĊĠ ĠJson Sc anning Statistics . Json Sc anned File ( ĊĠĠĠ Ġpath Ġ= Ġportable FilePath , ĊĠĠĠ Ġis Up ToDate Ġ= Ġis Up ToDate , ĊĠĠĠ Ġwas Fully Indexed By Infrastructure Extension Ġ= Ġwas Fully Indexed By Infrastructure Extension ĊĠ Ġ) Ċ Ċ @ Suppress (" D uplicated Code ") Ċ fun ĠIndex ing Job Statistics . toJson Statistics (): ĠJson File Provider Index Statistics Ġ{ ĊĠ Ġval Ġjson Indexed Files Ġ= Ġif Ġ( Index Diagnostic Dump er . should Dump Paths Of Indexed Files ) Ġ{ ĊĠĠĠ Ġindexed Files . map Ġ{ Ġit . toJson () Ġ} ĊĠ Ġ} ĊĠ Ġelse Ġ{ ĊĠĠĠ Ġnull ĊĠ Ġ} ĊĊĠ Ġreturn ĠJson File Provider Index Statistics ( ĊĠĠĠ Ġprovider Name Ġ= Ġfile SetName , ĊĠĠĠ Ġtotal NumberOf Indexed Files Ġ= ĠnumberOf Indexed Files , ĊĠĠĠ Ġtotal NumberOf Files Fully Indexed By Extensions Ġ= ĠnumberOf Files Fully Indexed By Extensions , ĊĠĠĠ Ġtotal Indexing Time Ġ= ĠJson Duration ( indexing Visible Time ), ĊĠĠĠ Ġcontent Loading Time Ġ= ĠJson Duration ( content Loading Visible Time ), ĊĠĠĠ ĠnumberOf Too Large For Indexing Files Ġ= ĠnumberOf Too Large For Indexing Files , ĊĠĠĠ Ġslow Indexed Files Ġ= Ġslow Indexed Files . big gest Elements . map Ġ{ Ġit . toJson () Ġ}, ĊĠĠĠ Ġindexed Files Ġ= Ġjson Indexed Files ĊĠ Ġ) Ċ } Ċ Ċ fun ĠS low Indexed File . toJson () Ġ= ĠJson File Provider Index Statistics . Json Slow Indexed File ( ĊĠ ĠfileName Ġ= ĠfileName , ĊĠ Ġprocessing Time Ġ= ĠJson Duration ( processing Time ), ĊĠ Ġindexing Time Ġ= ĠJson Duration ( indexing Time ), ĊĠ Ġcontent Loading Time Ġ= ĠJson Duration ( content Loading Time ) Ċ ) Ċ Ċ fun ĠIndex ing Job Statistics . Indexed File . toJson () Ġ= ĠJson File Provider Index Statistics . Json Indexed File ( ĊĠ Ġpath Ġ= Ġportable FilePath , ĊĠ Ġwas Fully Indexed By Extensions Ġ= Ġwas Fully Indexed By Extensions Ċ ) Ċ Ċ fun ĠProject Indexing History . Indexing Times . toJson () Ġ= ĊĠ ĠJson Project Indexing History Times ( ĊĠĠĠ Ġindexing Reason Ġ= Ġindexing Reason , ĊĠĠĠ Ġtotal Updating Time Ġ= ĠJson Duration ( total Updating Time ), ĊĠĠĠ Ġindexing Time Ġ= ĠJson Duration ( indexing Duration . to Nan os ()), ĊĠĠĠ Ġcontent Loading Time Ġ= ĠJson Duration ( content Loading Duration . to Nan os ()), ĊĠĠĠ Ġscan Files Time Ġ= ĠJson Duration ( scan Files Duration . to Nan os ()), ĊĠĠĠ Ġpush Properties Time Ġ= ĠJson Duration ( push Properties Duration . to Nan os ()), ĊĠĠĠ Ġindex Extensions Time Ġ= ĠJson Duration ( index Extensions Duration . to Nan os ()), ĊĠĠĠ Ġupdating Start Ġ= ĠJson DateTime ( updating Start ), ĊĠĠĠ Ġupdating End Ġ= ĠJson DateTime ( updating End ), ĊĠĠĠ Ġtotal Sus pended Time Ġ= ĠJson Duration ( sus pended Duration . to Nan os ()), ĊĠĠĠ Ġwas Inter rupted Ġ= Ġwas Inter rupted ĊĠ Ġ) Ċ Ċ private Ġfun Ġcalculate Percent ages ( part : ĠLong , Ġtotal : ĠLong ): ĠJson Percent ages Ġ= ĠJson Percent ages ( part , Ġtotal ) Ċ Ċ fun ĠProject Indexing History . toJson (): ĠJson Project Indexing History Ġ{ ĊĠ Ġtimes . content Loading Duration Ġ= ĠDuration . of Nan os ( provider Statistics . sum Of Ġ{ Ġit . content Loading Time . nano Ġ}) ĊĠ Ġreturn ĠJson Project Indexing History ( ĊĠĠĠ ĠprojectName Ġ= Ġproject . name , ĊĠĠĠ Ġtimes Ġ= Ġtimes . toJson (), ĊĠĠĠ Ġfile Count Ġ= ĠgetFile Count (), ĊĠĠĠ Ġtotal Stats Per FileType Ġ= Ġaggregate Stats Per FileType (). sorted By Descending Ġ{ Ġit . part Of Total Processing Time . double Percent ages Ġ}, ĊĠĠĠ Ġtotal Stats Per Indexer Ġ= Ġaggregate Stats Per Indexer (). sorted By Descending Ġ{ Ġit . part Of Total Indexing Time . double Percent ages Ġ}, ĊĠĠĠ Ġscanning Statistics Ġ= Ġscanning Statistics . sorted By Descending Ġ{ Ġit . sc anning Time . nano Ġ}, ĊĠĠĠ Ġfile Provider Statistics Ġ= Ġprovider Statistics . sorted By Descending Ġ{ Ġit . total Indexing Time . nano Ġ} ĊĠ Ġ) Ċ } Ċ Ċ private Ġfun ĠProject Indexing History . getFile Count () Ġ= ĠJson Project Indexing File Count ( ĊĠ ĠnumberOf File Providers Ġ= Ġscanning Statistics . size , ĊĠ ĠnumberOf Sc anned Files Ġ= Ġscanning Statistics . sum By Ġ{ Ġit . numberOf Sc anned Files Ġ}, ĊĠ ĠnumberOf Files Indexed By Infrastructure Extensions During Scan Ġ= Ġscanning Statistics . sum Of Ġ{ Ġit . numberOf Files Fully Indexed By Infrastructure Extensions Ġ}, ĊĠ ĠnumberOf Files Scheduled For Indexing After Scan Ġ= Ġscanning Statistics . sum By Ġ{ Ġit . numberOf Files For Indexing Ġ}, ĊĠ ĠnumberOf Files Indexed By Infrastructure Extensions During Indexing Stage Ġ= Ġprovider Statistics . sum Of Ġ{ Ġit . total NumberOf Files Fully Indexed By Extensions Ġ}, ĊĠ ĠnumberOf Files Indexed With Loading Content Ġ= Ġprovider Statistics . sum Of Ġ{ Ġit . total NumberOf Indexed Files Ġ} Ċ ) Ċ Ċ private Ġfun ĠProject Indexing History . aggregate Stats Per FileType (): ĠList < Json Project Indexing History . Json Stats Per FileType > Ġ{ ĊĠ Ġval Ġtotal Processing Time Ġ= Ġtotal Stats Per FileType . values . sum Of Ġ{ Ġit . total Processing TimeIn All Threads Ġ} ĊĠ Ġval ĠfileType To Processing Time Part Ġ= Ġtotal Stats Per FileType . map Values Ġ{ ĊĠĠĠ Ġcalculate Percent ages ( it . value . total Processing TimeIn All Threads , Ġtotal Processing Time ) ĊĠ Ġ} ĊĊĠ Ġ@ Suppress (" D uplicated Code ") ĊĠ Ġval Ġtotal Content Loading Time Ġ= Ġtotal Stats Per FileType . values . sum Of Ġ{ Ġit . total Content Loading TimeIn All Threads Ġ} ĊĠ Ġval ĠfileType To Content Loading Time Part Ġ= Ġtotal Stats Per FileType . map Values Ġ{ ĊĠĠĠ Ġcalculate Percent ages ( it . value . total Content Loading TimeIn All Threads , Ġtotal Content Loading Time ) ĊĠ Ġ} ĊĊĠ Ġval ĠfileType To Processing Speed Ġ= Ġtotal Stats Per FileType . map Values Ġ{ ĊĠĠĠ ĠJson Processing Speed ( it . value . total Bytes , Ġit . value . total Processing TimeIn All Threads ) ĊĠ Ġ} ĊĊĠ Ġreturn Ġtotal Stats Per FileType . map Ġ{ Ġ( fileType , Ġstats ) Ġ-> ĊĠĠĠ Ġval Ġjson Big gest FileType Contribut ors Ġ= Ġstats . big gest FileType Contribut ors . big gest Elements . map Ġ{ ĊĠĠĠĠĠ ĠJson Project Indexing History . Json Stats Per FileType . Json Big gest FileType Contributor ( ĊĠĠĠĠĠĠĠ Ġit . provider Name , ĊĠĠĠĠĠĠĠ Ġit . numberOf Files , ĊĠĠĠĠĠĠĠ ĠJson FileSize ( it . total Bytes ), ĊĠĠĠĠĠĠĠ Ġcalculate Percent ages ( it . processing TimeIn All Threads , Ġstats . total Processing TimeIn All Threads ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠĠĠ ĠJson Project Indexing History . Json Stats Per FileType ( ĊĠĠĠĠĠ ĠfileType , ĊĠĠĠĠĠ ĠfileType To Processing Time Part . getValue ( fileType ), ĊĠĠĠĠĠ ĠfileType To Content Loading Time Part . getValue ( fileType ), ĊĠĠĠĠĠ Ġstats . total NumberOf Files , ĊĠĠĠĠĠ ĠJson FileSize ( stats . total Bytes ), ĊĠĠĠĠĠ ĠfileType To Processing Speed . getValue ( fileType ), ĊĠĠĠĠĠ Ġjson Big gest FileType Contribut ors . sorted By Descending Ġ{ Ġit . part Of Total Processing Time Of This FileType . double Percent ages Ġ} ĊĠĠĠ Ġ) ĊĠ Ġ} Ċ } Ċ Ċ private Ġfun ĠProject Indexing History . aggregate Stats Per Indexer (): ĠList < Json Project Indexing History . Json Stats Per Indexer > Ġ{ ĊĠ Ġval Ġtotal Indexing Time Ġ= Ġtotal Stats Per Indexer . values . sum Of Ġ{ Ġit . total Indexing TimeIn All Threads Ġ} ĊĠ Ġval Ġindex Id To Indexing Time Part Ġ= Ġtotal Stats Per Indexer . map Values Ġ{ ĊĠĠĠ Ġcalculate Percent ages ( it . value . total Indexing TimeIn All Threads , Ġtotal Indexing Time ) ĊĠ Ġ} ĊĊĠ Ġval Ġindex Id To Processing Speed Ġ= Ġtotal Stats Per Indexer . map Values Ġ{ ĊĠĠĠ ĠJson Processing Speed ( it . value . total Bytes , Ġit . value . total Indexing TimeIn All Threads ) ĊĠ Ġ} ĊĊĠ Ġreturn Ġtotal Stats Per Indexer . map Ġ{ Ġ( index Id , Ġstats ) Ġ-> ĊĠĠĠ ĠJson Project Indexing History . Json Stats Per Indexer ( ĊĠĠĠĠĠ Ġindex Id Ġ= Ġindex Id , ĊĠĠĠĠĠ Ġpart Of Total Indexing Time Ġ= Ġindex Id To Indexing Time Part . getValue ( index Id ), ĊĠĠĠĠĠ Ġtotal NumberOf Files Ġ= Ġstats . total NumberOf Files , ĊĠĠĠĠĠ Ġtotal NumberOf Files Indexed By Extensions Ġ= Ġstats . total NumberOf Files Indexed By Extensions , ĊĠĠĠĠĠ Ġtotal Files Size Ġ= ĠJson FileSize ( stats . total Bytes ), ĊĠĠĠĠĠ Ġindexing Speed Ġ= Ġindex Id To Processing Speed . getValue ( index Id ), ĊĠĠĠĠĠ Ġsnapshot Input Mapping Stats Ġ= ĠJson Project Indexing History . Json Stats Per Indexer . Json Snapshot Input Mapping Stats ( ĊĠĠĠĠĠĠĠ Ġtotal Requests Ġ= Ġstats . snapshot Input Mapping Stats . requests , ĊĠĠĠĠĠĠĠ Ġtotal Mis ses Ġ= Ġstats . snapshot Input Mapping Stats . mis ses , ĊĠĠĠĠĠĠĠ Ġtotal Hits Ġ= Ġstats . snapshot Input Mapping Stats . hits ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} Ċ }