Is it possible to extract features from program dependency graph ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I am a bignner in matlab. I have to extract features/metrics from program dependency graphs generated by using a tool. These program dependency graphs are generated from c code. I would like to know, is it possible or is any way to extract features/metrics from these program dependency graphs by using MATLAB.
Features like
number of Assign- ments that come after Declarations,
number of Declarations coming after Control (e.g. i < count, for, while, if, switch etc.),
numbers of times nested iterations occur,
numbers of times nested selections occur
If is it possible then please guid me!
The program dependency graph is given as follow from which I want to extract metrics
In text formate
[pdg] ====== PDG GRAPH COMPUTED ======
[pdg] PDG for foo2
{n1}: InCtrl
{n2}: VarDecl : x_0
<-[a--]- 3
{n3}: In1
<-[a--]- 2
<-[--d]- 6
{n4}: VarDecl : x_1
<-[a--]- 5
{n5}: In2
<-[a--]- 4
<-[--d]- 6
{n6}: OutRet
[pdg] PDG for printf
{n7}: InCtrl
{n8}: VarDecl : x_0
<-[a--]- 9
{n9}: In1
<-[a--]- 8
{n10}: OutRet
{n11}: In("\nsumProd1A_Cordy: %lf "[bits 0 to 183])
<-[--d]- 10
[pdg] PDG for sumProd1A
{n12}: InCtrl
<-[-c-]- 18
<-[-c-]- 19
<-[-c-]- 20
<-[-c-]- 21
<-[-c-]- 22
<-[-c-]- 23
<-[-c-]- 24
<-[-c-]- 25
<-[-c-]- 26
<-[-c-]- 27
<-[-c-]- 28
<-[-c-]- 29
<-[-c-]- 30
<-[-c-]- 31
{n13}: VarDecl : n
<-[a--]- 14
<-[--d]- 22
{n14}: In1
<-[a--]- 13
<-[--d]- 22
{n15}: VarDecl : sum
<-[a--]- 18
<-[a-d]- 24
<-[--d]- 27
{n16}: VarDecl : prod
<-[a--]- 19
<-[a-d]- 25
<-[--d]- 28
{n17}: VarDecl : i
<-[a--]- 20
<-[--d]- 22
<-[--d]- 24
<-[--d]- 25
<-[a-d]- 29
{n18}: double sum = 0.0;
<-[--d]- 24
{n19}: double prod = 1.0;
<-[--d]- 25
{n20}: i = 1;
<-[--d]- 22
<-[--d]- 24
<-[--d]- 25
<-[--d]- 29
{n21}: while(1)
<-[-c-]- 21
<-[-c-]- 22
<-[-c-]- 23
<-[-c-]- 24
<-[-c-]- 25
<-[-c-]- 26
<-[-c-]- 27
<-[-c-]- 28
<-[-c-]- 29
<-[-c-]- 30
{n22}: i <= n
<-[-c-]- 21
<-[-c-]- 22
<-[-c-]- 23
<-[-c-]- 24
<-[-c-]- 25
<-[-c-]- 26
<-[-c-]- 27
<-[-c-]- 28
<-[-c-]- 29
<-[-c-]- 30
{n23}: block
<-[-c-]- 24
<-[-c-]- 25
<-[-c-]- 26
<-[-c-]- 27
<-[-c-]- 28
{n24}: sum += (double)i;
<-[--d]- 24
<-[--d]- 27
{n25}: prod *= (double)i;
<-[--d]- 25
<-[--d]- 28
{n26}: Call11-InCtrl : foo2(sum,prod);
<-[-c-]- 27
<-[-c-]- 28
{n27}: Call11-In1 : foo2(sum,prod);
{n28}: Call11-In2 : foo2(sum,prod);
{n29}: i ++;
<-[--d]- 22
<-[--d]- 24
<-[--d]- 25
<-[--d]- 29
{n30}: break;
<-[-c-]- 21
<-[-c-]- 22
<-[-c-]- 23
<-[-c-]- 24
<-[-c-]- 25
<-[-c-]- 26
<-[-c-]- 27
<-[-c-]- 28
<-[-c-]- 29
<-[-c-]- 30
{n31}: return;
[pdg] PDG for main
{n32}: InCtrl
<-[-c-]- 33
<-[-c-]- 34
<-[-c-]- 35
<-[-c-]- 36
<-[-c-]- 37
{n33}: Call15-InCtrl : printf("\nsumProd1A_Cordy: %lf ");
<-[-c-]- 34
{n34}: Call15-In1 : printf("\nsumProd1A_Cordy: %lf ");
{n35}: Call16-InCtrl : sumProd1A(4);
<-[-c-]- 36
{n36}: Call16-In1 : sumProd1A(4);
{n37}: return;
In Graphical format

0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!