1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

snake_case -> camelCase

This commit is contained in:
Rick Winfrey 2017-03-27 10:21:28 -07:00
parent e801ac3f07
commit 862c335213

View File

@ -25,11 +25,14 @@ newtype GitmonException = GitmonException String deriving (Show, Typeable)
instance Exception GitmonException
data ProcIO = ProcIO { read_bytes :: Integer
, write_bytes :: Integer } deriving (Show, Generic)
data ProcIO = ProcIO { readBytes :: Integer
, writeBytes :: Integer } deriving (Show, Generic)
instance FromJSON ProcIO
instance ToJSON ProcIO where
toJSON ProcIO{..} = object [ "read_bytes" .= readBytes, "write_bytes" .= writeBytes ]
data ProcessData = ProcessUpdateData { gitDir :: String
, program :: String
@ -111,10 +114,10 @@ reportGitmon' SocketFactory{..} program gitCommand =
where
-- | toNanoSecs converts TimeSpec to Integer, and we further convert this value to milliseconds (expected by Gitmon).
cpuTime = div (1 * 1000 * 1000) . toNanoSecs $ afterTime - beforeTime
beforeDiskReadBytes = either (const 0) (maybe 0 read_bytes) beforeProcIOContents
afterDiskReadBytes = either (const 0) (maybe 0 read_bytes) afterProcIOContents
beforeDiskWriteBytes = either (const 0) (maybe 0 write_bytes) beforeProcIOContents
afterDiskWriteBytes = either (const 0) (maybe 0 write_bytes) afterProcIOContents
beforeDiskReadBytes = either (const 0) (maybe 0 readBytes) beforeProcIOContents
afterDiskReadBytes = either (const 0) (maybe 0 readBytes) afterProcIOContents
beforeDiskWriteBytes = either (const 0) (maybe 0 writeBytes) beforeProcIOContents
afterDiskWriteBytes = either (const 0) (maybe 0 writeBytes) afterProcIOContents
diskReadBytes = afterDiskReadBytes - beforeDiskReadBytes
diskWriteBytes = afterDiskWriteBytes - beforeDiskWriteBytes
resultCode = 0
@ -176,5 +179,5 @@ clock :: Clock
clock = Realtime
processJSON :: GitmonCommand -> ProcessData -> ByteString
processJSON command processData = (toStrict . encode $ GitmonMsg command processData)
processJSON command processData = toStrict . encode $ GitmonMsg command processData