'Is there a way to save Cloudlet output to a csv file?

I'm working on a project using CloudSim simulation tool for masters. I want to know how to save the output of the printCloudletList to a csv file in NetBeans. Any ideas? Please let me know.



Solution 1:[1]

Using CloudSim Plus you can generate results in CSV and other formats. The code is as below. CloudSim Plus even allows you to add any data you want to the generated table.

try {
    CsvTable csv = new CsvTable();
    csv.setPrintStream(new PrintStream(new java.io.File("/tmp/results.csv")));
    new CloudletsTableBuilder(broker0.getCloudletFinishedList(), csv).build();
} catch (IOException e) {
    System.err.println(e.getMessage());
}

Solution 2:[2]

The code here worked for me. Just had to do some imports after pasting in code. Needed some minimal formatting of outputted csv file to get it right in excel format.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Manoel Campos
Solution 2 Daniel Cregg