Store proc attributes inside bucket directories.

Reviewed By: jberdine

Differential Revision: D3131009

fb-gh-sync-id: de5fec3
fbshipit-source-id: de5fec3
master
Cristiano Calcagno 9 years ago committed by Facebook Github Bot 9
parent aa1588372e
commit 8759017f7c

@ -21,8 +21,19 @@ let attributes_filename pname =
(** path to the .attr file for the given procedure in the current results directory *) (** path to the .attr file for the given procedure in the current results directory *)
let res_dir_attr_filename pname = let res_dir_attr_filename pname =
DB.Results_dir.path_to_filename let attr_fname = attributes_filename pname in
DB.Results_dir.Abs_root [Config.attributes_dir_name; attributes_filename pname] let bucket_dir =
let base = Filename.chop_extension attr_fname in
let len = String.length base in
if len < 2
then Filename.current_dir_name
else String.sub base (len - 2) 2 in
let filename =
DB.Results_dir.path_to_filename
DB.Results_dir.Abs_root
[Config.attributes_dir_name; bucket_dir; attr_fname] in
DB.filename_create_dir filename;
filename
let store_attributes proc_attributes = let store_attributes proc_attributes =
let proc_name = proc_attributes.ProcAttributes.proc_name in let proc_name = proc_attributes.ProcAttributes.proc_name in

@ -202,6 +202,11 @@ let create_dir dir =
(L.err "@.ERROR: cannot create directory %s@." dir; (L.err "@.ERROR: cannot create directory %s@." dir;
assert false)) assert false))
let filename_create_dir fname =
let dirname = Filename.dirname fname in
if not (Sys.file_exists dirname)
then create_dir dirname
let read_whole_file fd = let read_whole_file fd =
let stats = Unix.fstat fd in let stats = Unix.fstat fd in
let size = stats.Unix.st_size in let size = stats.Unix.st_size in

@ -134,6 +134,9 @@ val source_file_in_resdir : source_file -> filename
(** directory where the results of the capture phase are stored *) (** directory where the results of the capture phase are stored *)
val captured_dir : unit -> filename val captured_dir : unit -> filename
(** create the directory containing the file bane *)
val filename_create_dir : filename -> unit
(** Find the source directories in the current results dir *) (** Find the source directories in the current results dir *)
val find_source_dirs : unit -> source_dir list val find_source_dirs : unit -> source_dir list

Loading…
Cancel
Save