@@ -59,6 +59,7 @@ module Control.Distributed.Process.Internal.Types
59 , RegisterReply(..)
59 , RegisterReply(..)
60 , ProcessInfo(..)
60 , ProcessInfo(..)
61 , ProcessInfoNone(..)
61 , ProcessInfoNone(..)
62 -- * Node controller internal data types
63 -- * Node controller internal data types
63 , NCMsg(..)
64 , NCMsg(..)
64 , ProcessSignal(..)
65 , ProcessSignal(..)
@@ -522,6 +523,15 @@ data WhereIsReply = WhereIsReply String (Maybe ProcessId)
522data RegisterReply = RegisterReply String Bool
523data RegisterReply = RegisterReply String Bool
523 deriving (Show, Typeable)
524 deriving (Show, Typeable)
526+data NodeStats = NodeStats {
527+ nodeStatsNode :: NodeId
528+ , nodeStatsRegisteredNames :: Int
529+ , nodeStatsMonitors :: Int
530+ , nodeStatsLinks :: Int
531+ , nodeStatsProcesses :: Int
533+ deriving (Show, Eq, Typeable)
525-- | Provide information about a running process
535-- | Provide information about a running process
526data ProcessInfo = ProcessInfo {
536data ProcessInfo = ProcessInfo {
527 infoNode :: NodeId
537 infoNode :: NodeId
@@ -562,6 +572,7 @@ data ProcessSignal =
562 | Exit !ProcessId !Message
572 | Exit !ProcessId !Message
563 | GetInfo !ProcessId
573 | GetInfo !ProcessId
564 | SigShutdown
574 | SigShutdown
575+ | GetNodeStats !NodeId
565 deriving Show
576 deriving Show
567--------------------------------------------------------------------------------
578--------------------------------------------------------------------------------
@@ -612,6 +623,7 @@ instance Binary ProcessSignal where
612 put (LocalPortSend sid msg) = putWord8 12 >> put sid >> put (messageToPayload msg)
623 put (LocalPortSend sid msg) = putWord8 12 >> put sid >> put (messageToPayload msg)
613 put (GetInfo about) = putWord8 30 >> put about
624 put (GetInfo about) = putWord8 30 >> put about
614 put (SigShutdown) = putWord8 31
625 put (SigShutdown) = putWord8 31
626+ put (GetNodeStats nid) = putWord8 32 >> put nid
616 header <- getWord8
628 header <- getWord8
617 case header of
629 case header of
@@ -630,6 +642,7 @@ instance Binary ProcessSignal where
630 12 -> LocalPortSend <$> get <*> (payloadToMessage <$> get)
642 12 -> LocalPortSend <$> get <*> (payloadToMessage <$> get)
631 30 -> GetInfo <$> get
643 30 -> GetInfo <$> get
632 31 -> return SigShutdown
644 31 -> return SigShutdown
645+ 32 -> GetNodeStats <$> get
633 _ -> fail "ProcessSignal.get: invalid"
646 _ -> fail "ProcessSignal.get: invalid"
635instance Binary DiedReason where
648instance Binary DiedReason where
@@ -687,6 +700,14 @@ instance Binary ProcessInfo where
687 >> put (infoMonitors pInfo)
700 >> put (infoMonitors pInfo)
688 >> put (infoLinks pInfo)
701 >> put (infoLinks pInfo)
703+instance Binary NodeStats where
704+ get = NodeStats <$> get <*> get <*> get <*> get <*> get
705+ put nStats = put (nodeStatsNode nStats)
706+ >> put (nodeStatsRegisteredNames nStats)
707+ >> put (nodeStatsMonitors nStats)
708+ >> put (nodeStatsLinks nStats)
709+ >> put (nodeStatsProcesses nStats)
690instance Binary ProcessInfoNone where
711instance Binary ProcessInfoNone where
691 get = ProcessInfoNone <$> get
712 get = ProcessInfoNone <$> get
692 put (ProcessInfoNone r) = put r
713 put (ProcessInfoNone r) = put r