summaryrefslogtreecommitdiff
path: root/kern/profile.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-04-05 06:39:21 +0000
committerRoland McGrath <roland@gnu.org>2001-04-05 06:39:21 +0000
commitb42bd0d675ec7d1e1fbbf274fadbea984c8dab22 (patch)
treea7f61083f2dfa365d5d9e7101c72e8cb5b3b16a9 /kern/profile.c
parent2d43f4abdedd003eb070d633bac0e3a6fb3a746b (diff)
2001-04-04 Roland McGrath <roland@frob.com>
* ddb/db_access.h: Fix obsolescent #else/#endif syntax. * ddb/db_aout.c: Likewise. * ddb/db_break.c: Likewise. * ddb/db_break.h: Likewise. * ddb/db_command.c: Likewise. * ddb/db_command.h: Likewise. * ddb/db_cond.c: Likewise. * ddb/db_examine.c: Likewise. * ddb/db_expr.c: Likewise. * ddb/db_ext_symtab.c: Likewise. * ddb/db_input.c: Likewise. * ddb/db_lex.c: Likewise. * ddb/db_macro.c: Likewise. * ddb/db_mp.c: Likewise. * ddb/db_output.c: Likewise. * ddb/db_print.c: Likewise. * ddb/db_run.c: Likewise. * ddb/db_sym.c: Likewise. * ddb/db_task_thread.c: Likewise. * ddb/db_task_thread.h: Likewise. * ddb/db_trap.c: Likewise. * ddb/db_variables.c: Likewise. * ddb/db_watch.c: Likewise. * ddb/db_watch.h: Likewise. * ddb/db_write_cmd.c: Likewise. * device/dev_pager.c: Likewise. * device/device_port.h: Likewise. * device/device_types_kernel.h: Likewise. * device/ds_routines.h: Likewise. * device/errno.h: Likewise. * device/if_ether.h: Likewise. * device/if_hdr.h: Likewise. * device/io_req.h: Likewise. * device/net_io.c: Likewise. * device/net_io.h: Likewise. * i386/i386/ast_check.c: Likewise. * i386/i386/cswitch.S: Likewise. * i386/i386/db_disasm.c: Likewise. * i386/i386/db_interface.c: Likewise. * i386/i386/db_trace.c: Likewise. * i386/i386/debug.h: Likewise. * i386/i386/debug_i386.c: Likewise. * i386/i386/debug_trace.S: Likewise. * i386/i386/eflags.h: Likewise. * i386/i386/gdt.h: Likewise. * i386/i386/hardclock.c: Likewise. * i386/i386/idt-gen.h: Likewise. * i386/i386/ipl.h: Likewise. * i386/i386/ktss.h: Likewise. * i386/i386/kttd_interface.c: Likewise. * i386/i386/ldt.h: Likewise. * i386/i386/lock.h: Likewise. * i386/i386/locore.S: Likewise. * i386/i386/mp_desc.h: Likewise. * i386/i386/pic.c: Likewise. * i386/i386/pic.h: Likewise. * i386/i386/pio.h: Likewise. * i386/i386/pit.h: Likewise. * i386/i386/seg.h: Likewise. * i386/i386/thread.h: Likewise. * i386/i386/trap.c: Likewise. * i386/i386/trap.h: Likewise. * i386/i386/vm_param.h: Likewise. * i386/i386/vm_tuning.h: Likewise. * i386/i386at/autoconf.c: Likewise. * i386/i386at/blit.c: Likewise. * i386/i386at/conf.c: Likewise. * i386/i386at/fd.c: Likewise. * i386/i386at/idt.h: Likewise. * i386/i386at/immc.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/model_dep.c: Likewise. * i386/i386at/rtc.c: Likewise. * i386/include/mach/i386/asm.h: Likewise. * i386/include/mach/i386/eflags.h: Likewise. * i386/include/mach/i386/mach_i386.defs: Likewise. * i386/include/mach/i386/multiboot.h: Likewise. * i386/include/mach/i386/trap.h: Likewise. * i386/include/mach/i386/vm_types.h: Likewise. * i386/include/mach/sa/stdarg.h: Likewise. * i386/intel/pmap.c: Likewise. * i386/intel/pmap.h: Likewise. * include/alloca.h: Likewise. * include/device/device_types.defs: Likewise. * include/device/device_types.h: Likewise. * include/device/disk_status.h: Likewise. * include/device/net_status.h: Likewise. * include/mach/mach.defs: Likewise. * include/mach/memory_object.defs: Likewise. * include/mach/std_types.defs: Likewise. * include/mach_debug/hash_info.h: Likewise. * include/mach_debug/ipc_info.h: Likewise. * include/mach_debug/mach_debug.defs: Likewise. * include/mach_debug/mach_debug_types.defs: Likewise. * include/mach_debug/mach_debug_types.h: Likewise. * include/mach_debug/vm_info.h: Likewise. * include/mach_debug/zone_info.h: Likewise. * include/sys/ioctl.h: Likewise. * include/sys/time.h: Likewise. * ipc/ipc_entry.h: Likewise. * ipc/ipc_hash.h: Likewise. * ipc/ipc_init.c: Likewise. * ipc/ipc_kmsg.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_marequest.c: Likewise. * ipc/ipc_marequest.h: Likewise. * ipc/ipc_mqueue.c: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_notify.c: Likewise. * ipc/ipc_notify.h: Likewise. * ipc/ipc_object.c: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.c: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_pset.c: Likewise. * ipc/ipc_pset.h: Likewise. * ipc/ipc_right.c: Likewise. * ipc/ipc_right.h: Likewise. * ipc/ipc_space.c: Likewise. * ipc/ipc_space.h: Likewise. * ipc/mach_debug.c: Likewise. * ipc/mach_msg.c: Likewise. * ipc/mach_msg.h: Likewise. * ipc/mach_port.c: Likewise. * kern/act.c: Likewise. * kern/assert.h: Likewise. * kern/ast.c: Likewise. * kern/ast.h: Likewise. * kern/bootstrap.c: Likewise. * kern/counters.c: Likewise. * kern/counters.h: Likewise. * kern/debug.h: Likewise. * kern/exception.c: Likewise. * kern/host.h: Likewise. * kern/ipc_host.c: Likewise. * kern/ipc_host.h: Likewise. * kern/ipc_kobject.c: Likewise. * kern/ipc_mig.c: Likewise. * kern/ipc_tt.c: Likewise. * kern/ipc_tt.h: Likewise. * kern/kalloc.h: Likewise. * kern/lock_mon.c: Likewise. * kern/mach_clock.c: Likewise. * kern/mach_factor.c: Likewise. * kern/mach_param.h: Likewise. * kern/machine.c: Likewise. * kern/processor.c: Likewise. * kern/profile.c: Likewise. * kern/queue.h: Likewise. * kern/sched.h: Likewise. * kern/startup.c: Likewise. * kern/syscall_emulation.h: Likewise. * kern/syscall_subr.c: Likewise. * kern/syscall_subr.h: Likewise. * kern/syscall_sw.c: Likewise. * kern/syscall_sw.h: Likewise. * kern/task.h: Likewise. * kern/thread_swap.h: Likewise. * kern/time_out.h: Likewise. * kern/time_stamp.c: Likewise. * kern/time_stamp.h: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * kern/xpr.c: Likewise. * kern/xpr.h: Likewise. * kern/zalloc.c: Likewise. * kern/zalloc.h: Likewise. * linux/dev/drivers/block/ide.c: Likewise. * linux/dev/include/linux/blk.h: Likewise. * linux/src/include/linux/cdrom.h: Likewise. * linux/src/include/linux/md.h: Likewise. * util/cpu.h: Likewise. * vm/memory_object.c: Likewise. * vm/memory_object.h: Likewise. * vm/pmap.h: Likewise. * vm/vm_debug.c: Likewise. * vm/vm_external.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_fault.h: Likewise. * vm/vm_kern.h: Likewise. * vm/vm_map.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_pageout.c: Likewise. * vm/vm_pageout.h: Likewise. * vm/vm_user.h: Likewise.
Diffstat (limited to 'kern/profile.c')
-rw-r--r--kern/profile.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/kern/profile.c b/kern/profile.c
index 75139347..e14d4116 100644
--- a/kern/profile.c
+++ b/kern/profile.c
@@ -31,7 +31,7 @@
* Grenoble, FRANCE
*
* All Rights Reserved
- *
+ *
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appears in all copies and
@@ -40,7 +40,7 @@
* Foundation not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission.
- *
+ *
* OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
@@ -63,7 +63,7 @@ extern vm_map_t kernel_map; /* can be discarded, defined in <vm/vm_kern.h> */
thread_t profile_thread_id = THREAD_NULL;
-void profile_thread()
+void profile_thread()
{
struct message {
mach_msg_header_t head;
@@ -84,11 +84,11 @@ void profile_thread()
/* Template initialisation of header and type structures */
msg.head.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, MACH_MSG_TYPE_MAKE_SEND_ONCE);
- msg.head.msgh_size = sizeof(msg);
+ msg.head.msgh_size = sizeof(msg);
msg.head.msgh_local_port = MACH_PORT_NULL;
msg.head.msgh_kind = MACH_MSGH_KIND_NORMAL;
msg.head.msgh_id = 666666;
-
+
msg.type.msgt_name = MACH_MSG_TYPE_INTEGER_32;
msg.type.msgt_size = 32;
msg.type.msgt_number = SIZE_PROF_BUFFER+1;
@@ -105,7 +105,7 @@ void profile_thread()
splx(s);
if ((buf_entry = (buf_to_send_t) prof_queue_entry) == NULLBTS)
- {
+ {
thread_sleep((event_t) profile_thread, lock, TRUE);
if (current_thread()->wait_result != THREAD_AWAKENED)
break;
@@ -118,30 +118,30 @@ void profile_thread()
int imax;
curr_th = (thread_t) buf_entry->thread;
- curr_buf = (int) buf_entry->number;
+ curr_buf = (int) buf_entry->number;
pbuf = curr_th->profil_buffer;
/* Set the remote port */
msg.head.msgh_remote_port = (mach_port_t) pbuf->prof_port;
-
+
sample = pbuf->prof_area[curr_buf].p_zone;
imax = pbuf->prof_area[curr_buf].p_index;
for(j=0 ;j<imax; j++,sample++)
- msg.arg[j] = *sample;
+ msg.arg[j] = *sample;
/* Let hardclock() know you've finished the dirty job */
pbuf->prof_area[curr_buf].p_full = FALSE;
/*
- * Store the number of samples actually sent
+ * Store the number of samples actually sent
* as the last element of the array.
*/
msg.arg[SIZE_PROF_BUFFER] = imax;
- mr = mach_msg(&(msg.head), MACH_SEND_MSG,
- sizeof(struct message), 0,
- MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE,
+ mr = mach_msg(&(msg.head), MACH_SEND_MSG,
+ sizeof(struct message), 0,
+ MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE,
MACH_PORT_NULL);
if (mr != MACH_MSG_SUCCESS) {
@@ -192,10 +192,10 @@ thread_t th;
/* Ask for the sending of the last PC buffer.
* Make a request to the profile_thread by inserting
- * the buffer in the send queue, and wake it up.
+ * the buffer in the send queue, and wake it up.
* The last buffer must be inserted at the head of the
- * send queue, so the profile_thread handles it immediatly.
- */
+ * send queue, so the profile_thread handles it immediatly.
+ */
if (kmem_alloc( kernel_map, &vm_buf_entry,
sizeof(struct buf_to_send)) != KERN_SUCCESS)
return;
@@ -212,7 +212,7 @@ thread_t th;
mpenqueue_tail( &prof_queue, &(buf_entry->list));
thread_wakeup((event_t) profile_thread);
assert_wait((event_t) &buf_entry->wakeme, TRUE);
- splx(s);
+ splx(s);
thread_block((void (*)()) 0);
} else {
splx(s);
@@ -228,26 +228,26 @@ profile(pc) {
/* Find out which thread has been interrupted. */
thread_t it_thread = current_thread();
- int inout_val = pc;
+ int inout_val = pc;
buf_to_send_t buf_entry;
vm_offset_t vm_buf_entry;
int *val;
/*
- * Test if the current thread is to be sampled
+ * Test if the current thread is to be sampled
*/
if (it_thread->thread_profiled) {
/* Inserts the PC value in the buffer of the thread */
- set_pbuf_value(it_thread->profil_buffer, &inout_val);
+ set_pbuf_value(it_thread->profil_buffer, &inout_val);
switch(inout_val) {
- case 0:
+ case 0:
if (profile_thread_id == THREAD_NULL) {
reset_pbuf_area(it_thread->profil_buffer);
} else printf("ERROR : hardclock : full buffer unsent\n");
break;
- case 1:
+ case 1:
/* Normal case, value successfully inserted */
break;
- case 2 :
+ case 2 :
/*
* The value we have just inserted caused the
* buffer to be full, and ready to be sent.
@@ -279,8 +279,8 @@ profile(pc) {
thread_wakeup((event_t) profile_thread);
break;
- default:
- printf("ERROR: profile : unexpected case\n");
+ default:
+ printf("ERROR: profile : unexpected case\n");
}
}
}
@@ -295,12 +295,12 @@ ipc_space_t task;
ipc_object_t reply;
thread_t cur_thread;
{
-/*
+/*
* This routine is called every time that a new thread has made
- * a request for the sampling service. We must keep track of the
+ * a request for the sampling service. We must keep track of the
* correspondance between it's identity (cur_thread) and the port
- * we are going to use as a reply port to send out the samples resulting
- * from its execution.
+ * we are going to use as a reply port to send out the samples resulting
+ * from its execution.
*/
prof_data_t pbuf;
vm_offset_t vmpbuf;
@@ -341,7 +341,7 @@ printf("ERROR:mach_sample_thread:cannot set pbuf_nb\n");
cur_thread->thread_profiled_own = FALSE;
cur_thread->thread_profiled = FALSE;
- dealloc_pbuf_area(cur_thread->profil_buffer);
+ dealloc_pbuf_area(cur_thread->profil_buffer);
cur_thread->profil_buffer = NULLPBUF;
}
@@ -385,8 +385,8 @@ task_t cur_task;
if (turnon && profile_thread_id == THREAD_NULL)
profile_thread_id =
kernel_thread(current_task(), profile_thread);
- cur_task->task_profiled = turnon;
- actual = cur_task->thread_count;
+ cur_task->task_profiled = turnon;
+ actual = cur_task->thread_count;
sentone = 0;
for (i=0, thread=(thread_t) queue_first(&cur_task->thread_list);
i < actual;
@@ -402,7 +402,7 @@ task_t cur_task;
}
}
if (!turnon) {
- dealloc_pbuf_area(pbuf);
+ dealloc_pbuf_area(pbuf);
cur_task->profil_buffer = NULLPBUF;
}
}
@@ -410,4 +410,4 @@ task_t cur_task;
return KERN_SUCCESS;
}
-#endif 0
+#endif /* 0 */