Hi Dave, Thanks for the detailed feedback. I'm going to keep this x86_64 specific for now but will definitely explore other arch-specific logic. Cheers, Aaron ----- Original Message ----- From: "Dave Anderson" <anderson@xxxxxxxxxx> To: "Discussion list for crash utility usage, maintenance and development" <crash-utility@xxxxxxxxxx> Sent: Monday, January 28, 2013 4:10:52 PM Subject: Re: Thoughts on swap_usage Crash extension? ----- Original Message ----- > Hi, > > This is a trivial crash extension to report the actual swap > consumption of each user process. > What do you think, any suggestions [1]? > > For example: > > crash> ps tuned > PID PPID CPU TASK ST %MEM VSZ RSS COMM > 1237 1 20 ffff8805418d7500 IN 0.0 174728 1664 tuned > crash> vm -p 1237 | grep SWAP | wc -l > 974 > crash> extend swap_usage.so > ./swap_usage.so: shared object loaded > crash> swap_usage | grep tuned > 1237 3896 tuned > crash> p/d 974 << 2 > $3 = 3896 > crash> > > Thanks, > Aaron > --- > [1]: > https://github.com/aktlin115/crash-extension/blob/f5667ca9e4a521c0aaa31303fb74c169ac0b0efd/swap_usage.c Hi Anton, A couple suggestions: The _PAGE_FILE usage is x86-specific, so you're going to have have to either restrict its use in the MEMBER_NOT_FOUND case, or come up with other arch-specific logic. In fact, it wouldn't compile on anything other than x86_64. If you set up your cmd_swap_usage() function to check for arguments, you can specify task/pid numbers as arguments in order to avoid the "pipe-to-grep" requirement: while (args[optind]) { switch (str_to_context(args[optind], &value, &tc)) { case STR_PID: for (tc = pid_to_context(value); tc; tc = tc->tc_next) { show_swap_usage(tc, exists); } break; case STR_TASK: show_swap_usage(tc, exists); break; case STR_INVALID: error(INFO, "invalid task or pid value: %s\n", args[optind]); break; } subsequent++; optind++; } And a "help" page would be nice... Thanks, Dave -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility