Changeset 3d5bcded in rtems
- Timestamp:
- 10/03/14 19:01:44 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 04a13bd
- Parents:
- f7d2795
- git-author:
- Jennifer Averett <jennifer.averett@…> (10/03/14 19:01:44)
- git-committer:
- Jennifer Averett <jennifer.averett@…> (11/24/14 20:04:53)
- Location:
- cpukit/libmisc/capture
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libmisc/capture/capture.c
rf7d2795 r3d5bcded 314 314 } 315 315 316 void rtems_capture_ record_task( rtems_tcb* tcb )316 void rtems_capture_initialize_task( rtems_tcb* tcb ) 317 317 { 318 318 rtems_capture_control_t* control; 319 rtems_capture_task_record_t rec; 320 void* ptr; 321 322 rtems_object_get_classic_name( tcb->Object.id, &rec.name ); 319 rtems_name name; 323 320 324 321 /* … … 327 324 */ 328 325 326 rtems_object_get_classic_name( tcb->Object.id, &name ); 327 329 328 if (tcb->Capture.control == NULL) { 330 329 for (control = capture_controls; control != NULL; control = control->next) 331 330 if (rtems_capture_match_name_id (control->name, control->id, 332 rec.name, tcb->Object.id))331 name, tcb->Object.id)) 333 332 tcb->Capture.control = control; 334 333 } 335 334 335 tcb->Capture.flags |= RTEMS_CAPTURE_INIT_TASK; 336 } 337 338 void rtems_capture_record_task( rtems_tcb* tcb ) 339 { 340 rtems_capture_task_record_t rec; 341 void* ptr; 342 343 rtems_object_get_classic_name( tcb->Object.id, &rec.name ); 344 336 345 rec.stack_size = tcb->Start.Initial_stack.size; 337 346 rec.start_priority = _RTEMS_tasks_Priority_from_Core( … … 1225 1234 uint32_t counted; 1226 1235 size_t ptr_size = 0; 1236 size_t rel_size = 0; 1237 rtems_status_code ret_val = RTEMS_SUCCESSFUL; 1227 1238 1228 1239 rtems_interrupt_lock_acquire (&capture_lock, &lock_context); … … 1238 1249 _Assert(ptr_size >= (count * sizeof(*rec) )); 1239 1250 1240 ptr_size = 0;1251 rel_size = 0; 1241 1252 while (counted--) 1242 { 1253 { 1243 1254 rec = (rtems_capture_record_t*) ptr; 1244 ptr_size += rec->size; 1255 rel_size += rec->size; 1256 _Assert( rel_size <= ptr_size ); 1245 1257 ptr += rec->size; 1246 1258 } … … 1248 1260 rtems_interrupt_lock_acquire (&capture_lock, &lock_context); 1249 1261 1262 if (rel_size > ptr_size ) { 1263 ret_val = RTEMS_INVALID_NUMBER; 1264 rel_size = ptr_size; 1265 } 1266 1250 1267 capture_count -= count; 1251 1268 1252 1269 if (count) 1253 rtems_capture_buffer_free( &capture_records, ptr_size );1270 rtems_capture_buffer_free( &capture_records, rel_size ); 1254 1271 1255 1272 capture_flags &= ~RTEMS_CAPTURE_READER_ACTIVE; … … 1257 1274 rtems_interrupt_lock_release (&capture_lock, &lock_context); 1258 1275 1259 return RTEMS_SUCCESSFUL;1276 return ret_val; 1260 1277 } 1261 1278 -
cpukit/libmisc/capture/capture.h
rf7d2795 r3d5bcded 142 142 */ 143 143 #define RTEMS_CAPTURE_TRACED (1U << 0) 144 #define RTEMS_CAPTURE_RECORD_TASK (1U << 1) 144 #define RTEMS_CAPTURE_INIT_TASK (1U << 1) 145 #define RTEMS_CAPTURE_RECORD_TASK (1U << 2) 145 146 146 147 /* … … 599 600 600 601 /** 602 * @brief Capture initialize task 603 * 604 * This function initializes capture control in the tcb. 605 * 606 * @param[in] tcb is the task control block for the task 607 */ 608 void rtems_capture_initialize_task( rtems_tcb* tcb ); 609 610 /** 601 611 * @brief Capture record task. 602 612 * … … 617 627 static inline bool rtems_capture_task_recorded( rtems_tcb* tcb ) { 618 628 return ( (tcb->Capture.flags & RTEMS_CAPTURE_RECORD_TASK) != 0 ); 629 } 630 631 /** 632 * @brief Capture task initialized 633 * 634 * This function returns true if this task information has been 635 * initialized. 636 * 637 * @param[in] tcb is the task control block for the task 638 */ 639 static inline bool rtems_capture_task_initialized( rtems_tcb* tcb ) { 640 return ( (tcb->Capture.flags & RTEMS_CAPTURE_INIT_TASK) != 0 ); 619 641 } 620 642 -
cpukit/libmisc/capture/capture_user_extension.c
rf7d2795 r3d5bcded 96 96 if (rtems_capture_filter( tcb, events) ) 97 97 return; 98 99 if (!rtems_capture_task_recorded (tcb)) 100 rtems_capture_record_task (tcb); 98 101 99 102 rtems_capture_begin_add_record (tcb, events, size, &ptr); … … 142 145 */ 143 146 144 if (!rtems_capture_task_ recorded (ct))145 rtems_capture_ record_task (ct);147 if (!rtems_capture_task_initialized (ct)) 148 rtems_capture_initialize_task (ct); 146 149 147 150 /* 148 151 * Create the new task's capture control block. 149 152 */ 150 rtems_capture_ record_task (nt);153 rtems_capture_initialize_task (nt); 151 154 152 155 if (rtems_capture_trigger (ct, nt, RTEMS_CAPTURE_CREATE)) … … 171 174 */ 172 175 173 if (!rtems_capture_task_ recorded (ct))174 rtems_capture_ record_task (ct);176 if (!rtems_capture_task_initialized (ct)) 177 rtems_capture_initialize_task (ct); 175 178 176 179 if (st == NULL) 177 rtems_capture_ record_task (st);180 rtems_capture_initialize_task (st); 178 181 179 182 if (rtems_capture_trigger (ct, st, RTEMS_CAPTURE_START)) … … 196 199 */ 197 200 198 if (!rtems_capture_task_ recorded (ct))199 rtems_capture_ record_task (ct);200 201 if (!rtems_capture_task_ recorded (rt))202 rtems_capture_ record_task (rt);201 if (!rtems_capture_task_initialized (ct)) 202 rtems_capture_initialize_task (ct); 203 204 if (!rtems_capture_task_initialized (rt)) 205 rtems_capture_initialize_task (rt); 203 206 204 207 if (rtems_capture_trigger (ct, rt, RTEMS_CAPTURE_RESTART)) … … 216 219 rtems_tcb* dt) 217 220 { 218 if (!rtems_capture_task_ recorded (ct))219 rtems_capture_ record_task (ct);220 221 if (!rtems_capture_task_ recorded (dt))222 rtems_capture_ record_task (dt);221 if (!rtems_capture_task_initialized (ct)) 222 rtems_capture_initialize_task (ct); 223 224 if (!rtems_capture_task_initialized (dt)) 225 rtems_capture_initialize_task (dt); 223 226 224 227 if (rtems_capture_trigger (ct, dt, RTEMS_CAPTURE_DELETE)) … … 240 243 */ 241 244 242 if (!rtems_capture_task_ recorded (bt))243 rtems_capture_ record_task (bt);245 if (!rtems_capture_task_initialized (bt)) 246 rtems_capture_initialize_task (bt); 244 247 245 248 if (rtems_capture_trigger (NULL, bt, RTEMS_CAPTURE_BEGIN)) … … 259 262 */ 260 263 261 if (!rtems_capture_task_ recorded (et))262 rtems_capture_ record_task (et);264 if (!rtems_capture_task_initialized (et)) 265 rtems_capture_initialize_task (et); 263 266 264 267 if (rtems_capture_trigger (NULL, et, RTEMS_CAPTURE_EXITTED)) … … 277 280 */ 278 281 279 if (!rtems_capture_task_ recorded (tt))280 rtems_capture_ record_task (tt);282 if (!rtems_capture_task_initialized (tt)) 283 rtems_capture_initialize_task (tt); 281 284 282 285 if (rtems_capture_trigger (NULL, tt, RTEMS_CAPTURE_TERMINATED)) … … 301 304 rtems_capture_time_t time; 302 305 303 if (!rtems_capture_task_ recorded (ct))304 rtems_capture_ record_task (ct);305 306 if (!rtems_capture_task_ recorded (ht))307 rtems_capture_ record_task (ht);306 if (!rtems_capture_task_initialized (ct)) 307 rtems_capture_initialize_task (ct); 308 309 if (!rtems_capture_task_initialized (ht)) 310 rtems_capture_initialize_task (ht); 308 311 309 312 /*
Note: See TracChangeset
for help on using the changeset viewer.