Re-structure LTTng sub-project as per the Linux Tools guidelines
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / common / AbsTRangeUpdate.java
CommitLineData
6e512b93
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors: Alvaro Sanchez-Leon - Initial implementation
10 *******************************************************************************/
11package org.eclipse.linuxtools.lttng.ui.views.common;
12
6c13869b
FC
13import org.eclipse.linuxtools.lttng.core.state.evProcessor.ILttngEventProcessor;
14import org.eclipse.linuxtools.lttng.core.state.evProcessor.state.AbsStateProcessing;
15import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;
16import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
6e512b93 17
63eecb47 18public abstract class AbsTRangeUpdate extends AbsStateProcessing implements
8827c197 19 ILttngEventProcessor {
6e512b93
ASL
20
21 private static final long MINORBITS = 20;
22
23 // ========================================================================
24 // General methods
25 // =======================================================================
26
27 /**
28 * Get the mkdev node id<br>
29 * <br>
30 * This is an implementation of a KERNEL macro used in Lttv
31 *
32 */
33 public long getMkdevId(long major, long minor) {
34 return (((major) << MINORBITS) | (minor));
35 }
36
37 /**
38 * Get the pixels per Nano second, either from active widgets or initialise
39 * with the experiment time range values
40 *
41 * @param traceSt
42 * @param params
43 *
44 * @return double
45 */
46 protected double getPixelsPerNs(LttngTraceState traceSt, ParamsUpdater params) {
47 double pixPerNs = params.getPixelsPerNs();
0c2a2e08 48 if (pixPerNs == 0.0) {
8827c197 49 TmfTimeRange tsetRange = traceSt.getContext().getExperimentTimeWindow();
6e512b93
ASL
50
51 long startTime = tsetRange.getStartTime().getValue();
52 long endTime = tsetRange.getEndTime().getValue();
53 long delta = endTime - startTime;
54
55 if (delta > 0) {
56 pixPerNs = (double) params.getWidth() / (double) delta;
57 params.setPixelsPerNs(pixPerNs);
58 }
59 }
60 return pixPerNs;
61 }
62
63}
This page took 0.030028 seconds and 5 git commands to generate.