[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the runtime complexity of $(filter )?

From: Sam Ravnborg
Subject: Re: What is the runtime complexity of $(filter )?
Date: Sun, 10 Jan 2010 09:29:50 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

> I want to measure much the runtimes for each of the three operations
> that computes A, B and C. I'm wondering how to do it with gnu make.

You can always use date from the shell:
$ cat Makefile
.PHONY: all

start   := $(shell date +%N)
A       := $(patsubst %.1, %, $(wildcard *.1))
after_A := $(shell date +%N)
B       := $(patsubst %.2, %, $(wildcard *.2))
after_B := $(shell date +%N)
C       := $(filter $(A),$(B))
after_C := $(shell date +%N)

        echo $(C)
        @echo "A=$(shell expr $(after_A) - $(start)) nsec"
        @echo "B=$(shell expr $(after_B) - $(after_A)) nsec"
        @echo "C=$(shell expr $(after_C) - $(after_B)) nsec"

        @touch a.1 b.1 c.1

        @touch a.2 b.2 d.2

This will include the time to invoke date - which you can measure and 
compensate for.
Note that I changed your Makefile to use direct assignments to avoid deferring 
the assignment.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]