Main Page
From Contiki
Contiki Development at ANRG, University of Southern California
Contents
Getting started
Useful links
- Official Homepage
- GitHub repository
- Contiki Projects repository
- ContikiOS official blog
- Resources page
- Recommended reading
To-Do
- Find out how to input code lists with syntax highlighting. Install SyntaxHighlight extension (http://www.mediawiki.org/wiki/Extension:SyntaxHighlight) or ASHighlight extension (http://www.mediawiki.org/wiki/Extension:ASHighlight)
try {
AndroidAnalyzer analyzer = new AndroidAnalyzer(fileName);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select no from callgraph0 where no="+no);
if(!rs.next()) {
totalMethod = totalNativeMethods = totalClasses = packageMethods = packageNativeMethods = packageClasses = 0;
analyzer.buildCallGraph(false);
totalMethod = Scene.v().getReachableMethods().size();
QueueReader<MethodOrMethodContext> methods = Scene.v().getReachableMethods().listener();
Set<SootClass> classSet = new HashSet<SootClass>();
while (methods.hasNext()) {
SootMethod sm = methods.next().method();
classSet.add(sm.getDeclaringClass());
if (sm.isAndroidPackageMethod()) {
packageMethods++;
}
if (sm.isNative()) {
if (sm.isAndroidPackageMethod()) {
packageNativeMethods++;
}
totalNativeMethods++;
}
}
for (SootClass sc : classSet) {
if (sc.isAPK()) {
packageClasses++;
}
}
totalClasses = classSet.size();
System.out.println("Reachable classes = " + totalClasses);
System.out.println("Reachable package classes = " + packageClasses);
System.out.println("Reachable methods = " + totalMethod);
System.out.println("Reachable native methods = " + totalNativeMethods);
System.out.println("Reachable package methods = " + packageMethods);
System.out.println("Reachable package native methods = " + packageNativeMethods);
try {
pstmt0 = conn.prepareStatement("insert into callgraph0(no,totalMethods,totalNativeMethods,totalClasses,packageMethods,packageNativeMethods,packageClasses) values(?,?,?,?,?,?,?)");
pstmt0.setString(1, no);
pstmt0.setInt(2, totalMethod);
pstmt0.setInt(3, totalNativeMethods);
pstmt0.setInt(4, totalClasses);
pstmt0.setInt(5, packageMethods);
pstmt0.setInt(6, packageNativeMethods);
pstmt0.setInt(7, packageClasses);
pstmt0.execute();
pstmt0.close();
} catch (Exception e) {
}
}
stmt.close();
rs.close();
stmt = conn.createStatement();
rs = stmt.executeQuery("select no from callgraph where no="+no);
if(!rs.next()) {
totalMethod = totalNativeMethods = totalClasses = packageMethods = packageNativeMethods = packageClasses = 0;
analyzer.buildCallGraph(true);
totalMethod = Scene.v().getReachableMethods().size();
QueueReader<MethodOrMethodContext> methods = Scene.v().getReachableMethods().listener();
Set<SootClass> classSet = new HashSet<SootClass>();
while (methods.hasNext()) {
SootMethod sm = methods.next().method();
classSet.add(sm.getDeclaringClass());
if (sm.isAndroidPackageMethod()) {
packageMethods++;
}
if (sm.isNative()) {
if (sm.isAndroidPackageMethod()) {
packageNativeMethods++;
}
totalNativeMethods++;
}
}
for (SootClass sc : classSet) {
if (sc.isAPK()) {
packageClasses++;
}
}
totalClasses = classSet.size();
System.out.println("Reachable classes = " + totalClasses);
System.out.println("Reachable package classes = " + packageClasses);
System.out.println("Reachable methods = " + totalMethod);
System.out.println("Reachable native methods = " + totalNativeMethods);
System.out.println("Reachable package methods = " + packageMethods);
System.out.println("Reachable package native methods = " + packageNativeMethods);
try {
pstmt1 = conn.prepareStatement("insert into callgraph(no,totalMethods,totalNativeMethods,totalClasses,packageMethods,packageNativeMethods,packageClasses) values(?,?,?,?,?,?,?)");
pstmt1.setString(1, no);
pstmt1.setInt(2, totalMethod);
pstmt1.setInt(3, totalNativeMethods);
pstmt1.setInt(4, totalClasses);
pstmt1.setInt(5, packageMethods);
pstmt1.setInt(6, packageNativeMethods);
pstmt1.setInt(7, packageClasses);
pstmt1.execute();
pstmt1.close();
} catch (Exception e) {
}
}
stmt.close();
rs.close();
} catch (Exception e) {
e.printStackTrace();
}