-
Notifications
You must be signed in to change notification settings - Fork 11
chore(config): remove .codeclimate.yml and add new log helper scripts
#1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to extract and match "runs as process" lines with their corresponding "cpu time DFA" lines | ||
| # Usage: ./extractProcessAndTimes <logfile> | ||
|
|
||
| if [ $# -eq 0 ]; then | ||
| echo "Usage: $0 <logfile>" | ||
| echo "Example: $0 runAna4ProbAna_20250917_14h34m46s.log" | ||
| exit 1 | ||
| fi | ||
|
|
||
| logFile="$1" | ||
|
|
||
| if [ ! -f "$logFile" ]; then | ||
| echo "Error: File '$logFile' not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Extracting process and timing information from: $logFile" | ||
| echo "================================================================" | ||
| echo | ||
|
|
||
| # Create temporary files to store the extracted data | ||
| processLines=$(mktemp) | ||
| timingLines=$(mktemp) | ||
|
|
||
| # Extract all "runs as process" lines with line numbers | ||
| grep -n "runs as process" "$logFile" > "$processLines" | ||
|
|
||
| # Extract all "cpu time DFA" lines with line numbers | ||
| grep -n "cpu time DFA" "$logFile" > "$timingLines" | ||
|
|
||
| # Function to extract process ID from a line | ||
| getProcessId() { | ||
| echo "$1" | cut -d',' -f1 | cut -d':' -f2 | ||
| } | ||
|
|
||
| # Function to extract simulation name from process line | ||
| getSimName() { | ||
| echo "$1" | sed 's/.*INFO - \(.*\) runs as process.*/\1/' | ||
| } | ||
|
|
||
| # Function to extract CPU time from timing line | ||
| getCpuTime() { | ||
| echo "$1" | sed 's/.*cpu time DFA = \([0-9.]*\) s.*/\1/' | ||
|
fso42 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| # Counter for matched pairs | ||
| counter=1 | ||
|
|
||
| echo "Matched Process and Timing Pairs:" | ||
| echo "==================================" | ||
|
|
||
| # Read process lines and find matching timing lines | ||
| while IFS= read -r processLine; do | ||
| processId=$(getProcessId "$processLine") | ||
| simName=$(getSimName "$processLine") | ||
| processLineNum=$(echo "$processLine" | cut -d':' -f1) | ||
|
|
||
| # Find the next timing line with the same process ID that comes after this process line | ||
| matchingTiming=$(awk -F: -v pid="$processId" -v startLine="$processLineNum" ' | ||
| $1 > startLine && $2 ~ "^"pid"," && /cpu time DFA/ { | ||
| print $0 | ||
| exit | ||
| } | ||
| ' "$timingLines") | ||
|
|
||
| if [ -n "$matchingTiming" ]; then | ||
| cpuTime=$(getCpuTime "$matchingTiming") | ||
| printf "%2d. %-30s (PID: %s) → CPU time: %ss\n" "$counter" "$simName" "$processId" "$cpuTime" | ||
| ((counter++)) | ||
| fi | ||
|
|
||
| done < "$processLines" | ||
|
|
||
| echo | ||
| echo "Summary:" | ||
| echo "========" | ||
| echo "Total matched pairs: $((counter-1))" | ||
|
|
||
| # Count simulations per process ID | ||
| echo "Process distribution:" | ||
| for pid in $(cut -d',' -f1 "$processLines" | cut -d':' -f2 | sort -u); do | ||
|
fso42 marked this conversation as resolved.
|
||
| count=$(grep -c "^[0-9]*:$pid," "$processLines") | ||
| echo " Process $pid: $count simulations" | ||
| done | ||
|
|
||
| # Clean up temporary files | ||
| rm "$processLines" "$timingLines" | ||
|
|
||
| echo | ||
| echo "Script completed successfully!" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Enhanced script to extract and match simulations with their parameters and timing | ||
| # Usage: ./extractProcessTimesAndParams <logfile> | ||
|
|
||
| if [ $# -eq 0 ]; then | ||
| echo "Usage: $0 <logfile>" | ||
| echo "Example: $0 runAna4ProbAna_20250917_14h34m46s.log" | ||
| exit 1 | ||
| fi | ||
|
|
||
| logFile="$1" | ||
|
|
||
| if [ ! -f "$logFile" ]; then | ||
| echo "Error: File '$logFile' not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Extracting simulation data with parameters from: $logFile" | ||
| echo "==================================================================" | ||
| echo | ||
|
|
||
| # Create temporary files to store the extracted data | ||
| processLines=$(mktemp) | ||
| timingLines=$(mktemp) | ||
| thicknessLines=$(mktemp) | ||
| musamosatLines=$(mktemp) | ||
|
|
||
| # Extract all relevant data with line numbers | ||
| grep -n "runs as process" "$logFile" > "$processLines" | ||
| grep -n "cpu time DFA" "$logFile" > "$timingLines" | ||
| grep -n "'relTh0':" "$logFile" > "$thicknessLines" | ||
| grep -n "Friction model parameter used: musamosat" "$logFile" > "$musamosatLines" | ||
|
|
||
| # Functions to extract values | ||
| getProcessId() { | ||
| echo "$1" | cut -d',' -f1 | cut -d':' -f2 | ||
| } | ||
|
|
||
| getSimName() { | ||
| echo "$1" | sed 's/.*INFO - \(.*\) runs as process.*/\1/' | ||
|
fso42 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| getCpuTime() { | ||
| echo "$1" | sed 's/.*cpu time DFA = \([0-9.]*\) s.*/\1/' | ||
|
fso42 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| getThickness() { | ||
| echo "$1" | sed "s/.*'relTh0': '\([0-9.]*\)'.*/\1/" | ||
|
fso42 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| getMusamosat() { | ||
| echo "$1" | sed 's/.*musamosat with value \([0-9.]*\).*/\1/' | ||
|
fso42 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| getLineNumber() { | ||
| echo "$1" | cut -d':' -f1 | ||
| } | ||
|
|
||
| # Create arrays to store parameter values for each simulation | ||
| declare -A thicknessValues | ||
| declare -A musamosatValues | ||
| declare -A simCounter | ||
|
|
||
| # Count simulations per process to track which parameter set belongs to which simulation | ||
| while IFS= read -r processLine; do | ||
| processId=$(getProcessId "$processLine") | ||
| if [[ -z "${simCounter[$processId]}" ]]; then | ||
| simCounter[$processId]=0 | ||
| else | ||
| ((simCounter[$processId]++)) | ||
| fi | ||
| done < "$processLines" | ||
|
|
||
| # Reset counters for actual processing | ||
| declare -A currentSim | ||
|
fso42 marked this conversation as resolved.
|
||
|
|
||
| # Process thickness values (relTh0) - these appear sequentially before simulations | ||
| thicknessIndex=0 | ||
| while IFS= read -r thicknessLine; do | ||
| thickness=$(getThickness "$thicknessLine") | ||
| thicknessValues["$thicknessIndex"]="$thickness" | ||
| ((thicknessIndex++)) | ||
| done < "$thicknessLines" | ||
|
|
||
| # Reset simulation counters for musamosat processing | ||
| declare -A currentSimMu | ||
|
fso42 marked this conversation as resolved.
|
||
|
|
||
| # Process musamosat values - these appear before each set of simulations | ||
| # We need to map them correctly to the simulation order | ||
| musamosatIndex=0 | ||
| while IFS= read -r musamosatLine; do | ||
| musamosat=$(getMusamosat "$musamosatLine") | ||
| musamosatValues["$musamosatIndex"]="$musamosat" | ||
| ((musamosatIndex++)) | ||
| done < "$musamosatLines" | ||
|
|
||
| # Counter for matched pairs | ||
| counter=1 | ||
| musamosatSimIndex=0 | ||
| thicknessSimIndex=0 | ||
|
|
||
| echo "Matched Simulations with Parameters and Timing:" | ||
| echo "==============================================" | ||
| printf "%-3s %-30s %-8s %-12s %-12s %-10s\n" "No." "Simulation Name" "PID" "μ_sat" "Thickness" "CPU Time" | ||
| printf "%-3s %-30s %-8s %-12s %-12s %-10s\n" "---" "------------------------------" "--------" "------------" "------------" "----------" | ||
|
|
||
| # Read process lines and find matching data | ||
| while IFS= read -r processLine; do | ||
| processId=$(getProcessId "$processLine") | ||
| simName=$(getSimName "$processLine") | ||
| processLineNum=$(getLineNumber "$processLine") | ||
|
|
||
| # Find matching timing line | ||
| matchingTiming=$(awk -F: -v pid="$processId" -v startLine="$processLineNum" ' | ||
| $1 > startLine && $2 ~ "^"pid"," && /cpu time DFA/ { | ||
| print $0 | ||
| exit | ||
| } | ||
| ' "$timingLines") | ||
|
|
||
| if [ -n "$matchingTiming" ]; then | ||
| cpuTime=$(getCpuTime "$matchingTiming") | ||
|
|
||
| # Get thickness for this simulation (sequential mapping) | ||
| thickness="${thicknessValues[$thicknessSimIndex]}" | ||
|
|
||
| # Get musamosat for this simulation (they cycle through the parameter sets) | ||
| musamosat="${musamosatValues[$musamosatSimIndex]}" | ||
|
|
||
| printf "%-3d %-30s %-8s %12.3f %12.3f %-10ss\n" "$counter" "$simName" "$processId" "$musamosat" "$thickness" "$cpuTime" | ||
|
|
||
| ((counter++)) | ||
| ((musamosatSimIndex++)) | ||
| ((thicknessSimIndex++)) | ||
|
|
||
| # Reset musamosat index if we've used all parameter sets | ||
| if [ "$musamosatSimIndex" -ge "$musamosatIndex" ]; then | ||
| musamosatSimIndex=0 | ||
| fi | ||
| fi | ||
|
|
||
| done < "$processLines" | ||
|
|
||
| echo | ||
| echo "Summary:" | ||
| echo "========" | ||
| echo "Total matched simulations: $((counter-1))" | ||
| echo "Parameter sets used:" | ||
| echo " Thickness values: $thicknessIndex" | ||
| echo " μ_sat values: $musamosatIndex" | ||
|
|
||
| # Process distribution | ||
| echo "Process distribution:" | ||
| for pid in $(cut -d',' -f1 "$processLines" | cut -d':' -f2 | sort -u); do | ||
|
fso42 marked this conversation as resolved.
|
||
| count=$(grep -c "^[0-9]*:$pid," "$processLines") | ||
| echo " Process $pid: $count simulations" | ||
| done | ||
|
|
||
| # Clean up temporary files | ||
| rm "$processLines" "$timingLines" "$thicknessLines" "$musamosatLines" | ||
|
|
||
| echo | ||
| echo "Script completed successfully!" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.