// { // min_count: <number> // optional, defaults to 10 // } Json::Value RPCHandler::doGetCounts (Json::Value params, Resource::Charge& loadType, Application::ScopedLockType& masterLockHolder) { int minCount = 10; if (params.isMember ("min_count")) minCount = params["min_count"].asUInt (); CountedObjects::List objectCounts = CountedObjects::getInstance ().getCounts (minCount); Json::Value ret (Json::objectValue); BOOST_FOREACH (CountedObjects::Entry& it, objectCounts) { ret [it.first] = it.second; } int dbKB = getApp().getLedgerDB ()->getDB ()->getKBUsedAll (); if (dbKB > 0) ret["dbKBTotal"] = dbKB; dbKB = getApp().getLedgerDB ()->getDB ()->getKBUsedDB (); if (dbKB > 0) ret["dbKBLedger"] = dbKB; dbKB = getApp().getTxnDB ()->getDB ()->getKBUsedDB (); if (dbKB > 0) ret["dbKBTransaction"] = dbKB; { std::size_t c = getApp().getOPs().getLocalTxCount (); if (c > 0) ret["local_txs"] = static_cast<Json::UInt> (c); } ret["write_load"] = getApp().getNodeStore ().getWriteLoad (); ret["SLE_hit_rate"] = getApp().getSLECache ().getHitRate (); ret["node_hit_rate"] = getApp().getNodeStore ().getCacheHitRate (); ret["ledger_hit_rate"] = getApp().getLedgerMaster ().getCacheHitRate (); ret["AL_hit_rate"] = AcceptedLedger::getCacheHitRate (); ret["fullbelow_size"] = int(getApp().getFullBelowCache().size()); std::string uptime; int s = UptimeTimer::getInstance ().getElapsedSeconds (); textTime (uptime, s, "year", 365 * 24 * 60 * 60); textTime (uptime, s, "day", 24 * 60 * 60); textTime (uptime, s, "hour", 60 * 60); textTime (uptime, s, "minute", 60); textTime (uptime, s, "second", 1); ret["uptime"] = uptime; return ret; }
// { // min_count: <number> // optional, defaults to 10 // } Json::Value doGetCounts (RPC::Context& context) { int minCount = 10; if (context.params.isMember (jss::min_count)) minCount = context.params[jss::min_count].asUInt (); auto objectCounts = CountedObjects::getInstance ().getCounts (minCount); Json::Value ret (Json::objectValue); for (auto const& it : objectCounts) { ret [it.first] = it.second; } Application& app = getApp(); int dbKB = getKBUsedAll (app.getLedgerDB ().getSession ()); if (dbKB > 0) ret[jss::dbKBTotal] = dbKB; dbKB = getKBUsedDB (app.getLedgerDB ().getSession ()); if (dbKB > 0) ret[jss::dbKBLedger] = dbKB; dbKB = getKBUsedDB (app.getTxnDB ().getSession ()); if (dbKB > 0) ret[jss::dbKBTransaction] = dbKB; { std::size_t c = app.getOPs().getLocalTxCount (); if (c > 0) ret[jss::local_txs] = static_cast<Json::UInt> (c); } ret[jss::write_load] = app.getNodeStore ().getWriteLoad (); ret[jss::historical_perminute] = static_cast<int>( app.getInboundLedgers().fetchRate()); ret[jss::SLE_hit_rate] = app.getSLECache ().getHitRate (); ret[jss::node_hit_rate] = app.getNodeStore ().getCacheHitRate (); ret[jss::ledger_hit_rate] = app.getLedgerMaster ().getCacheHitRate (); ret[jss::AL_hit_rate] = AcceptedLedger::getCacheHitRate (); ret[jss::fullbelow_size] = static_cast<int>(app.family().fullbelow().size()); ret[jss::treenode_cache_size] = app.family().treecache().getCacheSize(); ret[jss::treenode_track_size] = app.family().treecache().getTrackSize(); std::string uptime; int s = UptimeTimer::getInstance ().getElapsedSeconds (); textTime (uptime, s, "year", 365 * 24 * 60 * 60); textTime (uptime, s, "day", 24 * 60 * 60); textTime (uptime, s, "hour", 60 * 60); textTime (uptime, s, "minute", 60); textTime (uptime, s, "second", 1); ret[jss::uptime] = uptime; ret[jss::node_writes] = app.getNodeStore().getStoreCount(); ret[jss::node_reads_total] = app.getNodeStore().getFetchTotalCount(); ret[jss::node_reads_hit] = app.getNodeStore().getFetchHitCount(); ret[jss::node_written_bytes] = app.getNodeStore().getStoreSize(); ret[jss::node_read_bytes] = app.getNodeStore().getFetchSize(); return ret; }
void CRemoteGraphForm::OnRefreshClick() { // let's load objects from ROT CComPtr<IRunningObjectTable> rot; HRESULT hr; graphs.RemoveAll(); list_graphs.DeleteAllItems(); sel_graph = RemoteGraph(); hr = GetRunningObjectTable(0, &rot); if (FAILED(hr)) return ; // scan through running objects CComPtr<IEnumMoniker> emon; CComPtr<IMoniker> moniker; CComPtr<IBindCtx> bindctx; ULONG f; hr = CreateBindCtx(0, &bindctx); if (FAILED(hr)) { return ; } CAtlRegExp<> regex; REParseError status = regex.Parse(_T("^\\!FilterGraph {[0-9A-F]+} pid {[0-9A-F]+}(; process\\: {.+?}, time\\: {[0-9]+\\-[0-9]+\\-[0-9]+})?"), FALSE); rot->EnumRunning(&emon); emon->Reset(); while (emon->Next(1, &moniker, &f) == NOERROR) { // is this a graph object ? LPOLESTR displayname; moniker->GetDisplayName(bindctx, NULL, &displayname); CString name(displayname); if (name.Find(_T("!FilterGraph")) == 0 && !GraphStudio::DisplayGraph::IsOwnRotGraph(name)) { RemoteGraph gr = {0}; CAtlREMatchContext<> mc; gr.name = name; gr.moniker = moniker; gr.pid = 0; gr.instance = 0; gr.processIsWOW64 = FALSE; if (regex.Match(name, &mc)) { const CAtlREMatchContext<>::RECHAR* szStart = 0; const CAtlREMatchContext<>::RECHAR* szEnd = 0; mc.GetMatch(0, &szStart, &szEnd); int nLength = (int) (szEnd - szStart); const CString textInstance(szStart, nLength); StrToInt64ExW(CStringW(L"0x") + textInstance, STIF_SUPPORT_HEX, &reinterpret_cast<LONGLONG&>(gr.instance)); mc.GetMatch(1, &szStart, &szEnd); nLength = (int) (szEnd - szStart); const CString textPID(szStart, nLength); CString nameSuffix(szEnd ? szEnd : _T("")); nameSuffix.Trim(); if (StrToIntExW(CStringW(L"0x") + textPID, STIF_SUPPORT_HEX, &reinterpret_cast<INT&>(gr.pid))) { CHandle process; process.Attach(OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, gr.pid)); if (process) { TCHAR pszPath[MAX_PATH] = { 0 }; if (GetModuleFileNameEx(process, NULL, pszPath, sizeof(pszPath))) { gr.processImagePath = pszPath; // Extract filename int fileNamePos = gr.processImagePath.FindFileName(); if (fileNamePos >= 0) gr.processImageFileName = CString(gr.processImagePath).Mid(fileNamePos); } else { // a 32Bit process can't list the modules of a 64Bit process, so try to get the processImageFileName from the ROT-Name (works only for FilterGraphSpy-Entries) mc.GetMatch(2, &szStart, &szEnd); nLength = (int) (szEnd - szStart); if (nLength > 0) { CString textFileName(szStart, nLength); gr.processImageFileName = textFileName; } else if (nameSuffix.GetLength() > 0) { gr.processImageFileName = nameSuffix; // as a last resort add any suffix information from the ROT name rather than leaving blank #ifndef _WIN64 gr.processImageFileName += _T(" *64"); // If we're 32bit, assume that we can't get process name because remote process is 64bit and show this on the dialog #endif } } IsWow64Process(process, &gr.processIsWOW64); } } mc.GetMatch(3, &szStart, &szEnd); nLength = (int) (szEnd - szStart); if (nLength > 0) { CString textTime(szStart, nLength); textTime.Replace(_T("-"), _T(":")); gr.time = textTime; } } graphs.Add(gr); CString entryName = gr.name; if (gr.pid > 0) entryName.Format(_T("%d (0x%08lX)"), gr.pid, gr.pid); int nIndex = list_graphs.InsertItem(list_graphs.GetItemCount(), entryName); if (gr.processIsWOW64) { CString val = gr.processImageFileName; val.Append(_T(" *32")); list_graphs.SetItemText(nIndex, 1, val); } else list_graphs.SetItemText(nIndex, 1, gr.processImageFileName); if (gr.instance > 0) { CString val; val.Format(_T("0x%I64d"), gr.instance); list_graphs.SetItemText(nIndex, 2, val); } list_graphs.SetItemText(nIndex, 3, gr.time); list_graphs.SetItemText(nIndex, 4, gr.processImagePath); if (graphs.GetCount() == 1) { list_graphs.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); list_graphs.SetSelectionMark(0); } } if (displayname) { CComPtr<IMalloc> alloc; if (SUCCEEDED(CoGetMalloc(0, &alloc))) { alloc->Free(displayname); } } moniker = NULL; } // Set column width automatically to fit contents refreshed above for (int n=0; n<=4; n++) { list_graphs.SetColumnWidth(n, LVSCW_AUTOSIZE_USEHEADER); } }
void PlotDummy( const TString &sim, UInt_t time, Int_t zoom=2, const TString &opt="") { PlasmaGlob::Initialize(); // Palettes! gROOT->Macro("PlasmaPalettes.C"); // More makeup gStyle->SetPadRightMargin(0.12); // Margin for palettes in 2D histos // Load PData PData *pData = PData::Get(sim.Data()); pData->LoadFileNames(time); if(!pData->IsInit()) return; // Get charge density histos Int_t index = 1; if(opt.Contains("beam")) index = 1; char hName[24]; sprintf(hName,"hDen_%i",index); TH2F *hDen2D = (TH2F*) gROOT->FindObject(hName); if(hDen2D) delete hDen2D; hDen2D = pData->GetCharge(index); hDen2D->SetName(hName); hDen2D->GetXaxis()->CenterTitle(); hDen2D->GetYaxis()->CenterTitle(); hDen2D->GetXaxis()->SetTitle("z [c/#omega_{p}]"); hDen2D->GetYaxis()->SetTitle("y [c/#omega_{p}]"); hDen2D->SetBit(kCanDelete); // Tunning the Histograms // --------------------- Float_t Time = hDen2D->GetXaxis()->GetXmin(); // Set the range of the histogram for maximum constrast Float_t density = 1; if(opt.Contains("units") && pData->GetPlasmaDensity()) density = 1e-15 * 1e-6 * pData->GetPlasmaDensity(); if(index==0) { Float_t Max = 1.1 * hDen2D->GetMaximum(); Float_t Base = density; Float_t Min = 2.* Base - Max; if(Max >= 2. * Base) { Min = 0; } else if(Max<1.0 * Base) { Max = 1.1 * Base; Min = 0.; } hDen2D->GetZaxis()->SetRangeUser(Min,Max); } // Zoom Float_t range = (hDen2D->GetYaxis()->GetXmax() - hDen2D->GetYaxis()->GetXmin())/zoom; Float_t midPoint = (hDen2D->GetYaxis()->GetXmax() + hDen2D->GetYaxis()->GetXmin())/2.; hDen2D->GetYaxis()->SetRangeUser(midPoint-range/2,midPoint+range/2); // Plotting // ----------------------------------------------- // Canvas setup TCanvas *C = new TCanvas("C","Charge density and Electric field",850,500); // Text objects TPaveText text1(0.6,0.94,0.88,1.0,"NDC"); PlasmaGlob::SetPaveStyle(&text1); text1.AddText("Charge density [a.u.]"); TPaveText textTime(0.7,0.82,0.85,0.88,"NDC"); PlasmaGlob::SetPaveStyle(&textTime); char ctext[128]; sprintf(ctext,"T = %5.1f [1/#omega_{p}]",Time); textTime.AddText(ctext); // Palettes!! // const Int_t electronNRGBs = 5; // const Int_t electronNCont = 64; // Double_t electronStops[electronNRGBs] = { 0.00, 0.10, 0.50, 0.95, 1.00}; // Double_t electronRed[electronNRGBs] = { 0.90, 0.52, 0.22, 0.39, 0.50}; // Double_t electronGreen[electronNRGBs] = { 0.90, 0.74, 0.34, 0.05, 0.00}; // Double_t electronBlue[electronNRGBs] = { 0.90, 0.80, 0.58, 0.33, 0.09}; // PPalette *electronPalette = new PPalette("electron"); // electronPalette->CreateGradientColorTable(electronNRGBs, electronStops, electronRed, electronGreen, electronBlue, electronNCont); // Actual Plotting! // ------------------------------------------------------------ // Output file TString fOutName = Form("./%s/Plots/Dummy/Dummy",sim.Data()); fOutName += Form("-%s_%i",sim.Data(),time); C->cd(0); C->cd(1); // <--- Top Plot gPad->SetFrameLineWidth(3); // if(index == 0) // plasmaPalette->cd(); // else PPalette * electronPalette = (PPalette*) gROOT->FindObject("electron"); electronPalette->cd(); hDen2D->Draw("colz"); // text1.Draw(); // textTime.Draw(); C->cd(); // Print to a file PlasmaGlob::imgconv(C,fOutName,opt); // --------------------------------------------------------- }