Docsity

Path Projection for User Centered Static analysis Tools - Slides | CMSC 631, Study notes of Computer Science

Toggle sidebar
bg1
Path Projection for User-
Centered Static Analysis Tools
Jeff Foster
University of Maryland, College Park
Joint work with Yit Phang Khoo, Mike Hicks, and Vibha Sazawal
Introduction
• Many recent successes in static analysis tools for
defect detection / prevention
!Lots of progress in the research community
!Coverity, Fortify, GrammaTech, and others sell static
analysis tools
!Microsoft has had great success with static analysis
• Major research focus: Building tools that are...
!“Precise enough”
!And still scale to large programs
2
Motivation
• Static analysis tools are not perfect
!Users must triage bug reports
-Decide whether true or false positives, and how important
!Users must remediate true bugs
• Conclusion: successful static analysis requires
cooperation between the user and the tool
• How do we build more user-centered static analyses?
3
Path Projection
• A new interface to help users visualize code paths
!E.g., call stacks, control flow paths, data flow paths
!These are common in static analysis error reports
• Core principles
!Remain true to original source code
!Fit as much on one screen at a time as possible
4
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Path Projection for User Centered Static analysis Tools - Slides | CMSC 631 and more Study notes Computer Science in PDF only on Docsity!

Centered Static Analysis ToolsPath Projection for User-

University of Maryland, College Park^ Jeff Foster

Joint work with Yit Phang Khoo, Mike Hicks, and Vibha Sazawal

Introduction

• Many recent successes in static analysis tools for defect detection / prevention

!! Lots of progress in the research communityCoverity, Fortify, GrammaTech, and others sell static

! analysis toolsMicrosoft has had great success with static analysis

• Major research focus: Building tools that are...! “Precise enough”

! And still scale to large programs 2

Motivation

• Static analysis tools are not perfect! Users must triage bug reports

! - Users must^ Decide whether true or false positives, and how important remediate true bugs

• Conclusion: successful static analysis requires cooperation between the user and the tool

• How do we build more user-centered static analyses?

Path Projection

• A new interface to help users visualize code paths! E.g., call stacks, control flow paths, data flow paths

! These are common in static analysis error reports

• Core principles! Remain true to original source code

! Fit as much on one screen at a time as possible

Contributions

• Prototype implementation in WebKit

• Controlled user study! Task: Triaging Locksmith error reports

! Compared to “standard viewer” (similar to IDEs)

• Experimental results! Improved performance (completion time)

!! Same accuracyQualitatively better

5

Programming Against Races

• • LocationsLocks l r

• Correlation:! Location r accessed while lock r @ l l held

• Consistent correlation! Any shared location only correlated with one lock

! - Implies race freedom^ Then that lock guards that location

6

Locksmith: Race Detection for C

