<< File: WalnutStatsMonitor.mesa>> <> <> <<>> DIRECTORY DB, Rope, IO, Commander, CommandTool; WalnutStatsMonitor: CEDAR PROGRAM IMPORTS DB, Rope, IO, Commander, CommandTool = BEGIN INT: TYPE = LONG INTEGER; ROPE: TYPE = Rope.ROPE; CmdHandle: TYPE = Commander.Handle; ArgumentVector: TYPE = CommandTool.ArgumentVector; <<>> <<>> <<>> <<>> <<>> MonUser: Commander.CommandProc = { argV: ArgumentVector = CommandTool.Parse[cmd]; rel: DB.Relation; relshipSet: DB.RelshipSet; rship: DB.Relship; count: INT; opName: ROPE; msgSet1: ROPE; msgSet2: ROPE; msgCount: INT; msgSetCount: INT; transHandle: DB.TransactionHandle; schemaInvalid: BOOLEAN; userName: ROPE = argV[1]; serverFile: ROPE; IF Rope.Equal["AlisonLee",userName] OR Rope.Equal["Tempero",userName] THEN serverFile _ Rope.Cat[r1: "[ebbetts.alpine]<", r2: userName, r3: ".pa>Walnut.segment"] ELSE serverFile _ Rope.Cat[r1: "[luther.alpine]<", r2: userName, r3: ".pa>Walnut.segment"]; IO.PutF[cmd.out, "Stats for %g", IO.rope["userName"] ]; <> DB.Initialize[nCachePages: 100]; DB.DeclareSegment[filePath: serverFile, segment: $Walnut, readonly: TRUE, nPagesInitial: 3000, createIfNotFound: FALSE, nPagesPerExtent: 256]; [trans: transHandle, schemaInvalid: schemaInvalid] _ DB.OpenTransaction[segment: $Walnut]; <> IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "---------------------------- "]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "Basic Stats"]; IO.PutChar[cmd.out, IO.CR]; rel _ DB.LookupRelation[name: "VersionInfo" , segment: $Walnut]; IO.PutChar[cmd.out, IO.CR]; <> relshipSet _ DB.RelationSubset[r:rel,index:NIL,constraint:NIL]; rship _ DB.NextRelship[rs: relshipSet]; msgCount _ DB.V2I[DB.GetF[t: rship, field: 0]]; msgSetCount _ DB.V2I[DB.GetF[t: rship, field: 1]]; IO.PutF[cmd.out, "number of messages = %5g number of message sets = %5g", IO.int[msgCount], IO.int[msgSetCount]]; IO.PutChar[cmd.out, IO.CR]; <> IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "---------------------------- "]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "Size of Active And Deleted Message Sets"]; IO.PutChar[cmd.out, IO.CR]; { <> msgSetDomain: DB.Domain _ DB.LookupDomain[name: "MsgSet", segment: $Walnut]; activeEntity: DB.Entity _ DB.LookupEntity[d: msgSetDomain, name: "Active"]; deletedEntity: DB.Entity _ DB.LookupEntity[d: msgSetDomain, name: "Deleted"]; rel: DB.Relation _ DB.LookupRelation[name: "msBasicInfo", segment: $Walnut]; rship1: DB.Relship _ DB.LookupProperty[r: rel, e: activeEntity]; rship2: DB.Relship _ DB.LookupProperty[r: rel, e: deletedEntity]; delCount: INT _ DB.V2I[DB.GetF[t: rship, field: 0]]; actCount: INT _ DB.V2I[DB.GetF[t: rship, field: 0]]; IO.PutF[cmd.out, "%5g %5g", IO.int[delCount], IO.int[actCount]]; IO.PutChar[cmd.out, IO.CR]; }; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "---------------------------- "]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "No Message Set Operations"]; IO.PutChar[cmd.out, IO.CR]; rel _ DB.LookupRelation[name: "noMsgSetsOperRelation" , segment: $Walnut]; IO.PutChar[cmd.out, IO.CR]; <> relshipSet _ DB.RelationSubset[r:rel,index:NIL,constraint:NIL]; DO rship _ DB.NextRelship[rs: relshipSet]; IF rship = NIL THEN EXIT; count _ DB.V2I[DB.GetF[t: rship, field: 0]]; opName _ DB.V2S[DB.GetF[t: rship, field: 1]]; IO.PutF[cmd.out, "%10g %5g", IO.rope[opName], IO.int[count]]; IO.PutChar[cmd.out, IO.CR]; ENDLOOP; IO.PutChar[cmd.out, IO.CR]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "---------------------------- "]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "Single Message Set Operations"]; IO.PutChar[cmd.out, IO.CR]; rel _ DB.LookupRelation[name: "oneMsgSetsOperRelation" , segment: $Walnut]; <> relshipSet _ DB.RelationSubset[r:rel,index:NIL,constraint:NIL]; DO rship _ DB.NextRelship[rs: relshipSet]; IF rship = NIL THEN EXIT; count _ DB.V2I[DB.GetF[t: rship, field: 0]]; opName _ DB.V2S[DB.GetF[t: rship, field: 1]]; msgSet1 _ DB.V2S[DB.GetF[t: rship, field: 2]]; IO.PutF[cmd.out, "%10g %10g %5g", IO.rope[opName], IO.rope[msgSet1], IO.int[count]]; IO.PutChar[cmd.out, IO.CR]; ENDLOOP; IO.PutChar[cmd.out, IO.CR]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "---------------------------- "]; IO.PutChar[cmd.out, IO.CR]; IO.PutF[cmd.out, "Double Message Set Operations"]; IO.PutChar[cmd.out, IO.CR]; rel _ DB.LookupRelation[name: "twoMsgSetsOperRelation" , segment: $Walnut]; <> relshipSet _ DB.RelationSubset[r:rel,index:NIL,constraint:NIL]; DO rship _ DB.NextRelship[rs: relshipSet]; IF rship = NIL THEN EXIT; count _ DB.V2I[DB.GetF[t: rship, field: 0]]; opName _ DB.V2S[DB.GetF[t: rship, field: 1]]; msgSet1 _ DB.V2S[DB.GetF[t: rship, field: 2]]; msgSet2 _ DB.V2S[DB.GetF[t: rship, field: 3]]; IO.PutF[cmd.out, "%10g %10g %10g %5g", IO.rope[opName], IO.rope[msgSet1], IO.rope[msgSet1], IO.int[count]]; IO.PutChar[cmd.out, IO.CR]; ENDLOOP; DB.CloseTransaction[trans: transHandle]; }; <<>> Commander.Register["MonUser", MonUser, "Monitor stats for a single walnut user"]; <> << "monitor stats for all test participants"];>> <<>> <<>> END.