void SystraceTAKick(PVRSRV_SGXDEV_INFO *psDevInfo, IMG_UINT32 ui32FrameNum, IMG_UINT32 ui32RTData, IMG_BOOL bIsFirstKick) 
{
	IMG_UINT32 ui32PID = OSGetCurrentProcessIDKM();
	IMG_UINT32 ui32JobID = 0;
	IMG_UINT32 ui32CtxID = 0;
	PVRSRV_SYSTRACE_ERROR eError = PVRSRV_SYSTRACE_OK;
	
	if(psDevInfo->bSystraceInitialised)
	{
		if(bIsFirstKick)
		{
			eError = CreateJob(psDevInfo->psSystraceData, ui32PID, ui32FrameNum, ui32RTData);
			if(eError != PVRSRV_SYSTRACE_OK)
			{
				PVR_DPF((PVR_DBG_WARNING,"Systrace: Error creating a Job"));
			}
		}
		
		eError = GetCtxAndJobID(psDevInfo->psSystraceData, ui32PID, ui32FrameNum, ui32RTData, &ui32CtxID, &ui32JobID);
		
		if(eError != PVRSRV_SYSTRACE_OK)
		{
			PVR_DPF((PVR_DBG_WARNING,"Systrace: Job not found"));
		}
		
		trace_gpu_job_enqueue(ui32CtxID, ui32JobID, "TA");
	}
}
void PVRGpuTraceClientWork(
    const IMG_UINT32 ui32Pid,
    const IMG_UINT32 ui32ExtJobRef,
    const IMG_UINT32 ui32IntJobRef,
    const IMG_CHAR* pszKickType)
{
    PVRSRV_ERROR eError = PVRSRV_OK;
    PVRSRV_FTRACE_GPU_JOB* psJob;
    IMG_UINT32   ui32CtxId = 0;

    PVR_ASSERT(pszKickType);

    PVR_DPF((PVR_DBG_VERBOSE, "PVRGpuTraceClientKick(%s): PID %u, extJobRef %u, intJobRef %u", pszKickType, ui32Pid, ui32ExtJobRef, ui32IntJobRef));

    CreateJob(ui32Pid, ui32ExtJobRef, ui32IntJobRef);

    /*
      Always create jobs for client work above but only emit the enqueue
      trace if the feature is enabled.
      This keeps the lookup tables up to date when the gpu_tracing_on is
      disabled so that when it is re-enabled the packets that might be in
      the HWPerf buffer can be decoded in the switch event processing below.
    */
    if (PVRGpuTraceEnabled())
    {
        eError = GetCtxAndJobID(ui32Pid, ui32ExtJobRef, ui32IntJobRef, &ui32CtxId,  &psJob);
        PVR_LOGRN_IF_ERROR(eError, "GetCtxAndJobID");

        trace_gpu_job_enqueue(ui32CtxId, PVRSRV_FTRACE_JOB_GET_ID(psJob), pszKickType);

        PVRSRV_FTRACE_JOB_SET_FLAGS(psJob, PVRSRV_FTRACE_JOB_FLAG_ENQUEUED);
    }
}
Example #3
0
void Peer::HandleTaskRequest(MessagePtr pMsg)
{
	Log(CONSOLE, L"Handling Task request from Peer: %d, taskid: %d\n", 
											pMsg->m_fromPeerId, pMsg->m_taskId);

	int frompeerid = pMsg->m_fromPeerId;
	PeerNodePtr pNode = pMsg->m_conn->GetPeerNode();
	// check whether the remote peer is in peer list- if not then add [TODO] implement more secure way
	RemotePeers rpeer = this->GetRemotePeerById(frompeerid);
	if(rpeer.peer_id < 0) {
		Log(CONSOLE, L"Received Task Request from Unresolved Peer, id: %d, taskId: %d\n", frompeerid,
			pMsg->m_taskId);
		rpeer.peer_id = frompeerid;
		rpeer.ip = pNode->GetIpAddr();
		rpeer.port = pNode->GetListenPort();

		// add
		m_db->AddPeer(rpeer);
	}

	//[TODO] check details of task and our capability

	// create job
	CreateJob(pMsg->m_fromPeerId, pMsg->m_taskId, pMsg->m_taskMap, pNode);

	// send the response
	pNode->TaskResponse(pMsg->m_taskId, true);
}
Example #4
0
Job*
CryptTask::CreateNextJob()
{
	if (IsDone())
		return NULL;

	CryptJob* job = CreateJob();
	_PrepareJob(job);
	return job;
}
uint32 FSimplygonRESTClient::Run()
{
	
	while (SwarmTask->GetState() != SRS_ASSETDOWNLOADED)
	{
		switch (SwarmTask->GetState())
		{
		case SRS_UNKNOWN:
			UploadAsset(TEXT("UE4_TEST"), SwarmTask->ZipFilePath);
			break;
		case SRS_FAILED:
			return 0;
			break;
		case SRS_ASSETUPLOADED:
			CreateJob(TEXT("UE4_TEST"), SwarmTask->InputAssetId);
			break;
		case SRS_JOBCREATED:
			UploadJobSettings(SwarmTask->JobId, SwarmTask->SplFilePath);
			break;
		case SRS_JOBSETTINGSUPLOADED:
			ProcessJob(SwarmTask->JobId);
			break;
		case SRS_JOBPROCESSING:
			GetJob(SwarmTask->JobId);
			break;
		case SRS_JOBPROCESSED:
			DownloadAsset(SwarmTask->OutputAssetId);
			break;
		case SRS_ASSETDOWNLOADED:
			break;
		}		

		if (SwarmTask->GetState() == SRS_FAILED)
		{
			break;
		}
		
		FPlatformProcess::Sleep(0.5);
	}

	return 0;
}
t_job *desserializeJob(int socket, uint16_t id) {
	size_t sbuffer;
	void *buffer;
	if (0 > socket_recv_packet(socket, &buffer, &sbuffer)) {
		log_error(logger, "|JOB %d| Died when deserializing", id);
		free(buffer);
		pthread_exit(NULL);
	}

	bool combiner;
	uint16_t sresultadoFinal;

	memcpy(&combiner, buffer, sizeof(combiner));
	void *bufferOffset = buffer + sizeof(combiner);
	memcpy(&sresultadoFinal, bufferOffset, sizeof(sresultadoFinal));
	sresultadoFinal = ntohs(sresultadoFinal);
	char *resultadoFinal = malloc(sresultadoFinal + 1);
	bufferOffset += sizeof(sresultadoFinal);
	memcpy(resultadoFinal, bufferOffset, sresultadoFinal);
	resultadoFinal[sresultadoFinal] = '\0';
	size_t sfiles = sbuffer - sizeof(combiner) - sizeof(sresultadoFinal)
			- sresultadoFinal;
	char *stringFiles = malloc(sfiles + 1);
	bufferOffset += sresultadoFinal;
	memcpy(stringFiles, bufferOffset, sfiles);
	stringFiles[sfiles] = '\0';

	t_job *job = CreateJob(id, combiner, resultadoFinal);
	free(resultadoFinal);

	stringsToPathFile(job->files, stringFiles);

	free(stringFiles);
	free(buffer);
	return job;
}
Example #7
0
BOOL WINAPI
LocalAddJob(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded)
{
    ADDJOB_INFO_1W AddJobInfo1;
    DWORD dwErrorCode;
    PLOCAL_HANDLE pHandle = (PLOCAL_HANDLE)hPrinter;
    PLOCAL_PRINTER_HANDLE pPrinterHandle;

    // Check if this is a printer handle.
    if (pHandle->HandleType != HandleType_Printer)
    {
        dwErrorCode = ERROR_INVALID_HANDLE;
        goto Cleanup;
    }

    pPrinterHandle = (PLOCAL_PRINTER_HANDLE)pHandle->pSpecificHandle;

    // This handle must not have started a job yet!
    if (pPrinterHandle->pJob)
    {
        dwErrorCode = ERROR_INVALID_HANDLE;
        goto Cleanup;
    }

    // Check if this is the right structure level.
    if (Level != 1)
    {
        dwErrorCode = ERROR_INVALID_LEVEL;
        goto Cleanup;
    }

    // Check if the printer is set to do direct printing.
    // The Job List isn't used in this case.
    if (pPrinterHandle->pPrinter->dwAttributes & PRINTER_ATTRIBUTE_DIRECT)
    {
        dwErrorCode = ERROR_INVALID_ACCESS;
        goto Cleanup;
    }

    // Check if the supplied buffer is large enough.
    *pcbNeeded = sizeof(ADDJOB_INFO_1W) + GetJobFilePath(L"SPL", 0, NULL);
    if (cbBuf < *pcbNeeded)
    {
        dwErrorCode = ERROR_INSUFFICIENT_BUFFER;
        goto Cleanup;
    }

    // All requirements are met - create a new job.
    dwErrorCode = CreateJob(pPrinterHandle);
    if (dwErrorCode != ERROR_SUCCESS)
        goto Cleanup;

    // Mark that this job was started with AddJob (so that it can be scheduled for printing with ScheduleJob).
    pPrinterHandle->pJob->bAddedJob = TRUE;

    // Return a proper ADDJOB_INFO_1W structure.
    AddJobInfo1.JobId = pPrinterHandle->pJob->dwJobID;
    AddJobInfo1.Path = (PWSTR)(pData + sizeof(ADDJOB_INFO_1W));

    CopyMemory(pData, &AddJobInfo1, sizeof(ADDJOB_INFO_1W));
    GetJobFilePath(L"SPL", AddJobInfo1.JobId, AddJobInfo1.Path);

Cleanup:
    SetLastError(dwErrorCode);
    return (dwErrorCode == ERROR_SUCCESS);
}