void foo(pthread_mutex_t *l, int *p) { pthread_mutex_lock(l);

*p++; pthread_mutex_unlock(l);

pthread_mutex_t L1, L2; int x, y;

foo foo 12 (&L1, &x);(&L2, &y);^ p @ l

x y L1 L

Sample Locksmith Error Report

Warning: at: g_conn_open Possible (knot.c::61) data race of

**1. -> dereference

  1. **^ - **main():558 thread_main_autospawn():458 accept_loop():395 -> pthread_create()-> dereference
  2. **^ - main():577 thread_main():476 accept_loop():395 -> pthread_create()-> dereference locks: -

Shared variable

possibly-^ Three^ Thread creation site^ No locks held at deref

racing derefs

(paths)

Side-by-side paths

Error report

Checklist

(non-consecutive^ Code folding line numbers)

Function call inlining

simultaneous^ Multiple searches Path Projection Demo

Informational Visualization Strategies

• Increase user’s memory and processing resources, and reduce the search for information

!! Make important lines of code visible on screenPlace related lines of code close together

• Use visual representation to enhance pattern matching! Put function definition in colored boxes

! Format/color code to reveal program structure

• Encode information in a manipulable medium! Allow users to search/highlight

17

User Study: Overview

• • Standard Viewer (SV) vs. Path Projection (PP)Task: Triage a Locksmith error report

• Measurements^!^ Decide whether it is a false positive or not

!! Completion time for the taskQualitative feedback from users

! Observations of user behavior

18

Locksmith Task Details

• All trials from Locksmith benchmarks! E.g., web server, ftp client, etc.

!! Roughly 1,500 lines eachUnfamiliar to participants

• One warning per trial! No need to manage warnings

Locksmith Task Details (cont’d)

• No potential aliasing issues! All shared variables and locks are global

! (Just a property of these particular warnings)

• Semantics-preserving simplifications:! Made local static variables global

!! ChangedDeleted #if 0 wait()/signal() or other conditional macros to join()

! Converted some goto/switch statements to if

Checklist

25

Submit completes checklist (and

ends trial)

Warm-up task Pairs of racing paths (and self-racing paths)

Checklist Demo

Checklist Improvement

• Participants improved completion times by 41% using the checklist

!! Comparing pilot study to final studyBut only anecdotal, because there were other changes

in the interface etc

• Interesting direction for future study

Participants and Equipment

• 8 student participants! 3 undergraduates, 5 graduates

!! Prior experience in C, multithreading (not necc. C)Self-rated experience: 3 to 4

! - 2 participants had experience in Locksmith and Eraser^ Scale of 1: no experience to 5: very experienced

• Apparatus! 24" 1920-by-1200 LCD

! Mac OS X 10.5.2 - All shortcuts disabled except for cut/copy/paste/find/find-next

Mean Time for All Participants

29

# Tabs 3 2 6 6:09^6 3 3 5:

* one incorrectly answered tab in the checklist

0 Session 1 Session 2

400 Completion time (sec)^ Standard Viewer Path Projection

0 Session 1 Session 2

Duration in error report (sec) Standard Viewer

Path Projection

Figure 5: Quantitative data

first, PP second), the mean time improved 3:08 minutes from the first session to the second, and for the PP-SV order

the mean time improved 55 seconds. We ran two one-way, within-subjects ANOVAs, analyzing each presentation order

separately, and we found that both of these improvements were statistically significant (F (1, 3) = 12.78, p = 0.038 and

F (1 However, notice that the SV-PP improvement is much, 3) = 19.33, p = 0.022, respectively).

greater than the PP-SV improvement. We applied Cohen’s a standard mean difference test, which showed that the SV- d,

PP improvement was large ( improvement was small-to-medium (d = 1.d276), and the PP-SV = 0.375). This pro-

vides evidence that while there is a learning e improves user performance significantly. ffect, PP still

distinguish correct and incorrect answers. Indeed, it is un-^ Note that when analyzing completion times, we did not

clear how this a only one tab out of several will contain an incorrect answer.ffects timings, especially since in many cases,

parent thread (and thus a Time spent in error report.ffecting the answers to two tabs). We found that under PP, par-

ticipants spend much less time with the mouse hovering over the error report compared to SV. The chart in the bottom

right of Figure 5 shows the mean times for each session and interface. We found that on average, participants spend 20

seconds in the error report under PP, compared to 1:34 min- utes under SV. This dramatic difference is highly significant

(F(1,3)=15.634, (within subjects) by presentation order (between subjects) p < 0 .001) according to a user interface

mixed ANOVA. We believe this difference is because PP makes the paths

clearly visible in the source code display, whereas in SV, hyperlinks in the error report are heavily used to bring up

relevant parts of the code. As additional evidence, partici- pants themselves reported the same result: one noted that

the error report is “necessary for the standard viewer, but just a convenience in [PP].”

Time spent in checklist. pants spend 27 seconds more on average with the mouse hov- Finally, we found that partici-

ering over the checklist in PP compared to SV. Since check- list times across different trial numbers are incomparable, we

applied a user interface-by-trial between-subjects ANOVA, which indicated a statistically significant result (p = 0.007).

roughly equal times for this in both interfaces. In retrospect,^ We were surprised by this result, because we expected

