+/*
+ * task_rollup_accounting_info
+ *
+ * Roll up accounting stats. Used to rollup stats
+ * for exec copy task and corpse fork.
+ */
+void
+task_rollup_accounting_info(task_t to_task, task_t from_task)
+{
+ assert(from_task != to_task);
+
+ to_task->total_user_time = from_task->total_user_time;
+ to_task->total_system_time = from_task->total_system_time;
+ to_task->total_ptime = from_task->total_ptime;
+ to_task->faults = from_task->faults;
+ to_task->pageins = from_task->pageins;
+ to_task->cow_faults = from_task->cow_faults;
+ to_task->messages_sent = from_task->messages_sent;
+ to_task->messages_received = from_task->messages_received;
+ to_task->syscalls_mach = from_task->syscalls_mach;
+ to_task->syscalls_unix = from_task->syscalls_unix;
+ to_task->c_switch = from_task->c_switch;
+ to_task->p_switch = from_task->p_switch;
+ to_task->ps_switch = from_task->ps_switch;
+ to_task->extmod_statistics = from_task->extmod_statistics;
+ to_task->low_mem_notified_warn = from_task->low_mem_notified_warn;
+ to_task->low_mem_notified_critical = from_task->low_mem_notified_critical;
+ to_task->purged_memory_warn = from_task->purged_memory_warn;
+ to_task->purged_memory_critical = from_task->purged_memory_critical;
+ to_task->low_mem_privileged_listener = from_task->low_mem_privileged_listener;
+ *to_task->task_io_stats = *from_task->task_io_stats;
+ to_task->cpu_time_qos_stats = from_task->cpu_time_qos_stats;
+ to_task->task_timer_wakeups_bin_1 = from_task->task_timer_wakeups_bin_1;
+ to_task->task_timer_wakeups_bin_2 = from_task->task_timer_wakeups_bin_2;
+ to_task->task_gpu_ns = from_task->task_gpu_ns;
+ to_task->task_immediate_writes = from_task->task_immediate_writes;
+ to_task->task_deferred_writes = from_task->task_deferred_writes;
+ to_task->task_invalidated_writes = from_task->task_invalidated_writes;
+ to_task->task_metadata_writes = from_task->task_metadata_writes;
+ to_task->task_energy = from_task->task_energy;
+
+ /* Skip ledger roll up for memory accounting entries */
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.cpu_time);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.platform_idle_wakeups);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.interrupt_wakeups);
+#if CONFIG_SCHED_SFI
+ for (sfi_class_id_t class_id = SFI_CLASS_UNSPECIFIED; class_id < MAX_SFI_CLASS_ID; class_id++) {
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.sfi_wait_times[class_id]);
+ }
+#endif
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.cpu_time_billed_to_me);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.cpu_time_billed_to_others);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.physical_writes);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.logical_writes);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.energy_billed_to_me);
+ ledger_rollup_entry(to_task->ledger, from_task->ledger, task_ledgers.energy_billed_to_others);
+}
+