Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
sasa
Commits
64c9ca75
Commit
64c9ca75
authored
2 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
fix: truncate info displayed in dot output
parent
0a3cdd00
No related branches found
Branches containing commit
Tags
1.0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/rdbg4sasa/dot4sasa.ml
+28
-21
28 additions, 21 deletions
tools/rdbg4sasa/dot4sasa.ml
with
28 additions
and
21 deletions
tools/rdbg4sasa/dot4sasa.ml
+
28
−
21
View file @
64c9ca75
...
@@ -6,7 +6,7 @@ open Data
...
@@ -6,7 +6,7 @@ open Data
open
RdbgEvent
open
RdbgEvent
open
Sasacore
open
Sasacore
open
Topology
open
Topology
type
process
=
{
type
process
=
{
name
:
string
;
name
:
string
;
actions
:
(
string
*
bool
*
bool
)
list
;
(* (action name, enabled, active) *)
actions
:
(
string
*
bool
*
bool
)
list
;
(* (action name, enabled, active) *)
...
@@ -25,14 +25,14 @@ let (is_parent: string -> string -> int -> RdbgEvent.t -> bool) =
...
@@ -25,14 +25,14 @@ let (is_parent: string -> string -> int -> RdbgEvent.t -> bool) =
|
_
->
false
|
_
->
false
let
(
get_processes
:
RdbgEvent
.
t
->
process
list
)
=
let
(
get_processes
:
RdbgEvent
.
t
->
process
list
)
=
fun
e
->
fun
e
->
(* if e.kind <> Ltop then (
(* if e.kind <> Ltop then (
print_string "dot should be called from Ltop event\n";
print_string "dot should be called from Ltop event\n";
failwith "exit dot"
failwith "exit dot"
);*)
);*)
let
l
=
List
.
map
(
fun
(
x
,
v
)
->
Str
.
split
(
Str
.
regexp
"_"
)
x
,
v
)
e
.
data
in
let
l
=
List
.
map
(
fun
(
x
,
v
)
->
Str
.
split
(
Str
.
regexp
"_"
)
x
,
v
)
e
.
data
in
let
rec
sortv
(
enab
,
other
)
(
x
,
v
)
=
let
rec
sortv
(
enab
,
other
)
(
x
,
v
)
=
match
args
.
salut_mode
,
x
with
match
args
.
salut_mode
,
x
with
|
false
,
"Enab"
::
pid
::
tail
->
(
pid
,
String
.
concat
"_"
tail
,
v
)
::
enab
,
other
|
false
,
"Enab"
::
pid
::
tail
->
(
pid
,
String
.
concat
"_"
tail
,
v
)
::
enab
,
other
|
false
,
pid
::
tail
->
enab
,
(
pid
,
(
String
.
concat
"_"
tail
)
,
v
)
::
other
|
false
,
pid
::
tail
->
enab
,
(
pid
,
(
String
.
concat
"_"
tail
)
,
v
)
::
other
|
_
,
[]
->
assert
false
|
_
,
[]
->
assert
false
...
@@ -43,7 +43,7 @@ let (get_processes : RdbgEvent.t -> process list) =
...
@@ -43,7 +43,7 @@ let (get_processes : RdbgEvent.t -> process list) =
let
_i
=
int_of_string
id
in
let
_i
=
int_of_string
id
in
enab
,
(
p
^
id
,
(
String
.
concat
"_"
(
id2
::
tail
))
,
v
)
::
other
enab
,
(
p
^
id
,
(
String
.
concat
"_"
(
id2
::
tail
))
,
v
)
::
other
with
_
->
with
_
->
try
try
let
_i
=
int_of_string
id2
in
let
_i
=
int_of_string
id2
in
enab
,
(
p
^
id2
,
(
String
.
concat
"_"
(
id
::
tail
))
,
v
)
::
other
enab
,
(
p
^
id2
,
(
String
.
concat
"_"
(
id
::
tail
))
,
v
)
::
other
with
_
->
assert
false
with
_
->
assert
false
...
@@ -53,7 +53,7 @@ let (get_processes : RdbgEvent.t -> process list) =
...
@@ -53,7 +53,7 @@ let (get_processes : RdbgEvent.t -> process list) =
(
string
*
string
*
Data
.
v
)
list
->
process
list
)
=
(
string
*
string
*
Data
.
v
)
list
->
process
list
)
=
fun
pidl
enab
other
->
fun
pidl
enab
other
->
match
enab
with
match
enab
with
|
[]
->
pidl
|
[]
->
pidl
|
(
pid
,
_
,
_
)
::_
->
|
(
pid
,
_
,
_
)
::_
->
let
enab_pid_list
,
enab
=
let
enab_pid_list
,
enab
=
List
.
partition
(
fun
(
pid0
,_,_
)
->
pid
=
pid0
)
enab
List
.
partition
(
fun
(
pid0
,_,_
)
->
pid
=
pid0
)
enab
...
@@ -68,9 +68,9 @@ let (get_processes : RdbgEvent.t -> process list) =
...
@@ -68,9 +68,9 @@ let (get_processes : RdbgEvent.t -> process list) =
in
in
let
get_actions
(
_
,
n
,
enabv
)
=
let
get_actions
(
_
,
n
,
enabv
)
=
match
List
.
find_opt
(
fun
(
_
,
n0
,
_
)
->
n
=
n0
)
acti_pid
with
match
List
.
find_opt
(
fun
(
_
,
n0
,
_
)
->
n
=
n0
)
acti_pid
with
|
Some
(
_
,_,
activ
)
->
|
Some
(
_
,_,
activ
)
->
(
n
,
enabv
=
Data
.
B
true
,
activ
=
B
true
)
(
n
,
enabv
=
Data
.
B
true
,
activ
=
B
true
)
|
None
->
|
None
->
(
n
,
enabv
=
Data
.
B
true
,
false
)
(
n
,
enabv
=
Data
.
B
true
,
false
)
in
in
let
pid
=
{
let
pid
=
{
...
@@ -88,7 +88,7 @@ let (get_processes : RdbgEvent.t -> process list) =
...
@@ -88,7 +88,7 @@ let (get_processes : RdbgEvent.t -> process list) =
used to compute a spanning tree, a draws edges accordingly in the
used to compute a spanning tree, a draws edges accordingly in the
dot output. If no var of type neighbor exists, we return the emty
dot output. If no var of type neighbor exists, we return the emty
string here and no edges will be displayed. if several vars of type
string here and no edges will be displayed. if several vars of type
neighbor exist, we take the first one.
neighbor exist, we take the first one.
let parent_var_name = ref None (* memoize it! *)
let parent_var_name = ref None (* memoize it! *)
let (get_parent_var_name: nodes list -> string) =
let (get_parent_var_name: nodes list -> string) =
fun nl ->
fun nl ->
...
@@ -99,7 +99,7 @@ let (get_parent_var_name: nodes list -> string) =
...
@@ -99,7 +99,7 @@ let (get_parent_var_name: nodes list -> string) =
| [] -> ""
| [] -> ""
| n::tail -> (
| n::tail -> (
let ml_file = (Filename.chop_extension file) ^ .ml in
let ml_file = (Filename.chop_extension file) ^ .ml in
match List.find_opt (fun (vn,vt) -> vt = Algo.Nt) n with
match List.find_opt (fun (vn,vt) -> vt = Algo.Nt) n with
| None -> search tail
| None -> search tail
| Some (vn,_) -> vn
| Some (vn,_) -> vn
...
@@ -110,6 +110,13 @@ let (get_parent_var_name: nodes list -> string) =
...
@@ -110,6 +110,13 @@ let (get_parent_var_name: nodes list -> string) =
vn
vn
*)
*)
let
val_to_string_trunc
v
=
let
res
=
Data
.
val_to_string
string_of_float
v
in
if
String
.
length
res
>
50
(* XXX should be a sasarg *)
then
(
String
.
sub
res
0
50
^
"..."
)
else
res
(* Compute a dot from the content of e.data. if [only_parent], only
(* Compute a dot from the content of e.data. if [only_parent], only
display the arcs of the parent, where the parent is an integer held
display the arcs of the parent, where the parent is an integer held
in a variable named "par". if no such variable exist in the current
in a variable named "par". if no such variable exist in the current
...
@@ -141,29 +148,29 @@ let to_pdf engine par_var only_parent rn g f e =
...
@@ -141,29 +148,29 @@ let to_pdf engine par_var only_parent rn g f e =
let
loc
=
String
.
concat
"|"
let
loc
=
String
.
concat
"|"
(
List
.
map
(
fun
(
n
,
v
)
->
(
List
.
map
(
fun
(
n
,
v
)
->
Printf
.
sprintf
"%s=%s"
n
Printf
.
sprintf
"%s=%s"
n
(
Data
.
val_to_string
string_of_float
v
))
(
val_to_string
_trunc
v
))
pid
.
vars
pid
.
vars
)
)
in
in
if
(
n
>
200
||
ln
>
5000
)
&&
enabled
<>
""
then
if
(
n
>
200
||
ln
>
5000
)
&&
enabled
<>
""
then
Printf
.
sprintf
" %s [shape=point]"
pid
.
name
Printf
.
sprintf
" %s [shape=point]"
pid
.
name
else
else
Printf
.
sprintf
" %s [%slabel=
\"
%s|{%s%s}
\"
] "
Printf
.
sprintf
" %s [%slabel=
\"
%s|{%s%s}
\"
] "
pid
.
name
color
pid
.
name
enabled
loc
pid
.
name
color
pid
.
name
enabled
loc
)
)
pidl
pidl
)
)
in
in
let
trans
=
let
trans
=
List
.
flatten
List
.
flatten
(
List
.
map
(
List
.
map
(
fun
n
->
(
fun
n
->
let
l
=
g
.
succ
n
.
id
in
let
l
=
g
.
succ
n
.
id
in
List
.
mapi
(
fun
i
t
->
List
.
mapi
(
fun
i
t
->
if
g
.
directed
then
if
g
.
directed
then
Printf
.
sprintf
"%s -> %s"
t
n
.
id
Printf
.
sprintf
"%s -> %s"
t
n
.
id
else
if
is_parent
"par"
n
.
id
i
e
then
else
if
is_parent
"par"
n
.
id
i
e
then
Printf
.
sprintf
"%s -> %s"
n
.
id
t
Printf
.
sprintf
"%s -> %s"
n
.
id
t
else
if
n
.
id
<
t
then
(* to avoid duplication in undir graphs *)
else
if
n
.
id
<
t
then
(* to avoid duplication in undir graphs *)
Printf
.
sprintf
"%s -- %s"
n
.
id
t
Printf
.
sprintf
"%s -- %s"
n
.
id
t
else
else
...
@@ -188,10 +195,10 @@ let to_pdf engine par_var only_parent rn g f e =
...
@@ -188,10 +195,10 @@ let to_pdf engine par_var only_parent rn g f e =
Str
.
global_replace
(
Str
.
regexp
"--"
)
"->"
trans_undir_str
in
Str
.
global_replace
(
Str
.
regexp
"--"
)
"->"
trans_undir_str
in
let
trans_str
=
let
trans_str
=
(* if trans_dir_str = "" then trans_undir_str else *)
(* if trans_dir_str = "" then trans_undir_str else *)
if
only_parent
then
if
only_parent
then
Printf
.
sprintf
"subgraph dir {
\n\t
%s} "
trans_dir_str
Printf
.
sprintf
"subgraph dir {
\n\t
%s} "
trans_dir_str
else
else
Printf
.
sprintf
"subgraph dir {
\n\t
%s}
Printf
.
sprintf
"subgraph dir {
\n\t
%s}
subgraph undir {
\n\t
edge [dir=none]
\n
%s} "
trans_dir_str
trans_undir_str
subgraph undir {
\n\t
edge [dir=none]
\n
%s} "
trans_dir_str
trans_undir_str
in
in
let
pot
=
match
List
.
assoc_opt
"potential"
e
.
data
with
let
pot
=
match
List
.
assoc_opt
"potential"
e
.
data
with
...
@@ -209,7 +216,7 @@ subgraph undir {\n\t edge [dir=none]\n%s} " trans_dir_str trans_undir_str
...
@@ -209,7 +216,7 @@ subgraph undir {\n\t edge [dir=none]\n%s} " trans_dir_str trans_undir_str
flush
stdout
flush
stdout
)
)
;;
;;
let
dot
=
to_pdf
"dot"
"_par"
;;
let
dot
=
to_pdf
"dot"
"_par"
;;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment