Commit 44637897 by Aaron Leung

printing memory usage

parent f99b3c6b
#include <stdio.h> #include <stdio.h>
#include "sass_interface.h" #include "sass_interface.h"
#include <sys/resource.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
...@@ -8,13 +9,18 @@ int main(int argc, char** argv) ...@@ -8,13 +9,18 @@ int main(int argc, char** argv)
return 0; return 0;
} }
int who = RUSAGE_SELF;
struct rusage r;
while (1) { while (1) {
getrusage(who, &r);
printf("Memory usage: %ld", r.ru_maxrss);
struct sass_file_context* ctx = sass_new_file_context(); struct sass_file_context* ctx = sass_new_file_context();
ctx->options.include_paths = "::/blah/bloo/fuzz:/slub/flub/chub::/Users/Aaron/dev/libsass/::::/huzz/buzz:::"; ctx->options.include_paths = "::/blah/bloo/fuzz:/slub/flub/chub::/Users/Aaron/dev/libsass/::::/huzz/buzz:::";
ctx->options.output_style = SASS_STYLE_NESTED; ctx->options.output_style = SASS_STYLE_NESTED;
ctx->input_path = argv[1]; ctx->input_path = argv[1];
sass_compile_file(ctx); sass_file_compile(ctx);
if (ctx->error_status) { if (ctx->error_status) {
if (ctx->error_message) printf("%s", ctx->error_message); if (ctx->error_message) printf("%s", ctx->error_message);
...@@ -29,7 +35,7 @@ int main(int argc, char** argv) ...@@ -29,7 +35,7 @@ int main(int argc, char** argv)
break; break;
} }
sass_free_file_context(ctx); sass_file_free_context(ctx);
} }
return 0; return 0;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment