示例#1
0
void MonitorSignalEvent(monitor_event_code_t    EventCode,
						unsigned int            Parameters[MONITOR_PARAMETER_COUNT],
						const char*             Description)
{
	unsigned int                DeviceId        = 0;
	struct DeviceContext_s*     Context         = GetDeviceContext(DeviceId);
	// If no context means the driver has not been installed.
	if (!Context)
	{
		//MONITOR_ERROR("Invalid monitor device %d\n", DeviceId);
		return;
	}
	MonitorRecordEvent(Context,
					   0,
					   EventCode,
					   (unsigned long long)ktime_to_us(ktime_get()),
					   Parameters,
					   Description);
}
示例#2
0
/*{{{ MonitorMMEThread*/
static int MonitorMMEThread(void *Param)
{
	struct MMEContext_s *Context = (struct MMEContext_s *)Param;
	MME_ERROR MMEStatus;
	unsigned long long TimeStamp;
	unsigned int TimeValue;
	daemonize(MONITOR_MME_THREAD_NAME);
	MONITOR_DEBUG("Starting\n");
	while (Context->Monitoring)
	{
		MMEStatus = TransformerGetLogEvent(Context);
		if (MMEStatus != MME_SUCCESS)
			break;
		if (down_interruptible(&(Context->EventReceived)) != 0)
			break;
		TimeValue = *Context->DeviceContext->Timer;
		TimeStamp = ktime_to_us(ktime_get());
		if (Context->MMECommandStatus.TimeCode != 0)
		{
			unsigned long long TimeDiff;
			/* This assumes that the timer is counting down from ClockMaxValue to 0 */
			if (Context->MMECommandStatus.TimeCode > TimeValue)
				TimeDiff = (unsigned long long)(Context->MMECommandStatus.TimeCode - TimeValue);
			else
				TimeDiff = ((unsigned long long)Context->MMECommandStatus.TimeCode + Context->ClockMaxValue + 1) - (unsigned long long)TimeValue;
			TimeStamp -= ((unsigned long long)TimeDiff * 1000000ull) / Context->TicksPerSecond;
		}
		if (Context->Monitoring)
			MonitorRecordEvent(Context->DeviceContext,
							   Context->Id,
							   Context->MMECommandStatus.EventID,
							   TimeStamp,
							   Context->MMECommandStatus.Parameters,
							   Context->MMECommandStatus.Message);
	}
	MONITOR_DEBUG("Terminating\n");
	up(&(Context->ThreadTerminated));
	return 0;
}