From: John L. <mov...@us...> - 2002-06-01 15:58:43
|
Update of /cvsroot/oprofile/oprofile/dae In directory usw-pr-cvs1:/tmp/cvs-serv30853/dae Modified Files: opd_image.c opd_image.h opd_proc.c Log Message: very minor changes Index: opd_image.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/opd_image.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- opd_image.c 22 May 2002 03:55:46 -0000 1.1 +++ opd_image.c 1 Jun 2002 15:58:37 -0000 1.2 @@ -164,7 +164,7 @@ opd_handle_old_sample_files(image); - /* samples files are lazily openeded */ + /* samples files are lazily opened */ } @@ -265,15 +265,16 @@ * * Returns the image pointer for the file specified by @name, or %NULL. */ -/* - * We make here a linear search through the whole image list. There is no need - * to improve performance, only /proc parsed app are hashless and when they - * are found one time by this function they receive a valid hash code. */ static struct opd_image * opd_find_image(char const * name, int hash, char const * app_name) { struct opd_image * image = 0; /* supress warn non initialized use */ struct list_head * pos; + /* We make here a linear search through the whole image list. There is no need + * to improve performance, only /proc parsed app are hashless and when they + * are found one time by this function they receive a valid hash code. + */ + list_for_each(pos, &opd_images) { image = list_entry(pos, struct opd_image, list_node); @@ -296,7 +297,7 @@ * are handled in a separate list */ if (hash != -1) { image->hash = hash; - if (image->hash_next) { /* parano check */ + if (image->hash_next) { /* paranoia check */ printf("error: image->hash_next != NULL and image->hash == -1\n"); exit(EXIT_FAILURE); } Index: opd_image.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/opd_image.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- opd_image.h 22 May 2002 03:55:46 -0000 1.1 +++ opd_image.h 1 Jun 2002 15:58:37 -0000 1.2 @@ -28,14 +28,14 @@ db_tree_t sample_files[OP_MAX_COUNTERS]; int hash; /* the application name where belongs this image, NULL if image has - * no owner (such as wmlinux or module) */ + * no owner (such as vmlinux or module) */ char const * app_name; - time_t mtime; /* image file mtime */ + time_t mtime; u8 kernel; char * name; }; -// FIXME: the wrong file, conceptually +// FIXME: the wrong file, conceptually - need a for_each_image possibly void opd_sync_sample_files(void); void opd_reopen_sample_files(void); void opd_image_cleanup(void); Index: opd_proc.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/opd_proc.c,v retrieving revision 1.120 retrieving revision 1.121 diff -u -d -r1.120 -r1.121 --- opd_proc.c 22 May 2002 03:55:46 -0000 1.120 +++ opd_proc.c 1 Jun 2002 15:58:37 -0000 1.121 @@ -87,61 +87,6 @@ /** - * opd_get_count - retrieve counter value - * @param count raw counter value - * - * Returns the counter value. - */ -inline static u16 opd_get_count(const u16 count) -{ - return (count & OP_COUNT_MASK); -} - -/** - * opd_get_counter - retrieve counter type - * @param count raw counter value - * - * Returns the counter number (0-N) - */ -inline static u16 opd_get_counter(const u16 count) -{ - return OP_COUNTER(count); -} - - -/** - * opd_put_image_sample - write sample to file - * @param image image for sample - * @param offset (file) offset to write to - * @param count raw counter value - * - * Add to the count stored at position @offset in the - * image file. Overflow pins the count at the maximum - * value. - * - * @count is the raw value passed from the kernel. - */ -void opd_put_image_sample(struct opd_image * image, u32 offset, u16 count) -{ - db_tree_t * sample_file; - int counter; - - counter = opd_get_counter(count); - sample_file = &image->sample_files[counter]; - - if (!sample_file->base_memory) { - opd_open_sample_file(image, counter); - if (!sample_file->base_memory) { - /* opd_open_sample_file output an error message */ - return; - } - } - - db_insert(sample_file, offset, opd_get_count(count)); -} - - -/** * opd_app_name - get the application name or %NULL if irrelevant * @param proc the process to examine * @@ -303,6 +248,63 @@ " end 0x%.8x, offset 0x%.8x, name \"%s\"\n", last_map, offset, map->start, map->end, map->offset, map->image->name); } + + +/** + * opd_get_count - retrieve counter value + * @param count raw counter value + * + * Returns the counter value. + */ +inline static u16 opd_get_count(const u16 count) +{ + return (count & OP_COUNT_MASK); +} + + +/** + * opd_get_counter - retrieve counter type + * @param count raw counter value + * + * Returns the counter number (0-N) + */ +inline static u16 opd_get_counter(const u16 count) +{ + return OP_COUNTER(count); +} + + +/** + * opd_put_image_sample - write sample to file + * @param image image for sample + * @param offset (file) offset to write to + * @param count raw counter value + * + * Add to the count stored at position @offset in the + * image file. Overflow pins the count at the maximum + * value. + * + * @count is the raw value passed from the kernel. + */ +void opd_put_image_sample(struct opd_image * image, u32 offset, u16 count) +{ + db_tree_t * sample_file; + int counter; + + counter = opd_get_counter(count); + sample_file = &image->sample_files[counter]; + + if (!sample_file->base_memory) { + opd_open_sample_file(image, counter); + if (!sample_file->base_memory) { + /* opd_open_sample_file output an error message */ + return; + } + } + + db_insert(sample_file, offset, opd_get_count(count)); +} + /** * opd_eip_is_kernel - is the sample from kernel/module space |