Programming Reference | Interfaces 12.8.13 Interface ITcRTimeTask | Interface ITcRTimeTask Query of extended TwinCAT task information. Syntax TCOM_DECL_INTERFACE("02000003-0000-0000-e000-000000000064", ITcRTimeTask) struct __declspec(novtable) ITcRTimeTask : public ITcTask Required include: TcRtInterfaces.h Methods TwinCAT task information can be queried and used with this interface. See Sample30: Timing Measurement [ } 300] 12.8.13.1 Method ITcRTimeTask::GetCpuAccount() | Method ITcRTimeTask::GetCpuAccount() Query of the CPU account of a TwinCAT task.
Syntax virtual HRESULT TCOMAPI GetCpuAccount(PULONG pAccount)=0; Return value If successful, S_OK ("0") or another positive value will be returned, cf. Return values [ } 161] . Extended messages refer in particular to the column HRESULT in ADS Return Codes [ } 323] . E_POINTER if the parameter pAccount = NULL. Parameter The GetCpuAccount() method can be used to query the current computing time used for the task. Code snippet showing the use of GetCpuAccount(), e.g. within an ITcCyclic::CycleUpdate() method: // CPU account in 100 ns interval ITcRTimeTaskPtr spRTimeTask = ipTask; ULONG nCpuAccountForComputeSomething = 0; if (spRTimeTask != NULL) { ULONG nStart = 0; hr = FAILED(hr) ? hr :
spRTimeTask->GetCpuAccount(&nStart); ComputeSomething(); ULONG nStop = 0; hr = FAILED(hr) ? hr : spRTimeTask->GetCpuAccount(&nStop); nCpuAccountForComputeSomething = nStop - nStart; } 12.8.14 Interface ITcTask | Interface ITcTask Query of the timestamp and task-specific information of a TwinCAT task. TwinCAT 3 183 Version: 1.19.1 Name Description GetCpuAccount [} 183] Query of the CPU account of a TwinCAT task. Name Type Description pAccount PULONG [out] TwinCAT Task CPU account is stored in this parameter.