// Ġ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 . fasterxml . jackson . core . Json Generator Ċ import Ġcom . fasterxml . jackson . databind . Json Serializer Ċ import Ġcom . fasterxml . jackson . databind . Serializer Provider Ċ import Ġcom . fasterxml . jackson . databind . annotation . Json Serialize Ċ import Ġcom . intellij . openapi . util . text . StringUtil Ċ import Ġcom . intellij . util . indexing . diagnostic . Bytes Number Ċ import Ġcom . intellij . util . indexing . diagnostic . Time Nano Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ @ Json Serialize ( using Ġ= ĠJson Processing Speed . Companion :: class ) Ċ data Ġclass ĠJson Processing Speed ( val Ġtotal Bytes : ĠBytes Number , Ġval Ġtotal Time : ĠTime Nano ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ: ĠJsonSerializer < Json Processing Speed >() Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġserialize ( value : ĠJson Processing Speed , Ġgen : ĠJson Generator , Ġserializers : ĠSerializer Provider ?) Ġ{ ĊĠĠĠĠĠ Ġgen . writeString ( value . present able Speed ()) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġpresent able Speed (): ĠString Ġ{ ĊĠĠĠ Ġif Ġ( total Time Ġ== Ġ 0 L ) Ġ{ ĊĠĠĠĠĠ Ġreturn Ġ" 0 ĠB / s " ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġbytes PerSecond Ġ= Ġ( total Bytes . toDouble () Ġ* ĠTimeUnit . SECONDS . to Nan os ( 1 ). toDouble () Ġ/ Ġtotal Time ). to Long () ĊĠĠĠ Ġreturn ĠString Util . format FileSize ( bytes PerSecond ) Ġ+ Ġ"/ s " ĊĠ Ġ} Ċ }