[Swift-commit] r6083 - trunk/libexec

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Nov 27 10:01:57 CST 2012


Author: wilde
Date: 2012-11-27 10:01:57 -0600 (Tue, 27 Nov 2012)
New Revision: 6083

Modified:
   trunk/libexec/_swiftwrap
Log:
Added time command around non-provider-staging non-kickstart app execution. Awlays on - not yet an option. Adds APP_RESOURCES tag to info file via a local file in the job dir.

Modified: trunk/libexec/_swiftwrap
===================================================================
--- trunk/libexec/_swiftwrap	2012-11-27 15:59:25 UTC (rev 6082)
+++ trunk/libexec/_swiftwrap	2012-11-27 16:01:57 UTC (rev 6083)
@@ -1,3 +1,4 @@
+
 #!/bin/bash
 # this script must be invoked inside of bash, not plain sh
 # note that this script modifies $IFS
@@ -475,17 +476,31 @@
 	fail 254 "The executable $EXEC does not have the executable bit set"
 fi
 if [ "$KICKSTART" == "" ]; then
+
+    TIMEARGS="-o swiftapp.resources -f APP_RESOURCES=real_time:%E,real_secs:%e,kernel_secs:%S,user_secs:%U,percent_cpu:%P,max_rss:%M,avg_rss:%t,avg_tot_vm:%K,avg_priv_data:%D,avg_priv_stack:%p,avg_shared_text:%X,page_size:%Z,major_pgfaults:%F,minor_pgfaults:%R,swaps:%W,invol_context_switches:%c,vol_waits%w,fs_reads:%I,fs_writes:%O,sock_recv:%r,sock_send:%s,signals:%k,exit_status:%x,command:%C"
+
+    if [ -x /usr/bin/time ]; then
+        TIMECMD="/usr/bin/time"
+    elif [ -x $HOME/swift.time ]; then
+        TIMECMD="$HOME/swift.time"
+    else
+        TIMECMD=""
+		TIMEARGS=""
+    fi
 	if [ "$STDIN" == "" ]; then
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts
 		fi
-		"$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
+		eval $TIMECMD $TIMEARGS "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
 	else
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts
 		fi
-		"$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR" <"$STDIN"
+		eval $TIMECMD $TIMEARGS "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR" <"$STDIN"
 	fi
+    if [ "_$TIMECMD" != _ ]; then
+		log "$(cat swiftapp.resources)"
+    fi
 	checkError $? "Application $EXEC failed with an exit code of $?"
 else
 	if [ ! -f "$KICKSTART" ]; then




More information about the Swift-commit mailing list