void TaskResumed(TASK * task) { if(task->priority!=250) { RecordEvent(ETaskResumed,task,NULL,NULL); } }
/** * Start capturing stats for upload * Uses the unique ApiKey associated with your app */ bool FAnalyticsProviderET::StartSession(const TArray<FAnalyticsEventAttribute>& Attributes) { UE_LOG(LogAnalytics, Log, TEXT("[%s] AnalyticsET::StartSession"),*APIKey); // end/flush previous session before staring new one if (bSessionInProgress) { EndSession(); } FGuid SessionGUID; FPlatformMisc::CreateGuid(SessionGUID); SessionID = SessionGUID.ToString(EGuidFormats::DigitsWithHyphensInBraces); // always ensure we send a few specific attributes on session start. TArray<FAnalyticsEventAttribute> AppendedAttributes(Attributes); // this is for legacy reasons (we used to use this ID, so helps us create old->new mappings). AppendedAttributes.Emplace(TEXT("UniqueDeviceId"), FPlatformMisc::GetUniqueDeviceId()); // we should always know what platform is hosting this session. AppendedAttributes.Emplace(TEXT("Platform"), FString(FPlatformProperties::IniPlatformName())); AppendedAttributes.Emplace(TEXT("LegacyURL"), bUsingLegacyAppServer ? TEXT("true") : TEXT("false")); RecordEvent(TEXT("SessionStart"), AppendedAttributes); bSessionInProgress = true; return bSessionInProgress; }
void MutexPutted(void * mutex,TASK * task) { if(task->priority!=250) { RecordEvent(EMutexPutted,mutex,task,NULL); } }
void SndSysDriverOSS::WriteBuffer(size_t Frames) { const size_t size = Frames * m_PlaybackFormat.Channels * m_PlaybackFormat.Bits/8; const size_t res = write(m_OutputFileDescriptor, m_pSoundBuffer, size); if (res != size) RecordEvent(SSEL_WARNING, "WriteBuffer could only write %zu of %zu bytes" " (errno = %d)!", res, size, errno); }
void RecordSetDLLBreaks( void ) { char_ring *dll; for( dll = DLLList; dll != NULL; dll = dll->next ) { GetBreakOnImageCmd( dll->name, TxtBuff, false ); RecordEvent( TxtBuff ); } }
static void RecordBreakEvent( brkp *bp, brk_event event ) { GetBPCmd( bp, event, TxtBuff, TXT_LEN ); RecordEvent( TxtBuff ); if( event == B_SET && !IS_NIL_ADDR( bp->loc.addr ) ) { GetBPAddrText( bp, TxtBuff ); DUIStatusText( TxtBuff ); } }
void BreakOnImageLoad( const char *name, unsigned len, bool clear ) { if( clear ) { DeleteRing( &DLLList, name, len, true ); } else { InsertRing( RingEnd( &DLLList ), name, len, true ); } GetBreakOnImageCmd( name, TxtBuff, clear ); RecordEvent( TxtBuff ); }
void TaskPreempted(TASK * OriginalTask,TASK * TargetTask) { if(OriginalTask->priority==250||TargetTask->priority==250) { if(OriginalTask->priority!=250) { OldTask=OriginalTask; } else if(TargetTask->priority!=250) { NewTask=TargetTask; } if(OldTask!=NewTask) { if(OldTask!=NULL&&NewTask!=NULL) { RecordEvent(ETaskPreempted,OldTask,NewTask,NULL); TaskResumed(NewTask); OldTask=NULL; NewTask=NULL; } } else { OldTask=NULL; NewTask=NULL; } } else { OldTask=NULL; NewTask=NULL; RecordEvent(ETaskPreempted,OriginalTask,TargetTask,NULL); TaskResumed(TargetTask); } }
/** * End capturing stats and queue the upload */ void FAnalyticsProviderET::EndSession() { if (bSessionInProgress) { RecordEvent(TEXT("SessionEnd"), TArray<FAnalyticsEventAttribute>()); } FlushEvents(); SessionID.Empty(); bSessionInProgress = false; }
void FAnalyticsProviderFlurry::RecordCurrencyGiven(const FString& GameCurrencyType, int GameCurrencyAmount) { FString EventName = "Currency Given"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("GameCurrencyType", GameCurrencyType)); AttributesDict.Add(FAnalyticsEventAttribute("GameCurrencyAmount", FString::FromInt(GameCurrencyAmount))); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordCurrencyGiven('%s', %d)"), *GameCurrencyType, GameCurrencyAmount); }
void FAnalyticsProviderFlurry::RecordError(const FString& Error, const TArray<FAnalyticsEventAttribute>& EventAttrs) { FString EventName = "Error"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("Error", Error)); AttributesDict.Append(EventAttrs); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordError('%s', %d)"), *Error, EventAttrs.Num()); }
void CProfiler2::RegisterCurrentThread(const std::string& name) { ENSURE(m_Initialised); ENSURE(pthread_getspecific(m_TLS) == NULL); // mustn't register a thread more than once ThreadStorage* storage = new ThreadStorage(*this, name); int err = pthread_setspecific(m_TLS, storage); ENSURE(err == 0); RecordSyncMarker(); RecordEvent("thread start"); AddThreadStorage(storage); }
void FAnalyticsProviderFlurry::RecordProgress(const FString& ProgressType, const FString& ProgressHierarchy, const TArray<FAnalyticsEventAttribute>& EventAttrs) { FString EventName = "Progress"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("ProgressType", ProgressType)); AttributesDict.Add(FAnalyticsEventAttribute("ProgressHierarchy", ProgressHierarchy)); AttributesDict.Append(EventAttrs); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordProgress('%s', %s, %d)"), *ProgressType, *ProgressHierarchy, EventAttrs.Num()); }
void FAnalyticsProviderFlurry::RecordItemPurchase(const FString& ItemId, int ItemQuantity, const TArray<FAnalyticsEventAttribute>& EventAttrs) { FString EventName = "Item Purchase"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("ItemId", ItemId)); AttributesDict.Add(FAnalyticsEventAttribute("ItemQuantity", FString::FromInt(ItemQuantity))); AttributesDict.Append(EventAttrs); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordItemPurchase('%s', %d, %d)"), *ItemId, ItemQuantity, EventAttrs.Num()); }
void FAnalyticsProviderFlurry::RecordItemPurchase(const FString& ItemId, const FString& Currency, int PerItemCost, int ItemQuantity) { FString EventName = "Item Purchase"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("ItemId", ItemId)); AttributesDict.Add(FAnalyticsEventAttribute("Currency", Currency)); AttributesDict.Add(FAnalyticsEventAttribute("PerItemCost", FString::FromInt(PerItemCost))); AttributesDict.Add(FAnalyticsEventAttribute("ItemQuantity", FString::FromInt(ItemQuantity))); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordItemPurchase('%s', '%s', %d, %d)"), *ItemId, *Currency, PerItemCost, ItemQuantity); }
bool SndSysDriverOSS::ResizeBuffer() { // Setup a buffer which will be used to move sound from the renderer to // OSS. This is set as the full size of the maximum latency time of the // OSS output. delete[] m_pSoundBuffer; m_SoundBufferSize=m_BufferLengthms * m_PlaybackFormat.Freq * m_PlaybackFormat.Bits/8 * m_PlaybackFormat.Channels / 1000; m_pSoundBuffer = new uint8[m_SoundBufferSize]; RecordEvent(SSEL_DEBUG, "Resizing buffer to %d ms (%d frames)", m_BufferLengthms, m_BufferLengthms * m_PlaybackFormat.Freq / 1000); if (!m_pSoundBuffer) return false; return true; }
unsigned Go( bool do_flip ) { char *p; unsigned conditions; p = StrCopy( GetCmdName( CMD_GO ), TxtBuff ); if( UserTmpBrk.status.b.active ) { p = Format( p, " %A", UserTmpBrk.loc.addr ); RecordEvent( TxtBuff ); } else { RecordGo( TxtBuff ); } conditions = Execute( false, do_flip ); CheckEventRecorded(); return( conditions ); }
void FAnalyticsProviderFlurry::RecordCurrencyPurchase(const FString& GameCurrencyType, int GameCurrencyAmount, const FString& RealCurrencyType, float RealMoneyCost, const FString& PaymentProvider) { FString EventName = "Currency Purchase"; // Build the dictionary TArray<FAnalyticsEventAttribute> AttributesDict; AttributesDict.Add(FAnalyticsEventAttribute("GameCurrencyType", GameCurrencyType)); AttributesDict.Add(FAnalyticsEventAttribute("GameCurrencyAmount", FString::FromInt(GameCurrencyAmount))); AttributesDict.Add(FAnalyticsEventAttribute("RealCurrencyType", RealCurrencyType)); AttributesDict.Add(FAnalyticsEventAttribute("RealMoneyCost", FString::Printf(TEXT("%.02f"), RealMoneyCost))); AttributesDict.Add(FAnalyticsEventAttribute("PaymentProvider", PaymentProvider)); // Send the event RecordEvent(EventName, AttributesDict); UE_LOG(LogAnalytics, Display, TEXT("AndroidFlurry::RecordCurrencyPurchase('%s', %d, '%s', %.02f, %s)"), *GameCurrencyType, GameCurrencyAmount, *RealCurrencyType, RealMoneyCost, *PaymentProvider); }
bool SndSysDriverOSS::Initialize (iObjectRegistry *obj_reg) { /// Interface to the Configuration file csConfigAccess Config; // copy the system pointer m_pObjectRegistry=obj_reg; // Get an interface for event recorder (if present) m_EventRecorder = csQueryRegistry<iSndSysEventRecorder> (m_pObjectRegistry); // Critical because you really want to log this. Trust me. Really. RecordEvent(SSEL_CRITICAL, "OSS sound driver for software sound renderer initialized."); // read the config file Config.AddConfig(m_pObjectRegistry, "/config/sound.cfg"); // check for optional output device name from the commandline csRef<iCommandLineParser> CMDLine ( csQueryRegistry<iCommandLineParser> (m_pObjectRegistry)); const char *OutputDeviceName = CMDLine->GetOption ("ossdevice"); if (!OutputDeviceName) OutputDeviceName = Config->GetStr("SndSys.Driver.OSS.Device", "/dev/dsp"); strcpy(m_OutputDeviceName, OutputDeviceName); // The 'buffer length' here is not a real buffer allocation, but // is instead the maximum amount of data we will send ahead to OSS. m_BufferLengthms=0; if (CMDLine) { const char *BufferLengthStr = CMDLine->GetOption("soundbufferms"); if (BufferLengthStr) m_BufferLengthms=atoi(BufferLengthStr); } // Check for sound config file option. Default to 20 ms if no option is found. if (m_BufferLengthms<=0) m_BufferLengthms = Config->GetInt("SndSys.Driver.OSS.SoundBufferms", 20); // The number of underbuffer events before the buffer size is automatically increased m_UnderBuffersAllowed=5; return true; }
void ChangeMemUndoable( address addr, const void *data, size_t size ) { char *p; char *end; if( AdvMachState( ACTION_MODIFY_MEMORY ) ) { ChangeMem( addr, data, size ); end = TxtBuff + TXT_LEN; p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr ); for( ; size > 0 && p < end - ( 2 + 8 ); --size ) { p = StrCopy( ", ", p ); p = CnvULong( *(unsigned char *)data, p, end - p ); data = (char *)data + 1; } RecordEvent( TxtBuff ); DbgUpdate( UP_MEM_CHANGE ); CollapseMachState(); } }
void ChangeMemUndoable( address addr, const void *item, unsigned size ) { char *p; const unsigned char *it; char *end; if( AdvMachState( ACTION_MODIFY_MEMORY ) ) { ChangeMem( addr, item, size ); it = item; end = TxtBuff + TXT_LEN; p = Format( TxtBuff, "%s %A", GetCmdName( CMD_MODIFY ), addr ); for( ; size > 0; --size ) { p = StrCopy( ", ", p ); p = CnvULong( *it++, p, end - p ); } RecordEvent( TxtBuff ); DbgUpdate( UP_MEM_CHANGE ); CollapseMachState(); } }
void RecordSetRegIP( address addr ) { Format( TxtBuff, "%s %A", GetCmdName( CMD_SKIP ), addr ); RecordEvent( TxtBuff ); SetRegIP( addr ); }
void MutexCreated(void * mutex) { RecordEvent(EMutexCreated,mutex,NULL,NULL); }
void TaskCompleted(TASK * task) { if(task->priority!=250) RecordEvent(ETaskCompleted,task,NULL,NULL); }
void SndSysDriverOSS::Run() { csTicks last_write, current_ticks; int UnderBufferCount=0; // Clear the buffer and write the full buffer size ahead ClearBuffer(); WriteBuffer(m_SoundBufferSize); // Mark the current time, OSS provides no timing information, so we // rely entirely on the system clock last_write=csGetTicks(); while (m_bRunning) { // Get the current time current_ticks=csGetTicks(); // Determine if a write is worthwhile. We will fill if at least 1/4 of the // full buffer time has elapsed if ((current_ticks - last_write) > m_BufferLengthms/4) { // The number of frames needed to refill the OSS buffer size_t NeededFrames=(current_ticks - last_write) * m_PlaybackFormat.Freq / 1000; // Check for underbuffer - if the elapsed time has exceeded the total buffer time if ((current_ticks - last_write) >= m_BufferLengthms) { UnderBufferCount++; RecordEvent(SSEL_WARNING, "Underbuffer condition detected. Buffer length [%d ms] elapsed cycle [%d ms] Underbuffer count [%d] allowed [%d]", m_BufferLengthms, current_ticks - last_write, UnderBufferCount, m_UnderBuffersAllowed); // Maximum allowed underbuffer count exceeded, expand our buffer to compensate if (UnderBufferCount > m_UnderBuffersAllowed) { // Double our buffer length m_BufferLengthms*=2; if (!ResizeBuffer()) { RecordEvent(SSEL_ERROR, "Failed to resize buffer! Aborting main loop."); break; } // Reset the count to 0 UnderBufferCount=0; // We'll need to adjust the number of frames so that we fill the entire buffer here NeededFrames=m_BufferLengthms * m_PlaybackFormat.Freq / 1000; } } // Fill the buffer with the required number of frames m_pAttachedRenderer->FillDriverBuffer(m_pSoundBuffer, NeededFrames, 0, 0); // Write the data to OSS WriteBuffer(NeededFrames); // Update our last write time last_write=current_ticks; } else { // Otherwise, sleep about 1/4 of the buffer length csSleep(m_BufferLengthms/4); } } }
bool SndSysDriverOSS::Open (csSndSysRendererSoftware*renderer, csSndSysSoundFormat *requested_format) { int result, param; RecordEvent(SSEL_DEBUG, "OSS Driver: Open()"); m_pAttachedRenderer=renderer; m_OutputFileDescriptor=open(m_OutputDeviceName, O_WRONLY, 0); if (m_OutputFileDescriptor==-1) { RecordEvent(SSEL_ERROR, "Failed to open output device [%s].", m_OutputDeviceName); return false; } // Set bits per sample and sample format switch (requested_format->Bits) { case 8: param=AFMT_U8; break; case 16: if ((requested_format->Flags & CSSNDSYS_SAMPLE_ENDIAN_MASK) == CSSNDSYS_SAMPLE_BIG_ENDIAN) param=AFMT_S16_BE; else param=AFMT_S16_LE; break; default: RecordEvent(SSEL_WARNING, "Unhandled output bits %d. Forcing to 16 bit.", requested_format->Bits); requested_format->Bits=16; if ((requested_format->Flags & CSSNDSYS_SAMPLE_ENDIAN_MASK) == CSSNDSYS_SAMPLE_BIG_ENDIAN) param=AFMT_S16_BE; else param=AFMT_S16_LE; break; } result=ioctl(m_OutputFileDescriptor, SNDCTL_DSP_SETFMT, ¶m); if (result==-1) { const char *endian_string; if ((requested_format->Flags & CSSNDSYS_SAMPLE_ENDIAN_MASK) == CSSNDSYS_SAMPLE_BIG_ENDIAN) endian_string="Big Endian"; else endian_string="Little Endian"; RecordEvent(SSEL_ERROR, "Failed to set output format to %d bit (%s).", requested_format->Bits, endian_string); close(m_OutputFileDescriptor); m_OutputFileDescriptor=-1; return false; } // Set channels param=requested_format->Channels; result=ioctl(m_OutputFileDescriptor, SNDCTL_DSP_CHANNELS, ¶m); if (result==-1) { RecordEvent(SSEL_ERROR, "Failed to set output format to %d channels.", requested_format->Channels); close(m_OutputFileDescriptor); m_OutputFileDescriptor=-1; return false; } // Set sample frequency param=requested_format->Freq; result=ioctl(m_OutputFileDescriptor, SNDCTL_DSP_SPEED, ¶m); if (result==-1) { RecordEvent(SSEL_ERROR, "Failed to set output bitrate to %d bits per channel per second.", requested_format->Freq); close(m_OutputFileDescriptor); m_OutputFileDescriptor=-1; return false; } // Copy the final format into local storage memcpy(&m_PlaybackFormat, requested_format, sizeof(csSndSysSoundFormat)); // Setup our initial sound buffer if (!ResizeBuffer()) return false; return true; }
void MutexDeleted(void * mutex) { RecordEvent(EMutexDeleted,mutex,NULL,NULL); }