NvBlastTkGroup.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTTKGROUP_H
30 #define NVBLASTTKGROUP_H
31 
32 #include "NvBlastTkIdentifiable.h"
33 
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
40 // Forward declarations
41 class TkActor;
42 
43 
49 {
50  uint32_t workerCount;
51 };
52 
53 
59 {
62  int64_t workerTime;
63 };
64 
65 
75 {
76 public:
82  virtual void process(uint32_t jobId) = 0;
83 };
84 
85 
101 class TkGroup : public TkIdentifiable
102 {
103 public:
111  virtual bool addActor(TkActor& actor) = 0;
112 
118  virtual uint32_t getActorCount() const = 0;
119 
129  virtual uint32_t getActors(TkActor** buffer, uint32_t bufferSize, uint32_t indexStart = 0) const = 0;
130 
137  virtual uint32_t startProcess() = 0;
138 
149  virtual bool endProcess() = 0;
150 
154  virtual void setWorkerCount(uint32_t workerCount) = 0;
155 
159  virtual uint32_t getWorkerCount() const = 0;
160 
167  virtual TkGroupWorker* acquireWorker() = 0;
168 
174  virtual void returnWorker(TkGroupWorker*) = 0;
175 
179  void process();
180 
187  virtual void getStats(TkGroupStats& stats) const = 0;
188 };
189 
190 } // namespace Blast
191 } // namespace Nv
192 
193 
195 {
196  uint32_t jobCount = startProcess();
197  if (jobCount > 0)
198  {
199  TkGroupWorker* worker = acquireWorker();
200  for (uint32_t i = 0; i < jobCount; i++)
201  {
202  worker->process(i);
203  }
204  returnWorker(worker);
205  }
206  endProcess();
207 }
208 
209 
210 #endif // ifndef NVBLASTTKGROUP_H
uint32_t workerCount
The number of expected TkWorkers to process the TkGroup concurrently.
Definition: NvBlastTkGroup.h:50
void process()
Definition: NvBlastTkGroup.h:194
virtual void process(uint32_t jobId)=0
Definition: NvBlastTkActor.h:57
int64_t workerTime
Accumulated time spent executing TkWorker::run. Unit is ticks, see NvBlastTimers. ...
Definition: NvBlastTkGroup.h:62
NvBlastTimers timers
Accumulated time spent in blast low-level functions, see NvBlastTimers.
Definition: NvBlastTkGroup.h:60
Definition: NvBlastTkGroup.h:48
Definition: NvBlastTkGroup.h:58
Definition: NvBlastTypes.h:85
Definition: NvBlastTkIdentifiable.h:50
Definition: NvBlastTkGroup.h:74
Definition: NvBlastTkGroup.h:101
uint32_t processedActorsCount
Accumulated number of processed actors in all TkWorker.
Definition: NvBlastTkGroup.h:61
Definition: NvBlastExtAuthoring.h:34