@@ -59,6 +59,7 @@ module Control.Distributed.Process.Internal.Types
5959 , RegisterReply(..)
6060 , ProcessInfo(..)
6161 , ProcessInfoNone(..)
62+ , NodeStats(..)
6263 -- * Node controller internal data types
6364 , NCMsg(..)
6465 , ProcessSignal(..)
@@ -522,6 +523,15 @@ data WhereIsReply = WhereIsReply String (Maybe ProcessId)
522523data RegisterReply = RegisterReply String Bool
523524 deriving (Show, Typeable)
524525
526+data NodeStats = NodeStats {
527+ nodeStatsNode :: NodeId
528+ , nodeStatsRegisteredNames :: Int
529+ , nodeStatsMonitors :: Int
530+ , nodeStatsLinks :: Int
531+ , nodeStatsProcesses :: Int
532+ }
533+ deriving (Show, Eq, Typeable)
534+
525535-- | Provide information about a running process
526536data ProcessInfo = ProcessInfo {
527537 infoNode :: NodeId
@@ -562,6 +572,7 @@ data ProcessSignal =
562572 | Exit !ProcessId !Message
563573 | GetInfo !ProcessId
564574 | SigShutdown
575+ | GetNodeStats !NodeId
565576 deriving Show
566577
567578--------------------------------------------------------------------------------
@@ -612,6 +623,7 @@ instance Binary ProcessSignal where
612623 put (LocalPortSend sid msg) = putWord8 12 >> put sid >> put (messageToPayload msg)
613624 put (GetInfo about) = putWord8 30 >> put about
614625 put (SigShutdown) = putWord8 31
626+ put (GetNodeStats nid) = putWord8 32 >> put nid
615627 get = do
616628 header <- getWord8
617629 case header of
@@ -630,6 +642,7 @@ instance Binary ProcessSignal where
630642 12 -> LocalPortSend <$> get <*> (payloadToMessage <$> get)
631643 30 -> GetInfo <$> get
632644 31 -> return SigShutdown
645+ 32 -> GetNodeStats <$> get
633646 _ -> fail "ProcessSignal.get: invalid"
634647
635648instance Binary DiedReason where
@@ -687,6 +700,14 @@ instance Binary ProcessInfo where
687700 >> put (infoMonitors pInfo)
688701 >> put (infoLinks pInfo)
689702
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)
710+
690711instance Binary ProcessInfoNone where
691712 get = ProcessInfoNone <$> get
692713 put (ProcessInfoNone r) = put r