EBTStatus DecoratorLogTask::decorate(EBTStatus status)
    {
        BEHAVIAC_ASSERT(DecoratorLog::DynamicCast(this->GetNode()));
        const DecoratorLog* pDecoratorLogNode = (const DecoratorLog*)(this->GetNode());
		BEHAVIAC_LOGMSG("DecoratorLogTask:%s\n", pDecoratorLogNode->m_message.c_str());

        return status;
    }
    void ConnectorInterface::Log(const char* msg)
    {
        ScopedInt_t scopedInt(&gs_threadFlag);

        BEHAVIAC_LOGMSG(msg);
    }
void btagenttick(behaviac::Workspace::EFileFormat format, int countAgents)
{
    const char* strFormat = "xml";

    if (format == behaviac::Workspace::EFF_xml) {
        strFormat = "xml";

    } else if (format == behaviac::Workspace::EFF_cpp) {
        strFormat = "cpp";
    }

    if (format == behaviac::Workspace::EFF_bson) {
        strFormat = "bson";
    }

    printf("\nAgents %d Format %s\n", countAgents, strFormat);
    BEHAVIAC_LOGMSG("\nAgents %d Format %s\n", countAgents, strFormat);

	behaviac::Workspace::GetInstance()->SetFilePath("../integration/unity_performance/Assets/Resources/behaviac/exported");
	behaviac::Workspace::GetInstance()->SetFileFormat(format);

    behaviac::Config::SetLogging(false);
	behaviac::Config::SetLoggingFlush(false);
    behaviac::Config::SetSocketing(false);

    

    behaviac::Agent::Register<CPerformanceAgent>();


    behaviac::Config::SetProfiling(false);

    AgentItem_t* agents = BEHAVIAC_NEW AgentItem_t[countAgents];

    behaviac::Agent::SetIdMask(0xffffffff);

    for (int i = 0; i < countAgents; ++i) {
        agents[i].pA = behaviac::Agent::Create<CPerformanceAgent>();

        agents[i].pA->SetIdFlag(0);

        agents[i].pA->btload("performance/Performance");
        agents[i].pA->btsetcurrent("performance/Performance");
    }

    //run once to warm the oven
    MyMethod(countAgents, agents);

    behaviac::Config::SetProfiling(true);
    behaviac::Profiler::GetInstance()->SetOutputDebugBlock(true);
    behaviac::Profiler::GetInstance()->SetHierarchy(false);

    for (int i = 0; i < countAgents; ++i) {
        agents[i].bGo = true;
        agents[i].pA->Clear();
        agents[i].pA->btresetcurrent();
    }

    behaviac::Profiler::GetInstance()->BeginFrame();

    MyMethod(countAgents, agents);

    behaviac::Profiler::GetInstance()->EndFrame();

    const behaviac::string profile_data = behaviac::Profiler::GetInstance()->GetData(true, false);

    behaviac::string profile_data_m = "\n";
    profile_data_m += profile_data;
    profile_data_m += "\n";

    //BEHAVIAC_LOGMSG("\n%s\n", profile_data_m.c_str());
    behaviac::ConsoleOut::PrintLines(profile_data_m.c_str());

    behaviac::LogManager::GetInstance()->Flush(0);

    BEHAVIAC_DELETE(agents);

    behaviac::Agent::UnRegister<CPerformanceAgent>();

    

    printf("\ndone\n");
}