Ejemplo n.º 1
0
void ObjectHost::commandListObjects(const Command::Command& cmd, Command::Commander* cmdr, Command::CommandID cmdid) {
    Command::Result result = Command::EmptyResult();
    // Make sure we return the objects key set even if there are none
    result.put( String("objects"), Command::Array());
    Command::Array& objects_ary = result.getArray("objects");

    Sirikata::SerializationCheck::Scoped sc(&mSessionSerialization);

    for(InternalIDHostedObjectMap::const_iterator it = mHostedObjectsByID.begin(); it != mHostedObjectsByID.end(); it++) {
        HostedObjectPtr ho = it->second.lock();
        if (ho) objects_ary.push_back( ho->id().toString() );
    }
    cmdr->result(cmdid, result);
}
Ejemplo n.º 2
0
void IOService::commandReportAllStats(const Command::Command& cmd, Command::Commander* cmdr, Command::CommandID cmdid) {
#ifdef SIRIKATA_TRACK_EVENT_QUEUES
    AllIOServicesLockGuard lock(gAllIOServicesMutex);

    Command::Result result = Command::EmptyResult();
    // Ensure the top-level structure is there
    result.put("ioservices", Command::Array());
    Command::Array& services = result.getArray("ioservices");

    for(AllIOServicesSet::const_iterator it = gAllIOServices.begin(); it != gAllIOServices.end(); it++) {
        services.push_back(Command::Object());
        (*it)->fillCommandResultWithStats(services.back());
    }
    cmdr->result(cmdid, result);
#endif
}
Ejemplo n.º 3
0
void IOService::fillCommandResultWithStats(Command::Result& res) {
    LockGuard lock(const_cast<Mutex&>(mMutex));

    res.put("name", name());
    res.put("timers.enqueued", numTimersEnqueued());
    res.put("timers.latency", timerLatency().toString());
    res.put("handlers.enqueued", numEnqueued());
    res.put("handlers.latency", handlerLatency().toString());
    reportOffenders(mTagCounts, res, "offenders");

    res.put("strands", Command::Array());
    Command::Array& strands = res.getArray("strands");
    for(StrandSet::const_iterator it = mStrands.begin(); it != mStrands.end(); it++) {
        strands.push_back(Command::Object());
        strands.back().put("name", (*it)->name());
        strands.back().put("timers.enqueued", (*it)->numTimersEnqueued());
        strands.back().put("timers.latency", (*it)->timerLatency().toString());
        strands.back().put("handlers.enqueued", (*it)->numEnqueued());
        strands.back().put("handlers.latency", (*it)->handlerLatency().toString());
        reportOffenders((*it)->enqueuedTags(), strands.back(), "offenders");
    }

}