Changeset 11909ce3 in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2024-01-21T15:48:43Z (4 months ago)
- Branches:
- master
- Children:
- 515f1b1
- Parents:
- 33e15a0
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-03-29 10:25:36)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-21 15:48:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
r33e15a0 r11909ce3 258 258 thread->thread_code = func; 259 259 thread->thread_arg = arg; 260 thread->ucycles = 0;261 thread->kcycles = 0;260 thread->ucycles = ATOMIC_TIME_INITIALIZER(); 261 thread->kcycles = ATOMIC_TIME_INITIALIZER(); 262 262 thread->uncounted = 263 263 ((flags & THREAD_FLAG_UNCOUNTED) == THREAD_FLAG_UNCOUNTED); … … 333 333 334 334 if (!thread->uncounted) { 335 thread->task->ucycles += thread->ucycles;336 thread->task->kcycles += thread->kcycles;335 thread->task->ucycles += atomic_time_read(&thread->ucycles); 336 thread->task->kcycles += atomic_time_read(&thread->kcycles); 337 337 } 338 338 … … 682 682 uint64_t ucycles, kcycles; 683 683 char usuffix, ksuffix; 684 order_suffix( thread->ucycles, &ucycles, &usuffix);685 order_suffix( thread->kcycles, &kcycles, &ksuffix);684 order_suffix(atomic_time_read(&thread->ucycles), &ucycles, &usuffix); 685 order_suffix(atomic_time_read(&thread->kcycles), &kcycles, &ksuffix); 686 686 687 687 state_t state = atomic_get_unordered(&thread->state); … … 788 788 void thread_update_accounting(bool user) 789 789 { 790 assert(interrupts_disabled()); 791 790 792 uint64_t time = get_cycle(); 791 793 792 assert(interrupts_disabled());793 assert(irq_spinlock_locked(&THREAD->lock));794 795 794 if (user) 796 THREAD->ucycles += time - THREAD->last_cycle;795 atomic_time_increment(&THREAD->ucycles, time - THREAD->last_cycle); 797 796 else 798 THREAD->kcycles += time - THREAD->last_cycle;797 atomic_time_increment(&THREAD->kcycles, time - THREAD->last_cycle); 799 798 800 799 THREAD->last_cycle = time;
Note:
See TracChangeset
for help on using the changeset viewer.