Exemplo n.º 1
0
CLogCacheStatistics::CLogCacheStatistics ( CLogCachePool& pool
                                         , const CString& uuid
                                         , const CString& url)
{
    Reset();

    CollectData (pool, uuid, url);
    if (CacheExists())
        CollectData (*pool.GetCache (uuid, url));

    connectionState
        = pool.GetRepositoryInfo().GetConnectionState (uuid, url);
}
Exemplo n.º 2
0
void WeaponUsageStatistic::OnPlayerAddMoney(game_PlayerState* ps, s32 MoneyAmount)
{
	if (!CollectData())							return;
	if (!ps || MoneyAmount<=0)					return;
	Player_Statistic& PlayerStat				= *(FindPlayer(ps->getName()));
	PlayerStat.m_dwCurMoneyRoundDelta			+= MoneyAmount;
};
Exemplo n.º 3
0
void WeaponUsageStatistic::OnExplosionKill(game_PlayerState* ps, const SHit& hit)
{
	if (!CollectData())							return;
	if (!ps)									return;
	if (!OnServer())							return;

	CObject* killer								= hit.who;
	if(!killer)									return;

	u16 killer_id								= hit.whoID;
	game_PlayerState* killerPS					= Game().GetPlayerByGameID(killer_id);
	Player_Statistic& PlayerStatKiller			= *(FindPlayer(killerPS->getName()));

	CObject* weapon_object						= Level().Objects.net_Find(hit.weaponID);
	WEAPON_STATS_it WeaponIt					= PlayerStatKiller.FindPlayersWeapon(weapon_object->cNameSect().c_str());
	WeaponIt->m_dwHitsScored++;
	WeaponIt->m_dwKillsScored++;

	HitData NewHit;
	//---------------------------		
	NewHit.Completed	= true;
	NewHit.Deadly		= true;
	NewHit.BoneID		= hit.boneID;
	NewHit.TargetID		= ps->GameID;
	NewHit.BulletID		= 0;
	NewHit.Pos0			= killer->Position();
	NewHit.Pos1			= weapon_object->Position();
	NewHit.TargetName	= ps->getName();
	NewHit.BoneName		= 0;
	//---------------------------
	WeaponIt->m_Hits.push_back(NewHit);
}
Exemplo n.º 4
0
void WeaponUsageStatistic::OnPlayerBringArtefact(game_PlayerState* ps)
{
	if (!CollectData())					return;
	if (!ps)							return;
	Player_Statistic& PlayerStat		= *(FindPlayer(ps->getName()));

	PlayerStat.m_dwArtefacts[ps->team]++;
}
void WeaponUsageStatistic::SaveDataLtx(CInifile& ini)
{
	if (OnClient())					return;
	if (!CollectData())				return;
	if (aPlayersStatistic.empty())	return;

	WriteLtx						(ini);
}
Exemplo n.º 6
0
void GpuTimer::FinishCollection()
{
	// retrieve all available timestamps
	while( CollectData(m_nextRetrTs) )
	{
		if( ++m_nextRetrTs == m_numTimeStamps )
			m_nextRetrTs = 0;
	}
}
Exemplo n.º 7
0
void WeaponUsageStatistic::OnPlayerSpawned(game_PlayerState* ps)
{
	if (!CollectData()) return;
	if (!ps) return;
	Player_Statistic& PlayerStat		= *(FindPlayer(ps->getName()));
	PlayerStat.m_dwNumRespawned[ps->team]++;
	PlayerStat.m_dwCurMoneyRoundDelta	= 0;
	m_dwTotalNumRespawns[ps->team]++;	
	PlayerStat.m_dwCurrentTeam			= ps->team;
}
Exemplo n.º 8
0
void OptimiseData::Run(csString in, csString out)
{
  printf("Collecting Data!\n");
  CollectData(in);

  printf("Sorting Data!\n");
  SortData();

  printf("Writing Data!\n");
  WriteData(out);
}
Exemplo n.º 9
0
bool World::PredictWorld(const Action& action) {
	if (data_points_.empty() || enemies_.empty()) {
		return true;
	}
	auto closest_data_points = MoveEnemies();
	if (!PerfromHeroAction(action)) {
		return false;
	};
	CollectData(closest_data_points);
	return true;
}
Exemplo n.º 10
0
void GpuTimer::WaitIdle()
{
	while( m_nextRetrTs != m_curIssueTs )
	{
		CollectData( m_nextRetrTs, true );

		if( ++m_nextRetrTs == m_numTimeStamps )
			m_nextRetrTs = 0;
	}

	// retrieve the current Ts
	CollectData( m_nextRetrTs, true );
	if( ++m_nextRetrTs == m_numTimeStamps )
		m_nextRetrTs = 0;

    if( 0 == m_CurTimeFrame.invalid )
	{
		m_LastTime = m_CurTime;
		m_SumTime +=  m_CurTime;
		++m_NumFrames;
	}
}
Exemplo n.º 11
0
void WeaponUsageStatistic::Update()
{
	if (!CollectData())							return;
	if (Level().timeServer() < (m_dwLastUpdateTime + m_dwUpdateTimeDelta))
	{
		//---------------------------------------------
		m_dwLastUpdateTime = Level().timeServer();
		//---------------------------------------------
		NET_Packet P;
		P.w_begin	(M_STATISTIC_UPDATE);
		P.w_u32		(Level().timeServer());
		Level().Send(P);
	}
};
Exemplo n.º 12
0
void WeaponUsageStatistic::OnPlayerKilled(game_PlayerState* ps)
{
	if (!CollectData())							return;
	if (!ps)									return;
	u32 dwAliveTime								= ps->DeathTime - ps->RespawnTime;
	
	m_dwTotalPlayersAliveTime[ps->team]			+= dwAliveTime;

	Player_Statistic& PlayerStat				= *(FindPlayer(ps->getName()));
	PlayerStat.m_dwTotalAliveTime[ps->team]		+= dwAliveTime;
	
	PlayerStat.m_dwTotalMoneyRound[ps->team]	+= PlayerStat.m_dwCurMoneyRoundDelta;
	m_dwTotalPlayersMoneyRound[ps->team]		+= PlayerStat.m_dwCurMoneyRoundDelta;
};
Exemplo n.º 13
0
void WeaponUsageStatistic::OnWeaponBought(game_PlayerState* ps, LPCSTR WeaponName)
{
	if (!CollectData()) return;
	if (!ps) return;
	PLAYERS_STATS_it PlayerIt = FindPlayer(ps->getName());
	WEAPON_STATS_it WeaponIt = PlayerIt->FindPlayersWeapon(WeaponName);
	WeaponIt->NumBought++;
	//-----------------------------------------------
	int BasketPos = 0;
	if (ps->money_for_round > 500)
	{
		BasketPos = (ps->money_for_round-1)/1000 + 1;
	};
	WeaponIt->m_Basket[ps->team][BasketPos]++;
};
Exemplo n.º 14
0
void CBaseGameStats_Driver::LevelShutdownPreEntity()
{
	float flElapsed = gpGlobals->realtime - m_flLevelStartTime;

	if ( flElapsed < 0.0f )
	{
		Assert( 0 );
		Warning( "EVENT_LEVELSHUTDOWN:  with negative elapsed time (rt %f starttime %f)\n", gpGlobals->realtime, m_flLevelStartTime );
		flElapsed = 0.0f;
	}

	//Assert( m_bInLevel ); //so, apparently shutdowns can happen before inits

#ifdef GAME_DLL
	if ( m_bInLevel && ( gpGlobals->eLoadType != MapLoad_Background ) )
#else
	if ( m_bInLevel )
#endif
	{
		m_flTotalTimeInLevels += flElapsed;
		m_iNumLevels ++;

		gamestats->Event_LevelShutdown( flElapsed );

		if ( gamestats->UseOldFormat() )
		{
#ifdef GAME_DLL
			if( gamestats->AutoSave_OnLevelShutdown() )
				gamestats->SaveToFileNOW( true );

			if( gamestats->AutoUpload_OnLevelShutdown() )
				gamestats->UploadStatsFileNOW();
#endif
		}
		else
		{
			// code path for new format game stats
			CollectData( STATSEND_LEVELSHUTDOWN );
			if ( gamestats->ShouldSendDataOnLevelShutdown() )
			{
				SendData();
			}	
		}
		m_bInLevel = false;	
	}
}
Exemplo n.º 15
0
void GpuTimer::Start()
{
	if( ++m_curIssueTs == m_numTimeStamps )
		m_curIssueTs = 0;

	if( 0 != m_ts[m_curIssueTs].data.startIssued )
	{
		_ASSERT( false && "CPU stall required! This should never happen. Please increase GpuTimer::NumTimeStamps in Timer.h" );
		CollectData( m_curIssueTs, TRUE );
	}

	m_ts[m_curIssueTs].data.frameID = m_FrameID;
	m_ts[m_curIssueTs].data.startIssued = 1;
	m_ts[m_curIssueTs].data.stopIssued = 0;
	m_pDevCtx->Begin(m_ts[m_curIssueTs].pDisjointTS);
	m_pDevCtx->End(m_ts[m_curIssueTs].pStart);
}
Exemplo n.º 16
0
void WeaponUsageStatistic::OnPlayerKillPlayer(game_PlayerState* ps, KILL_TYPE KillType, SPECIAL_KILL_TYPE SpecialKillType)
{
	if (!CollectData()) return;
	if (!ps)			return;

	Player_Statistic& PlayerStat				= *(FindPlayer(ps->getName()));

//.	m_dwSpecialKills[0];//headshot, backstab, knifekill
	switch(SpecialKillType)
	{
	case SKT_HEADSHOT:
			PlayerStat.m_dwSpecialKills[0]++;break;
	case SKT_BACKSTAB:
			PlayerStat.m_dwSpecialKills[1]++;break;
	case SKT_KNIFEKILL:
			PlayerStat.m_dwSpecialKills[2]++;break;
	};
}
Exemplo n.º 17
0
void CBaseGameStats_Driver::Shutdown()
{
	m_bShuttingDown = true;

	gamestats->Event_Shutdown();

	if ( gamestats->UseOldFormat() )
	{
#ifdef GAME_DLL
		if( gamestats->AutoSave_OnShutdown() )
			gamestats->SaveToFileNOW();

		if( gamestats->AutoUpload_OnShutdown() )
			gamestats->UploadStatsFileNOW();
#endif // GAME_DLL
	}
	else
	{
		// code path for new format game stats
		if ( gamestats->ShouldSendDataOnAppShutdown() )
		{
			CollectData( STATSEND_APPSHUTDOWN );
			SendData();
		}
	}
	if ( FILESYSTEM_INVALID_HANDLE != g_LogFileHandle )
	{
		filesystem->Close( g_LogFileHandle );
		g_LogFileHandle = FILESYSTEM_INVALID_HANDLE;
	}

	if ( m_pGamestatsData != NULL )
	{
#ifdef CLIENT_DLL 
		engine->SetGamestatsData( NULL );
#endif
		delete m_pGamestatsData;
		m_pGamestatsData = NULL;
	}
}
Exemplo n.º 18
0
uint8 Process_Event()
{
    uint8 current_event;
    current_event = Pop_T();
    switch(current_event)
    {
      case EVENT_BEACON_HANDLER:
        BeaconHandler(DataRecvBuffer);
        break;
      case EVENT_JOINREQUESTACK_HANDLER:
        JoinRequestACKHandler();
        break;
      case EVENT_JOINREQUEST_SEND:
        SendJoinRequest();
        break;
      case EVENT_DATA_SEND:
        DataSend();
        break;
      case EVENT_DATAACK_HANDLER:
        DataACKHandler();
        break;
      case EVENT_WAKE_A7139:
        A7139_WakeToRecv();
        break;
      case EVENT_CSMA_RESEND:
        CSMADataResend();
        break;
      case EVENT_COLLECT_DATA:
        CollectData();
        break;
      case EVENT_IDENTIFY_CAR:
        IdentifyCar();
        break;
      case EVENT_REJOIN_HANDLER:
        ReJoinHandler();
        break;
    }
    return current_event;
}
Exemplo n.º 19
0
//------------------------------------------------------------------------------
void LocatedEventTable::BuildPlot(const wxString &plotName)
{
   // Commented out for stability

   thePlot = new OwnedPlot(plotName);

   thePlot->SetStringParameter(wxT("PlotTitle"), plotName);
   thePlot->SetStringParameter(wxT("XAxisTitle"), wxT("A.1 Epoch"));
   thePlot->SetStringParameter(wxT("YAxisTitle"), wxT("Duration (sec)"));
   thePlot->SetBooleanParameter(wxT("UseLines"), false);
   thePlot->SetBooleanParameter(wxT("UseHiLow"), false);

   // Turn on automatic marker colors
   thePlot->SetIntegerParameter(thePlot->GetParameterID(wxT("DefaultColor")), 0);

   eventTypesWithNames.clear();
   for (UnsignedInt i = 0; i < events.size(); ++i)
      if (find(eventTypesWithNames.begin(), eventTypesWithNames.end(),
            events[i]->dataName) == eventTypesWithNames.end())
         eventTypesWithNames.push_back(events[i]->dataName);

   for (UnsignedInt i = 0; i < eventTypesWithNames.size(); ++i)
   {
      wxString curveName = eventTypesWithNames[i];
      thePlot->SetStringParameter(wxT("Add"), curveName);
   }

   thePlot->Initialize();

   for (UnsignedInt i = 0; i < eventTypesWithNames.size(); ++i)
   {
      // Load up the data
      RealArray xd, yd;
      CollectData(eventTypesWithNames[i], xd, yd); 
      
      if (xd.size() > 0)
         thePlot->SetCurveData(i, &xd, &yd);
   }
}
Exemplo n.º 20
0
void WeaponUsageStatistic::OnBullet_Fire(SBullet* pBullet, const CCartridge& cartridge)
{
	if (!CollectData()) return;

	if (!pBullet || !pBullet->flags.allow_sendhit) return;
	CObject					*object_weapon = Level().Objects.net_Find(pBullet->weapon_id);
	if (!object_weapon) return;
	CObject					*object_parent = Level().Objects.net_Find(pBullet->parent_id);
	if (!object_parent) return;
	CActor* pActor = smart_cast<CActor*>(object_parent);
	if (!pActor) return;
	//-----------------------------------------------------------------------------------
	PLAYERS_STATS_it PlayerIt = FindPlayer(*object_parent->cName());
	pBullet->m_dwID = PlayerIt->m_dwTotalShots++;
	PlayerIt->m_dwTotalShots_d++;
	WEAPON_STATS_it WeaponIt = PlayerIt->FindPlayersWeapon(*object_weapon->cNameSect());
	WeaponIt->m_dwRoundsFired = (++WeaponIt->m_dwBulletsFired)/cartridge.m_buckShot;
	WeaponIt->m_dwBulletsFired_d++;
	//-----------------------------------------------------------------------------------
	ActiveBullets.push_back(BulletData(object_parent->cName(), object_weapon->cNameSect(), pBullet));
	
//	Msg("! OnBullet Fire ID[%d]", pBullet->m_dwID);
}
void WeaponUsageStatistic::SaveData()
{

	if (OnClient()) return;
	if (!CollectData()) return;
	if (aPlayersStatistic.empty()) return;

	string64		GameType;
	SYSTEMTIME		Time;	
	switch ( GameID() )
	{
	case eGameIDDeathmatch:				xr_sprintf(GameType, "dm"); break;
	case eGameIDTeamDeathmatch:			xr_sprintf(GameType, "tdm"); break;
	case eGameIDArtefactHunt:			xr_sprintf(GameType, "ah"); break;
	case eGameIDCaptureTheArtefact:		xr_sprintf(GameType, "cta"); break;
	default:
		return;
		break;
	};
	GetLocalTime(&Time);	
	xr_sprintf(mFileName, "(%s)_(%s)_%02d.%02d.%02d_%02d.%02d.%02d.wus", *(Level().name()), GameType, Time.wMonth, Time.wDay, Time.wYear, Time.wHour, Time.wMinute, Time.wSecond);


	//---------------------------------------------------------
	FS.update_path			(mFileName,"$logs$",mFileName);
	FILE* SFile				= fopen(mFileName, "wb");
	if (!SFile)				return;
	//---------------------------------------------------------
	u32 IDENT				= WUS_IDENT;
	fwrite					(&IDENT, 4, 1, SFile);
	u32 Ver					= WUS_VERSION;
	fwrite					(&Ver, 4, 1, SFile);
	//---------------------------------------------------------
	Write					(SFile);
	//---------------------------------------------------------
	fclose					(SFile);
};
void WeaponUsageStatistic::SaveData()
{

	if (OnClient()) return;
	if (!CollectData()) return;
	if (aPlayersStatistic.empty()) return;

	string1024		GameType;
	SYSTEMTIME		Time;	
	switch (GameID())
	{
	case GAME_DEATHMATCH: sprintf_s(GameType, "dm"); break;
	case GAME_TEAMDEATHMATCH: sprintf_s(GameType, "tdm"); break;
	case GAME_ARTEFACTHUNT: sprintf_s(GameType, "ah"); break;
	default:
		return;
		break;
	};
	GetLocalTime(&Time);	
	sprintf_s(mFileName, "(%s)_(%s)_%02d.%02d.%02d_%02d.%02d.%02d.wus", *(Level().name()), GameType, Time.wMonth, Time.wDay, Time.wYear, Time.wHour, Time.wMinute, Time.wSecond);


	//---------------------------------------------------------
	FS.update_path			(mFileName,"$logs$",mFileName);
	FILE* SFile				= fopen(mFileName, "wb");
	if (!SFile)				return;
	//---------------------------------------------------------
	u32 IDENT				= WUS_IDENT;
	fwrite					(&IDENT, 4, 1, SFile);
	u32 Ver					= WUS_VERSION;
	fwrite					(&Ver, 4, 1, SFile);
	//---------------------------------------------------------
	Write					(SFile);
	//---------------------------------------------------------
	fclose					(SFile);
};
Exemplo n.º 23
0
void OptimiseData::CollectData(csString in)
{
  csRef<iStringArray> files = vfs->FindFiles(in);
  if(files->IsEmpty())
  {
    files->Push(in);
  }

  vfs->PushDir(in);

  for(size_t i=0; i<files->GetSize(); i++)
  {
    csRef<iFile> file = vfs->Open(files->Get(i), VFS_FILE_READ);
    if(file.IsValid())
    {
      csRef<iDocument> doc = docSys->CreateDocument();
      doc->Parse(file);
      csRef<iDocumentNode> root = doc->GetRoot();
      if(root.IsValid())
      {
        csRef<iDocumentNodeIterator> meshfacts = root->GetNodes("meshfact");
        while(meshfacts->HasNext())
        {
          meshFacts.Push(meshfacts->Next());
        }

        csRef<iDocumentNode> top = root->GetNode("library");
        if(!top.IsValid())
        {
          top = root->GetNode("world");
          if(top.IsValid())
          {
            csString mapName = files->Get(i);
            mapName.Truncate(mapName.FindLast("/"));
            mapInPaths.Push(mapName);
            if(mapName.FindLast("/") != (size_t)-1)
            {
                mapName = mapName.Slice(mapName.FindLast("/"));
            }
            if(mapName.FindLast("\\") != (size_t)-1)
            {
                mapName = mapName.Slice(mapName.FindLast("\\")+1);
            }
            mapNames.Push(mapName);
            maps.Push(top);
          }
          else
          {
            continue;
          }
        }

        csRef<iDocumentNode> node;
        csRef<iDocumentNodeIterator> texsNode = top->GetNodes("textures");
        while(texsNode->HasNext())
        {
          node = texsNode->Next();
          addonLib = false;
          csRef<iDocumentNodeIterator> textureNodes = node->GetNodes("texture");
          while(textureNodes->HasNext())
          {
            textures.PushSmart(textureNodes->Next());
          }            
        }

        csRef<iDocumentNodeIterator> matsNode = top->GetNodes("materials");
        while(matsNode->HasNext())
        {
          node = matsNode->Next();
          addonLib = false;
          csRef<iDocumentNodeIterator> materialNodes = node->GetNodes("material");
          while(materialNodes->HasNext())
          {
            materials.PushSmart(materialNodes->Next());
          }            
        }

        meshfacts = top->GetNodes("meshfact");
        while(meshfacts->HasNext())
        {
          addonLib = false;
          meshFacts.PushSmart(meshfacts->Next());
        }

        csRef<iDocumentNodeIterator> libraries = top->GetNodes("library");
        while(libraries->HasNext())
        {
          csRef<iDocumentNode> libnode = libraries->Next();
          csString lib = libnode->GetContentsValue();
          if(lib.Compare(""))
          {
            lib = csString(libnode->GetAttributeValue("path")) + "/" + libnode->GetAttributeValue("file");
          }
          addonLib = true;
          CollectData(lib);
          if(addonLib)
          {
            addonNames.Push(lib.Slice(lib.FindLast('/')+1));
          }
          addonLib = false;
        }

        csRef<iDocumentNodeIterator> addonNodes = top->GetNodes("addon");
        while(addonLib && addonNodes->HasNext())
        {
          addons.Push(addonNodes->Next());
        }
      }
    }
  }
  vfs->PopDir();
}
Exemplo n.º 24
0
void WeaponUsageStatistic::ChangePlayerName( LPCSTR from, LPCSTR to )
{
	if ( !CollectData() ) return;
	PLAYERS_STATS_it pPlayerI = FindPlayer( from );
	pPlayerI->PName = to;
}