however, we realized that participants need not scroll or click on the error report very often under PP, and hence they may

the mouse cursor idle over the checklist.

5.2 In addition to quantitative data, we also examined partic- Qualitative Results

ipants’ answers to the questionnaires we administered. The questions are on a 5-point Likert scale, and we analyze them

using either the Wilcoxon rank-sum test for paired compar- isons, or the Wilcoxon signed-rank test otherwise.

Overall impressions. a box plot summarizing participants’ opinions of the inter- The upper chart in Figure 6 gives

faces. questions, we see that participants felt PP took longer to Comparing the median responses for the first three

learn, led to more confidence in answers, and made it easier

PP-SV: 55s

SV-PP: 188s

Still a learning effect

Both improvements statistically significant

PP improvement large SV improvement small-med

Accuracy and Detailed Times

• Similar # of mistakes: 10 PP (10.9%), 9 SV (9.8%)

30

Trial Completion times and accuracy for each trial1.1 Session 11.2 1.3^ mean 2.1 2.2Session 2 2.3 mean User 12 8:365:07 (^) * 14:143:10 SV (^) 9:445:50 10:514:42 7:074:16 4:482:29PP (^) 4:022:10 (^) * 5:192: 57 7:465:40 2:346:23 5:387:35 (^) 6:515:206:33 5:133:05 3:433:53^ 1:182:32 (^) 3:433:253: User 03 6:276:38* 6:097:18 PP (^) 8:328:35* 7:037:30 (^) 11:189:42 5:166:21* SV (^) 3:113:39* 6:037: 46 8:217:11 2:112:52 4:434:50 (^) ** (^) 6:095:054:57 5:264:33* 4:274:06^ 2:461:58^ 5:144:133:

Tabs * (^) one incorrectly answered tab in the checklist 3 2 6 6 3 3

(^0) Session 1 Session 2

100

200

300

400 Completion time (sec) Standard Viewer Path Projection

(^0) Session 1 Session 2 20 40

60

80 100

120 Duration in error report (sec)^ Standard Viewer Path Projection

Figure 5: Quantitative data

first, PP second), the mean time improved 3:08 minutes from the first session to the second, and for the PP-SV order the mean time improved 55 seconds. We ran two one-way,

within-subjects ANOVAs, analyzing each presentation order separately, and we found that both of these improvements were statistically significant (F (1, 3) = 12.78, p = 0.038 and

F greater than the PP-SV improvement. We applied Cohen’s (1 However, notice that the SV-PP improvement is much, 3) = 19.33, p = 0.022, respectively). d,

a standard mean di PP improvement was large ( improvement was small-to-medium (fference test, which showed that the SV-d = 1.276), and the PP-SVd = 0.375). This pro-

vides evidence that while there is a learning e improves user performance significantly. Note that when analyzing completion times, we did notffect, PP still

distinguish correct and incorrect answers. Indeed, it is un-

( rable for both ip Most of the= 0.770), su

and 2.3, in whic tain a common report a false p

pleted two tabs lying mistake: parent thread (

Time spent in ticipants spend the error repor

right of Figure interface. We f seconds in the e

utes under SV. (F(1,3)=15.634 (within subject

mixed ANOVA clearly visible We believe th

hyperlinks in th relevant parts o pants themselv

the error repor just a convenie

Time spent in pants spend 27 ering over the c

list times across applied a user which indicated

roughly equal ti however, we rea^ We were sur

on the error rep the mouse curs

5.2 In addition to Qualita

ipants’ answers questions are on using either the

isons, or the W Overall impre

a box plot sum faces. Compar

• •^ • • • • • •

• •^ •^ • • •

Mouse Hover Time in Error Report

• 20s on average for PP, compared to 1:34 for SV! Little need to use hyperlinks under PP

31

Trial Completion times and accuracy for each trial1.1 Session 11.2 1.3^ mean 2.1 Session 22.2 2.3 mean User 12 8:365:07 (^) * 14:143:10 SV (^) 9:445:50 10:514:42 7:074:16 4:482:29PP** (^) 4:022:10* 5:192: 57 7:465:40 2:346:23 5:387:35* (^) 6:515:206:33 5:133:05 3:433:53^ 1:182:32 (^) 3:433:253: User 03 6:276:38 6:097:18 PP (^) 8:328:35* 7:037:30 (^) 11:189:42 5:166:21* SV (^) 3:113:39* 6:037: 46 8:217:11 2:112:52 4:434:50 (^) ** (^) 6:095:054:57 5:264:33* 4:274:06^ 2:461:58^ 5:144:133:

Tabs * (^) one incorrectly answered tab in the checklist 3 2 6 6 3 3

(^0) Session 1 Session 2

100

200

300

400 Completion time (sec) Standard Viewer Path Projection

(^0) Session 1 Session 2 20 40

60

80 100

120

Duration in error report (sec) Standard Viewer

Path Projection

Figure 5: Quantitative data

first, PP second), the mean time improved 3:08 minutes from the first session to the second, and for the PP-SV order

( rable for both interfaces.p = 0.770), suggesting the distribution of errors is compa-

and 2.3, in which two potentially-racing paths actually con-^ Most of the participant mistakes occurred in trials 2.

tain a common unrealizable sub-path, making the data race report a false positive. In trial 1.3, one participant com-

pleted two tabs incorrectly, but there was only one under- lying mistake: misidentifying the same child thread as a

parent thread (and thus a Time spent in error report.ffecting the answers to two tabs). We found that under PP, par-

ticipants spend much less time with the mouse hovering over the error report compared to SV. The chart in the bottom

right of Figure 5 shows the mean times for each session and interface. We found that on average, participants spend 20

seconds in the error report under PP, compared to 1:34 min- utes under SV. This dramatic difference is highly significant

(F(1,3)=15.634, (within subjects) by presentation order (between subjects) p < 0 .001) according to a user interface

mixed ANOVA. We believe this difference is because PP makes the paths

clearly visible in the source code display, whereas in SV, hyperlinks in the error report are heavily used to bring up

relevant parts of the code. As additional evidence, partici- pants themselves reported the same result: one noted that

the error report is “necessary for the standard viewer, but just a convenience in [PP].”

Time spent in checklist. pants spend 27 seconds more on average with the mouse hov- Finally, we found that partici-

ering over the checklist in PP compared to SV. Since check- list times across different trial numbers are incomparable, we

applied a user interface-by-trial between-subjects ANOVA, which indicated a statistically significant result (p = 0.007).

roughly equal times for this in both interfaces. In retrospect,^ We were surprised by this result, because we expected

however, we realized that participants need not scroll or click

Seconds

Overall Impression (Qualitative)

• Boxplot! Centerline = median Box extent = quartiles

! Whiskers = min/max Dots = outliers 32

!

! (^1) to learn Quick Confident of answer verify race Easy to Path Projection Prefer 2

3

4 5

Overall impression

Standard Viewer Path Projection

! 3!

4 5

Usefulness of features

However, participan ularly that code fold feature,” and “I love not. When we asked that the code foldin^ Most participants without it. query was in use b (shown in Figure 2). Howeve

extremely useful in c 5.3 Threats to

our results. alize. We had a sma^ There are a numb The co were students rather nificant experience grams (N = 2) and e was small. ror reports for unfam they had developed Moreove als before each expe learning e However, even witffect acros produce statistically formation for our p

Strongly Disagree

Strongly^ Agree

Threats to Validity

• Results may not generalize! Small population, students, not data race experts

!! Small set of programsLearning effect still present

• Changes to programs to make task easier! Task in experiments is very focused

! Understanding error reports generally requires wider range of activities

• SV interface is not production quality! Deliberate choice, to avoid giving any advantages

Summary

• Introduced Path Projection, a new interface! Side-by-side display of paths

!! Function call inliningCode folding

• Experimental results suggest PP^!^ In general, tries to follow InfoViz principles

!! Improves completion timesIs liked by users

• Lots more to do on this topic!

http://www.cs.umd.edu/projects/PL/PP 38